更新客商同步

This commit is contained in:
sx 2024-08-16 10:26:34 +08:00
parent 821c26bc3a
commit 6ee242d2a6
5 changed files with 2 additions and 486 deletions

View File

@ -145,7 +145,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity {
boolean isExis = true; boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setRootAppPk(requestVo.getParentvo().getCustcode()); integrationTaskLivingDetailsEntity.setRootAppPk(requestVo.getParentvo().getCustcode());
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y_H); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {

View File

@ -1,257 +0,0 @@
package com.hzya.frame.plugin.lets.plugin.base;
import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.lets.constant.OverallConstant;
import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant;
import com.hzya.frame.plugin.lets.queryvo.CustdocRequestVo;
import com.hzya.frame.plugin.lets.queryvo.CustmandocRequestVo;
import com.hzya.frame.plugin.lets.resultvo.CbdocResultVo;
import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto;
import com.hzya.frame.plugin.lets.u8cdto.CustmandocEntityDto;
import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
import com.hzya.frame.plugin.lets.util.PushDataByU8cUtil;
import com.hzya.frame.plugin.lets.util.SaveOrUpdateBusinessLogUtil;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
/**
* @Author
* @Date 2024/8/12 15:25
* @PackageName:com.hzya.frame.plugin.lets.plugin.base
* @ClassName: CustmandocPluginInitializer
* @Description: 客商管理档案
*/
public class CustmandocPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(CustmandocPluginInitializer.class);
private static final ReentrantLock LOCK = new ReentrantLock(true);
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
@Override
public String getPluginId() {
return "com.hzya.frame.plugin.lets.plugin.base.CustmandocPluginInitializer";
}
@Override
public String getPluginName() {
return "丽知OFS客商档案--->U8C客商管理档案";
}
@Override
public String getPluginLabel() {
return "丽知U8C客商基本档案--->U8C客商管理档案";
}
@Override
public String getPluginType() {
return "1";
}
@Autowired
private PushDataByU8cUtil pushDataByU8cUtil;
@Autowired
private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao;
@Autowired
private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil;
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
return null;
}
/**
* 默认推送
*/
public void start() {
try {
//获取符合条件客商基本档案
List<CustdocRequestVo> custdocRequestVos = queryCustDoc();
implement(custdocRequestVos);
} catch (Exception e) {
logger.error("丽知U8C客商基本档案 --->U8C客商管理档案 ,start()方法报错:", e);
}
}
/**
* 查询客商基本档案
* @return
*/
private List<CustdocRequestVo> queryCustDoc() {
List<CustdocRequestVo> custdocRequestVos=null;
try {
String data = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocQuery"), "{}");
CbdocResultVo cbdocResultVo = JSONObject.parseObject(data, CbdocResultVo.class);
String datastring = cbdocResultVo.getData();
Map map = JSONObject.parseObject(datastring, Map.class);
Object o = map.get("datas");
List<CustdocRequestVo> list = JSONObject.parseArray(JSON.toJSONString(o), CustdocRequestVo.class);
custdocRequestVos = filterData(list);
} catch (Exception e) {
logger.error("丽知:查询客商基本档案失败", e);
}
return custdocRequestVos;
}
private List<CustdocRequestVo> filterData(List<CustdocRequestVo> list) {
List<CustdocRequestVo> filterlist = new ArrayList<>();
for (CustdocRequestVo requestVo : list) {
if("N".equals(requestVo.getParentvo().getDef11())){
filterlist.add(requestVo);
}
}
return filterlist;
}
public void implement(List<CustdocRequestVo> list) {
for (CustdocRequestVo vo : list) {
String mandocjsonString = "";
//生成业务日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 定义日期格式
Date date = new Date(System.currentTimeMillis()); // 创建Date对象
String businessFormat = sdf.format(date); // 将Date对象格式化为字符串
CustdocEntityDto parentvo = vo.getParentvo();
try {
parentvo.setPk_areacl("F");
CustmandocRequestVo custmandocRequestVo = new CustmandocRequestVo();
custmandocRequestVo.setParentvo(parentvo);
custmandocRequestVo.setAddrs(vo.getAddrs());
// custmandocRequestVo.setBanks(vo.getBanks());
CustmandocEntityDto custmandocEntityDto = new CustmandocEntityDto();
custmandocEntityDto.setCustflag("0");
CustmandocEntityDto custmandocEntityDto1 = new CustmandocEntityDto();
custmandocEntityDto1.setCustflag("4");
List<CustmandocEntityDto> custmandocEntities = new ArrayList<>();
custmandocEntities.add(custmandocEntityDto);
custmandocEntities.add(custmandocEntityDto1);
custmandocRequestVo.setChildrenvo(custmandocEntities);
HashMap<String, Object> mandocparam = new HashMap<>();
mandocparam.put("billvo", custmandocRequestVo);
mandocjsonString = JSONObject.toJSONString(mandocparam);
String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custmandocSave"), mandocjsonString);
System.out.println(response);
boolean isSuccess = false;
if (response != null && !"".equals(response)) {
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
isSuccess = true;
updateDoc(vo);
}
}
if (!isSuccess) {
Assert.state(false, "推送U8C-->丽知U8C客商基本档案 --->U8C客商管理档案 失败 接口返回结果:{} 接口入参:{}", response, mandocjsonString);
}
//成功
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setRootAppNewData(mandocjsonString);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat);
integrationTaskLivingDetailsEntity.setRootAppPk(parentvo.getPk_cubasdoc());
integrationTaskLivingDetailsEntity.setRootAppBill(parentvo.getCustcode());
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} catch (Exception e) {
e.printStackTrace();
logger.error("丽知U8C客商基本档案 --->U8C客商管理档案 ,implement()方法报错", e);
//失败
String ErrMessage = e.getMessage();
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
integrationTaskLivingDetailsEntity.setRootAppNewData(mandocjsonString);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(businessFormat);
integrationTaskLivingDetailsEntity.setRootAppPk(parentvo.getPk_cubasdoc());
integrationTaskLivingDetailsEntity.setRootAppBill(parentvo.getCustcode());
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}
}
}
private void updateDoc(CustdocRequestVo custdocRequestVo) {
//已分配
String pkCubasdoc = custdocRequestVo.getParentvo().getPk_cubasdoc();
String createtime = custdocRequestVo.getParentvo().getCreatetime();
custdocRequestVo.getParentvo().setDef11("Y");
ArrayList<CustdocRequestVo> requestVos = new ArrayList<>();
requestVos.add(custdocRequestVo);
HashMap<String, List> map = new HashMap<>();
map.put("custbasvo", requestVos);
String data = JSONObject.toJSONString(map);
try {
String response = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocUpdate"), data);
boolean isSuccess = false;
if (response != null && !"".equals(response)) {
ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
isSuccess = true;
}
}
if (!isSuccess) {
Assert.state(false, "更新客商基本档案失败 接口返回结果:{} 接口入参:{}", response, data);
}
//成功
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setRootAppNewData(data);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(response);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
integrationTaskLivingDetailsEntity.setRootAppPk(pkCubasdoc);
integrationTaskLivingDetailsEntity.setRootAppBill(pkCubasdoc);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
} catch (Exception e) {
//失败
logger.error("U8C->客商基本档案更新updateDoc(CustdocRequestVo custdocRequestVo)方法失败");
String ErrMessage = e.getMessage();
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N);
integrationTaskLivingDetailsEntity.setRootAppNewData(data);
integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage);
integrationTaskLivingDetailsEntity.setNewPushDate(new Date());
integrationTaskLivingDetailsEntity.setBusinessDate(createtime);
integrationTaskLivingDetailsEntity.setRootAppPk(pkCubasdoc);
integrationTaskLivingDetailsEntity.setRootAppBill(pkCubasdoc);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity);
}
}
}

View File

@ -210,10 +210,6 @@ public class ShopPluginInitializer extends PluginBaseEntity {
// parentvo.setCustcode(shopEntity.getCustomerCode()); // parentvo.setCustcode(shopEntity.getCustomerCode());
// parentvo.setCustcode(shopEntity.getBizCode()); // parentvo.setCustcode(shopEntity.getBizCode());
// parentvo.setPk_areacl("F"); // parentvo.setPk_areacl("F");
//设置还未分配公司
// parentvo.setDef10("N");
// //设置还未同步到管理档案
// parentvo.setDef11("N");
// parentvo.setCustprop("2"); // parentvo.setCustprop("2");
custdocRequestVo.setParentvo(parentvo); custdocRequestVo.setParentvo(parentvo);
@ -284,7 +280,7 @@ public class ShopPluginInitializer extends PluginBaseEntity {
boolean isExis = true; boolean isExis = true;
IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity();
integrationTaskLivingDetailsEntity.setRootAppPk(ofsShopDto.getBizCode()); integrationTaskLivingDetailsEntity.setRootAppPk(ofsShopDto.getBizCode());
integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y_H); integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y);
integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId());
List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity); List<IntegrationTaskLivingDetailsEntity> integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity);
if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) { if (integrationTaskLivingDetailsEntities == null || integrationTaskLivingDetailsEntities.size() == 0) {

View File

@ -1,24 +0,0 @@
package com.hzya.frame.plugin.lets.queryvo;
import com.hzya.frame.plugin.lets.entity.BdCumandocEntity;
import com.hzya.frame.plugin.lets.u8cdto.CustdocEntityDto;
import com.hzya.frame.plugin.lets.u8cdto.CustmandocEntityDto;
import lombok.Data;
import java.util.List;
/**
* @Author
* @Date 2024/8/8 15:17
* @PackageName:com.hzya.frame.plugin.lets.plugin.base.vo
* @ClassName: CustmandocRequestVo
* @Description: TODO
*/
@Data
public class CustmandocRequestVo {
private List<AddrVo> addrs;
private List<BankVo> custBanks;
private List<CustmandocEntityDto> childrenvo;
private CustdocEntityDto parentvo;
}

View File

@ -1,199 +0,0 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
import java.util.List;
/**
* @Author
* @Date 2024/8/8 15:15
* @PackageName:com.hzya.frame.plugin.lets.plugin.base.vo
* @ClassName: BdCumandocEntity
* @Description: 客商管理档案
*/
@Data
public class CustmandocEntityDto {
// 于客商总公司账期控制
private boolean acclimitcontrol;
// 呼机
private String bp;
// 助记码
private String cmnecode;
// 是否收付协同
private boolean cooperateflag;
// 合作期限从
private String cooperatingdayfrom;
// 合作期限到
private String cooperatingdayto;
// 创建时间
private String createtime;
// 创建人
private String creator;
// 基于客商总公司信用控制
private boolean creditcontrol;
// 信用等级(填写编码)
private String creditlevel;
// 信用期限
private int creditlimitnum;
// 信用额度
private double creditmny;
// 信用保证金
private double creditmoney;
// 是否信用管制
private String credlimitflag;
// 客商编码
private String custcode;
//由于客商管理档案在数据库表中存的两条所以childrenvo如果传的话需要传两条这两条数据的客商属性字段必须是这些组合客户0和4供应商1和空格客商2和3不传childrenvo默认是客户0和4
private String custflag;
// 客商名称
private String custname;
// 客商状态
private String custstate;
private String def1;
private String def10;
private String def11;
private String def12;
private String def13;
private String def14;
private String def15;
private String def16;
private String def17;
private String def18;
private String def19;
private String def2;
private String def20;
private String def21;
private String def22;
private String def23;
private String def24;
private String def25;
private String def26;
private String def27;
private String def28;
private String def29;
private String def3;
private String def30;
private String def4;
private String def5;
private String def6;
private String def7;
private String def8;
private String def9;
// 发展日期
private String developdate;
//是否允许异币种核算
private String diffcurrflag;
// 扣率
private String discountrate;
// 删除标志
private int dr;
// 免于帐期检查
private boolean freeofacclmtcheck;
// 免于信用额度检查
private boolean freeofcremnycheck;
// 冻结时间
private String frozendate;
// 是否冻结
private boolean frozenflag;
// 等级
private int grade;
// 内控帐期天数
private String innerctldays;
// 筹投资单位
private boolean iounit;
// 是否零售加盟店
private boolean isagent;
// 是否催款
private boolean ispromtesettlement;
// 联系人
private String linkman;
// 备注
private String memo;
// 手机
private String mobilephone;
// 修改人
private String modifier;
// 修改时间
private String modifytime;
// 地区分类
private String pk_areacl;
// 库存组织(填写编码)
private String pk_calbody;
// 公司(填写编码)
private String pk_corp;
// 默认交易币种(填写编码)
private String pk_currtype1;
// 开票客商(填写编码)
private String pk_cusmandoc2;
// 发货客商(填写编码)
private String pk_cusmandoc3;
// 默认业务类型(填写编码)
private String pk_defbusitype;
// 默认收付款协议(填写编码)
private String pk_payterm;
// 公司价格分组(填写编码)
private String pk_pricegroupcorp;
// 专管部门(填写编码)
private String pk_respdept1;
// 专管业务员(填写编码)
private String pk_resppsn1;
// 销售组织(填写编码)
private String pk_salestru;
// 发运方式(填写编码)
private String pk_sendtype;
// 结算单位主键(已废弃)
private String pk_settleunit;
// 仓库档案(填写编码)
private String pk_stordoc2;
// 预收款比例
private int prepaidratio;
// 批准日期
private String ratifydate;
// 封存标志
private String sealflag;
// 存货最低售价比例
private int stockpriceratio;
// 新产品试销保证金
private double testsalemoney;
}