Browse Source

问题修改

master
God 2 years ago
parent
commit
ea179f6ec5
  1. 4
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthFeign.java
  2. 5
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthFeignFallback.java
  3. 76
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthVoExcel.java
  4. 2
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthMapper.java
  5. 21
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthMapper.xml
  6. 25
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthRest.java
  7. 20
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthService.java

4
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthFeign.java

@ -100,5 +100,9 @@ public interface ScmVehInventorymonthFeign {
@ResponseBody
public ResultBean<AppScmVehInventorymonthInfoVo> getCarInventoryReport(@SpringQueryMap AppScmVehInventorymonthInfoQuery appScmVehInventorymonthInfoQuery);
@PostMapping("/exportExcel")
@ApiOperation(value = "盘库报告导出")
@ResponseBody
public void exportExcel(@RequestBody String[] sids);
}

5
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthFeignFallback.java

@ -95,4 +95,9 @@ public class ScmVehInventorymonthFeignFallback implements ScmVehInventorymonthFe
public ResultBean<AppScmVehInventorymonthInfoVo> getCarInventoryReport(AppScmVehInventorymonthInfoQuery appScmVehInventorymonthInfoQuery) {
return null;
}
@Override
public void exportExcel(String[] sids) {
}
}

76
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehinventorymonth/ScmVehInventorymonthVoExcel.java

@ -0,0 +1,76 @@
/*********************************************************
*********************************************************
******************** *******************
************* ************
******* _oo0oo_ *******
*** o8888888o ***
* 88" . "88 *
* (| -_- |) *
* 0\ = /0 *
* ___/`---'\___ *
* .' \\| |// '. *
* / \\||| : |||// \ *
* / _||||| -:- |||||- \ *
* | | \\\ - /// | | *
* | \_| ''\---/'' |_/ | *
* \ .-\__ '-' ___/-. / *
* ___'. .' /--.--\ `. .'___ *
* ."" '< `.___\_<|>_/___.' >' "". *
* | | : `- \`.;`\ _ /`;.`/ - ` : | | *
* \ \ `_. \_ __\ /__ _/ .-` / / *
* =====`-.____`.___ \_____/___.-`___.-'===== *
* `=---=' *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
*********__佛祖保佑__永无BUG__验收通过__钞票多多__*********
*********************************************************/
package com.yxt.anrui.scm.api.scmvehinventorymonth;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yxt.common.core.utils.ExportEntityMap;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* Project: aaa(aaa) <br/>
* File: ScmVehInventorymonthVo.java <br/>
* Class: com.yxt.anrui.scm.api.api.scmvehinventorymonth.ScmVehInventorymonthVo <br/>
* Description: 月度盘库 视图数据对象. <br/>
* Copyright: Copyright (c) 2011 <br/>
* Company: https://gitee.com/liuzp315 <br/>
* Makedate: 2022-09-16 15:52:05 <br/>
*
* @author liupopo
* @version 1.0
* @since 1.0
*/
@Data
public class ScmVehInventorymonthVoExcel{
private String sid;
@ExportEntityMap(CnName = "序号", EnName = "rankNo")
private Integer rankNo;
@ExportEntityMap(CnName = "编号", EnName = "billNo")
private String billNo; // 编号(yyyyMMdd)
@ExportEntityMap(CnName = "生成日期", EnName = "createTime")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime; //
@ExportEntityMap(CnName = "生成人", EnName = "createByName")
private String createByName;
@ExportEntityMap(CnName = "应盘(台)", EnName = "rankNo")
private String totalNumber;
@ExportEntityMap(CnName = "实盘(台)", EnName = "rankNo")
private String actualNumber;
@ExportEntityMap(CnName = "未盘(台)", EnName = "rankNo")
private String surplusNumber;
@ExportEntityMap(CnName = "盘盈(台)", EnName = "rankNo")
private String profitNumber;
@ExportEntityMap(CnName = "盘亏(台)", EnName = "rankNo")
private String lossNumber;
@ExportEntityMap(CnName = "盘损(台)", EnName = "rankNo")
private String damageNumber;
}

2
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthMapper.java

@ -76,4 +76,6 @@ public interface ScmVehInventorymonthMapper extends BaseMapper<ScmVehInventorymo
@Select("select * from scm_veh_inventorymonth order by id desc")
List<AppScmVehInventorymonthVo> selectListAll();
ScmVehInventorymonthVoExcel selByExcel(String sid);
}

21
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthMapper.xml

@ -13,12 +13,16 @@
`state`
FROM
scm_veh_inventorymonth
<where>${ew.sqlSegment}</where>
<where>
${ew.sqlSegment}
</where>
</select>
<select id="selectListAllVo" resultType="com.yxt.anrui.scm.api.scmvehinventorymonth.ScmVehInventorymonthVo">
SELECT * FROM scm_veh_inventorymonth
<where>${ew.sqlSegment}</where>
<where>
${ew.sqlSegment}
</where>
</select>
<select id="getCarInventoryReportList"
@ -45,14 +49,23 @@
from scm_veh_inventorymonth
where billNo LIKE concat(#{bill}, '%')
order by id desc
limit 1
limit 1
</select>
<select id="selByMainSid"
resultType="com.yxt.anrui.scm.api.scmvehinventorymonth.AppScmVehInventorymonthInfoVo">
SELECT receiverNames as recipient,
DATE_FORMAT(createTime, '%Y-%m-%d') AS `date`,
reason as surplusNumberRemarks
reason as surplusNumberRemarks
FROM scm_veh_inventoryreport
WHERE mainSid = #{sid} limit 1
</select>
<select id="selByExcel" resultType="com.yxt.anrui.scm.api.scmvehinventorymonth.ScmVehInventorymonthVoExcel">
SELECT sid,
billNo,
createTime,
createByName
FROM scm_veh_inventorymonth
WHERE sid = #{sid}
</select>
</mapper>

25
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthRest.java

@ -26,7 +26,9 @@ package com.yxt.anrui.scm.biz.scmvehinventorymonth; /***************************
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.anrui.base.api.basevehicleout.BaseVehicleOutVoExecl;
import com.yxt.anrui.scm.api.scmvehinventorymonth.*;
import com.yxt.common.base.utils.ExportExcelUtils;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.base.utils.StringUtils;
import com.yxt.common.core.query.PagerQuery;
@ -37,6 +39,11 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
/**
* Project: aaa(aaa) <br/>
* File: ScmVehInventorymonthFeignFallback.java <br/>
@ -57,6 +64,8 @@ public class ScmVehInventorymonthRest implements ScmVehInventorymonthFeign {
@Autowired
private ScmVehInventorymonthService scmVehInventorymonthService;
@Autowired
private HttpServletResponse response;
@Override
@ApiOperation("根据条件分页查询数据的列表")
@ -129,4 +138,20 @@ public class ScmVehInventorymonthRest implements ScmVehInventorymonthFeign {
public ResultBean<AppScmVehInventorymonthInfoVo> getCarInventoryReport(AppScmVehInventorymonthInfoQuery appScmVehInventorymonthInfoQuery) {
return scmVehInventorymonthService.getCarInventoryReport(appScmVehInventorymonthInfoQuery);
}
@Override
public void exportExcel(String[] sids) {
//得到所有要导出的数据
List<ScmVehInventorymonthVoExcel> scmVehInventorymonthVoExcels = scmVehInventorymonthService.listExcel(sids);
//定义导出的excel名字
String excelName = "盘库报告列表";
String fileNameURL = "";
try {
fileNameURL = URLEncoder.encode(excelName, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//导出盘库报告列表
ExportExcelUtils.export(fileNameURL, scmVehInventorymonthVoExcels, ScmVehInventorymonthVoExcel.class, response);
}
}

20
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehinventorymonth/ScmVehInventorymonthService.java

@ -409,4 +409,24 @@ public class ScmVehInventorymonthService extends MybatisBaseService<ScmVehInvent
public List<AppScmVehInventorymonthVo> selectListAll() {
return baseMapper.selectListAll();
}
public List<ScmVehInventorymonthVoExcel> listExcel(String[] sids) {
List<ScmVehInventorymonthVoExcel> scmVehInventorymonthVoExcels = new ArrayList<>();
int id = 1;
for (String sid : sids) {
ScmVehInventorymonthVoExcel scmVehInventorymonthVoExcel = baseMapper.selByExcel(sid);
String mainSid = scmVehInventorymonthVoExcel.getSid();
AppVehInventorymonthVo vo = scmVehicleInventoryService.getMonthByMainSid(mainSid);
scmVehInventorymonthVoExcel.setSurplusNumber(String.valueOf(vo.getSurplusNumber()));
scmVehInventorymonthVoExcel.setTotalNumber(String.valueOf(vo.getTotalNumber()));
scmVehInventorymonthVoExcel.setLossNumber(String.valueOf(vo.getLossNumber()));
scmVehInventorymonthVoExcel.setDamageNumber(String.valueOf(vo.getDamageNumber()));
scmVehInventorymonthVoExcel.setProfitNumber(String.valueOf(vo.getProfitNumber()));
scmVehInventorymonthVoExcel.setActualNumber(String.valueOf(vo.getProfitNumber() + vo.getNormalNumber() + vo.getDamageNumber() + vo.getLossNumber()));
scmVehInventorymonthVoExcel.setRankNo(id);
id = id + 1;
scmVehInventorymonthVoExcels.add(scmVehInventorymonthVoExcel);
}
return scmVehInventorymonthVoExcels;
}
}
Loading…
Cancel
Save