第三方库存信息代码提交

master
郑明梁 2 years ago
parent 3c0c2532ce
commit 647e84b5c2

@ -1,29 +1,200 @@
package com.glxp.api.controller.thrsys;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.constant.Constant;
import com.glxp.api.entity.basic.BasicThirdSysEntity;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.entity.thrsys.ThrSystemEntity;
import com.glxp.api.http.HttpOkClient;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrInvProductsRequest;
import com.glxp.api.req.thrsys.PostThrInvProductsRequest;
import com.glxp.api.req.thrsys.ThrOnhandRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import com.glxp.api.service.thrsys.ThrInvProductsDlService;
import com.glxp.api.service.thrsys.ThrInvProductsImportLogService;
import com.glxp.api.service.thrsys.ThrInvProductsService;
import com.glxp.api.service.thrsys.ThrSystemService;
import com.glxp.api.util.CustomUtil;
import com.glxp.api.util.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author zml
* @since 2023-01-10
*/
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@RestController
public class ThrInvProductsController {
@Resource
RedisUtil redisUtil;
@Resource
private ThrInvProductsService thrInvProductsService;
@Resource
private ThrInvProductsDlService thrInvProductsDlService;
@Resource
private ThrInvProductsImportLogService thrInvProductsImportLogService;
@Resource
HttpOkClient httpOkClient;
@Resource
private ThrSystemService thrSystemService;
}
@GetMapping("/udiwms/thrsys/getInvProducts")
public BaseResponse getInvProducts(FilterThrInvProductsRequest filterThrInvProductsRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvProductsEntity> thrInvProductsEntities
= thrInvProductsService.filterThrInvProductss(filterThrInvProductsRequest);
PageInfo<ThrInvProductsEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvProductsEntities);
PageSimpleResponse<ThrInvProductsEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvProductsEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
//第三方服务上传(包括文件导入后上传)
@PostMapping("/udiwms/thrsys/postInvProducts")
public BaseResponse postInvProducts(@RequestBody PostThrInvProductsRequest postThrInvProductsRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvProductResponse> erpOnHandResponses = postThrInvProductsRequest.getDatas();
String genKey = postThrInvProductsRequest.getGenKey();
if (genKey == null) {
genKey = CustomUtil.getId();
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
if (thrInvProductsImportLogEntity == null) {
thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
thrInvProductsImportLogEntity.setGenKey(genKey);
if (postThrInvProductsRequest.getUploadType() != null) {
thrInvProductsImportLogEntity.setFromType(postThrInvProductsRequest.getUploadType());
} else
thrInvProductsImportLogEntity.setFromType("第三方系统上传");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(postThrInvProductsRequest.getThirdSys());
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
}
if (erpOnHandResponses != null && erpOnHandResponses.size() > 0) {
thrInvProductsDlService.insertInvProducts(genKey, postThrInvProductsRequest.getThirdSys(), erpOnHandResponses);
return ResultVOUtils.success("库存产品信息上传成功,后台正在处理,请稍后重试!");
}
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setRemark("上传数据为空");
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
return ResultVOUtils.error(500, "上传数据为空");
}
@PostMapping("/udiwms/thrsys/delInvProducts")
public BaseResponse delInvProducts(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
boolean b = thrInvProductsService.deleteById(id);
if (b)
return ResultVOUtils.success("删除成功");
else return ResultVOUtils.error(500, "无法删除!");
}
@RequestMapping("/udiwms/thrsys/invProducts/delAll")
public BaseResponse delAll() {
thrInvProductsService.deleteAll();
return ResultVOUtils.success("删除成功");
}
@RequestMapping("/udiwms/thrsys/invProducts/downloadAll")
public BaseResponse downloadAll(FilterThrInvProductsRequest filterThrInvProductsRequest) {
String data = (String) redisUtil.get(Constant.dlThrInvProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新库存产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 10 * 60);
if (filterThrInvProductsRequest.getThirdSysFk() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrInvProductsImportLogEntity.setGenKey(genKey);
thrInvProductsImportLogEntity.setFromType("第三方系统获取");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(filterThrInvProductsRequest.getThirdSys());
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
thrInvProductsDlService.importProducrs(genKey,filterThrInvProductsRequest.getThirdSysFk(), null);
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
@PostMapping("/udiwms/thrsys/invProducts/inpisDlAll")
public BaseResponse inpisDlAll(@RequestBody ThrOnhandRequest erpOnhandRequest) {
String data = (String) redisUtil.get(Constant.dlThrInvProducts);
if (data != null && data.equals("true")) {
return ResultVOUtils.error(500, "当前任务正在下载更新库存产品信息,请稍后重试!");
} else {
redisUtil.set(Constant.dlThrProducts, "true", 10 * 60);
if (erpOnhandRequest.getThirdSys() == null) {
return ResultVOUtils.error(500, "未选择第三方系统!");
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = new ThrInvProductsImportLogEntity();
String genKey = CustomUtil.getId();
thrInvProductsImportLogEntity.setGenKey(genKey);
thrInvProductsImportLogEntity.setFromType("第三方系统获取");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogEntity.setThirdSysFk(erpOnhandRequest.getThirdSys());
thrInvProductsImportLogService.insertImportLog(thrInvProductsImportLogEntity);
if (erpOnhandRequest.getThrInvProductsEntities() != null && erpOnhandRequest.getThrInvProductsEntities().size() > 0) {//选中导出
thrInvProductsDlService.importSelcyInvProducrs(genKey,erpOnhandRequest.getThirdSys(), erpOnhandRequest.getThrInvProductsEntities());
} else { //结果导出
thrInvProductsDlService.importProducrs(genKey,erpOnhandRequest.getThirdSys(),erpOnhandRequest);
}
return ResultVOUtils.success("后台开始下载更新,请稍后刷新查看");
}
}
@GetMapping("/udiwms/inv/getInvProducts")
public BaseResponse getInvProducts(ThrOnhandRequest thrOnhandRequest) {
ThrSystemEntity thrSystemEntity = thrSystemService.selectByThirdId(thrOnhandRequest.getThirdSys());
String url = thrSystemEntity.getThridUrl() + "/udiwms/erp/inv/getEnvProduct";
try {
String response = httpOkClient.uCloudPost(url, thrOnhandRequest, thrSystemEntity);
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> udiDlDeviceResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrInvProductResponse>>>() {
});
return udiDlDeviceResponse;
} catch (Exception e) {
log.error("获取库存产品信息异常", e);
return ResultVOUtils.error(500, "连接第三方系统接口服务出错!");
}
}
}

@ -0,0 +1,187 @@
package com.glxp.api.controller.thrsys;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity;
import com.glxp.api.entity.thrsys.ThrSystemDetailEntity;
import com.glxp.api.http.ErpInvClient;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import com.glxp.api.service.thrsys.ThrInvProductsDlService;
import com.glxp.api.service.thrsys.ThrInvProductsExportLogService;
import com.glxp.api.service.thrsys.ThrInvProductsService;
import com.glxp.api.service.thrsys.ThrSystemDetailService;
import com.glxp.api.util.CustomUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController
public class ThrInvProductsExportLogController {
@Resource
ThrInvProductsExportLogService thrInvProductsExportLogService;
@Resource
ThrInvProductsDlService thrInvProductsDlService;
@Resource
ThrSystemDetailService thrSystemDetailService;
@Resource
private ThrInvProductsService thrInvProductsService;
@Resource
ErpInvClient erpInvClient;
@GetMapping("/udiwms/invProducts/exportLog/filter")
public BaseResponse filter(FilterThrCorpExportLogRequest filterThrProductsExportLogRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvProductsExportLogEntity> thrInvProductsExportLogEntities = thrInvProductsExportLogService.filterThrInvProductsExportLog(filterThrProductsExportLogRequest);
PageInfo<ThrInvProductsExportLogEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvProductsExportLogEntities);
PageSimpleResponse<ThrInvProductsExportLogEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvProductsExportLogEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/udiwms/invProducts/exportLog/deleteLog")
public BaseResponse deleteLog(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
thrInvProductsExportLogService.deleteById(id + "");
return ResultVOUtils.success("删除成功");
}
//产品信息excel文件下载
@GetMapping("/udiwms/invProducts/exportLog/download")
public void download(FilterThrCorpExportLogRequest filterThrCorpExportLogRequest, HttpServletResponse res) {
List<ThrInvProductsExportLogEntity> thrInvProductsExportLogEntities = thrInvProductsExportLogService.filterThrInvProductsExportLog(filterThrCorpExportLogRequest);
ThrInvProductsExportLogEntity thrInvProductsExportLogEntity = thrInvProductsExportLogEntities.get(0);
try {
String filePath = thrInvProductsExportLogEntity.getFilePath();
String fileName = "temp";
if (filePath != null && filePath.length() > 0) {
String[] data = filePath.split("/");
fileName = data[data.length - 1];
}
res.setHeader("Content-disposition", "attachment;fileName=" + fileName);
res.setContentType("text/plain;charset=UTF-8");
FileInputStream input = new FileInputStream(new File(filePath));
OutputStream out = res.getOutputStream();
byte[] b = new byte[2048];
int len;
while ((len = input.read(b)) != -1) {
out.write(b, 0, len);
}
input.close();
if (thrInvProductsExportLogEntity.getDlCount() == 0) {
thrInvProductsExportLogEntity.setDlCount(1);
} else {
thrInvProductsExportLogEntity.setDlCount(thrInvProductsExportLogEntity.getDlCount() + 1);
}
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
} catch (Exception ex) {
System.out.println("下载失败!");
}
}
//产品信息导出生成Excel并创建生成记录
@PostMapping("/udiwms/invProducts/importLog/export")
public BaseResponse excelDownload(@RequestBody ThrInvProductsExportRequest thrInvProductsExportRequest) {
String fileName = "D:\\udiwms\\exportFile\\" + "库存产品信息导出" + System.currentTimeMillis() + ".xls";
File file = new File(fileName);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
ThrInvProductsExportLogEntity udiInfoExportLogEntity = new ThrInvProductsExportLogEntity();
udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_PROCESS);
String genKey = CustomUtil.getId();
udiInfoExportLogEntity.setGenKey(genKey);
udiInfoExportLogEntity.setFilePath(fileName);
udiInfoExportLogEntity.setUpdateTime(new Date());
udiInfoExportLogEntity.setDlCount(0);
thrInvProductsExportLogService.insertThrInvProductsExportLog(udiInfoExportLogEntity);
thrInvProductsDlService.genExcel(genKey, thrInvProductsExportRequest);
return ResultVOUtils.success("后台正在导出生成excel文件请稍后刷新查看!");
}
//第三方库存产品信息接口下载(第三方使用)
@GetMapping("/udiwms/thirdSys/invProducts/download")
public BaseResponse getOnhand(ThrOnhandRequest onhandQueryRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("invPiUrl", onhandQueryRequest.getThirdSys());
String onHandUrl;
if (thrSystemDetailEntity == null || thrSystemDetailEntity.getValue() == null)
return ResultVOUtils.error(500, "ERP库存产品信息接口地址未定义");
else
onHandUrl = thrSystemDetailEntity.getValue();
if (!thrSystemDetailEntity.getEnabled()) {
return ResultVOUtils.error(500, "第三方系统库存信息接口服务未启用!");
}
if (thrSystemDetailEntity.getFromType() == 0) {
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> responseBaseResponse = erpInvClient.getInvPrdoductResponse(onhandQueryRequest, onHandUrl);
return responseBaseResponse;
} else {
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
BeanUtils.copyProperties(onhandQueryRequest, filterThrInvProductsRequest);
filterThrInvProductsRequest.setThirdSysFk(onhandQueryRequest.getThirdSys());
List<ThrInvProductsEntity> thrInvProductsEntities
= thrInvProductsService.filterThrInvProductss(filterThrInvProductsRequest);
List<ThrInvProductResponse> erpInvProductResponseList = thrInvProductsEntities.stream().map(item ->
{
ThrInvProductResponse erpInvProductResponse = new ThrInvProductResponse();
BeanUtils.copyProperties(item, erpInvProductResponse);
erpInvProductResponse.setCode(item.getInventoryCode());
erpInvProductResponse.setName(item.getInventoryName());
return erpInvProductResponse;
}).collect(Collectors.toList());
PageInfo<ThrInvProductResponse> pageInfo;
pageInfo = new PageInfo<>(erpInvProductResponseList);
PageSimpleResponse<ThrInvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(erpInvProductResponseList);
return ResultVOUtils.success(pageSimpleResponse);
}
}
}

@ -0,0 +1,90 @@
package com.glxp.api.controller.thrsys;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.enums.ResultEnum;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity;
import com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.req.thrsys.FilterThrCorpExportLogRequest;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import com.glxp.api.req.thrsys.FilterThrCorpRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.thrsys.ThrInvProductsDetailService;
import com.glxp.api.service.thrsys.ThrInvProductsImportLogService;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
public class ThrInvProductsImportLogController {
@Resource
ThrInvProductsImportLogService thrInvProductsImportLogService;
@Resource
ThrInvProductsDetailService thrInvProductsDetailService;
@GetMapping("/udiwms/thrInvProducts/importLog/filter")
public BaseResponse filter(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvProductsImportLogEntity> thrInvProductsImportLogEntities
= thrInvProductsImportLogService.filterThrInvProductsImportLog(filterThrCorpImportLogRequest);
PageInfo<ThrInvProductsImportLogEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvProductsImportLogEntities);
PageSimpleResponse<ThrInvProductsImportLogEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvProductsImportLogEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@GetMapping("/udiwms/thrInvProducts/importLog/filterDetail")
public BaseResponse filterDetail(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest,
BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities
= thrInvProductsDetailService.filterInvProductsDetailImport(filterThrCorpImportLogRequest);
PageInfo<ThrInvProductsImportDetailEntity> pageInfo;
pageInfo = new PageInfo<>(thrInvProductsImportDetailEntities);
PageSimpleResponse<ThrInvProductsImportDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(thrInvProductsImportDetailEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/udiwms/thrInvProducts/importLog/deleteLog")
public BaseResponse deleteLog(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
}
String id = deleteRequest.getId();
FilterThrCorpImportLogRequest filterInCodeLogRequest = new FilterThrCorpImportLogRequest();
filterInCodeLogRequest.setId(Integer.parseInt(id));
List<ThrInvProductsImportLogEntity> thrInvProductsImportLogEntities = thrInvProductsImportLogService.filterThrInvProductsImportLog(filterInCodeLogRequest);
if (thrInvProductsImportLogEntities != null && thrInvProductsImportLogEntities.size() > 0) {
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogEntities.get(0);
thrInvProductsImportLogService.deleteById(thrInvProductsImportLogEntity.getId() + "");
thrInvProductsDetailService.deleteByGenkey(thrInvProductsImportLogEntity.getGenKey());
return ResultVOUtils.success("删除成功");
}else {
return ResultVOUtils.error(500, "删除失败,未找到该记录");
}
}
}

@ -1,17 +1,28 @@
package com.glxp.api.dao.thrsys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.req.thrsys.FilterThrInvProductsRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* Mapper
* </p>
*
* @author zml
* @since 2023-01-10
*/
public interface ThrInvProductsDao extends BaseMapper<ThrInvProductsEntity> {
import java.util.List;
@Mapper
public interface ThrInvProductsDao {
List<ThrInvProductsEntity> filterThrInvProductss(FilterThrInvProductsRequest filterThrInvProductsRequest);
ThrInvProductsEntity selectById(@Param("id") String id);
boolean insertThrInvProduct(ThrInvProductsEntity thrInvProductsEntity);
boolean insertThrInvProducts(@Param("thrInvProductsEntities") List<ThrInvProductsEntity> thrInvProductsEntities);
boolean updateThrInvProducts(ThrInvProductsEntity thrInvProductsEntity);
boolean deleteById(@Param("id") String id);
boolean deleteAll();
}

@ -0,0 +1,24 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrInvProductsDetailDao {
List<ThrInvProductsImportDetailEntity> filterInvProductsDetailImport(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest);
boolean insertInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity);
boolean updateInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity);
boolean insertInvProductsDetailImports(@Param("invProducts") List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities);
boolean deleteById(@Param("id") String id);
boolean deleteByGenkey(@Param("genKey") String genKey);
}

@ -0,0 +1,20 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpExportLogRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrInvProductsExportLogDao {
List<ThrInvProductsExportLogEntity> filterThrInvProductsExportLog(FilterThrCorpExportLogRequest filterThrCorpExportLogRequest);
boolean insertThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity);
boolean updateThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity);
boolean deleteById(@Param("id") String id);
}

@ -0,0 +1,22 @@
package com.glxp.api.dao.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ThrInvProductsImportLogDao {
List<ThrInvProductsImportLogEntity> filterThrInvProductsImportLog(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest);
boolean insertImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity);
boolean updateImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity);
boolean deleteById(@Param("id") String id);
}

@ -0,0 +1,88 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author
* @since 2023-01-12
*/
@Data
@TableName("thr_inv_products_export_log")
public class ThrInvProductsExportLogEntity {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
*
*/
@TableField("genKey")
private String genKey;
/**
* 01
*/
@TableField("status")
private Integer status;
/**
*
*/
@TableField("dlCount")
private Integer dlCount;
/**
*
*/
@TableField("filePath")
private String filePath;
@TableField("type")
private Integer type;
/**
*
*/
@TableField("createUser")
private String createUser;
/**
*
*/
@TableField("createTime")
private Date createTime;
/**
*
*/
@TableField("updateUser")
private String updateUser;
/**
*
*/
@TableField("updateTime")
private Date updateTime;
/**
*
*/
@TableField("remark")
private String remark;
}

@ -0,0 +1,116 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author
* @since 2023-01-12
*/
@Data
@TableName("thr_inv_products_import_detail")
public class ThrInvProductsImportDetailEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("inventoryCode")
private String inventoryCode;
@TableField("inventoryName")
private String inventoryName;
@TableField("spec")
private String spec;
@TableField("count")
private String count;
@TableField("batchNo")
private String batchNo;
/**
*
*/
@TableField("warehouseName")
private String warehouseName;
/**
*
*/
@TableField("warehouseCode")
private String warehouseCode;
@TableField("registerCertNo")
private String registerCertNo;
/**
*
*/
@TableField("spaceCode")
private String spaceCode;
/**
*
*/
@TableField("spaceName")
private String spaceName;
@TableField("manufacturingDate")
private String manufacturingDate;
@TableField("expirationDate")
private String expirationDate;
@TableField("thirdSysFk")
private String thirdSysFk;
@TableField("genKeyFk")
private String genKeyFk;
/**
*
*/
@TableField("createUser")
private String createUser;
/**
*
*/
@TableField("createTime")
private Date createTime;
/**
*
*/
@TableField("updateUser")
private String updateUser;
/**
*
*/
@TableField("updateTime")
private Date updateTime;
/**
*
*/
@TableField("remark")
private String remark;
}

@ -0,0 +1,77 @@
package com.glxp.api.entity.thrsys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author
* @since 2023-01-12
*/
@Data
@TableName("thr_inv_products_import_log")
public class ThrInvProductsImportLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("genKey")
private String genKey;
/**
* 0:1.2.3.
*/
@TableField("status")
private Integer status;
@TableField("fromType")
private String fromType;
@TableField("thirdSysFk")
private String thirdSysFk;
/**
*
*/
@TableField("createUser")
private String createUser;
/**
*
*/
@TableField("createTime")
private Date createTime;
/**
*
*/
@TableField("updateUser")
private String updateUser;
/**
*
*/
@TableField("updateTime")
private Date updateTime;
/**
*
*/
@TableField("remark")
private String remark;
}

@ -0,0 +1,65 @@
package com.glxp.api.http;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.req.thrsys.ThrOnhandRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class ErpInvClient {
@Resource
HttpOkClient httpOkClient;
public BaseResponse<PageSimpleResponse<ThrInvProductResponse>> getInvPrdoductResponse(ThrOnhandRequest onhandRequest, String url) {
Map<String, Object> paramMap = new HashMap<>(16);
if (onhandRequest.getBatchNo() != null && !onhandRequest.getBatchNo().equals(""))
paramMap.put("batchNo", onhandRequest.getBatchNo());
if (onhandRequest.getWarehouseCode() != null && !onhandRequest.getWarehouseCode().equals(""))
paramMap.put("warehouseCode", onhandRequest.getWarehouseCode());
if (onhandRequest.getInventoryCode() != null && !onhandRequest.getInventoryCode().equals(""))
paramMap.put("inventoryCode", onhandRequest.getInventoryCode());
if (onhandRequest.getInventoryName() != null && !onhandRequest.getInventoryName().equals(""))
paramMap.put("inventoryName", onhandRequest.getInventoryName());
if (onhandRequest.getSpec() != null && !onhandRequest.getSpec().equals(""))
paramMap.put("spec", onhandRequest.getSpec());
if (onhandRequest.getRegisterCertNo() != null && !onhandRequest.getRegisterCertNo().equals(""))
paramMap.put("registerCertNo", onhandRequest.getRegisterCertNo());
if (onhandRequest.getManufactory() != null && !onhandRequest.getManufactory().equals(""))
paramMap.put("manufactory", onhandRequest.getManufactory());
if (onhandRequest.getFilterCount() != null && !onhandRequest.getFilterCount().equals(""))
paramMap.put("filterCount", onhandRequest.getFilterCount());
if (onhandRequest.getPage() != null)
paramMap.put("page", onhandRequest.getPage());
if (onhandRequest.getLimit() != null)
paramMap.put("limit", onhandRequest.getLimit());
// String response = HttpClient.mipsGet(url, paramMap);
String response = httpOkClient.uCloudPost(url, onhandRequest);
try {
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> onHandsResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<ThrInvProductResponse>>>() {
});
return onHandsResponse;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public List<ThrInvProductResponse> getInvPrdoduct(ThrOnhandRequest onhandRequest, String url) {
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> responseBaseResponse = getInvPrdoductResponse(onhandRequest, url);
List<ThrInvProductResponse> responseList = responseBaseResponse.getData().getList();
return responseList;
}
}

@ -0,0 +1,40 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.req.ListPageRequest;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import lombok.Data;
import java.util.List;
@Data
public class FilterThrInvProductsRequest extends ListPageRequest {
private String inventoryCode;
private String inventoryName;
private String thirdSysFk;
private String batchNo;
private String warehouseCode;
private List<String> inventoryCodes;
private String udiCode;
private String nameCode;
private String thirdSys;
List<ThrInvProductResponse> thrInvProductResponseList;
private String spec;
private String registerCertNo;
private String manufactory;
private Integer filterCount;//0:不过滤1过滤等于02.过滤大于0
//增加字段
private String productDate; //生产日期
private String expireDate; //失效日期
private String productName; //产品名称
private String productId; //产品ID
private String standard; //规格型号
private String registerNo; //注册、备案证号
private String supId; //配送企业ID
private String supName; //配送企业名称
}

@ -0,0 +1,16 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import lombok.Data;
import java.util.List;
@Data
public class PostThrInvProductsRequest {
private String genKey;
private String thirdSys;
private String uploadType;
private List<ThrInvProductResponse> datas;
}

@ -0,0 +1,22 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import lombok.Data;
import java.util.List;
@Data
public class ThrInvProductsExportRequest {
private List<ThrInvProductsEntity> thrInvProductsEntities;
private String inventoryCode;
private String inventoryName;
private String thirdSysFk;
private String batchNo;
private String warehouseCode;
private List<String> inventoryCodes;
private String udiCode;
private String nameCode;
private String thirdSys;
}

@ -0,0 +1,33 @@
package com.glxp.api.req.thrsys;
import com.glxp.api.req.ListPageRequest;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import lombok.Data;
import java.util.List;
@Data
public class ThrOnhandRequest extends ListPageRequest {
private String batchNo;
private String warehouseCode;
private String inventoryName;
private String inventoryCode;
private List<String> inventoryCodes;
private String udiCode;
private String nameCode;
private String thirdSys;
private Boolean isDownThrSys;
List<ThrInvProductResponse> thrInvProductsEntities;
private String spec;
private String registerCertNo;
private String manufactory;
private Integer filterCount;//0:不过滤1过滤等于02.过滤大于0
}

@ -0,0 +1,40 @@
package com.glxp.api.res.thrsys;
import lombok.Data;
import java.util.Date;
@Data
public class ThrInvProductResponse {
private String code;
private String name;
private String batchNo;
private String manufacturingDate;
private String expirationDate;
private String warehouseCode;
private String warehouseName;
private String registerCertNo;
private String spaceCode;
private String spaceName;
private String thirdSysFk;
private String spec;
private Integer count;
private String manufactory;
//增加字段
private String productDate; //生产日期
private String expireDate; //失效日期
private String productName; //产品名称
private String productId; //产品ID
private String standard; //规格型号
private String registerNo; //注册、备案证号
private String supId; //配送企业ID
private String supName; //配送企业名称
private String createUser;
private Date createTime;
private String updateUser;
private Date updateTime;
private String remark;
}

@ -0,0 +1,16 @@
package com.glxp.api.res.thrsys;
import lombok.Data;
@Data
public class ThrOnHandResponse {
private String inventoryCode;
private String inventoryName;
private String spec;
private int count;
private String batchNo;
private String warehouseName;
private String warehouseCode;
private String registerCertNo;
}

@ -0,0 +1,21 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import java.util.List;
public interface ThrInvProductsDetailService {
List<ThrInvProductsImportDetailEntity> filterInvProductsDetailImport(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest);
boolean insertInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity);
boolean updateInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity);
boolean insertInvProductsDetailImports(List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities);
boolean deleteById(String id);
boolean deleteByGenkey(String genKey);
}

@ -0,0 +1,343 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.config.WebSocketServer;
import com.glxp.api.constant.BasicProcessStatus;
import com.glxp.api.constant.Constant;
import com.glxp.api.entity.basic.BasicThirdSysDetailEntity;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.http.ErpInvClient;
import com.glxp.api.req.thrsys.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.thrsys.ThrInvProductResponse;
import com.glxp.api.util.ExcelUtil;
import com.glxp.api.util.RedisUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class ThrInvProductsDlService {
@Resource
ThrInvProductsService thrInvProductsService;
@Resource
ThrSystemDetailService thrSystemDetailService;
@Resource
RedisUtil redisUtil;
@Resource
ThrInvProductsImportLogService thrInvProductsImportLogService;
@Resource
ThrInvProductsExportLogService thrInvProductsExportLogService;
@Resource
ThrInvProductsDetailService thrInvProductsDetailService;
@Resource
ErpInvClient erpInvClient;
@Async
public void importSelcyInvProducrs(String genKey, String thirdSys, List<ThrInvProductResponse> ThrInvProductResponses) {
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
ThrSystemDetailEntity piDetailEntity = thrSystemDetailService.selectByKey("invPiUrl", thirdSys);
if (piDetailEntity == null || piDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("库存产品信息接口未设置!", "sid");
return;
}
if (ThrInvProductResponses != null && ThrInvProductResponses.size() > 0) {
List<ThrInvProductsImportDetailEntity> thrProductsEntities = ThrInvProductResponses.stream().map(
item -> {
ThrInvProductsImportDetailEntity thrProductsEntity = new ThrInvProductsImportDetailEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setInventoryCode(item.getCode());
thrProductsEntity.setInventoryName(item.getName());
thrProductsEntity.setGenKeyFk(genKey);
thrProductsEntity.setThirdSysFk(thirdSys);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsDetailService.insertInvProductsDetailImports(thrProductsEntities);
}
FilterThrCorpImportLogRequest filterUdiIpLogRequest = new FilterThrCorpImportLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities = thrInvProductsDetailService.filterInvProductsDetailImport(filterUdiIpLogRequest);
List<ThrInvProductsEntity> thrInvProductsEntities = thrInvProductsImportDetailEntities.stream().map(
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsService.insertThrInvProducts(thrInvProductsEntities);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("库存产品信息下载已完成,请刷新查看!", "sid");
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
}
@Async
public void importProducrs(String genKey, String thirdSys, ThrOnhandRequest thrOnhandRequest) {
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("invPiUrl", thirdSys);
if (thrSystemDetailEntity == null || thrSystemDetailEntity.getValue() == null) {
WebSocketServer.sendInfo("库存产品信息接口未设置!", "sid");
return;
}
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
int page = 1;
int limit = 100;
while (page != -1) {
page = getInvmandoc(page, limit, thrSystemDetailEntity.getValue(), thrInvProductsImportLogEntity, genKey, thirdSys, thrOnhandRequest);
}
FilterThrCorpImportLogRequest filterUdiIpLogRequest = new FilterThrCorpImportLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities = thrInvProductsDetailService.filterInvProductsDetailImport(filterUdiIpLogRequest);
List<ThrInvProductsEntity> thrInvProductsEntities = thrInvProductsImportDetailEntities.stream().map(
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsService.insertThrInvProducts(thrInvProductsEntities);
redisUtil.set(Constant.dlThrProducts, "false");
WebSocketServer.sendInfo("库存产品信息下载已完成,请刷新查看!", "sid");
}
@Async
public void genExcel(String genKey, ThrInvProductsExportRequest thrInvProductsExportRequest) {
ThrInvProductsExportLogEntity thrInvProductsExportLogEntity = thrInvProductsExportLogService.selectByGenKey(genKey);
List<List<String>> excelData = new ArrayList<>();
List<String> head = new ArrayList<>();
head.add("存货编码");
head.add("存货名称");
head.add("规格型号");
head.add("数量");
head.add("批次号");
head.add("生产日期");
head.add("失效日期");
head.add("仓位号");
head.add("仓位名称");
head.add("货位号");
head.add("货位名称");
excelData.add(head);
//选中导出
if (thrInvProductsExportRequest.getThrInvProductsEntities() != null && thrInvProductsExportRequest.getThrInvProductsEntities().size() > 0) {
List<ThrInvProductsEntity> thrInvProductsEntities = thrInvProductsExportRequest.getThrInvProductsEntities();
for (ThrInvProductsEntity thrInvProductsEntity : thrInvProductsEntities) {
thrInvProductsEntity.setInventoryCode(thrInvProductsEntity.getInventoryCode());
thrInvProductsEntity.setInventoryName(thrInvProductsEntity.getInventoryName());
}
excelData.addAll(getRows(thrInvProductsEntities));
} else {//一键导出
//判断是否启用实时获取
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("invPiUrl", thrInvProductsExportRequest.getThirdSys());
if (thrSystemDetailEntity == null || thrSystemDetailEntity.getValue() == null) {
thrInvProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrInvProductsExportLogEntity.setRemark("库存产品信息接口地址未定义");
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
return;
}
if (!thrSystemDetailEntity.getEnabled()) {
thrInvProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrInvProductsExportLogEntity.setRemark("第三方库存产品信息接口服务未启用");
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
return;
}
if (thrSystemDetailEntity.getFromType() == 0) {
//从第三方服务实时一键导出
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
BeanUtils.copyProperties(thrInvProductsExportRequest, filterThrInvProductsRequest);
List<ThrInvProductsEntity> thrInvProductsEntities = exportInvProducts(filterThrInvProductsRequest);
excelData.addAll(getRows(thrInvProductsEntities));
} else {
//从本地导出
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
BeanUtils.copyProperties(thrInvProductsExportRequest, filterThrInvProductsRequest);
List<List<String>> genDatas = genExcelData(null, filterThrInvProductsRequest);
if (genDatas != null && genDatas.size() > 0) {
excelData.addAll(genDatas);
}
}
}
String sheetName = "库存产品信息";
new ExcelUtil().exportExcel(excelData, sheetName, thrInvProductsExportLogEntity.getFilePath(), 20);
thrInvProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrInvProductsExportLogService.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
}
@Async
public void insertInvProducts(String genKey, String thirdSys, List<ThrInvProductResponse> erpOnHandResponses) {
ThrInvProductsImportLogEntity thrInvProductsImportLogEntity = thrInvProductsImportLogService.selectByGenKey(genKey);
List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities;
thrInvProductsImportDetailEntities = erpOnHandResponses.stream().map(
item -> {
ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity = new ThrInvProductsImportDetailEntity();
BeanUtils.copyProperties(item, thrInvProductsImportDetailEntity);
thrInvProductsImportDetailEntity.setInventoryCode(item.getCode());
thrInvProductsImportDetailEntity.setInventoryName(item.getName());
thrInvProductsImportDetailEntity.setThirdSysFk(thirdSys);
thrInvProductsImportDetailEntity.setGenKeyFk(genKey);
thrInvProductsImportDetailEntity.setUpdateTime(new Date());
return thrInvProductsImportDetailEntity;
}
).collect(Collectors.toList());
thrInvProductsDetailService.insertInvProductsDetailImports(thrInvProductsImportDetailEntities);
List<ThrInvProductsEntity> thrInvProductsEntities;
thrInvProductsEntities = thrInvProductsImportDetailEntities.stream().map(
item -> {
ThrInvProductsEntity thrInvProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrInvProductsEntity);
thrInvProductsEntity.setUpdateTime(new Date());
return thrInvProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsService.insertThrInvProducts(thrInvProductsEntities);
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrInvProductsImportLogEntity.setUpdateTime(new Date());
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
}
public int getInvmandoc(int page, int limit, String productUrl, ThrInvProductsImportLogEntity thrInvProductsImportLogEntity,
String genKey, String thirdSys, ThrOnhandRequest ThrOnhandRequest) {
if (ThrOnhandRequest == null)
ThrOnhandRequest = new ThrOnhandRequest();
ThrOnhandRequest.setPage(page);
ThrOnhandRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> responseBaseResponse = erpInvClient.getInvPrdoductResponse(ThrOnhandRequest, productUrl);
if (responseBaseResponse.getCode() != 20000) {
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
thrInvProductsImportLogEntity.setRemark(responseBaseResponse.getMessage());
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
return -1;
}
List<ThrInvProductResponse> ThrInvProductResponses = responseBaseResponse.getData().getList();
if (ThrInvProductResponses != null && ThrInvProductResponses.size() > 0) {
List<ThrInvProductsImportDetailEntity> thrProductsEntities = ThrInvProductResponses.stream().map(
item -> {
ThrInvProductsImportDetailEntity thrProductsEntity = new ThrInvProductsImportDetailEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setInventoryCode(item.getCode());
thrProductsEntity.setInventoryName(item.getName());
thrProductsEntity.setGenKeyFk(genKey);
thrProductsEntity.setThirdSysFk(thirdSys);
thrProductsEntity.setUpdateTime(new Date());
return thrProductsEntity;
}
).collect(Collectors.toList());
thrInvProductsDetailService.insertInvProductsDetailImports(thrProductsEntities);
page++;
if (page * limit < responseBaseResponse.getData().getTotal()) {
return page;
}
}
thrInvProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
thrInvProductsImportLogService.updateImportLog(thrInvProductsImportLogEntity);
return -1;
}
public List<ThrInvProductsEntity> exportInvProducts(FilterThrInvProductsRequest filterThrInvProductsRequest) {
ThrSystemDetailEntity thrSystemDetailEntity = thrSystemDetailService.selectByKey("invPiUrl", filterThrInvProductsRequest.getThirdSys());
int page = 1;
int limit = 100;
List<ThrInvProductsEntity> thrInvProductsEntities = new ArrayList<>();
while (true) {
List<ThrInvProductsEntity> datas = getInvProducts(page, limit, thrSystemDetailEntity.getValue(), filterThrInvProductsRequest);
if (datas != null && datas.size() >= limit) {
thrInvProductsEntities.addAll(datas);
page++;
} else {
if (datas != null) {
thrInvProductsEntities.addAll(datas);
}
break;
}
}
return thrInvProductsEntities;
}
public List<ThrInvProductsEntity> getInvProducts(int page, int limit, String invPiUrl, FilterThrInvProductsRequest filterThrInvProductsRequest) {
ThrOnhandRequest ThrOnhandRequest = new ThrOnhandRequest();
BeanUtils.copyProperties(filterThrInvProductsRequest, ThrOnhandRequest);
ThrOnhandRequest.setPage(page);
ThrOnhandRequest.setLimit(limit);
BaseResponse<PageSimpleResponse<ThrInvProductResponse>> responseBaseResponse = erpInvClient.getInvPrdoductResponse(ThrOnhandRequest, invPiUrl);
if (responseBaseResponse != null && responseBaseResponse.getCode() == 20000) {
List<ThrInvProductResponse> ThrInvProductResponses = responseBaseResponse.getData().getList();
if (ThrInvProductResponses != null && ThrInvProductResponses.size() > 0) {
List<ThrInvProductsEntity> thrProductsEntities = ThrInvProductResponses.stream().map(
item -> {
ThrInvProductsEntity thrProductsEntity = new ThrInvProductsEntity();
BeanUtils.copyProperties(item, thrProductsEntity);
thrProductsEntity.setInventoryCode(item.getCode());
thrProductsEntity.setInventoryName(item.getName());
return thrProductsEntity;
}
).collect(Collectors.toList());
return thrProductsEntities;
}
}
return null;
}
public List<List<String>> genExcelData(String id, FilterThrInvProductsRequest filterThrInvProductsRequest) {
filterThrInvProductsRequest.setThirdSysFk(filterThrInvProductsRequest.getThirdSys());
List<List<String>> excelData = new ArrayList<>();
List<ThrInvProductsEntity> thrInvProductsEntities = new ArrayList<>();
if (id != null) {
ThrInvProductsEntity thrInvProductsEntity = thrInvProductsService.selectById(id);
thrInvProductsEntities.add(thrInvProductsEntity);
} else {
thrInvProductsEntities = thrInvProductsService.filterThrInvProductss(filterThrInvProductsRequest);
}
excelData.addAll(getRows(thrInvProductsEntities));
return excelData;
}
public List<List<String>> getRows(List<ThrInvProductsEntity> thrInvProductsEntities) {
List<List<String>> excelData = new ArrayList<>();
for (ThrInvProductsEntity thrInvProductsEntity : thrInvProductsEntities) {
List<String> rows = new ArrayList<>();
rows.add(thrInvProductsEntity.getInventoryCode());
rows.add(thrInvProductsEntity.getInventoryName());
rows.add(thrInvProductsEntity.getSpec());
rows.add(thrInvProductsEntity.getCount() + "");
rows.add(thrInvProductsEntity.getBatchNo());
rows.add(thrInvProductsEntity.getManufacturingDate());
rows.add(thrInvProductsEntity.getExpirationDate());
rows.add(thrInvProductsEntity.getWarehouseCode());
rows.add(thrInvProductsEntity.getWarehouseName());
rows.add(thrInvProductsEntity.getSpaceCode());
rows.add(thrInvProductsEntity.getSpaceName());
excelData.add(rows);
}
return excelData;
}
}

@ -0,0 +1,21 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpExportLogRequest;
import java.util.List;
public interface ThrInvProductsExportLogService {
ThrInvProductsExportLogEntity selectByGenKey(String genKey);
List<ThrInvProductsExportLogEntity> filterThrInvProductsExportLog(FilterThrCorpExportLogRequest filterThrCorpExportLogRequest);
boolean insertThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity);
boolean updateThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity);
boolean deleteById(String id);
}

@ -0,0 +1,22 @@
package com.glxp.api.service.thrsys;
import com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import java.util.List;
public interface ThrInvProductsImportLogService {
List<ThrInvProductsImportLogEntity> filterThrInvProductsImportLog(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest);
boolean insertImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity);
boolean updateImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity);
boolean deleteById(String id);
ThrInvProductsImportLogEntity selectByGenKey(String genKey);
}

@ -1,17 +1,26 @@
package com.glxp.api.service.thrsys;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.req.thrsys.FilterThrInvProductsRequest;
import java.util.List;
public interface ThrInvProductsService {
List<ThrInvProductsEntity> filterThrInvProductss(FilterThrInvProductsRequest filterThrInvProductsRequest);
ThrInvProductsEntity selectById(String id);
boolean insertThrInvProduct(ThrInvProductsEntity thrInvProductsEntity);
boolean insertThrInvProducts(List<ThrInvProductsEntity> thrInvProductsEntities);
boolean updateThrInvProducts(ThrInvProductsEntity thrInvProductsEntity);
boolean deleteById(String id);
/**
* <p>
*
* </p>
*
* @author zml
* @since 2023-01-10
*/
public interface ThrInvProductsService extends IService<ThrInvProductsEntity> {
boolean deleteAll();
}

@ -0,0 +1,57 @@
package com.glxp.api.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrInvProductsDetailDao;
import com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import com.glxp.api.service.thrsys.ThrInvProductsDetailService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvProductsDetailServiceImpl implements ThrInvProductsDetailService {
@Resource
ThrInvProductsDetailDao thrInvProductsDetailDao;
@Override
public List<ThrInvProductsImportDetailEntity> filterInvProductsDetailImport(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest) {
if (filterThrCorpImportLogRequest == null) {
return Collections.emptyList();
}
if (filterThrCorpImportLogRequest.getPage() != null) {
int offset = (filterThrCorpImportLogRequest.getPage() - 1) * filterThrCorpImportLogRequest.getLimit();
PageHelper.offsetPage(offset, filterThrCorpImportLogRequest.getLimit());
}
List<ThrInvProductsImportDetailEntity> data = thrInvProductsDetailDao.filterInvProductsDetailImport(filterThrCorpImportLogRequest);
return data;
}
@Override
public boolean insertInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity) {
return thrInvProductsDetailDao.insertInvProductsDetailImport(thrInvProductsImportDetailEntity);
}
@Override
public boolean updateInvProductsDetailImport(ThrInvProductsImportDetailEntity thrInvProductsImportDetailEntity) {
return thrInvProductsDetailDao.updateInvProductsDetailImport(thrInvProductsImportDetailEntity);
}
@Override
public boolean insertInvProductsDetailImports(List<ThrInvProductsImportDetailEntity> thrInvProductsImportDetailEntities) {
return thrInvProductsDetailDao.insertInvProductsDetailImports(thrInvProductsImportDetailEntities);
}
@Override
public boolean deleteById(String id) {
return thrInvProductsDetailDao.deleteById(id);
}
@Override
public boolean deleteByGenkey(String genKey) {
return thrInvProductsDetailDao.deleteByGenkey(genKey);
}
}

@ -0,0 +1,58 @@
package com.glxp.api.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrInvProductsExportLogDao;
import com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpExportLogRequest;
import com.glxp.api.service.thrsys.ThrInvProductsExportLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvProductsExportLogServiceImpl implements ThrInvProductsExportLogService {
@Resource
ThrInvProductsExportLogDao thrInvProductsExportLogDao;
@Override
public ThrInvProductsExportLogEntity selectByGenKey(String genKey) {
FilterThrCorpExportLogRequest filterUdiEpLogRequest = new FilterThrCorpExportLogRequest();
filterUdiEpLogRequest.setGenKey(genKey);
List<ThrInvProductsExportLogEntity> thrInvProductsExportLogEntities = thrInvProductsExportLogDao.filterThrInvProductsExportLog(filterUdiEpLogRequest);
if (thrInvProductsExportLogEntities != null && thrInvProductsExportLogEntities.size() > 0) {
return thrInvProductsExportLogEntities.get(0);
}
return null;
}
@Override
public List<ThrInvProductsExportLogEntity> filterThrInvProductsExportLog(FilterThrCorpExportLogRequest filterThrCorpExportLogRequest) {
if (filterThrCorpExportLogRequest == null) {
return Collections.emptyList();
}
if (filterThrCorpExportLogRequest.getPage() != null) {
int offset = (filterThrCorpExportLogRequest.getPage() - 1) * filterThrCorpExportLogRequest.getLimit();
PageHelper.offsetPage(offset, filterThrCorpExportLogRequest.getLimit());
}
List<ThrInvProductsExportLogEntity> data = thrInvProductsExportLogDao.filterThrInvProductsExportLog(filterThrCorpExportLogRequest);
return data;
}
@Override
public boolean insertThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity) {
return thrInvProductsExportLogDao.insertThrInvProductsExportLog(thrInvProductsExportLogEntity);
}
@Override
public boolean updateThrInvProductsExportLog(ThrInvProductsExportLogEntity thrInvProductsExportLogEntity) {
return thrInvProductsExportLogDao.updateThrInvProductsExportLog(thrInvProductsExportLogEntity);
}
@Override
public boolean deleteById(String id) {
return thrInvProductsExportLogDao.deleteById(id);
}
}

@ -0,0 +1,59 @@
package com.glxp.api.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.thrsys.ThrInvProductsImportLogDao;
import com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity;
import com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest;
import com.glxp.api.service.thrsys.ThrInvProductsImportLogService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvProductsImportLogServiceImpl implements ThrInvProductsImportLogService
{
@Resource
ThrInvProductsImportLogDao thrInvProductsImportLogDao;
@Override
public List<ThrInvProductsImportLogEntity> filterThrInvProductsImportLog(FilterThrCorpImportLogRequest filterThrCorpImportLogRequest) {
if (filterThrCorpImportLogRequest == null) {
return Collections.emptyList();
}
if (filterThrCorpImportLogRequest.getPage() != null) {
int offset = (filterThrCorpImportLogRequest.getPage() - 1) * filterThrCorpImportLogRequest.getLimit();
PageHelper.offsetPage(offset, filterThrCorpImportLogRequest.getLimit());
}
List<ThrInvProductsImportLogEntity> data = thrInvProductsImportLogDao.filterThrInvProductsImportLog(filterThrCorpImportLogRequest);
return data;
}
@Override
public boolean insertImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity) {
return thrInvProductsImportLogDao.insertImportLog(thrInvProductsImportLogEntity);
}
@Override
public boolean updateImportLog(ThrInvProductsImportLogEntity thrInvProductsImportLogEntity) {
return thrInvProductsImportLogDao.updateImportLog(thrInvProductsImportLogEntity);
}
@Override
public boolean deleteById(String id) {
return thrInvProductsImportLogDao.deleteById(id);
}
@Override
public ThrInvProductsImportLogEntity selectByGenKey(String genKey) {
FilterThrCorpImportLogRequest filterUdiIpLogRequest = new FilterThrCorpImportLogRequest();
filterUdiIpLogRequest.setGenKey(genKey);
List<ThrInvProductsImportLogEntity> data = thrInvProductsImportLogDao.filterThrInvProductsImportLog(filterUdiIpLogRequest);
if (data != null && data.size() > 0) {
return data.get(0);
}
return null;
}
}

@ -1,21 +1,63 @@
package com.glxp.api.service.thrsys.impl;
import com.github.pagehelper.PageHelper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.thrsys.ThrInvProductsDao;
import com.glxp.api.entity.thrsys.ThrInvProductsEntity;
import com.glxp.api.req.thrsys.FilterThrInvProductsRequest;
import com.glxp.api.service.thrsys.ThrInvProductsService;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author zml
* @since 2023-01-10
*/
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class ThrInvProductsServiceImpl extends ServiceImpl<ThrInvProductsDao, ThrInvProductsEntity> implements ThrInvProductsService {
public class ThrInvProductsServiceImpl implements ThrInvProductsService {
@Resource
private ThrInvProductsDao thrInvProductsDao;
@Override
public List<ThrInvProductsEntity> filterThrInvProductss(FilterThrInvProductsRequest filterThrInvProductsRequest) {
if (filterThrInvProductsRequest == null) {
return Collections.emptyList();
}
if (filterThrInvProductsRequest.getPage() != null) {
int offset = (filterThrInvProductsRequest.getPage() - 1) * filterThrInvProductsRequest.getLimit();
PageHelper.offsetPage(offset, filterThrInvProductsRequest.getLimit());
}
List<ThrInvProductsEntity> data = thrInvProductsDao.filterThrInvProductss(filterThrInvProductsRequest);
return data;
}
@Override
public ThrInvProductsEntity selectById(String id) {
return thrInvProductsDao.selectById(id);
}
@Override
public boolean insertThrInvProduct(ThrInvProductsEntity thrInvProductsEntity) {
return thrInvProductsDao.insertThrInvProduct(thrInvProductsEntity);
}
@Override
public boolean insertThrInvProducts(List<ThrInvProductsEntity> thrInvProductsEntities) {
return thrInvProductsDao.insertThrInvProducts(thrInvProductsEntities);
}
@Override
public boolean updateThrInvProducts(ThrInvProductsEntity thrInvProductsEntity) {
return thrInvProductsDao.updateThrInvProducts(thrInvProductsEntity);
}
@Override
public boolean deleteById(String id) {
return thrInvProductsDao.deleteById(id);
}
@Override
public boolean deleteAll() {
return thrInvProductsDao.deleteAll();
}
}

@ -1,42 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrInvProductsDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrInvProductsEntity">
<id column="id" property="id" />
<result column="inventoryCode" property="inventoryCode" />
<result column="inventoryName" property="inventoryName" />
<result column="spec" property="spec" />
<result column="count" property="count" />
<result column="batchNo" property="batchNo" />
<result column="warehouseName" property="warehouseName" />
<result column="warehouseCode" property="warehouseCode" />
<result column="registerCertNo" property="registerCertNo" />
<result column="spaceCode" property="spaceCode" />
<result column="spaceName" property="spaceName" />
<result column="manufacturingDate" property="manufacturingDate" />
<result column="expirationDate" property="expirationDate" />
<result column="thirdSysFk" property="thirdSysFk" />
<result column="manufactory" property="manufactory" />
<result column="productDate" property="productDate" />
<result column="expireDate" property="expireDate" />
<result column="productName" property="productName" />
<result column="productId" property="productId" />
<result column="standard" property="standard" />
<result column="registerNo" property="registerNo" />
<result column="supId" property="supId" />
<result column="supName" property="supName" />
<result column="createUser" property="createUser" />
<result column="createTime" property="createTime" />
<result column="updateUser" property="updateUser" />
<result column="updateTime" property="updateTime" />
<result column="remark" property="remark" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, inventoryCode, inventoryName, spec, count, batchNo, warehouseName, warehouseCode, registerCertNo, spaceCode, spaceName, manufacturingDate, expirationDate, thirdSysFk, manufactory, productDate, expireDate, productName, productId, standard, registerNo, supId, supName, createUser, createTime, updateUser, updateTime, remark
</sql>
</mapper>
<select id="filterThrInvProductss" parameterType="com.glxp.api.req.thrsys.FilterThrInvProductsRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvProductsEntity">
SELECT * FROM thr_inv_products
<where>
<if test="inventoryCode != '' and inventoryCode != null">
AND inventoryCode LIKE concat('%',#{inventoryCode},'%')
</if>
<if test="inventoryName != '' and inventoryName != null">
AND inventoryName LIKE concat('%',#{inventoryName},'%')
</if>
<if test="filterCount != '' and filterCount != null and filterCount==1">
AND count <![CDATA[ = ]]> 0
</if>
<if test="filterCount != '' and filterCount != null and filterCount==2">
AND count <![CDATA[ > ]]> 0
</if>
<if test="spec != '' and spec != null">
AND spec LIKE concat('%',#{spec},'%')
</if>
<if test="registerCertNo != '' and registerCertNo != null">
AND registerCertNo LIKE concat('%',#{registerCertNo},'%')
</if>
<if test="manufactory != '' and manufactory != null">
AND manufactory LIKE concat('%',#{manufactory},'%')
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
ORDER BY updateTime DESC
</select>
<select id="selectById" parameterType="Map" resultType="com.glxp.api.entity.thrsys.ThrInvProductsEntity">
select * FROM thr_inv_products WHERE id = #{id}
</select>
<insert id="insertThrInvProduct" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrInvProductsEntity">
replace INTO thr_inv_products
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime,manufactory,
productDate, expireDate, productName, productId, standard, registerNo, supId, supName
)
values
(
#{inventoryCode}, #{inventoryName}, #{count}, #{spec},
#{warehouseName}, #{warehouseCode}, #{registerCertNo}, #{manufacturingDate},
#{expirationDate},
#{thirdSysFk},#{batchNo},#{spaceCode},#{spaceName},#{updateTime},#{manufactory},
#{productDate}, #{expireDate}, #{productName}, #{productId}, #{standard},
#{registerNo}, #{supId}, #{supName}
)
</insert>
<insert id="insertThrInvProducts" keyProperty="id" parameterType="java.util.List">
replace INTO thr_inv_products
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime,manufactory,
productDate, expireDate, productName, productId, standard, registerNo, supId, supName
)
values
<foreach collection="thrInvProductsEntities" item="item" index="index"
separator=",">
(
#{item.inventoryCode}, #{item.inventoryName}, #{item.count}, #{item.spec},
#{item.warehouseName}, #{item.warehouseCode}, #{item.registerCertNo},
#{item.manufacturingDate}, #{item.expirationDate},
#{item.thirdSysFk},#{item.batchNo},#{item.spaceCode},#{item.spaceName},#{item.updateTime},#{item.manufactory},
#{item.productDate},#{item.expireDate}, #{item.productName}, #{item.productId}, #{item.standard}, #{item.registerNo},
#{item.supId}, #{item.supName}
)
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE FROM thr_inv_products WHERE id = #{id}
</delete>
<delete id="deleteAll">
DELETE FROM thr_inv_products
</delete>
<update id="updateThrInvProducts" parameterType="com.glxp.api.entity.thrsys.ThrInvProductsEntity">
UPDATE thr_inv_products
<trim prefix="set" suffixOverrides=",">
<if test="inventoryCode != null">inventoryCode=#{inventoryCode},</if>
<if test="inventoryName != null">inventoryName=#{inventoryName},</if>
<if test="spec != null">spec=#{spec},</if>
<if test="count != null">count=#{count},</if>
<if test="batchNo != null">batchNo=#{batchNo},</if>
<if test="warehouseName != null">warehouseName=#{warehouseName},</if>
<if test="warehouseCode != null">warehouseCode=#{warehouseCode},</if>
<if test="registerCertNo != null">registerCertNo=#{registerCertNo},</if>
<if test="manufacturingDate != null">manufacturingDate=#{manufacturingDate},</if>
<if test="expirationDate != null">expirationDate=#{expirationDate},</if>
<if test="spaceCode != null">spaceCode=#{spaceCode},</if>
<if test="spaceName != null">spaceName=#{spaceName},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="manufactory != null">manufactory=#{manufactory},</if>
<if test="productDate != null">productDate=#{productDate},</if>
<if test="expireDate != null">expireDate=#{expireDate},</if>
<if test="productName != null">productName=#{productName},</if>
<if test="productId != null">productId=#{productId},</if>
<if test="standard != null">standard=#{standard},</if>
<if test="registerNo != null">registerNo=#{registerNo},</if>
<if test="supId != null">supId=#{supId},</if>
<if test="supName != null">supName=#{supName},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrInvProductsDetailDao">
<select id="filterInvProductsDetailImport" parameterType="com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity">
SELECT * FROM thr_inv_products_import_detail
<where>
<if test="genKey != '' and genKey != null">
AND genKeyFk = #{genKey}
</if>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="status != '' and status != null">
AND status = #{status}
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
</select>
<insert id="insertInvProductsDetailImport" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity">
insert INTO thr_inv_products_import_detail
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime ,genKeyFk
)
values
(
#{inventoryCode}, #{inventoryName}, #{count}, #{spec},
#{warehouseName}, #{warehouseCode}, #{registerCertNo}, #{manufacturingDate},
#{expirationDate},
#{thirdSysFk},#{batchNo},#{spaceCode},#{spaceName},
#{updateTime},
#{genKeyFk}
)
</insert>
<insert id="insertInvProductsDetailImports" keyProperty="id" parameterType="java.util.List">
insert INTO thr_inv_products_import_detail
(
inventoryCode,inventoryName,count,spec,
warehouseName,warehouseCode,registerCertNo,manufacturingDate,
expirationDate,thirdSysFk,batchNo,spaceCode,spaceName,updateTime ,genKeyFk )
values
<foreach collection="invProducts" item="item" index="index"
separator=",">
(
#{item.inventoryCode}, #{item.inventoryName}, #{item.count}, #{item.spec},
#{item.warehouseName}, #{item.warehouseCode}, #{item.registerCertNo},
#{item.manufacturingDate}, #{item.expirationDate},
#{item.thirdSysFk},#{item.batchNo},#{item.spaceCode},#{item.spaceName}
,#{item.updateTime},#{item.genKeyFk} )
</foreach>
</insert>
<delete id="deleteById" parameterType="Map">
DELETE FROM thr_inv_products_import_detail WHERE id = #{id}
</delete>
<delete id="deleteByGenkey" parameterType="Map">
DELETE FROM thr_inv_products_import_detail WHERE genKeyFk = #{genKey}
</delete>
<update id="updateInvProductsDetailImport" parameterType="com.glxp.api.entity.thrsys.ThrInvProductsImportDetailEntity">
UPDATE thr_inv_products_import_detail
<trim prefix="set" suffixOverrides=",">
<if test="inventoryCode != null">inventoryCode=#{inventoryCode},</if>
<if test="inventoryName != null">inventoryName=#{inventoryName},</if>
<if test="spec != null">spec=#{spec},</if>
<if test="count != null">count=#{count},</if>
<if test="batchNo != null">batchNo=#{batchNo},</if>
<if test="warehouseName != null">warehouseName=#{warehouseName},</if>
<if test="warehouseCode != null">warehouseCode=#{warehouseCode},</if>
<if test="registerCertNo != null">registerCertNo=#{registerCertNo},</if>
<if test="manufacturingDate != null">manufacturingDate=#{manufacturingDate},</if>
<if test="expirationDate != null">expirationDate=#{expirationDate},</if>
<if test="spaceCode != null">spaceCode=#{spaceCode},</if>
<if test="spaceName != null">spaceName=#{spaceName},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="genKeyFk != null">genKeyFk=#{genKeyFk},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrInvProductsExportLogDao">
<select id="filterThrInvProductsExportLog" parameterType="com.glxp.api.req.thrsys.FilterThrCorpExportLogRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity">
SELECT * FROM thr_inv_products_export_log
<where>
<if test="genKey != '' and genKey != null">
AND genKey = #{genKey}
</if>
<if test="status != '' and status != null">
AND status = #{status}
</if>
<if test="type != '' and type != null">
AND `type` = #{type}
</if>
</where>
ORDER BY updateTime DESC
</select>
<insert id="insertThrInvProductsExportLog" keyProperty="id"
parameterType="com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity">
insert INTO thr_inv_products_export_log
(genKey,updateTime,dlCount,status,filePath,remark,`type`)
values
(
#{genKey},
#{updateTime},
#{dlCount},#{status},#{filePath},#{remark},#{type}
)
</insert>
<delete id="deleteById" parameterType="Map">
DELETE FROM thr_inv_products_export_log WHERE id = #{id}
</delete>
<update id="updateThrInvProductsExportLog" parameterType="com.glxp.api.entity.thrsys.ThrInvProductsExportLogEntity">
UPDATE thr_inv_products_export_log
<set>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="dlCount != null">dlCount=#{dlCount},</if>
<if test="status != null">status=#{status},</if>
<if test="filePath != null">filePath=#{filePath},</if>
<if test="remark != null">remark=#{remark},</if>
</set>
WHERE genKey = #{genKey}
</update>
</mapper>

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.thrsys.ThrInvProductsImportLogDao">
<select id="filterThrInvProductsImportLog" parameterType="com.glxp.api.req.thrsys.FilterThrCorpImportLogRequest"
resultType="com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity">
SELECT * FROM thr_inv_products_import_log
<where>
<if test="genKey != '' and genKey != null">
AND genKey = #{genKey}
</if>
<if test="id != '' and id != null">
AND id = #{id}
</if>
<if test="status != '' and status != null">
AND status = #{status}
</if>
<if test="thirdSysFk != '' and thirdSysFk != null">
AND thirdSysFk = #{thirdSysFk}
</if>
</where>
ORDER BY updateTime DESC
</select>
<insert id="insertImportLog" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity">
insert INTO thr_inv_products_import_log
(genKey,fromType,updateTime,thirdSysFk,status)
values
(
#{genKey},
#{fromType},
#{updateTime},
#{thirdSysFk},#{status}
)
</insert>
<delete id="deleteById" parameterType="Map">
DELETE FROM thr_inv_products_import_log WHERE id = #{id}
</delete>
<update id="updateImportLog" parameterType="com.glxp.api.entity.thrsys.ThrInvProductsImportLogEntity">
UPDATE thr_inv_products_import_log
<set>
<if test="genKey != null">genKey=#{genKey},</if>
<if test="fromType != null">fromType=#{fromType},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="status != null">status=#{status},</if>
<if test="remark != null">remark=#{remark},</if>
</set>
WHERE genKey = #{genKey}
</update>
</mapper>
Loading…
Cancel
Save