Merge remote-tracking branch 'origin/master'
commit
6babaa7135
@ -0,0 +1,101 @@
|
||||
package com.glxp.api.controller.inv;
|
||||
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.entity.inout.IoStatDayEntity;
|
||||
import com.glxp.api.req.inout.FilterStatDataDetailRequest;
|
||||
import com.glxp.api.service.inout.ExcelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:14
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@Api(tags = "文件接口")
|
||||
public class ApiExcelController {
|
||||
|
||||
@Resource
|
||||
private ExcelService excelService;
|
||||
|
||||
/**
|
||||
* excel导入-单个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/excelImport")
|
||||
@ApiOperation(value = "excel导入")
|
||||
public BaseResponse<Object> excelImport(@RequestParam("file") MultipartFile multipartFile){
|
||||
excelService.excelImport(multipartFile);
|
||||
return new BaseResponse<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导出-单个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@GetMapping("/udiwms/inv/excelExportOut")
|
||||
public void export(HttpServletResponse response,String billNo,String key) {
|
||||
|
||||
excelService.excelExport(response,billNo,key);
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入-多个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
* @return 响应体
|
||||
*/
|
||||
@PostMapping("/excelSheetImport")
|
||||
@ApiOperation(value = "excel导入-多个sheet")
|
||||
public BaseResponse<Object> excelSheetImport(@RequestParam("file") MultipartFile multipartFile){
|
||||
excelService.excelSheetImport(multipartFile);
|
||||
return new BaseResponse<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导出-多个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@ApiOperation(value = "excel导出-多个sheet", httpMethod = "GET")
|
||||
@GetMapping("/excelSheetExport")
|
||||
public void excelSheetExport(HttpServletResponse response) {
|
||||
excelService.excelSheetExport(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* excel模板导出-单个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@ApiOperation(value = "excel模板导出", httpMethod = "GET")
|
||||
@GetMapping("/excelTemplate")
|
||||
public void excelTemplate(HttpServletResponse response) {
|
||||
|
||||
excelService.excelTemplate(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* excel模板导出-多个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@ApiOperation(value = "excel模板导出-多个sheet", httpMethod = "GET")
|
||||
@GetMapping("/excelSheetTemplate")
|
||||
public void excelSheetTemplate(HttpServletResponse response) throws Exception {
|
||||
excelService.excelSheetTemplate(response);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.glxp.api.entity.inout;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:11
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "导出实体")
|
||||
public class ExcelVO {
|
||||
|
||||
@ExcelProperty("序号")
|
||||
@ApiModelProperty(value = "序号")
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("产品通用名")
|
||||
@ApiModelProperty(value = "产品通用名")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty("规格型号")
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String ggxh;
|
||||
|
||||
@ExcelProperty("批次号")
|
||||
@ApiModelProperty(value = "批次号")
|
||||
private String batchNo;
|
||||
|
||||
@ExcelProperty({"期初","数量"})
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer beginCount;
|
||||
|
||||
@ExcelProperty({"期初","价格"})
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal beginPrice;
|
||||
|
||||
@ExcelProperty({"期初","金额"})
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal beginAmount;
|
||||
|
||||
@ExcelProperty({"入库","数量"})
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer inCount;
|
||||
|
||||
@ExcelProperty({"入库","价格"})
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal inPrice;
|
||||
|
||||
@ExcelProperty({"入库","金额"})
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal inAmount;
|
||||
|
||||
@ExcelProperty({"出库","数量"})
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer outCount;
|
||||
|
||||
@ExcelProperty({"出库","价格"})
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal outPrice;
|
||||
|
||||
@ExcelProperty({"出库","金额"})
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal outAmount;
|
||||
|
||||
|
||||
@ExcelProperty({"结余","数量"})
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer balanceCount;
|
||||
|
||||
@ExcelProperty({"结余","价格"})
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal balancePrice;
|
||||
|
||||
@ExcelProperty({"结余","金额"})
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal balanceAmount;
|
||||
|
||||
//无需导出字段使用此注解
|
||||
//@JsonSerialize(using = ToStringSerializer.class)
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.glxp.api.req.inout;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 13:52
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ExcelRequest {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.glxp.api.res.sync;
|
||||
|
||||
import com.glxp.api.entity.basic.ProductInfoEntity;
|
||||
import com.glxp.api.entity.basic.UdiCompanyEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SpSyncUdiResponse extends BaseSyncResponse{
|
||||
|
||||
//同步任务ID
|
||||
List<ProductInfoEntity> productInfoEntityList;
|
||||
List<UdiCompanyEntity> udiCompanyEntities;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.glxp.api.res.sync;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
|
||||
import com.glxp.api.entity.basic.BasicBusTypePreEntity;
|
||||
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||||
import com.glxp.api.entity.system.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 同步系统设置数据
|
||||
*/
|
||||
@Data
|
||||
public class SpsSyncSysSettingResponse extends BaseSyncResponse {
|
||||
|
||||
private List<SystemParamConfigEntity> systemParamConfigEntities;
|
||||
|
||||
private List<EntrustReceEntity> entrustReceEntities;
|
||||
|
||||
private List<SystemPDFModuleEntity> systemPDFModuleEntities;
|
||||
|
||||
private List<SystemPDFTemplateEntity> systemPDFTemplateEntities;
|
||||
|
||||
private List<SysPdfTemplateRelevanceCodeEntity> sysPdfTemplateRelevanceCodeEntities;
|
||||
|
||||
private List<SysPdfTemplateRelevanceBizEntity> sysPdfTemplateRelevanceBizEntities;
|
||||
|
||||
private List<SysPdfTemplateRelevanceLabelEntity> sysPdfTemplateRelevanceLabelEntities;
|
||||
|
||||
private List<SysPdfTemplateRelevanceStatemenEntity> sysPdfTemplateRelevanceStatemenEntities;
|
||||
|
||||
private List<BasicBusTypePreEntity> basicBusTypePreEntities;
|
||||
|
||||
private List<BasicBusTypeChangeEntity> basicBusTypeChangeEntities;
|
||||
|
||||
|
||||
/**
|
||||
* 拼接日志
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String logs() {
|
||||
StringBuilder logs = new StringBuilder();
|
||||
if (CollUtil.isNotEmpty(this.systemParamConfigEntities)) {
|
||||
logs.append("系统运行参数:").append(this.systemParamConfigEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.entrustReceEntities)) {
|
||||
logs.append("委托验收设置:").append(this.entrustReceEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.systemPDFModuleEntities)) {
|
||||
logs.append("打印模块:").append(this.systemPDFModuleEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.systemPDFTemplateEntities)) {
|
||||
logs.append("打印模板:").append(this.systemPDFTemplateEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.sysPdfTemplateRelevanceCodeEntities)) {
|
||||
logs.append("扫码单据关联表:").append(this.sysPdfTemplateRelevanceCodeEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.sysPdfTemplateRelevanceBizEntities)) {
|
||||
logs.append("业务单据关联表:").append(this.sysPdfTemplateRelevanceBizEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.sysPdfTemplateRelevanceLabelEntities)) {
|
||||
logs.append("内部码打印关联表:").append(this.sysPdfTemplateRelevanceLabelEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.sysPdfTemplateRelevanceStatemenEntities)) {
|
||||
logs.append("资质证书打印关联表:").append(this.sysPdfTemplateRelevanceStatemenEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.basicBusTypePreEntities)) {
|
||||
logs.append("自动建出入库单设置:").append(this.basicBusTypePreEntities.size()).append("条\n");
|
||||
}
|
||||
if (CollUtil.isNotEmpty(this.basicBusTypeChangeEntities)) {
|
||||
logs.append("自动建业务单设置:").append(this.basicBusTypeChangeEntities.size()).append("条\n");
|
||||
}
|
||||
return logs.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.glxp.api.res.sync;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrCorpEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 同步第三方基础数据
|
||||
*/
|
||||
@Data
|
||||
public class SpsSyncThrDataResponse extends BaseSyncResponse {
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*/
|
||||
private List<ThrDeptEntity> deptEntities;
|
||||
|
||||
/**
|
||||
* 仓库信息
|
||||
*/
|
||||
private List<ThrInvWarehouseEntity> invWarehouseEntities;
|
||||
|
||||
/**
|
||||
* 往来单位信息
|
||||
*/
|
||||
private List<ThrCorpEntity> corpEntities;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.glxp.api.res.sync;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrProductsEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 同步第三方产品数据
|
||||
*/
|
||||
@Data
|
||||
public class SpsSyncThrProductsResponse extends BaseSyncResponse {
|
||||
|
||||
/**
|
||||
* 产品信息
|
||||
*/
|
||||
private List<ThrProductsEntity> productsEntities;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.glxp.api.service.inout;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:12
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
import com.glxp.api.entity.inout.IoStatDayEntity;
|
||||
import com.glxp.api.req.inout.FilterStatDataDetailRequest;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 导出业务接口
|
||||
*/
|
||||
public interface ExcelService {
|
||||
|
||||
/**
|
||||
* excel导入-单个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
*/
|
||||
void excelImport(MultipartFile multipartFile);
|
||||
|
||||
/**
|
||||
* excel导出-单个sheet
|
||||
*
|
||||
* @param response 响应体
|
||||
*/
|
||||
void excelExport(HttpServletResponse response,String billNo,String key);
|
||||
|
||||
/**
|
||||
* excel多入-多个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
*/
|
||||
void excelSheetImport(MultipartFile multipartFile);
|
||||
|
||||
/**
|
||||
* excel导出-多个sheet
|
||||
*
|
||||
* @param response 响应体
|
||||
*/
|
||||
void excelSheetExport(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* excel模板导出-单个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
void excelTemplate(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* excel模板导出-多个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
void excelSheetTemplate(HttpServletResponse response) throws Exception;
|
||||
}
|
||||
|
@ -0,0 +1,284 @@
|
||||
package com.glxp.api.service.inout.impl;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:13
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.glxp.api.entity.inout.*;
|
||||
import com.glxp.api.req.inout.FilterStatDataDetailRequest;
|
||||
import com.glxp.api.service.inout.*;
|
||||
import com.glxp.api.util.Excel.ExcelHandler;
|
||||
import com.glxp.api.util.Excel.ExcelTemplateEnum;
|
||||
import com.glxp.api.util.Excel.Exception.RenException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 导出业务实现
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ExcelServiceImpl implements ExcelService {
|
||||
|
||||
@Resource
|
||||
ExcelHandler excelHandler;
|
||||
|
||||
@Resource
|
||||
private IoStatDayService statDayService;
|
||||
@Resource
|
||||
private IoStatMonthService statMonthService;
|
||||
|
||||
@Resource
|
||||
private IoStatQuarterService statQuarterService;
|
||||
|
||||
@Resource
|
||||
private IoStatYearService statYearService;
|
||||
|
||||
/**
|
||||
* excel导入-单个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
*/
|
||||
@Override
|
||||
public void excelImport(MultipartFile multipartFile) {
|
||||
try {
|
||||
List<ExcelVO> voList = excelHandler.importExcel(multipartFile, ExcelVO.class, null);
|
||||
if (CollectionUtils.isNotEmpty(voList)) {
|
||||
System.out.println("本次成功导出:" + voList.size() + "条,数据如下---------------");
|
||||
voList.forEach(vo -> {
|
||||
System.out.println("vo=" + vo.toString());
|
||||
});
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RenException("导入失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导出-单个sheet
|
||||
*
|
||||
* @param response 响应体
|
||||
*/
|
||||
@Override
|
||||
public void excelExport(HttpServletResponse response, String billNo,String key) {
|
||||
try {
|
||||
List<ExcelVO> excelVOS = structureDate(billNo,key);
|
||||
excelHandler.exportExcel(response, excelVOS, ExcelVO.class, "excel导出-单et", "excel导出heet");
|
||||
} catch (Exception e) {
|
||||
throw new RenException("导出失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导入-多个sheet
|
||||
*
|
||||
* @param multipartFile 文件流
|
||||
*/
|
||||
@Override
|
||||
public void excelSheetImport(MultipartFile multipartFile) {
|
||||
try {
|
||||
List<Integer> indexList = new ArrayList<>();
|
||||
indexList.add(0);
|
||||
indexList.add(1);
|
||||
indexList.add(2);
|
||||
indexList.add(3);
|
||||
indexList.add(4);
|
||||
indexList.add(5);
|
||||
List<Object> objList = new ArrayList<>();
|
||||
objList.add(new ExcelVO());
|
||||
objList.add(new ExcelVO());
|
||||
objList.add(new ExcelVO());
|
||||
objList.add(new ExcelVO());
|
||||
objList.add(new ExcelVO());
|
||||
objList.add(new ExcelVO());
|
||||
List<List<Object>> resultList = excelHandler.importExcelsByIndex(multipartFile, objList, 6, indexList);
|
||||
System.out.println("resultList="+resultList.size());
|
||||
resultList.forEach(vo->{
|
||||
List<ExcelVO> voList = JSON.parseArray(JSON.toJSONString(vo), ExcelVO.class);
|
||||
System.out.println("voList="+voList.size()+"条数据");
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new RenException("导入失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* excel导出-多个sheet
|
||||
*
|
||||
* @param response 响应体
|
||||
*/
|
||||
@Override
|
||||
public void excelSheetExport(HttpServletResponse response) {
|
||||
// try {
|
||||
// //构建多集合集合
|
||||
// List<List<?>> lists = new ArrayList<>();
|
||||
// lists.add(structureDate(10));
|
||||
// lists.add(structureDate(20));
|
||||
// lists.add(structureDate(30));
|
||||
// lists.add(structureDate(40));
|
||||
// lists.add(structureDate(50));
|
||||
// lists.add(structureDate(60));
|
||||
// //Sheet页初始化
|
||||
// Map<Integer, String> clazzMap = new HashMap<>();
|
||||
// clazzMap.put(0, "一年级成绩表");
|
||||
// clazzMap.put(1, "二年级成绩表");
|
||||
// clazzMap.put(2, "三年级成绩表");
|
||||
// clazzMap.put(3, "四年级成绩表");
|
||||
// clazzMap.put(4, "五年级成绩表");
|
||||
// clazzMap.put(5, "六年级成绩表");
|
||||
// excelHandler.exportExcels(response, Collections.singletonList(lists), clazzMap, "excel导出-单sheet");
|
||||
// } catch (Exception e) {
|
||||
// throw new RenException("导出失败");
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* excel模板导出-单个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@Override
|
||||
public void excelTemplate(HttpServletResponse response) {
|
||||
// try {
|
||||
// //准备数据
|
||||
// JSONObject obj = new JSONObject();
|
||||
// obj.put("date","2022年");
|
||||
// obj.put("season","秋季");
|
||||
// obj.put("user","王远");
|
||||
// obj.put("userDate",new Date());
|
||||
// List<ExcelVO> list = structureDate(20);
|
||||
// excelHandler.exportTemplateExcels(response,list,obj, ExcelTemplateEnum.TEMPLATE_1.getDesc(),ExcelTemplateEnum.TEMPLATE_1.getDesc());
|
||||
// }catch (Exception e){
|
||||
// log.error("导出错误:{}", e.getMessage());
|
||||
// throw new RenException("导出错误");
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* excel模板导出-多个sheet
|
||||
*
|
||||
* @param response 响应流
|
||||
*/
|
||||
@Override
|
||||
public void excelSheetTemplate(HttpServletResponse response) throws Exception {
|
||||
// 准备数据
|
||||
// JSONObject obj = new JSONObject();
|
||||
// obj.put("date","2022年");
|
||||
// obj.put("season","秋季");
|
||||
// obj.put("user","王远");
|
||||
// obj.put("userDate",new Date());
|
||||
// List<ExcelVO> list = structureDate(20);
|
||||
// excelHandler.exportSheetTemplateExcels(response,list,list,obj,obj, ExcelTemplateEnum.TEMPLATE_1.getDesc(),ExcelTemplateEnum.TEMPLATE_1.getDesc());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造数据
|
||||
*
|
||||
* @return 数据集合
|
||||
*/
|
||||
private List<ExcelVO> structureDate(String billNo ,String key) {
|
||||
List<ExcelVO> list = new ArrayList<>();
|
||||
if("day".equals(key)){
|
||||
List<IoStatDayEntity> ioStatDayEntities = statDayService.filterListByRecordKey(billNo);
|
||||
for (int i=0; i < ioStatDayEntities.size(); i++) {
|
||||
ExcelVO vo = new ExcelVO();
|
||||
vo.setId(i+1);
|
||||
vo.setProductName(ioStatDayEntities.get(i).getProductName());
|
||||
vo.setGgxh(ioStatDayEntities.get(i).getGgxh());
|
||||
vo.setBatchNo(ioStatDayEntities.get(i).getBatchNo());
|
||||
vo.setBeginCount(ioStatDayEntities.get(i).getBeginCount());
|
||||
vo.setBeginPrice(ioStatDayEntities.get(i).getBeginPrice());
|
||||
vo.setBeginAmount(ioStatDayEntities.get(i).getBeginAmount());
|
||||
vo.setInCount(ioStatDayEntities.get(i).getInCount());
|
||||
vo.setInPrice(ioStatDayEntities.get(i).getInPrice());
|
||||
vo.setInAmount(ioStatDayEntities.get(i).getInAmount());
|
||||
vo.setOutCount(ioStatDayEntities.get(i).getOutCount());
|
||||
vo.setOutPrice(ioStatDayEntities.get(i).getOutPrice());
|
||||
vo.setOutAmount(ioStatDayEntities.get(i).getOutAmount());
|
||||
vo.setBalanceCount(ioStatDayEntities.get(i).getBalanceCount());
|
||||
vo.setBalancePrice(ioStatDayEntities.get(i).getBalancePrice());
|
||||
vo.setBalanceAmount(ioStatDayEntities.get(i).getBalanceAmount());
|
||||
list.add(vo);
|
||||
}
|
||||
}else if("month".equals(key)){
|
||||
List<IoStatMonthEntity> ioStatMonthEntities = statMonthService.filterListByRecordKey(billNo);
|
||||
for (int i=0; i < ioStatMonthEntities.size(); i++) {
|
||||
ExcelVO vo = new ExcelVO();
|
||||
vo.setId(i+1);
|
||||
vo.setProductName(ioStatMonthEntities.get(i).getProductName());
|
||||
vo.setGgxh(ioStatMonthEntities.get(i).getGgxh());
|
||||
vo.setBatchNo(ioStatMonthEntities.get(i).getBatchNo());
|
||||
vo.setBeginCount(ioStatMonthEntities.get(i).getBeginCount());
|
||||
vo.setBeginPrice(ioStatMonthEntities.get(i).getBeginPrice());
|
||||
vo.setBeginAmount(ioStatMonthEntities.get(i).getBeginAmount());
|
||||
vo.setInCount(ioStatMonthEntities.get(i).getInCount());
|
||||
vo.setInPrice(ioStatMonthEntities.get(i).getInPrice());
|
||||
vo.setInAmount(ioStatMonthEntities.get(i).getInAmount());
|
||||
vo.setOutCount(ioStatMonthEntities.get(i).getOutCount());
|
||||
vo.setOutPrice(ioStatMonthEntities.get(i).getOutPrice());
|
||||
vo.setOutAmount(ioStatMonthEntities.get(i).getOutAmount());
|
||||
vo.setBalanceCount(ioStatMonthEntities.get(i).getBalanceCount());
|
||||
vo.setBalancePrice(ioStatMonthEntities.get(i).getBalancePrice());
|
||||
vo.setBalanceAmount(ioStatMonthEntities.get(i).getBalanceAmount());
|
||||
list.add(vo);
|
||||
}
|
||||
}else if("quarter".equals(key)){
|
||||
List<IoStatQuarterEntity> ioStatQuarterEntities = statQuarterService.filterListByRecordKey(billNo);
|
||||
for (int i=0; i < ioStatQuarterEntities.size(); i++) {
|
||||
ExcelVO vo = new ExcelVO();
|
||||
vo.setId(i+1);
|
||||
vo.setProductName(ioStatQuarterEntities.get(i).getProductName());
|
||||
vo.setGgxh(ioStatQuarterEntities.get(i).getGgxh());
|
||||
vo.setBatchNo(ioStatQuarterEntities.get(i).getBatchNo());
|
||||
vo.setBeginCount(ioStatQuarterEntities.get(i).getBeginCount());
|
||||
vo.setBeginPrice(ioStatQuarterEntities.get(i).getBeginPrice());
|
||||
vo.setBeginAmount(ioStatQuarterEntities.get(i).getBeginAmount());
|
||||
vo.setInCount(ioStatQuarterEntities.get(i).getInCount());
|
||||
vo.setInPrice(ioStatQuarterEntities.get(i).getInPrice());
|
||||
vo.setInAmount(ioStatQuarterEntities.get(i).getInAmount());
|
||||
vo.setOutCount(ioStatQuarterEntities.get(i).getOutCount());
|
||||
vo.setOutPrice(ioStatQuarterEntities.get(i).getOutPrice());
|
||||
vo.setOutAmount(ioStatQuarterEntities.get(i).getOutAmount());
|
||||
vo.setBalanceCount(ioStatQuarterEntities.get(i).getBalanceCount());
|
||||
vo.setBalancePrice(ioStatQuarterEntities.get(i).getBalancePrice());
|
||||
vo.setBalanceAmount(ioStatQuarterEntities.get(i).getBalanceAmount());
|
||||
list.add(vo);
|
||||
}
|
||||
}else{
|
||||
List<IoStatYearEntity> ioStatYearEntities = statYearService.filterListByRecordKey(billNo);
|
||||
for (int i=0; i < ioStatYearEntities.size(); i++) {
|
||||
ExcelVO vo = new ExcelVO();
|
||||
vo.setId(i+1);
|
||||
vo.setProductName(ioStatYearEntities.get(i).getProductName());
|
||||
vo.setGgxh(ioStatYearEntities.get(i).getGgxh());
|
||||
vo.setBatchNo(ioStatYearEntities.get(i).getBatchNo());
|
||||
vo.setBeginCount(ioStatYearEntities.get(i).getBeginCount());
|
||||
vo.setBeginPrice(ioStatYearEntities.get(i).getBeginPrice());
|
||||
vo.setBeginAmount(ioStatYearEntities.get(i).getBeginAmount());
|
||||
vo.setInCount(ioStatYearEntities.get(i).getInCount());
|
||||
vo.setInPrice(ioStatYearEntities.get(i).getInPrice());
|
||||
vo.setInAmount(ioStatYearEntities.get(i).getInAmount());
|
||||
vo.setOutCount(ioStatYearEntities.get(i).getOutCount());
|
||||
vo.setOutPrice(ioStatYearEntities.get(i).getOutPrice());
|
||||
vo.setOutAmount(ioStatYearEntities.get(i).getOutAmount());
|
||||
vo.setBalanceCount(ioStatYearEntities.get(i).getBalanceCount());
|
||||
vo.setBalancePrice(ioStatYearEntities.get(i).getBalancePrice());
|
||||
vo.setBalanceAmount(ioStatYearEntities.get(i).getBalanceAmount());
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.glxp.api.service.sync;
|
||||
|
||||
import com.glxp.api.entity.thrsys.ThrCorpEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrDeptEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrInvWarehouseEntity;
|
||||
import com.glxp.api.entity.thrsys.ThrProductsEntity;
|
||||
import com.glxp.api.req.sync.SpsSyncDataRequest;
|
||||
import com.glxp.api.res.sync.SpsSyncThrDataResponse;
|
||||
import com.glxp.api.res.sync.SpsSyncThrProductsResponse;
|
||||
import com.glxp.api.res.system.SyncDataSetResponse;
|
||||
import com.glxp.api.service.thrsys.ThrCorpService;
|
||||
import com.glxp.api.service.thrsys.ThrDeptService;
|
||||
import com.glxp.api.service.thrsys.ThrInvWarehouseService;
|
||||
import com.glxp.api.service.thrsys.ThrProductsService;
|
||||
import com.glxp.api.util.DateUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 上传第三方基础数据到自助平台
|
||||
*/
|
||||
@Service
|
||||
public class UpThrDataService {
|
||||
|
||||
@Resource
|
||||
private SyncDataSetService syncDataSetService;
|
||||
@Resource
|
||||
private ThrDeptService thrDeptService;
|
||||
@Resource
|
||||
private ThrInvWarehouseService thrInvWarehouseService;
|
||||
@Resource
|
||||
private ThrProductsService thrProductsService;
|
||||
@Resource
|
||||
private ThrCorpService thrCorpService;
|
||||
|
||||
/**
|
||||
* 上传最近更新的第三方基础信息数据
|
||||
*
|
||||
* @param spsSyncDataRequest
|
||||
* @return
|
||||
*/
|
||||
public SpsSyncThrDataResponse upThrData(SpsSyncDataRequest spsSyncDataRequest) {
|
||||
SpsSyncThrDataResponse spsSyncThrDataResponse = new SpsSyncThrDataResponse();
|
||||
//查询数据同步设置
|
||||
SyncDataSetResponse syncDataSet = syncDataSetService.selectSet();
|
||||
|
||||
//第三方部门信息
|
||||
if (syncDataSet.getBasicThirdDept() == 1) {
|
||||
List<ThrDeptEntity> deptEntities = thrDeptService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
||||
spsSyncThrDataResponse.setDeptEntities(deptEntities);
|
||||
}
|
||||
|
||||
//第三方仓库信息
|
||||
if (syncDataSet.getBasicThirdInv() == 1) {
|
||||
List<ThrInvWarehouseEntity> invWarehouseEntities = thrInvWarehouseService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
||||
spsSyncThrDataResponse.setInvWarehouseEntities(invWarehouseEntities);
|
||||
}
|
||||
|
||||
//第三方往来单位信息
|
||||
if (syncDataSet.getBasicThirdCorp() == 1) {
|
||||
List<ThrCorpEntity> corpEntities = thrCorpService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
||||
spsSyncThrDataResponse.setCorpEntities(corpEntities);
|
||||
}
|
||||
return spsSyncThrDataResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传最近更新的第三方产品信息数据
|
||||
*
|
||||
* @param spsSyncDataRequest
|
||||
* @return
|
||||
*/
|
||||
public SpsSyncThrProductsResponse upThrProducts(SpsSyncDataRequest spsSyncDataRequest) {
|
||||
SpsSyncThrProductsResponse spsSyncThrProductsResponse = new SpsSyncThrProductsResponse();
|
||||
//查询数据同步设置
|
||||
SyncDataSetResponse syncDataSet = syncDataSetService.selectSet();
|
||||
|
||||
//第三方产品信息
|
||||
if (syncDataSet.getBasicThirdProducts() == 1) {
|
||||
List<ThrProductsEntity> thrProductsEntities = thrProductsService.findByLastTime(DateUtil.parseDate(spsSyncDataRequest.getLastUpdateTime()));
|
||||
spsSyncThrProductsResponse.setProductsEntities(thrProductsEntities);
|
||||
}
|
||||
|
||||
return spsSyncThrProductsResponse;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.glxp.api.util.Excel;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:09
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Getter
|
||||
public enum ExcelTemplateEnum {
|
||||
/**单sheet导出*/
|
||||
TEMPLATE_1("1","complex"),
|
||||
|
||||
/**模板格式*/
|
||||
TEMPLATE_SUFFIX("xlsx",".xlsx"),
|
||||
TEMPLATE_SUFFIX_XLS("xls",".xls"),
|
||||
TEMPLATE_SUFFIX_DOCX("docx",".docx"),
|
||||
/**模板路径*/
|
||||
TEMPLATE_PATH("path","excel"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
ExcelTemplateEnum(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过code获取msg
|
||||
*
|
||||
* @param code 枚举值
|
||||
* @return
|
||||
*/
|
||||
public static String getMsgByCode(String code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
ExcelTemplateEnum enumList = getByCode(code);
|
||||
if (enumList == null) {
|
||||
return null;
|
||||
}
|
||||
return enumList.getDesc();
|
||||
}
|
||||
|
||||
public static String getCode(ExcelTemplateEnum enumList) {
|
||||
if (enumList == null) {
|
||||
return null;
|
||||
}
|
||||
return enumList.getCode();
|
||||
}
|
||||
|
||||
public static ExcelTemplateEnum getByCode(String code) {
|
||||
for (ExcelTemplateEnum enumList : values()) {
|
||||
if (enumList.getCode().equals(code)) {
|
||||
return enumList;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.glxp.api.util.Excel.Exception;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/4/17 11:21
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
|
||||
public class RenException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String msg;
|
||||
private int code = 500;
|
||||
|
||||
public RenException(String msg) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public RenException(String msg, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public RenException(String msg, int code) {
|
||||
super(msg);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public RenException(String msg, int code, Throwable e) {
|
||||
super(msg, e);
|
||||
this.msg = msg;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
server:
|
||||
port: 9991
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jdbc-url: jdbc:mysql://192.168.0.66:3364/udi_wms_glxp?allowMultiQueries=true&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Glxp@6066
|
||||
hikari:
|
||||
connection-timeout: 60000
|
||||
maximum-pool-size: 60
|
||||
minimum-idle: 10
|
||||
redis:
|
||||
database: 8
|
||||
host: 127.0.0.1
|
||||
port: 6401
|
||||
# password: 123456
|
||||
timeout: 300
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 500MB
|
||||
max-request-size: 500MB
|
||||
|
||||
ok:
|
||||
http:
|
||||
connect-timeout: 3000
|
||||
read-timeout: 3000
|
||||
write-timeout: 3000
|
||||
max-idle-connections: 200
|
||||
keep-alive-duration: 300
|
||||
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.glxp.api.dao: debug
|
||||
|
||||
file_path: D:/udi/udiwms/udiwmsfile/
|
||||
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
|
||||
UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test
|
||||
SPMS_KEY: lCOdWCBKS6Kw45wdnnqUTELXyuSKnXEs
|
||||
|
||||
back_file_path: D:/share/udisps/back/
|
||||
API_KEY: 1101
|
||||
API_SECRET: zBITspLNvuoEd4FaamlSoqxRHmNsmQ9L
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue