Commit a3086070d05ecb9c676abd5c97ba3f42372eae26

Authored by 周鸿
1 parent 2b49a170

fix:同步t100客户视图修改;

src/main/java/com/huaheng/pc/config/customer/domain/CustomerErp.java 0 → 100644
  1 +package com.huaheng.pc.config.customer.domain;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +
  6 +import com.baomidou.mybatisplus.annotation.TableField;
  7 +import com.baomidou.mybatisplus.annotation.TableName;
  8 +
  9 +import io.swagger.annotations.ApiModelProperty;
  10 +import lombok.Data;
  11 +
  12 +@Data
  13 +@TableName(value = "erp_mes_pmaa2uc_v")
  14 +public class CustomerErp implements Serializable {
  15 +
  16 + /**
  17 + * 企业编号,环境
  18 + */
  19 + @TableField(value = "企业编号")
  20 + @ApiModelProperty(value = "企业编号")
  21 + private String pmaa000;
  22 + /**
  23 + * 交易对象编号/编码
  24 + */
  25 + @TableField(value = "交易对象编号")
  26 + @ApiModelProperty(value = "交易对象编号")
  27 + private String pmaa001;
  28 +
  29 +
  30 +
  31 + /**
  32 + * 交易对象类型:1是供应商,2是客户,3是二者皆是
  33 + */
  34 + @TableField(value = "交易对象类型")
  35 + @ApiModelProperty(value = "交易对象类型")
  36 + private String pmaa002;
  37 +
  38 + /**
  39 + * 供应商、客户名称
  40 + */
  41 + @TableField(value = "交易对象简称")
  42 + @ApiModelProperty(value = "供应商、客户名称")
  43 + private String pmaal;
  44 + /**
  45 + * 最近更新日期
  46 + */
  47 + @TableField(value = "最近更改日")
  48 + @ApiModelProperty(value = "最近更新日期")
  49 + private Date pmaamodd;
  50 +
  51 +
  52 +}
0 53 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/customer/mapper/CustomerErpMapper.java 0 → 100644
  1 +package com.huaheng.pc.config.customer.mapper;
  2 +
  3 +import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  4 +import com.huaheng.pc.config.customer.domain.CustomerErp;
  5 +import com.huaheng.pc.config.supplier.domain.SupplierErp;
  6 +
  7 +public interface CustomerErpMapper extends BaseMapper<CustomerErp>
  8 +{
  9 +}
0 10 \ No newline at end of file
... ...
src/main/java/com/huaheng/pc/config/customer/service/CustomerErpService.java 0 → 100644
  1 +package com.huaheng.pc.config.customer.service;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.time.Instant;
  5 +import java.time.temporal.ChronoUnit;
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +
  9 +import javax.annotation.Resource;
  10 +
  11 +import com.huaheng.pc.config.customer.domain.CustomerErp;
  12 +import com.huaheng.pc.config.customer.mapper.CustomerErpMapper;
  13 +import org.springframework.stereotype.Service;
  14 +
  15 +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  16 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  17 +import com.huaheng.framework.aspectj.lang.annotation.Ds;
  18 +import com.huaheng.framework.aspectj.lang.constant.DataSourceName;
  19 +import com.huaheng.pc.config.address.domain.Address;
  20 +import com.huaheng.pc.config.supplier.domain.SupplierErp;
  21 +import com.huaheng.pc.config.supplier.mapper.SupplierErpMapper;
  22 +
  23 +
  24 +@Service
  25 +public class CustomerErpService extends ServiceImpl<CustomerErpMapper, CustomerErp>{
  26 +
  27 + @Resource
  28 + private CustomerErpMapper customerErpMapper;
  29 +
  30 +
  31 + SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  32 +
  33 +
  34 + /**
  35 + * 查找erp数据库的客户数据
  36 + * @return
  37 + */
  38 + @Ds(name= DataSourceName.SLAVE)
  39 + public List<CustomerErp> findCustomerData(Integer time, Address address,Date syncTimes){
  40 +// String startTime= DateUtils.getNowPreDays("yyyy-MM-dd HH:mm:ss", 30);
  41 +// time=time*24*14;
  42 + // 将Date转换为Instant
  43 + Instant instant = syncTimes.toInstant();
  44 + // 将Instant往前推移10分钟
  45 + Instant newInstant = instant.minus(5, ChronoUnit.MINUTES);
  46 + // 将新的Instant转换回Date
  47 + Date newDate = Date.from(newInstant);
  48 +// String startTime= DateUtils.getNowPreMin("yyyy-MM-dd HH:mm:ss", time);
  49 +// Date date=null;
  50 +// try{
  51 +// date=sf.parse(startTime);
  52 +// }catch (Exception e){
  53 +// }
  54 + QueryWrapper<CustomerErp> queryWrapper = new QueryWrapper<>();
  55 + queryWrapper.in("交易对象类型", 2,3);
  56 +// queryWrapper.isNull("最近更改日");
  57 + queryWrapper.ge("最近更改日", newDate);
  58 + queryWrapper.eq("企业编号", address.getUserDef2());
  59 + queryWrapper.select(" DISTINCT 交易对象编号 as pmaa001, 交易对象类型 AS pmaa002,交易对象简称 AS pmaal, \n" +
  60 + "最近更改日 AS pmaamodd");
  61 +// queryWrapper.last(" and rownum<=1");
  62 + List<CustomerErp> lists = this.list(queryWrapper);
  63 + return lists;
  64 + }
  65 +}
... ...
src/main/java/com/huaheng/pc/config/customer/service/CustomerServiceImpl.java
... ... @@ -24,11 +24,11 @@ public class CustomerServiceImpl extends ServiceImpl&lt;CustomerMapper, Customer&gt; i
24 24 return this.listMaps(lambda);
25 25 }
26 26  
27   - public Customer getCustomerByCode(String code){
28   - return this.getOne(new LambdaQueryWrapper<Customer>()
29   - .eq(Customer::getCode,code)
30   - .eq(Customer::getWarehouseCode,ShiroUtils.getWarehouseCode()));
31   - }
  27 +// public Customer getCustomerByCode(String code){
  28 +// return this.getOne(new LambdaQueryWrapper<Customer>()
  29 +// .eq(Customer::getCode,code)
  30 +// .eq(Customer::getWarehouseCode,ShiroUtils.getWarehouseCode()));
  31 +// }
32 32  
33 33 public Customer getCustomerByCode(String code,String warehouseCode){
34 34 return this.getOne(new LambdaQueryWrapper<Customer>()
... ...
src/main/java/com/huaheng/pc/config/supplier/service/SupplierSyncService.java
... ... @@ -13,6 +13,8 @@ import com.huaheng.pc.config.address.domain.Address;
13 13 import com.huaheng.pc.config.address.service.AddressService;
14 14 import com.huaheng.pc.config.container.domain.Container;
15 15 import com.huaheng.pc.config.customer.domain.Customer;
  16 +import com.huaheng.pc.config.customer.domain.CustomerErp;
  17 +import com.huaheng.pc.config.customer.service.CustomerErpService;
16 18 import com.huaheng.pc.config.customer.service.CustomerServiceImpl;
17 19 import com.huaheng.pc.config.supplier.domain.Supplier;
18 20 import com.huaheng.pc.config.supplier.mapper.SupplierMapper;
... ... @@ -49,6 +51,8 @@ public class SupplierSyncService extends ServiceImpl&lt;SupplierMapper, Supplier&gt;{
49 51 private SyncTimeService syncTimeService;
50 52 @Resource
51 53 private AddressService addressService;
  54 + @Resource
  55 + private CustomerErpService customerErpService;
52 56  
53 57  
54 58 public void syncSupplierData(Integer supplierTime){
... ... @@ -75,7 +79,7 @@ public class SupplierSyncService extends ServiceImpl&lt;SupplierMapper, Supplier&gt;{
75 79 }
76 80 SyncTime syncTime=getTimeByName(syncName);
77 81 Address address=addressService.selectAddressByParam("ERP", QuantityConstant.WAREHOUSE_CS);
78   - List<SupplierErp> list=supplierErpService.findCustomerData(customerTime,address,syncTime.getSyncTimes());
  82 + List<CustomerErp> list=customerErpService.findCustomerData(customerTime,address,syncTime.getSyncTimes());
79 83 System.out.println("======客户数据========"+list.size());
80 84 saveAndUpdateDataCustomer(list);
81 85 syncTimeService.updateStatus("customer",1,date);
... ... @@ -120,16 +124,16 @@ public class SupplierSyncService extends ServiceImpl&lt;SupplierMapper, Supplier&gt;{
120 124 }
121 125  
122 126 @Transactional(propagation = Propagation.REQUIRES_NEW)
123   - public void saveAndUpdateDataCustomer(List<SupplierErp> list){
  127 + public void saveAndUpdateDataCustomer(List<CustomerErp> list){
124 128 if(list==null||list.size()==0){
125 129 return ;
126 130 }
127 131 List<Customer> lists=new ArrayList<>();
128 132 for (int a=0;a<list.size();a++){
129   - SupplierErp supplierErp=list.get(a);
  133 + CustomerErp supplierErp=list.get(a);
130 134 Customer customer=new Customer();
131 135 String code=supplierErp.getPmaa001();
132   - Customer customer1 = customerService.getCustomerByCode(code);
  136 + Customer customer1 = customerService.getCustomerByCode(code,null);
133 137 if(customer1!=null){
134 138 if(StringUtils.isNotEmpty(supplierErp.getPmaal())&&!supplierErp.getPmaal().equals(customer1.getName())){
135 139 customer.setId(customer1.getId());
... ...
src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
... ... @@ -222,7 +222,9 @@ public class TaskHeaderController extends BaseController {
222 222 .eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)
223 223 .orderByAsc(TaskHeader::getStatus)
224 224 .orderByDesc(TaskHeader::getId);
225   -
  225 + if (StringUtils.isNotEmpty(taskHeader.getReferenceCode())) {
  226 + lambdaQueryWrapper.apply(" id in(select taskId from task_detail where referenceCode ='" + taskHeader.getReferenceCode() + "' )");
  227 + }
226 228 PageDomain pageDomain = TableSupport.buildPageRequest();
227 229 Integer pageNum = pageDomain.getPageNum();
228 230 Integer pageSize = pageDomain.getPageSize();
... ...