第三方产品信息导入导出代码提交
							parent
							
								
									af87625995
								
							
						
					
					
						commit
						a25f2c8e57
					
				| @ -0,0 +1,84 @@ | |||||||
|  | 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.ThrProductsImportLogEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity; | ||||||
|  | import com.glxp.api.req.system.DeleteRequest; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.service.auth.CustomerService; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductsImportDetailService; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductsImportLogService; | ||||||
|  | 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 ThrProductsImportLogController { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsImportLogService thrProductsImportLogService; | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsImportDetailService thrProductsImportDetailService; | ||||||
|  |     @Resource | ||||||
|  |     private CustomerService customerService; | ||||||
|  | 
 | ||||||
|  |     @GetMapping("/udiwms/thrProducts/importLog/filter") | ||||||
|  |     public BaseResponse filter(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest, | ||||||
|  |                                BindingResult bindingResult) { | ||||||
|  | 
 | ||||||
|  |         if (bindingResult.hasErrors()) { | ||||||
|  |             return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductsImportLogEntity> thrProductsImportLogEntities = thrProductsImportLogService.filterThrPorductsImportLog(filterThrProductsImportLogRequest); | ||||||
|  |         PageInfo<ThrProductsImportLogEntity> pageInfo; | ||||||
|  |         pageInfo = new PageInfo<>(thrProductsImportLogEntities); | ||||||
|  |         PageSimpleResponse<ThrProductsImportLogEntity> pageSimpleResponse = new PageSimpleResponse<>(); | ||||||
|  |         pageSimpleResponse.setTotal(pageInfo.getTotal()); | ||||||
|  |         pageSimpleResponse.setList(thrProductsImportLogEntities); | ||||||
|  |         return ResultVOUtils.success(pageSimpleResponse); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @GetMapping("/udiwms/thrProducts/importLog/filterDetail") | ||||||
|  |     public BaseResponse filterDetail(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest, | ||||||
|  |                                      BindingResult bindingResult) { | ||||||
|  | 
 | ||||||
|  |         if (bindingResult.hasErrors()) { | ||||||
|  |             return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities = thrProductsImportDetailService.filterProductsDetailImport(filterThrProductsImportLogRequest); | ||||||
|  |         PageInfo<ThrProductsImportDetailEntity> pageInfo; | ||||||
|  |         pageInfo = new PageInfo<>(thrProductsImportDetailEntities); | ||||||
|  |         PageSimpleResponse<ThrProductsImportDetailEntity> pageSimpleResponse = new PageSimpleResponse<>(); | ||||||
|  |         pageSimpleResponse.setTotal(pageInfo.getTotal()); | ||||||
|  |         pageSimpleResponse.setList(thrProductsImportDetailEntities); | ||||||
|  |         return ResultVOUtils.success(pageSimpleResponse); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @PostMapping("/udiwms/thrProducts//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(); | ||||||
|  |         FilterThrProductsImportLogRequest filterThrProductsImportLogRequest = new FilterThrProductsImportLogRequest(); | ||||||
|  |         filterThrProductsImportLogRequest.setId(Integer.parseInt(id)); | ||||||
|  |         List<ThrProductsImportLogEntity> thrProductsImportLogEntities = thrProductsImportLogService.filterThrPorductsImportLog(filterThrProductsImportLogRequest); | ||||||
|  |         if (thrProductsImportLogEntities != null && thrProductsImportLogEntities.size() > 0) { | ||||||
|  |             ThrProductsImportLogEntity thrInvProductsImportLogEntity = thrProductsImportLogEntities.get(0); | ||||||
|  |             thrProductsImportLogService.deleteById(thrInvProductsImportLogEntity.getId() + ""); | ||||||
|  |             thrProductsImportDetailService.deleteByGenkey(thrInvProductsImportLogEntity.getGenKey()); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return ResultVOUtils.success("删除成功"); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -1,7 +0,0 @@ | |||||||
| package com.glxp.api.dao.basic; |  | ||||||
| 
 |  | ||||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; |  | ||||||
| import com.glxp.api.entity.thrsys.ThrProductsExportLogEntity; |  | ||||||
| 
 |  | ||||||
| public interface ThrProductsExportLogDao extends BaseMapper<ThrProductsExportLogEntity> { |  | ||||||
| } |  | ||||||
| @ -1,7 +0,0 @@ | |||||||
| package com.glxp.api.dao.basic; |  | ||||||
| 
 |  | ||||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; |  | ||||||
| import com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity; |  | ||||||
| 
 |  | ||||||
| public interface ThrProductsImportDetailDao extends BaseMapper<ThrProductsImportDetailEntity> { |  | ||||||
| } |  | ||||||
| @ -0,0 +1,31 @@ | |||||||
|  | package com.glxp.api.dao.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsExportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsExportLogRequest; | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Mapper | ||||||
|  | public interface ThrProductsExportLogDao { | ||||||
|  | 
 | ||||||
|  |     List<ThrProductsExportLogEntity> filterThrProductsExportLog(FilterThrProductsExportLogRequest filterThrProductsExportLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean deleteById(@Param("id") String id); | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * 查询文件路径 | ||||||
|  |      * | ||||||
|  |      * @param id | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     String selectFilePathById(@Param("id") String id); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | package com.glxp.api.dao.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Mapper | ||||||
|  | public interface ThrProductsImportDetailDao { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     List<ThrProductsImportDetailEntity> filterProductsDetailImport(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity); | ||||||
|  | 
 | ||||||
|  |     boolean insertProductsDetailImports(@Param("products") List<ThrProductsImportDetailEntity> thrOrderImportDetailEntities); | ||||||
|  | 
 | ||||||
|  |     boolean deleteById(@Param("id") String id); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByGenkey(@Param("genKey") String genKey); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,22 @@ | |||||||
|  | package com.glxp.api.dao.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | import org.apache.ibatis.annotations.Mapper; | ||||||
|  | import org.apache.ibatis.annotations.Param; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Mapper | ||||||
|  | public interface ThrProductsImportLogDao { | ||||||
|  |     List<ThrProductsImportLogEntity> filterThrPorductsImportLog(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean deleteById(@Param("id") String id); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | } | ||||||
| @ -0,0 +1,19 @@ | |||||||
|  | package com.glxp.api.req.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 com.glxp.api.req.ListPageRequest; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | import java.util.Date; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class FilterThrProductsExportLogRequest extends ListPageRequest { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     private String genKey; | ||||||
|  |     private Integer status; | ||||||
|  |     private Integer type; | ||||||
|  | } | ||||||
| @ -0,0 +1,16 @@ | |||||||
|  | package com.glxp.api.req.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.req.ListPageRequest; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class FilterThrProductsImportLogRequest extends ListPageRequest { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     private Integer id; | ||||||
|  |     private String genKey; | ||||||
|  |     private Integer status; | ||||||
|  |     private String thirdSysFk; | ||||||
|  |     private String fromType; | ||||||
|  |     private String lastUpdateTime; | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | package com.glxp.api.req.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.res.thrsys.ThrProductsResponse; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class PostThrProductsRequest { | ||||||
|  | 
 | ||||||
|  |     private String genKey; | ||||||
|  |     private String thirdSys; | ||||||
|  |     private String uploadType; | ||||||
|  |     List<ThrProductsResponse> datas; | ||||||
|  | 
 | ||||||
|  |     //添加字段
 | ||||||
|  |     private String model; //型号
 | ||||||
|  |     private String standard; //规格型号,二合一字段
 | ||||||
|  |     private String qtbm; //其他编码
 | ||||||
|  |     private String zczyxqz; //注册有效期截止时间
 | ||||||
|  |     private String remark; //备注
 | ||||||
|  |     private String remark1; //备注1
 | ||||||
|  |     private String remark2; //备注2
 | ||||||
|  |     private String remark3; //备注3
 | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,15 @@ | |||||||
|  | package com.glxp.api.req.thrsys; | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsEntity; | ||||||
|  | import lombok.Data; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Data | ||||||
|  | public class ThrProductsExportRequest { | ||||||
|  |     private List<ThrProductsEntity> thrProductsEntities; | ||||||
|  |     private String code; | ||||||
|  |     private String name; | ||||||
|  |     private String thirdSys; | ||||||
|  |     private String thirdSysFk; | ||||||
|  | } | ||||||
| @ -0,0 +1,602 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | import cn.hutool.core.io.file.FileWriter; | ||||||
|  | import cn.hutool.json.JSONUtil; | ||||||
|  | import com.alibaba.fastjson.JSONObject; | ||||||
|  | import com.alibaba.fastjson.TypeReference; | ||||||
|  | import com.glxp.api.common.res.BaseResponse; | ||||||
|  | import com.glxp.api.constant.BasicProcessStatus; | ||||||
|  | import com.glxp.api.entity.basic.BasicThirdSysDetailEntity; | ||||||
|  | import com.glxp.api.entity.system.SyncDataSetEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsEntity; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsExportLogEntity; | ||||||
|  | import com.glxp.api.http.ErpBasicClient; | ||||||
|  | import com.glxp.api.http.HttpOkClient; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsRequest; | ||||||
|  | import com.glxp.api.req.thrsys.PostThrProductsRequest; | ||||||
|  | import com.glxp.api.req.thrsys.ThrProductsExportRequest; | ||||||
|  | import com.glxp.api.res.PageSimpleResponse; | ||||||
|  | import com.glxp.api.res.thrsys.ThrProductsResponse; | ||||||
|  | import com.glxp.api.service.basic.BasicThirdSysDetailService; | ||||||
|  | import com.glxp.api.service.system.SyncDataSetService; | ||||||
|  | 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 ThrProductsDlService { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     HttpOkClient httpOkClient; | ||||||
|  |     @Resource | ||||||
|  |     SyncDataSetService syncDataSetService; | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsService thrProductsService; | ||||||
|  |     @Resource | ||||||
|  |     BasicThirdSysDetailService basicThirdSysDetailService; | ||||||
|  | //    @Resource
 | ||||||
|  | //    RedisUtil redisUtil;
 | ||||||
|  | //    @Resource
 | ||||||
|  | //    ThrProductsImportLogService thrProductsImportLogService;
 | ||||||
|  | //    @Resource
 | ||||||
|  | //    ThrProductsImportDetailService thrProductsImportDetailService;
 | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsExportLogService thrProductsExportLogService; | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     private ErpBasicClient erpBasicClient; | ||||||
|  | //    @Resource
 | ||||||
|  | //    private BasicThirdSysService basicThirdSysService;
 | ||||||
|  | //    @Resource
 | ||||||
|  | //    private UdiRelevanceService udiRelevanceService;
 | ||||||
|  | //    @Resource
 | ||||||
|  | //    private UdiContrastService udiContrastService;
 | ||||||
|  | //
 | ||||||
|  | //    @Async
 | ||||||
|  | //    public void importSelectProducrs(String genKey, List<ThrProductsEntity> thrProductsEntities, String thirdSys) {
 | ||||||
|  | //        ThrProductsImportLogEntity thrProductsImportLogEntity = thrProductsImportLogService.selectByGenKey(genKey);
 | ||||||
|  | //        if (thrProductsEntities != null && thrProductsEntities.size() > 0) {
 | ||||||
|  | //            List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities;
 | ||||||
|  | //            thrProductsImportDetailEntities = thrProductsEntities.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ThrProductsImportDetailEntity thrProductsImportDetailEntity = new ThrProductsImportDetailEntity();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsImportDetailEntity);
 | ||||||
|  | //                        thrProductsImportDetailEntity.setSpec(item.getStandard());
 | ||||||
|  | //                        thrProductsImportDetailEntity.setThirdSysFk(thirdSys);
 | ||||||
|  | //                        thrProductsImportDetailEntity.setGenKeyFk(thrProductsImportLogEntity.getGenKey());
 | ||||||
|  | //                        return thrProductsImportDetailEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  | //            thrProductsImportDetailService.insertProductsDetailImports(thrProductsImportDetailEntities);
 | ||||||
|  | //            FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
 | ||||||
|  | //            filterUdiIpLogRequest.setGenKey(genKey);
 | ||||||
|  | //            List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities1 =
 | ||||||
|  | //                    thrProductsImportDetailService.filterProductsDetailImport(filterUdiIpLogRequest);
 | ||||||
|  | //            List<ThrProductsEntity> thrProductsEntities1 = thrProductsImportDetailEntities1.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                        thrProductsEntity.setUpdateTime(new Date());
 | ||||||
|  | ////                        thrProductsService.insertOrUpdateSelective(thrProductsEntity);
 | ||||||
|  | //                        return thrProductsEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  | //            thrProductsService.insertThrProductss(thrProductsEntities1);
 | ||||||
|  | //
 | ||||||
|  | //            redisUtil.set(Constant.dlThrProducts, "false");
 | ||||||
|  | //            thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //            thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //            WebSocketServer.sendInfo("产品信息下载已完成,请刷新查看!", "sid");
 | ||||||
|  | //        }
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //    //主动下载产品信息
 | ||||||
|  | //    @Async
 | ||||||
|  | //    public void importProducrs(String genKey, FilterThrProductsRequest filterThrProductsRequest) {
 | ||||||
|  | //        ThrProductsImportLogEntity thrProductsImportLogEntity = thrProductsImportLogService.selectByGenKey(genKey);
 | ||||||
|  | //        BasicThirdSysDetailEntity piDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", filterThrProductsRequest.getThirdSysFk());
 | ||||||
|  | //        if (piDetailEntity == null || piDetailEntity.getValue() == null) {
 | ||||||
|  | //            thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //            thrProductsImportLogEntity.setRemark("产品信息接口未设置");
 | ||||||
|  | //            thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //            WebSocketServer.sendInfo("产品信息接口未设置!", "sid");
 | ||||||
|  | //            return;
 | ||||||
|  | //        }
 | ||||||
|  | //
 | ||||||
|  | //        int page = 1;
 | ||||||
|  | //        int limit = 50;
 | ||||||
|  | //        while (page != -1) {
 | ||||||
|  | //            FilterErpGoodsRequest filterErpGoodsRequest = new FilterErpGoodsRequest();
 | ||||||
|  | //            BeanUtils.copyProperties(filterThrProductsRequest, filterErpGoodsRequest);
 | ||||||
|  | //            page = getInvmandoc(thrProductsImportLogEntity, page, limit, piDetailEntity.getValue(), filterErpGoodsRequest.getThirdSys(), filterErpGoodsRequest);
 | ||||||
|  | //        }
 | ||||||
|  | //        FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
 | ||||||
|  | //        filterUdiIpLogRequest.setGenKey(genKey);
 | ||||||
|  | //        List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities =
 | ||||||
|  | //                thrProductsImportDetailService.filterProductsDetailImport(filterUdiIpLogRequest);
 | ||||||
|  | //        List<ThrProductsEntity> thrProductsEntities = thrProductsImportDetailEntities.stream().map(
 | ||||||
|  | //                item -> {
 | ||||||
|  | //                    ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
 | ||||||
|  | //                    BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                    thrProductsEntity.setUpdateTime(new Date());
 | ||||||
|  | //                    return thrProductsEntity;
 | ||||||
|  | //                }
 | ||||||
|  | //        ).collect(Collectors.toList());
 | ||||||
|  | //
 | ||||||
|  | //        List<List<ThrProductsEntity>> splitList = CustomUtil.splitList(thrProductsEntities, 100);
 | ||||||
|  | //        for (List<ThrProductsEntity> data : splitList) {
 | ||||||
|  | //            thrProductsService.insertThrProductss(data);
 | ||||||
|  | //        }
 | ||||||
|  | ////        BasicThirdSysEntity basicThirdSysEntity = basicThirdSysService.selectMainThrSys();
 | ||||||
|  | ////        if (filterThrProductsRequest.getThirdSysFk().equals(basicThirdSysEntity.getThirdId())) {
 | ||||||
|  | ////            for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
 | ||||||
|  | ////                UdiRelevanceEntity udiRelevanceEntity = udiRelevanceService.selectByMainIdLimitOne(thrProductsEntity.getCode());
 | ||||||
|  | ////                if (udiRelevanceEntity == null) {
 | ||||||
|  | ////                    udiContrastService.createOnlyMainId(thrProductsEntity.getCode());
 | ||||||
|  | ////                }
 | ||||||
|  | ////            }
 | ||||||
|  | ////        }
 | ||||||
|  | //        redisUtil.set(Constant.dlThrProducts, "false");
 | ||||||
|  | //        thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //        thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //        WebSocketServer.sendInfo("产品信息下载已完成,请刷新查看!", "sid");
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //    //导出生成Excel文件
 | ||||||
|  | //    @Async
 | ||||||
|  | //    public void genExcel(String genKey, ThrProductsExportRequest thrProductsExportRequest) {
 | ||||||
|  | //
 | ||||||
|  | //        ThrProductsExportLogEntity thrProductsExportLogEntity = thrProductsExportLogService.selectByGenKey(genKey);
 | ||||||
|  | //
 | ||||||
|  | //        List<List<String>> excelData = new ArrayList<>();
 | ||||||
|  | //        List<String> head = new ArrayList<>();
 | ||||||
|  | //        head.add("产品ID");
 | ||||||
|  | //        head.add("产品名称");
 | ||||||
|  | //        head.add("计量单位");
 | ||||||
|  | //        head.add("规格型号");
 | ||||||
|  | //        head.add("注册证号");
 | ||||||
|  | //        head.add("生产厂家");
 | ||||||
|  | //        head.add("配送企业");
 | ||||||
|  | //        excelData.add(head);
 | ||||||
|  | //        //选中导出
 | ||||||
|  | //        if (thrProductsExportRequest.getThrProductsEntities() != null && thrProductsExportRequest.getThrProductsEntities().size() > 0) {
 | ||||||
|  | //            List<ThrProductsEntity> thrProductsEntities = thrProductsExportRequest.getThrProductsEntities();
 | ||||||
|  | //            excelData.addAll(getRows(thrProductsEntities));
 | ||||||
|  | //
 | ||||||
|  | //        } else {//一键导出
 | ||||||
|  | //
 | ||||||
|  | //            BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thrProductsExportRequest.getThirdSys());
 | ||||||
|  | //            if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
 | ||||||
|  | //                thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //                thrProductsExportLogEntity.setRemark("产品信息接口未定义!");
 | ||||||
|  | //                thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //                return;
 | ||||||
|  | //            }
 | ||||||
|  | //
 | ||||||
|  | //            if (!basicThirdSysDetailEntity.getEnabled()) {
 | ||||||
|  | //                thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //                thrProductsExportLogEntity.setRemark("第三方系统产品信息接口服务未启用!");
 | ||||||
|  | //                thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //                return;
 | ||||||
|  | //            }
 | ||||||
|  | //
 | ||||||
|  | //            if (basicThirdSysDetailEntity.getFromType() == 0) {
 | ||||||
|  | //                FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
 | ||||||
|  | //                BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest);
 | ||||||
|  | //                List<ThrProductsEntity> thrProductsEntities = exportThrProducts(filterThrProductsRequest);
 | ||||||
|  | //                excelData.addAll(getRows(thrProductsEntities));
 | ||||||
|  | //
 | ||||||
|  | //            } else {
 | ||||||
|  | //                FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
 | ||||||
|  | //                BeanUtils.copyProperties(thrProductsExportRequest, filterThrInvProductsRequest);
 | ||||||
|  | //                List<List<String>> genDatas = genExcelData(null, filterThrInvProductsRequest);
 | ||||||
|  | //                if (genDatas != null && genDatas.size() > 0) {
 | ||||||
|  | //                    excelData.addAll(genDatas);
 | ||||||
|  | //                }
 | ||||||
|  | //            }
 | ||||||
|  | //        }
 | ||||||
|  | //        String sheetName = "产品信息";
 | ||||||
|  | //        new ExcelUtil().exportExcel(excelData, sheetName, thrProductsExportLogEntity.getFilePath(), 20);
 | ||||||
|  | //        thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //        thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //    //上传SMP
 | ||||||
|  | //    @Async
 | ||||||
|  | //    public void uploadSmp(String genKey, ThrProductsExportRequest thrProductsExportRequest) {
 | ||||||
|  | //
 | ||||||
|  | //        PostThrProductsRequest postThrProductsRequest = new PostThrProductsRequest();
 | ||||||
|  | //        List<ErpProductsResponse> datas = new ArrayList<>();
 | ||||||
|  | //        ThrProductsExportLogEntity thrProductsExportLogEntity = thrProductsExportLogService.selectByGenKey(genKey);
 | ||||||
|  | //
 | ||||||
|  | //        //选中导出
 | ||||||
|  | //        if (thrProductsExportRequest.getThrProductsEntities() != null && thrProductsExportRequest.getThrProductsEntities().size() > 0) {
 | ||||||
|  | //            List<ThrProductsEntity> thrProductsEntities = thrProductsExportRequest.getThrProductsEntities();
 | ||||||
|  | //            List<ErpProductsResponse> lists = thrProductsEntities.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ErpProductsResponse thrProductsEntity = new ErpProductsResponse();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                        return thrProductsEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  | //            datas.addAll(lists);
 | ||||||
|  | //            postThrProductsRequest.setDatas(datas);
 | ||||||
|  | //            postThrProductsRequest.setGenKey(genKey);
 | ||||||
|  | //            postThrProductsRequest.setThirdSys(thrProductsExportRequest.getThirdSys());
 | ||||||
|  | //            postThrProductsRequest.setUploadType("接口上传");
 | ||||||
|  | //
 | ||||||
|  | //
 | ||||||
|  | //        } else {//一键导出
 | ||||||
|  | //
 | ||||||
|  | //            BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thrProductsExportRequest.getThirdSys());
 | ||||||
|  | //            if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) {
 | ||||||
|  | //                thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //                thrProductsExportLogEntity.setRemark("产品信息接口未定义!");
 | ||||||
|  | //                thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //                return;
 | ||||||
|  | //            }
 | ||||||
|  | //
 | ||||||
|  | //            if (!basicThirdSysDetailEntity.getEnabled()) {
 | ||||||
|  | //                thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //                thrProductsExportLogEntity.setRemark("第三方系统产品信息接口服务未启用!");
 | ||||||
|  | //                thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //                return;
 | ||||||
|  | //            }
 | ||||||
|  | //            List<ThrProductsEntity> thrProductsEntities;
 | ||||||
|  | //            if (basicThirdSysDetailEntity.getFromType() == 0) {
 | ||||||
|  | //                FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest();
 | ||||||
|  | //                BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest);
 | ||||||
|  | //                thrProductsEntities = exportThrProducts(filterThrProductsRequest);
 | ||||||
|  | //            } else {
 | ||||||
|  | //                FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest();
 | ||||||
|  | //                thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest);
 | ||||||
|  | //            }
 | ||||||
|  | //            if (thrProductsEntities != null) {
 | ||||||
|  | //                List<ErpProductsResponse> lists = thrProductsEntities.stream().map(
 | ||||||
|  | //                        item -> {
 | ||||||
|  | //                            ErpProductsResponse thrProductsEntity = new ErpProductsResponse();
 | ||||||
|  | //                            BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                            return thrProductsEntity;
 | ||||||
|  | //                        }
 | ||||||
|  | //                ).collect(Collectors.toList());
 | ||||||
|  | //                datas.addAll(lists);
 | ||||||
|  | //                postThrProductsRequest.setDatas(datas);
 | ||||||
|  | //                postThrProductsRequest.setGenKey(genKey);
 | ||||||
|  | //                postThrProductsRequest.setThirdSys(thrProductsExportRequest.getThirdSys());
 | ||||||
|  | //                postThrProductsRequest.setUploadType("接口上传");
 | ||||||
|  | //            }
 | ||||||
|  | //
 | ||||||
|  | //
 | ||||||
|  | //        }
 | ||||||
|  | //        String response = httpOkClient.uCloudPost(getIpUrl() + "/udiwms/thrsys/postThrProducts", postThrProductsRequest);
 | ||||||
|  | //        BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() {
 | ||||||
|  | //        });
 | ||||||
|  | //        if (baseResponse.getCode() == 20000) {
 | ||||||
|  | //            thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //        } else {
 | ||||||
|  | //            thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //        }
 | ||||||
|  | //        thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //        thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity);
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //
 | ||||||
|  |     //上传SMP
 | ||||||
|  |     @Async | ||||||
|  |     public void uploadSpssync(String genKey, ThrProductsExportRequest thrProductsExportRequest) { | ||||||
|  | 
 | ||||||
|  |         PostThrProductsRequest postThrProductsRequest = new PostThrProductsRequest(); | ||||||
|  |         List<ThrProductsResponse> datas = new ArrayList<>(); | ||||||
|  |         ThrProductsExportLogEntity thrProductsExportLogEntity = thrProductsExportLogService.selectByGenKey(genKey); | ||||||
|  | 
 | ||||||
|  |         //选中导出
 | ||||||
|  |         if (thrProductsExportRequest.getThrProductsEntities() != null && thrProductsExportRequest.getThrProductsEntities().size() > 0) { | ||||||
|  |             List<ThrProductsEntity> thrProductsEntities = thrProductsExportRequest.getThrProductsEntities(); | ||||||
|  |             List<ThrProductsResponse> lists = thrProductsEntities.stream().map( | ||||||
|  |                     item -> { | ||||||
|  |                         ThrProductsResponse thrProductsEntity = new ThrProductsResponse(); | ||||||
|  |                         BeanUtils.copyProperties(item, thrProductsEntity); | ||||||
|  |                         return thrProductsEntity; | ||||||
|  |                     } | ||||||
|  |             ).collect(Collectors.toList()); | ||||||
|  |             datas.addAll(lists); | ||||||
|  |             postThrProductsRequest.setDatas(datas); | ||||||
|  |             postThrProductsRequest.setGenKey(genKey); | ||||||
|  |             postThrProductsRequest.setThirdSys(thrProductsExportRequest.getThirdSys()); | ||||||
|  |             postThrProductsRequest.setUploadType("接口上传"); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         } else {//一键导出
 | ||||||
|  |             BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thrProductsExportRequest.getThirdSys()); | ||||||
|  |             if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) { | ||||||
|  |                 thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); | ||||||
|  |                 thrProductsExportLogEntity.setRemark("产品信息接口未定义!"); | ||||||
|  |                 thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (!basicThirdSysDetailEntity.getEnabled()) { | ||||||
|  |                 thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); | ||||||
|  |                 thrProductsExportLogEntity.setRemark("第三方系统产品信息接口服务未启用!"); | ||||||
|  |                 thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             List<ThrProductsResponse> thrProductsResponses=new ArrayList<>(); | ||||||
|  |             if (basicThirdSysDetailEntity.getFromType() == 0) { | ||||||
|  |                 FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); | ||||||
|  |                 BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest); | ||||||
|  |                 List<ThrProductsEntity> thrProductsEntities= exportThrProducts(filterThrProductsRequest); | ||||||
|  |                 if(thrProductsEntities.size()>0){ | ||||||
|  |                     thrProductsResponses = thrProductsEntities.stream().map( | ||||||
|  |                             item -> { | ||||||
|  |                                 ThrProductsResponse thrProductsResponse = new ThrProductsResponse(); | ||||||
|  |                                 BeanUtils.copyProperties(item, thrProductsResponse); | ||||||
|  |                                 return thrProductsResponse; | ||||||
|  |                             } | ||||||
|  |                     ).collect(Collectors.toList()); | ||||||
|  |                 } | ||||||
|  |             } else { | ||||||
|  |                 FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest(); | ||||||
|  |                 thrProductsResponses = thrProductsService.filterThrProductsRequest(filterThrInvProductsRequest); | ||||||
|  |             } | ||||||
|  |             if (thrProductsResponses.size()>0) { | ||||||
|  |                 List<ThrProductsResponse> lists = thrProductsResponses.stream().map( | ||||||
|  |                         item -> { | ||||||
|  |                             ThrProductsResponse thrProductsEntity = new ThrProductsResponse(); | ||||||
|  |                             BeanUtils.copyProperties(item, thrProductsEntity); | ||||||
|  |                             return thrProductsEntity; | ||||||
|  |                         } | ||||||
|  |                 ).collect(Collectors.toList()); | ||||||
|  |                 datas.addAll(lists); | ||||||
|  |                 postThrProductsRequest.setDatas(datas); | ||||||
|  |                 postThrProductsRequest.setGenKey(genKey); | ||||||
|  |                 postThrProductsRequest.setThirdSys(thrProductsExportRequest.getThirdSys()); | ||||||
|  |                 postThrProductsRequest.setUploadType("接口上传"); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         String response = httpOkClient.uCloudPost(getIpUrl() + "/spssync/thirdsys/products/upload", postThrProductsRequest); | ||||||
|  |         BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference<BaseResponse>() { | ||||||
|  |         }); | ||||||
|  |         if (baseResponse.getCode() == 20000) { | ||||||
|  |             thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); | ||||||
|  |         } else { | ||||||
|  |             thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); | ||||||
|  |         } | ||||||
|  |         thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getIpUrl() { | ||||||
|  |         SyncDataSetEntity syncDataSetEntity = syncDataSetService.findSet(); | ||||||
|  |         return syncDataSetEntity.getSyncIp(); | ||||||
|  |     } | ||||||
|  | //
 | ||||||
|  | //    // //接收第三方上传或文件导入数据
 | ||||||
|  | //    @Async
 | ||||||
|  | //    public void insertData(String genKey, List<ErpProductsResponse> erpProductsResponses, String thirdSys) {
 | ||||||
|  | //        ThrProductsImportLogEntity thrProductsImportLogEntity = thrProductsImportLogService.selectByGenKey(genKey);
 | ||||||
|  | //        if (erpProductsResponses != null && erpProductsResponses.size() > 0) {
 | ||||||
|  | //            List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities;
 | ||||||
|  | //            thrProductsImportDetailEntities = erpProductsResponses.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ThrProductsImportDetailEntity thrProductsImportDetailEntity = new ThrProductsImportDetailEntity();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsImportDetailEntity);
 | ||||||
|  | //                        thrProductsImportDetailEntity.setThirdSysFk(thirdSys);
 | ||||||
|  | //                        thrProductsImportDetailEntity.setGenKeyFk(genKey);
 | ||||||
|  | //                        return thrProductsImportDetailEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  | //
 | ||||||
|  | //            List<List<ThrProductsImportDetailEntity>> splitList = CustomUtil.splitList(thrProductsImportDetailEntities, 100);
 | ||||||
|  | //            for (List<ThrProductsImportDetailEntity> data : splitList) {
 | ||||||
|  | //                thrProductsImportDetailService.insertProductsDetailImports(data);
 | ||||||
|  | //            }
 | ||||||
|  | //            List<ThrProductsEntity> thrProductsEntities;
 | ||||||
|  | //            thrProductsEntities = thrProductsImportDetailEntities.stream().map(
 | ||||||
|  | //                    item -> {
 | ||||||
|  | //                        ThrProductsEntity thrProductsEntity = new ThrProductsEntity();
 | ||||||
|  | //                        BeanUtils.copyProperties(item, thrProductsEntity);
 | ||||||
|  | //                        thrProductsEntity.setUpdateTime(new Date());
 | ||||||
|  | //                        thrProductsService.insertOrUpdateSelective(thrProductsEntity);
 | ||||||
|  | //                        return thrProductsEntity;
 | ||||||
|  | //                    }
 | ||||||
|  | //            ).collect(Collectors.toList());
 | ||||||
|  | //            List<List<ThrProductsEntity>> products = CustomUtil.splitList(thrProductsEntities, 100);
 | ||||||
|  | ////            for (List<ThrProductsEntity> data : products) {
 | ||||||
|  | ////                thrProductsService.insertThrProductss(data);
 | ||||||
|  | ////            }
 | ||||||
|  | //            thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS);
 | ||||||
|  | //            thrProductsImportLogEntity.setUpdateTime(new Date());
 | ||||||
|  | //            thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //        } else {
 | ||||||
|  | //            thrProductsImportLogEntity.setRemark("未选择产品信息");
 | ||||||
|  | //            thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //            thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //        }
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //    public int getInvmandoc(ThrProductsImportLogEntity thrProductsImportLogEntity, int page, int limit, String
 | ||||||
|  | //            productUrl, String thirdSys, FilterErpGoodsRequest filterErpGoodsRequest) {
 | ||||||
|  | //
 | ||||||
|  | //        filterErpGoodsRequest.setPage(page);
 | ||||||
|  | //        filterErpGoodsRequest.setLimit(limit);
 | ||||||
|  | //        BaseResponse<PageSimpleResponse<ErpProductsResponse>> erpProducts = erpBasicClient.getErpProducts(filterErpGoodsRequest);
 | ||||||
|  | //        if (erpProducts != null && erpProducts.getCode() == 20000) {
 | ||||||
|  | //            List<ErpProductsResponse> erpProductsResponses = erpProducts.getData().getList();
 | ||||||
|  | //            if (erpProductsResponses != null && erpProductsResponses.size() > 0) {
 | ||||||
|  | //                List<ThrProductsImportDetailEntity> thrProductsImportDetailEntities;
 | ||||||
|  | //                thrProductsImportDetailEntities = erpProductsResponses.stream().map(
 | ||||||
|  | //                        item -> {
 | ||||||
|  | //                            ThrProductsImportDetailEntity thrProductsImportDetailEntity = new ThrProductsImportDetailEntity();
 | ||||||
|  | //                            BeanUtils.copyProperties(item, thrProductsImportDetailEntity);
 | ||||||
|  | //                            thrProductsImportDetailEntity.setSpec(item.getStandard());
 | ||||||
|  | //                            thrProductsImportDetailEntity.setThirdSysFk(thirdSys);
 | ||||||
|  | //                            thrProductsImportDetailEntity.setGenKeyFk(thrProductsImportLogEntity.getGenKey());
 | ||||||
|  | //                            return thrProductsImportDetailEntity;
 | ||||||
|  | //                        }
 | ||||||
|  | //                ).collect(Collectors.toList());
 | ||||||
|  | //                thrProductsImportDetailService.insertProductsDetailImports(thrProductsImportDetailEntities);
 | ||||||
|  | //                page++;
 | ||||||
|  | //                return page;
 | ||||||
|  | ////                if (page * limit < erpProducts.getData().getTotal()) {
 | ||||||
|  | ////                    return page;
 | ||||||
|  | ////                }
 | ||||||
|  | //            } else {
 | ||||||
|  | //                return -1;
 | ||||||
|  | //            }
 | ||||||
|  | //        } else {
 | ||||||
|  | //            thrProductsImportLogEntity.setRemark(erpProducts.getMessage());
 | ||||||
|  | //            thrProductsImportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL);
 | ||||||
|  | //            thrProductsImportLogService.updateImportLog(thrProductsImportLogEntity);
 | ||||||
|  | //            return -1;
 | ||||||
|  | //        }
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  |     public List<ThrProductsEntity> exportThrProducts(FilterThrProductsRequest filterThrProductsRequest) { | ||||||
|  |         BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", filterThrProductsRequest.getThirdSys()); | ||||||
|  |         int page = 1; | ||||||
|  |         int limit = 100; | ||||||
|  |         List<ThrProductsEntity> thrProductsEntities = new ArrayList<>(); | ||||||
|  |         while (true) { | ||||||
|  |             List<ThrProductsEntity> datas = getThrProducrts(page, limit, basicThirdSysDetailEntity.getValue(), filterThrProductsRequest); | ||||||
|  |             if (datas != null && datas.size() >= limit) { | ||||||
|  |                 thrProductsEntities.addAll(datas); | ||||||
|  |                 page++; | ||||||
|  | 
 | ||||||
|  |             } else { | ||||||
|  |                 if (datas != null) { | ||||||
|  |                     thrProductsEntities.addAll(datas); | ||||||
|  |                 } | ||||||
|  |                 break; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |         } | ||||||
|  |         return thrProductsEntities; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public List<ThrProductsEntity> getThrProducrts(int page, int limit, String productUrl, FilterThrProductsRequest filterThrProductsRequest) { | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         filterThrProductsRequest.setPage(page); | ||||||
|  |         filterThrProductsRequest.setLimit(limit); | ||||||
|  |         BaseResponse<PageSimpleResponse<ThrProductsResponse>> erpProducts = erpBasicClient.getErpProducts(filterThrProductsRequest); | ||||||
|  |         if (erpProducts != null && erpProducts.getCode() == 20000) { | ||||||
|  |             List<ThrProductsResponse> erpProductsResponses = erpProducts.getData().getList(); | ||||||
|  |             if (erpProductsResponses != null && erpProductsResponses.size() > 0) { | ||||||
|  |                 List<ThrProductsEntity> thrProductsEntities = erpProductsResponses.stream().map( | ||||||
|  |                         item -> { | ||||||
|  |                             ThrProductsEntity thrProductsEntity = new ThrProductsEntity(); | ||||||
|  |                             BeanUtils.copyProperties(item, thrProductsEntity); | ||||||
|  |                             return thrProductsEntity; | ||||||
|  |                         } | ||||||
|  |                 ).collect(Collectors.toList()); | ||||||
|  |                 return thrProductsEntities; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | //    public List<List<String>> genExcelData(String id, FilterThrProductsRequest filterThrProductsRequest) {
 | ||||||
|  | //
 | ||||||
|  | //        List<List<String>> excelData = new ArrayList<>();
 | ||||||
|  | //        List<ThrProductsEntity> thrProductsEntities = new ArrayList<>();
 | ||||||
|  | //        if (id != null) {
 | ||||||
|  | //            ThrProductsEntity thrProductsEntity = thrProductsService.selectById(id);
 | ||||||
|  | //            thrProductsEntities.add(thrProductsEntity);
 | ||||||
|  | //        } else {
 | ||||||
|  | //            thrProductsEntities = thrProductsService.filterThrProductsRequest(filterThrProductsRequest);
 | ||||||
|  | //        }
 | ||||||
|  | //        excelData.addAll(getRows(thrProductsEntities));
 | ||||||
|  | //        return excelData;
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  |     public List<ThrProductsResponse> genJsonData(String id, FilterThrProductsRequest filterThrProductsRequest) { | ||||||
|  |         List<ThrProductsResponse> jsonData = new ArrayList<>(); | ||||||
|  |         if (id != null) { | ||||||
|  |             ThrProductsEntity thrProductsEntity = thrProductsService.selectById(id); | ||||||
|  |             ThrProductsResponse thrProductsResponse=new ThrProductsResponse(); | ||||||
|  |             BeanUtils.copyProperties(thrProductsEntity, thrProductsResponse); | ||||||
|  |             jsonData.add(thrProductsResponse); | ||||||
|  |         } else { | ||||||
|  |             jsonData = thrProductsService.filterThrProductsRequest(filterThrProductsRequest); | ||||||
|  |         } | ||||||
|  |         return jsonData; | ||||||
|  |     } | ||||||
|  | //
 | ||||||
|  | //    public List<List<String>> getRows(List<ThrProductsEntity> thrProductsEntities) {
 | ||||||
|  | //        List<List<String>> excelData = new ArrayList<>();
 | ||||||
|  | //        for (ThrProductsEntity thrProductsEntity : thrProductsEntities) {
 | ||||||
|  | //            List<String> rows = new ArrayList<>();
 | ||||||
|  | //            rows.add(thrProductsEntity.getCode());
 | ||||||
|  | //            rows.add(thrProductsEntity.getName());
 | ||||||
|  | //            rows.add(thrProductsEntity.getMeasname() + "");
 | ||||||
|  | //            rows.add(thrProductsEntity.getSpec());
 | ||||||
|  | //            rows.add(thrProductsEntity.getRegisterNo());
 | ||||||
|  | //            rows.add(thrProductsEntity.getManufactory());
 | ||||||
|  | //            rows.add(thrProductsEntity.getSupName());
 | ||||||
|  | //            excelData.add(rows);
 | ||||||
|  | //        }
 | ||||||
|  | //        return excelData;
 | ||||||
|  | //    }
 | ||||||
|  | //
 | ||||||
|  | //
 | ||||||
|  |     //导出json文件
 | ||||||
|  |     @Async | ||||||
|  |     public void genJsonFile(String genKey, ThrProductsExportRequest thrProductsExportRequest) { | ||||||
|  | 
 | ||||||
|  |         ThrProductsExportLogEntity thrProductsExportLogEntity = thrProductsExportLogService.selectByGenKey(genKey); | ||||||
|  | 
 | ||||||
|  |         List<ThrProductsEntity> exportData = new ArrayList<>(); | ||||||
|  |         //选中导出
 | ||||||
|  |         if (thrProductsExportRequest.getThrProductsEntities() != null && thrProductsExportRequest.getThrProductsEntities().size() > 0) { | ||||||
|  |             List<ThrProductsEntity> thrProductsEntities = thrProductsExportRequest.getThrProductsEntities(); | ||||||
|  |             exportData.addAll(thrProductsEntities); | ||||||
|  |         } else {//一键导出
 | ||||||
|  | 
 | ||||||
|  |             BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("piQueryUrl", thrProductsExportRequest.getThirdSys()); | ||||||
|  |             if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null) { | ||||||
|  |                 thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); | ||||||
|  |                 thrProductsExportLogEntity.setRemark("产品信息接口未定义!"); | ||||||
|  |                 thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (!basicThirdSysDetailEntity.getEnabled()) { | ||||||
|  |                 thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); | ||||||
|  |                 thrProductsExportLogEntity.setRemark("第三方系统产品信息接口服务未启用!"); | ||||||
|  |                 thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (basicThirdSysDetailEntity.getFromType() == 0) { | ||||||
|  |                 FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); | ||||||
|  |                 BeanUtils.copyProperties(thrProductsExportRequest, filterThrProductsRequest); | ||||||
|  |                 List<ThrProductsEntity> thrProductsEntities = exportThrProducts(filterThrProductsRequest); | ||||||
|  |                 exportData.addAll(thrProductsEntities); | ||||||
|  | 
 | ||||||
|  |             } else { | ||||||
|  |                 List<ThrProductsResponse> exportData1 = new ArrayList<>(); | ||||||
|  |                 FilterThrProductsRequest filterThrInvProductsRequest = new FilterThrProductsRequest(); | ||||||
|  |                 BeanUtils.copyProperties(thrProductsExportRequest, filterThrInvProductsRequest); | ||||||
|  |                 List<ThrProductsResponse> jsonData = genJsonData(null, filterThrInvProductsRequest); | ||||||
|  |                 exportData1.addAll(jsonData); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         FileWriter writer = new FileWriter(thrProductsExportLogEntity.getFilePath()); | ||||||
|  |         writer.write(JSONUtil.toJsonStr(exportData)); | ||||||
|  |         thrProductsExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); | ||||||
|  |         thrProductsExportLogService.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,24 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsExportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsExportLogRequest; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | public interface ThrProductsExportLogService { | ||||||
|  | 
 | ||||||
|  |     ThrProductsExportLogEntity selectByGenKey(String genKey); | ||||||
|  | 
 | ||||||
|  |     List<ThrProductsExportLogEntity> filterThrProductsExportLog(FilterThrProductsExportLogRequest filterThrProductsExportLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean deleteById(String id); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,26 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | public interface ThrProductsImportDetailService { | ||||||
|  | 
 | ||||||
|  |     List<ThrProductsImportDetailEntity> filterProductsDetailImport(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity); | ||||||
|  | 
 | ||||||
|  |     boolean insertProductsDetailImports(List<ThrProductsImportDetailEntity> thrOrderImportDetailEntities); | ||||||
|  | 
 | ||||||
|  |     boolean deleteById(String id); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByGenkey(String genKey); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,23 @@ | |||||||
|  | package com.glxp.api.service.thrsys; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | 
 | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | public interface ThrProductsImportLogService { | ||||||
|  | 
 | ||||||
|  |     List<ThrProductsImportLogEntity> filterThrPorductsImportLog(FilterThrProductsImportLogRequest filterInCodeLogRequest); | ||||||
|  | 
 | ||||||
|  |     boolean insertImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity); | ||||||
|  | 
 | ||||||
|  |     boolean updateImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity); | ||||||
|  | //
 | ||||||
|  |     boolean deleteById(String id); | ||||||
|  | 
 | ||||||
|  |     boolean deleteByTime(); | ||||||
|  | //
 | ||||||
|  | //    ThrProductsImportLogEntity selectByGenKey(String genKey);
 | ||||||
|  | } | ||||||
| @ -0,0 +1,70 @@ | |||||||
|  | package com.glxp.api.service.thrsys.impl; | ||||||
|  | 
 | ||||||
|  | import cn.hutool.core.io.FileUtil; | ||||||
|  | import cn.hutool.core.util.StrUtil; | ||||||
|  | import com.github.pagehelper.PageHelper; | ||||||
|  | import com.glxp.api.dao.thrsys.ThrProductsExportLogDao; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsExportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsExportLogRequest; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductsExportLogService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class ThrProductsExportLogServiceImpl implements ThrProductsExportLogService { | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsExportLogDao thrProductsExportLogDao; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public ThrProductsExportLogEntity selectByGenKey(String genKey) { | ||||||
|  |         FilterThrProductsExportLogRequest filterThrProductsExportLogRequest = new FilterThrProductsExportLogRequest(); | ||||||
|  |         filterThrProductsExportLogRequest.setGenKey(genKey); | ||||||
|  |         List<ThrProductsExportLogEntity> data = thrProductsExportLogDao.filterThrProductsExportLog(filterThrProductsExportLogRequest); | ||||||
|  |         if (data != null) { | ||||||
|  |             return data.get(0); | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<ThrProductsExportLogEntity> filterThrProductsExportLog(FilterThrProductsExportLogRequest filterThrProductsExportLogRequest) { | ||||||
|  |         if (filterThrProductsExportLogRequest == null) { | ||||||
|  |             return Collections.emptyList(); | ||||||
|  |         } | ||||||
|  |         if (filterThrProductsExportLogRequest.getPage() != null) { | ||||||
|  |             int offset = (filterThrProductsExportLogRequest.getPage() - 1) * filterThrProductsExportLogRequest.getLimit(); | ||||||
|  |             PageHelper.offsetPage(offset, filterThrProductsExportLogRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductsExportLogEntity> data = thrProductsExportLogDao.filterThrProductsExportLog(filterThrProductsExportLogRequest); | ||||||
|  |         return data; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean insertThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity) { | ||||||
|  |         return thrProductsExportLogDao.insertThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean updateThrProductsExportLog(ThrProductsExportLogEntity thrProductsExportLogEntity) { | ||||||
|  |         return thrProductsExportLogDao.updateThrProductsExportLog(thrProductsExportLogEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteById(String id) { | ||||||
|  |         //删除日志同步删除文件
 | ||||||
|  |         String filePath = thrProductsExportLogDao.selectFilePathById(id); | ||||||
|  |         if (StrUtil.isNotBlank(filePath)) { | ||||||
|  |             FileUtil.del(filePath); | ||||||
|  |         } | ||||||
|  |         return thrProductsExportLogDao.deleteById(id); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteByTime() { | ||||||
|  |         return thrProductsExportLogDao.deleteByTime(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,62 @@ | |||||||
|  | package com.glxp.api.service.thrsys.impl; | ||||||
|  | 
 | ||||||
|  | import com.github.pagehelper.PageHelper; | ||||||
|  | import com.glxp.api.dao.thrsys.ThrProductsImportDetailDao; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductsImportDetailService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class ThrProductsImportDetailServiceImpl implements ThrProductsImportDetailService { | ||||||
|  | 
 | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsImportDetailDao thrProductsImportDetailDao; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<ThrProductsImportDetailEntity> filterProductsDetailImport(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest) { | ||||||
|  |         if (filterThrProductsImportLogRequest == null) { | ||||||
|  |             return Collections.emptyList(); | ||||||
|  |         } | ||||||
|  |         if (filterThrProductsImportLogRequest.getPage() != null) { | ||||||
|  |             int offset = (filterThrProductsImportLogRequest.getPage() - 1) * filterThrProductsImportLogRequest.getLimit(); | ||||||
|  |             PageHelper.offsetPage(offset, filterThrProductsImportLogRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductsImportDetailEntity> data = thrProductsImportDetailDao.filterProductsDetailImport(filterThrProductsImportLogRequest); | ||||||
|  |         return data; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean insertProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity) { | ||||||
|  |         return thrProductsImportDetailDao.insertProductsDetailImport(thrOrderImportDetailEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean updateProductsDetailImport(ThrProductsImportDetailEntity thrOrderImportDetailEntity) { | ||||||
|  |         return thrProductsImportDetailDao.updateProductsDetailImport(thrOrderImportDetailEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean insertProductsDetailImports(List<ThrProductsImportDetailEntity> thrOrderImportDetailEntities) { | ||||||
|  |         return thrProductsImportDetailDao.insertProductsDetailImports(thrOrderImportDetailEntities); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteById(String id) { | ||||||
|  |         return thrProductsImportDetailDao.deleteById(id); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteByTime() { | ||||||
|  |         return thrProductsImportDetailDao.deleteByTime(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteByGenkey(String genKey) { | ||||||
|  |         return thrProductsImportDetailDao.deleteByGenkey(genKey); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,62 @@ | |||||||
|  | package com.glxp.api.service.thrsys.impl; | ||||||
|  | 
 | ||||||
|  | import com.github.pagehelper.PageHelper; | ||||||
|  | import com.glxp.api.dao.thrsys.ThrProductsImportLogDao; | ||||||
|  | import com.glxp.api.entity.thrsys.ThrProductsImportLogEntity; | ||||||
|  | import com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest; | ||||||
|  | import com.glxp.api.service.thrsys.ThrProductsImportLogService; | ||||||
|  | import org.springframework.stereotype.Service; | ||||||
|  | 
 | ||||||
|  | import javax.annotation.Resource; | ||||||
|  | import java.util.Collections; | ||||||
|  | import java.util.List; | ||||||
|  | 
 | ||||||
|  | @Service | ||||||
|  | public class ThrProductsImportLogServiceImpl implements ThrProductsImportLogService { | ||||||
|  |     @Resource | ||||||
|  |     ThrProductsImportLogDao thrProductsImportLogDao; | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public List<ThrProductsImportLogEntity> filterThrPorductsImportLog(FilterThrProductsImportLogRequest filterThrProductsImportLogRequest) { | ||||||
|  |         if (filterThrProductsImportLogRequest == null) { | ||||||
|  |             return Collections.emptyList(); | ||||||
|  |         } | ||||||
|  |         if (filterThrProductsImportLogRequest.getPage() != null) { | ||||||
|  |             int offset = (filterThrProductsImportLogRequest.getPage() - 1) * filterThrProductsImportLogRequest.getLimit(); | ||||||
|  |             PageHelper.offsetPage(offset, filterThrProductsImportLogRequest.getLimit()); | ||||||
|  |         } | ||||||
|  |         List<ThrProductsImportLogEntity> data = thrProductsImportLogDao.filterThrPorductsImportLog(filterThrProductsImportLogRequest); | ||||||
|  |         return data; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean insertImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity) { | ||||||
|  |         return thrProductsImportLogDao.insertImportLog(thrProductsImportLogEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean updateImportLog(ThrProductsImportLogEntity thrProductsImportLogEntity) { | ||||||
|  |         return thrProductsImportLogDao.updateImportLog(thrProductsImportLogEntity); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteById(String id) { | ||||||
|  |         return thrProductsImportLogDao.deleteById(id); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     @Override | ||||||
|  |     public boolean deleteByTime() { | ||||||
|  |         return thrProductsImportLogDao.deleteByTime(); | ||||||
|  |     } | ||||||
|  | //
 | ||||||
|  | //    @Override
 | ||||||
|  | //    public ThrProductsImportLogEntity selectByGenKey(String genKey) {
 | ||||||
|  | //        FilterUdiIpLogRequest filterUdiIpLogRequest = new FilterUdiIpLogRequest();
 | ||||||
|  | //        filterUdiIpLogRequest.setGenKey(genKey);
 | ||||||
|  | //        List<ThrProductsImportLogEntity> data = thrProductsImportLogDao.filterImportLog(filterUdiIpLogRequest);
 | ||||||
|  | //        if (data != null && data.size() > 0) {
 | ||||||
|  | //            return data.get(0);
 | ||||||
|  | //        }
 | ||||||
|  | //        return null;
 | ||||||
|  | //    }
 | ||||||
|  | } | ||||||
| @ -1,24 +1,67 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8" ?> | <?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" > | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||||||
| <mapper namespace="com.glxp.api.dao.basic.ThrProductsExportLogDao"> | 
 | ||||||
|   <resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrProductsExportLogEntity"> | <mapper namespace="com.glxp.api.dao.thrsys.ThrProductsExportLogDao"> | ||||||
|     <!--@mbg.generated--> | 
 | ||||||
|     <!--@Table thr_products_export_log--> |     <select id="filterThrProductsExportLog" parameterType="com.glxp.api.req.thrsys.FilterThrProductsExportLogRequest" | ||||||
|     <id column="id" jdbcType="INTEGER" property="id" /> |             resultType="com.glxp.api.entity.thrsys.ThrProductsExportLogEntity"> | ||||||
|     <result column="genKey" jdbcType="VARCHAR" property="genKey" /> |         SELECT * FROM thr_products_export_log | ||||||
|     <result column="status" jdbcType="INTEGER" property="status" /> |         <where> | ||||||
|     <result column="dlCount" jdbcType="INTEGER" property="dlCount" /> |             <if test="genKey != '' and genKey != null"> | ||||||
|     <result column="filePath" jdbcType="VARCHAR" property="filePath" /> |                 AND genKey = #{genKey} | ||||||
|     <result column="type" jdbcType="INTEGER" property="type" /> |             </if> | ||||||
|     <result column="createUser" jdbcType="VARCHAR" property="createUser" /> |             <if test="status != '' and status != null"> | ||||||
|     <result column="createTime" jdbcType="TIMESTAMP" property="createTime" /> |                 AND status = #{status} | ||||||
|     <result column="updateUser" jdbcType="VARCHAR" property="updateUser" /> |             </if> | ||||||
|     <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" /> |             <if test="type != '' and type != null"> | ||||||
|     <result column="remark" jdbcType="VARCHAR" property="remark" /> |                 AND `type` = #{type} | ||||||
|   </resultMap> |             </if> | ||||||
|   <sql id="Base_Column_List"> |         </where> | ||||||
|     <!--@mbg.generated--> |         ORDER BY updateTime DESC | ||||||
|     id, genKey, `status`, dlCount, filePath, `type`, `createUser`, createTime, updateUser,  |     </select> | ||||||
|     updateTime, remark |     <select id="selectFilePathById" resultType="java.lang.String"> | ||||||
|   </sql> |         select filePath from thr_products_export_log where id = #{id} | ||||||
|  |     </select> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <insert id="insertThrProductsExportLog" keyProperty="id" | ||||||
|  |             parameterType="com.glxp.api.entity.thrsys.ThrProductsExportLogEntity"> | ||||||
|  |         insert INTO thr_products_export_log | ||||||
|  |         (genKey,updateTime,dlCount,status,filePath,remark,`type`,createUser,createTime,updateUser) | ||||||
|  |         values | ||||||
|  |             ( | ||||||
|  |             #{genKey}, | ||||||
|  |             #{updateTime}, | ||||||
|  |             #{dlCount},#{status},#{filePath},#{remark},#{type},#{createUser}, | ||||||
|  |             #{createTime}, | ||||||
|  |             #{updateUser} | ||||||
|  |             ) | ||||||
|  |     </insert> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <delete id="deleteById" parameterType="Map"> | ||||||
|  |         DELETE FROM thr_products_export_log  WHERE id =  #{id} | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
|  |     <update id="updateThrProductsExportLog" parameterType="com.glxp.api.entity.thrsys.ThrProductsExportLogEntity"> | ||||||
|  |         UPDATE thr_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> | ||||||
|  |             <if test="createUser != null">createUser=#{createUser},</if> | ||||||
|  |             <if test="createTime != null">createTime=#{createTime},</if> | ||||||
|  |             <if test="updateUser != null">updateUser=#{updateUser},</if> | ||||||
|  |         </set> | ||||||
|  |         WHERE genKey = #{genKey} | ||||||
|  |     </update> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <delete id="deleteByTime"> | ||||||
|  |         Delete From thr_products_export_log | ||||||
|  |         where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
| </mapper> | </mapper> | ||||||
| @ -1,40 +1,110 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8" ?> | <?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" > | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||||||
| <mapper namespace="com.glxp.api.dao.basic.ThrProductsImportDetailDao"> | 
 | ||||||
|   <resultMap id="BaseResultMap" type="com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity"> | <mapper namespace="com.glxp.api.dao.thrsys.ThrProductsImportDetailDao"> | ||||||
|     <!--@mbg.generated--> | 
 | ||||||
|     <!--@Table thr_products_import_detail--> |     <select id="filterProductsDetailImport" parameterType="com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest" | ||||||
|     <id column="id" jdbcType="INTEGER" property="id" /> |             resultType="com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity"> | ||||||
|     <result column="code" jdbcType="VARCHAR" property="code" /> |         SELECT * FROM thr_products_import_detail | ||||||
|     <result column="name" jdbcType="VARCHAR" property="name" /> |         <where> | ||||||
|     <result column="measname" jdbcType="VARCHAR" property="measname" /> |             <if test="genKey != '' and genKey != null"> | ||||||
|     <result column="spec" jdbcType="LONGVARCHAR" property="spec" /> |                 AND genKeyFk = #{genKey} | ||||||
|     <result column="registerNo" jdbcType="VARCHAR" property="registerNo" /> |             </if> | ||||||
|     <result column="manufactory" jdbcType="VARCHAR" property="manufactory" /> |             <if test="id != '' and id != null"> | ||||||
|     <result column="thirdSysFk" jdbcType="VARCHAR" property="thirdSysFk" /> |                 AND id = #{id} | ||||||
|     <result column="cplb" jdbcType="VARCHAR" property="cplb" /> |             </if> | ||||||
|     <result column="flbm" jdbcType="VARCHAR" property="flbm" /> |             <if test="status != '' and status != null"> | ||||||
|     <result column="qxlb" jdbcType="VARCHAR" property="qxlb" /> |                 AND status = #{status} | ||||||
|     <result column="ybbm" jdbcType="VARCHAR" property="ybbm" /> |             </if> | ||||||
|     <result column="sptm" jdbcType="VARCHAR" property="sptm" /> |             <if test="thirdSysFk != '' and thirdSysFk != null"> | ||||||
|     <result column="tyshxydm" jdbcType="VARCHAR" property="tyshxydm" /> |                 AND thirdSysFk = #{thirdSysFk} | ||||||
|     <result column="zczbhhzbapzbh" jdbcType="VARCHAR" property="zczbhhzbapzbh" /> |             </if> | ||||||
|     <result column="ylqxzcrbarmc" jdbcType="VARCHAR" property="ylqxzcrbarmc" /> |         </where> | ||||||
|     <result column="ylqxzcrbarywmc" jdbcType="VARCHAR" property="ylqxzcrbarywmc" /> | 
 | ||||||
|     <result column="cpms" jdbcType="LONGVARCHAR" property="cpms" /> |     </select> | ||||||
|     <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" /> | 
 | ||||||
|     <result column="genKeyFk" jdbcType="VARCHAR" property="genKeyFk" /> | 
 | ||||||
|     <result column="supName" jdbcType="VARCHAR" property="supName" /> |     <insert id="insertProductsDetailImport" keyProperty="id" | ||||||
|     <result column="price" jdbcType="VARCHAR" property="price" /> |             parameterType="com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity"> | ||||||
|     <result column="createUser" jdbcType="VARCHAR" property="createUser" /> |         insert INTO thr_products_import_detail | ||||||
|     <result column="createTime" jdbcType="TIMESTAMP" property="createTime" /> |         (code, name, measname, spec, registerNo, manufactory, | ||||||
|     <result column="updateUser" jdbcType="VARCHAR" property="updateUser" /> |          cplb, flbm, qxlb, ybbm, sptm, tyshxydm, zczbhhzbapzbh, ylqxzcrbarmc, ylqxzcrbarywmc, cpms, | ||||||
|     <result column="remark" jdbcType="VARCHAR" property="remark" /> |          thirdSysFk, updateTime, genKeyFk, supName, price) | ||||||
|   </resultMap> |         values (#{code}, | ||||||
|   <sql id="Base_Column_List"> |                 #{name}, | ||||||
|     <!--@mbg.generated--> |                 #{measname}, | ||||||
|     id, code, `name`, measname, spec, registerNo, manufactory, thirdSysFk, cplb, flbm,  |                 #{spec}, | ||||||
|     qxlb, ybbm, sptm, tyshxydm, zczbhhzbapzbh, ylqxzcrbarmc, ylqxzcrbarywmc, cpms, updateTime,  |                 #{registerNo}, | ||||||
|     genKeyFk, supName, price, `createUser`, createTime, updateUser, remark |                 #{manufactory}, | ||||||
|   </sql> |                 #{cplb}, #{flbm}, #{qxlb}, #{ybbm}, #{sptm}, | ||||||
|  |                 #{tyshxydm}, #{zczbhhzbapzbh}, #{ylqxzcrbarmc}, #{ylqxzcrbarywmc}, #{cpms} | ||||||
|  |             #{thirdSysFk}, #{updateTime}, #{genKeyFk}, #{supName}, #{price}) | ||||||
|  |     </insert> | ||||||
|  | 
 | ||||||
|  |     <insert id="insertProductsDetailImports" keyProperty="id" parameterType="java.util.List"> | ||||||
|  |         insert INTO thr_products_import_detail | ||||||
|  |         ( | ||||||
|  |         code,name,measname,spec,registerNo,manufactory, | ||||||
|  |         cplb,flbm,qxlb,ybbm,sptm,tyshxydm,zczbhhzbapzbh,ylqxzcrbarmc,ylqxzcrbarywmc,cpms, | ||||||
|  |         thirdSysFk ,updateTime ,genKeyFk,supName,price ) | ||||||
|  |         values | ||||||
|  |         <foreach collection="products" item="item" index="index" | ||||||
|  |                  separator=","> | ||||||
|  |             ( | ||||||
|  |             #{item.code}, | ||||||
|  |             #{item.name}, | ||||||
|  |             #{item.measname}, | ||||||
|  |             #{item.spec}, | ||||||
|  |             #{item.registerNo}, | ||||||
|  |             #{item.manufactory}, | ||||||
|  |             #{item.cplb}, #{item.flbm}, #{item.qxlb}, #{item.ybbm},#{item.sptm}, | ||||||
|  |             #{item.tyshxydm}, #{item.zczbhhzbapzbh}, #{item.ylqxzcrbarmc}, #{item.ylqxzcrbarywmc},#{item.cpms}, | ||||||
|  |             #{item.thirdSysFk} ,#{item.updateTime},#{item.genKeyFk} ,#{item.supName} ,#{item.price} ) | ||||||
|  |         </foreach> | ||||||
|  |     </insert> | ||||||
|  |     <delete id="deleteById" parameterType="Map"> | ||||||
|  |         DELETE | ||||||
|  |         FROM thr_products_import_detail | ||||||
|  |         WHERE id = #{id} | ||||||
|  |     </delete> | ||||||
|  |     <delete id="deleteByGenkey" parameterType="Map"> | ||||||
|  |         DELETE | ||||||
|  |         FROM thr_products_import_detail | ||||||
|  |         WHERE genKeyFk = #{genKey} | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
|  |     <update id="updateProductsDetailImport" | ||||||
|  |             parameterType="com.glxp.api.entity.thrsys.ThrProductsImportDetailEntity"> | ||||||
|  |         UPDATE thr_products_import_detail | ||||||
|  |         <trim prefix="set" suffixOverrides=","> | ||||||
|  |             <if test="code != null">code=#{code},</if> | ||||||
|  |             <if test="name != null">name=#{name},</if> | ||||||
|  |             <if test="measname != null">measname=#{measname},</if> | ||||||
|  |             <if test="spec != null">spec=#{spec},</if> | ||||||
|  |             <if test="registerNo != null">registerNo=#{registerNo},</if> | ||||||
|  |             <if test="cplb != null">cplb=#{cplb},</if> | ||||||
|  |             <if test="flbm != null">flbm=#{flbm},</if> | ||||||
|  |             <if test="qxlb != null">qxlb=#{qxlb},</if> | ||||||
|  |             <if test="ybbm != null">ybbm=#{ybbm},</if> | ||||||
|  |             <if test="sptm != null">sptm=#{sptm},</if> | ||||||
|  |             <if test="tyshxydm != null">tyshxydm=#{tyshxydm},</if> | ||||||
|  |             <if test="zczbhhzbapzbh != null">zczbhhzbapzbh=#{zczbhhzbapzbh},</if> | ||||||
|  |             <if test="ylqxzcrbarmc != null">ylqxzcrbarmc=#{ylqxzcrbarmc},</if> | ||||||
|  |             <if test="ylqxzcrbarywmc != null">ylqxzcrbarywmc=#{ylqxzcrbarywmc},</if> | ||||||
|  |             <if test="manufactory != null">manufactory=#{manufactory},</if> | ||||||
|  |             <if test="cpms != null">cpms=#{cpms},</if> | ||||||
|  |             <if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if> | ||||||
|  |             <if test="updateTime != null">updateTime=#{updateTime},</if> | ||||||
|  |             <if test="genKeyFk != null">genKeyFk=#{genKeyFk},</if> | ||||||
|  |             <if test="supName != null">supName=#{supName},</if> | ||||||
|  | 
 | ||||||
|  |         </trim> | ||||||
|  |         WHERE id = #{id} | ||||||
|  |     </update> | ||||||
|  | 
 | ||||||
|  |     <delete id="deleteByTime"> | ||||||
|  |         Delete From thr_products_import_detail | ||||||
|  |         where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
| </mapper> | </mapper> | ||||||
| @ -0,0 +1,68 @@ | |||||||
|  | <?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.ThrProductsImportLogDao"> | ||||||
|  | 
 | ||||||
|  |     <select id="filterThrPorductsImportLog" parameterType="com.glxp.api.req.thrsys.FilterThrProductsImportLogRequest" | ||||||
|  |             resultType="com.glxp.api.entity.thrsys.ThrProductsImportLogEntity"> | ||||||
|  |         SELECT * FROM thr_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.ThrProductsImportLogEntity"> | ||||||
|  |         insert INTO thr_products_import_log | ||||||
|  |         (genKey,fromType,updateTime,thirdSysFk,status,remark,createUser,createTime,updateUser) | ||||||
|  |         values | ||||||
|  |             ( | ||||||
|  |             #{genKey}, | ||||||
|  |             #{fromType}, | ||||||
|  |             #{updateTime}, | ||||||
|  |             #{thirdSysFk},#{status},#{remark},#{createUser}, | ||||||
|  |             #{createTime}, | ||||||
|  |             #{updateUser} | ||||||
|  |             ) | ||||||
|  |     </insert> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <delete id="deleteById" parameterType="Map"> | ||||||
|  |         DELETE FROM thr_products_import_log  WHERE id =  #{id} | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
|  |     <update id="updateImportLog" parameterType="com.glxp.api.entity.thrsys.ThrProductsImportLogEntity"> | ||||||
|  |         UPDATE thr_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> | ||||||
|  |             <if test="createUser != null">createUser=#{createUser},</if> | ||||||
|  |             <if test="createTime != null">createTime=#{createTime},</if> | ||||||
|  |             <if test="updateUser != null">updateUser=#{updateUser},</if> | ||||||
|  |         </set> | ||||||
|  |         WHERE genKey = #{genKey} | ||||||
|  |     </update> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     <delete id="deleteByTime"> | ||||||
|  |         Delete From thr_products_import_log | ||||||
|  |         where date(updateTime) <= date(DATE_SUB(NOW(),INTERVAL 30 day)) | ||||||
|  |     </delete> | ||||||
|  | 
 | ||||||
|  | </mapper> | ||||||
					Loading…
					
					
				
		Reference in New Issue