|
|
@ -1,7 +1,11 @@ |
|
|
|
package com.dxhy.order.consumer.openapi.service.impl; |
|
|
|
package com.dxhy.order.consumer.openapi.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.dxhy.order.baseservice.module.buyer.dao.BuyerMapper; |
|
|
|
|
|
|
|
import com.dxhy.order.baseservice.module.buyer.model.BuyerEntity; |
|
|
|
import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxtbRspBO; |
|
|
|
import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxtbRspBO; |
|
|
|
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.dao.GroupTaxClassCodeMapper; |
|
|
|
|
|
|
|
import com.dxhy.order.baseservice.module.taxclass.model.GroupTaxClassCodeEntity; |
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
import com.dxhy.order.consumer.openapi.protocol.AjaxResult; |
|
|
|
import com.dxhy.order.consumer.openapi.protocol.AjaxResult; |
|
|
|
import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*; |
|
|
|
import com.dxhy.order.consumer.openapi.protocol.v6.sdenergy.*; |
|
|
@ -13,6 +17,7 @@ import com.dxhy.order.model.MdmGroupTaxClassCode; |
|
|
|
import com.dxhy.order.utils.DistributedKeyMaker; |
|
|
|
import com.dxhy.order.utils.DistributedKeyMaker; |
|
|
|
import com.dxhy.order.utils.JsonUtils; |
|
|
|
import com.dxhy.order.utils.JsonUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -38,14 +43,20 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private MdmBuyerManageInfoMapper mdmBuyerManageInfoMapper; |
|
|
|
private MdmBuyerManageInfoMapper mdmBuyerManageInfoMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private BuyerMapper buyerMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private GroupTaxClassCodeMapper groupTaxClassCodeMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public AjaxResult syncBuyerMessage(List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS, String requestBody) { |
|
|
|
public AjaxResult syncBuyerMessage(List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS, String requestBody) { |
|
|
|
// 存表
|
|
|
|
// 存表
|
|
|
|
List<MdmBuyerManageInfo> list = new ArrayList<>(); |
|
|
|
List<BuyerEntity> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { |
|
|
|
for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { |
|
|
|
MdmGmfxxtbReqBO tempMdmGmfxxtbReqBO = mdmGmfxxtbReqBOS.get(i); |
|
|
|
MdmGmfxxtbReqBO tempMdmGmfxxtbReqBO = mdmGmfxxtbReqBOS.get(i); |
|
|
|
MdmBuyerManageInfo entity = new MdmBuyerManageInfo(); |
|
|
|
BuyerEntity entity = new BuyerEntity(); |
|
|
|
entity.setId(DistributedKeyMaker.generateShotKey()); |
|
|
|
entity.setId(DistributedKeyMaker.generateShotKey()); |
|
|
|
entity.setTaxpayerCode(tempMdmGmfxxtbReqBO.getDESC14()); |
|
|
|
entity.setTaxpayerCode(tempMdmGmfxxtbReqBO.getDESC14()); |
|
|
|
entity.setPurchaseName(tempMdmGmfxxtbReqBO.getDESC1()); |
|
|
|
entity.setPurchaseName(tempMdmGmfxxtbReqBO.getDESC1()); |
|
|
@ -83,7 +94,7 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
entity.setGhfQylx("01"); |
|
|
|
entity.setGhfQylx("01"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setXhfNsrsbh(null); |
|
|
|
entity.setXhfNsrsbh("-1"); // 如果为-1,代表总表
|
|
|
|
entity.setXhfMc(null); |
|
|
|
entity.setXhfMc(null); |
|
|
|
entity.setBuyerCode(tempMdmGmfxxtbReqBO.getCODE()); |
|
|
|
entity.setBuyerCode(tempMdmGmfxxtbReqBO.getCODE()); |
|
|
|
entity.setInvoiceName(tempMdmGmfxxtbReqBO.getDESC48()); |
|
|
|
entity.setInvoiceName(tempMdmGmfxxtbReqBO.getDESC48()); |
|
|
@ -91,7 +102,8 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
entity.setMdmMulticodeJson(JsonUtils.getInstance().toJsonStringNullToEmpty(tempMdmGmfxxtbReqBO.getMULTICODE())); |
|
|
|
entity.setMdmMulticodeJson(JsonUtils.getInstance().toJsonStringNullToEmpty(tempMdmGmfxxtbReqBO.getMULTICODE())); |
|
|
|
entity.setUUID(tempMdmGmfxxtbReqBO.getUUID()); |
|
|
|
entity.setUUID(tempMdmGmfxxtbReqBO.getUUID()); |
|
|
|
|
|
|
|
|
|
|
|
if (mdmBuyerManageInfoMapper.insertSelectiveOnDuplicateKey(entity) > 0) { |
|
|
|
// if (mdmBuyerManageInfoMapper.insertSelectiveOnDuplicateKey(entity) > 0) {
|
|
|
|
|
|
|
|
if (buyerMapper.insertBuyerOnDuplicateKey(entity) > 0) { |
|
|
|
entity.setSuccess(true); |
|
|
|
entity.setSuccess(true); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
entity.setSuccess(false); |
|
|
|
entity.setSuccess(false); |
|
|
@ -104,7 +116,7 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
baseBO, |
|
|
|
baseBO, |
|
|
|
list, |
|
|
|
list, |
|
|
|
i -> { |
|
|
|
i -> { |
|
|
|
MdmBuyerManageInfo t = (MdmBuyerManageInfo) i; |
|
|
|
BuyerEntity t = (BuyerEntity) i; |
|
|
|
SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); |
|
|
|
SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); |
|
|
|
resp.setCODE(t.getBuyerCode()); |
|
|
|
resp.setCODE(t.getBuyerCode()); |
|
|
|
resp.setUUID(t.getUUID()); |
|
|
|
resp.setUUID(t.getUUID()); |
|
|
@ -127,10 +139,10 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public AjaxResult syncMdmGroupTax(List<MdmSyncGroupTaxCodeReqBO> mdmGmfxxtbReqBOS, String requestBody) { |
|
|
|
public AjaxResult syncMdmGroupTax(List<MdmSyncGroupTaxCodeReqBO> mdmGmfxxtbReqBOS, String requestBody) { |
|
|
|
List<MdmGroupTaxClassCode> list = new ArrayList<>(); |
|
|
|
List<GroupTaxClassCodeEntity> list = new ArrayList<>(); |
|
|
|
for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { |
|
|
|
for (int i = 0; i < mdmGmfxxtbReqBOS.size(); i++) { |
|
|
|
MdmSyncGroupTaxCodeReqBO reqBO = mdmGmfxxtbReqBOS.get(i); |
|
|
|
MdmSyncGroupTaxCodeReqBO reqBO = mdmGmfxxtbReqBOS.get(i); |
|
|
|
MdmGroupTaxClassCode entity = new MdmGroupTaxClassCode(); |
|
|
|
GroupTaxClassCodeEntity entity = new GroupTaxClassCodeEntity(); |
|
|
|
entity.setId(DistributedKeyMaker.generateShotKey()); |
|
|
|
entity.setId(DistributedKeyMaker.generateShotKey()); |
|
|
|
entity.setSortId((long) i); |
|
|
|
entity.setSortId((long) i); |
|
|
|
entity.setMerchandiseName(reqBO.getDESC1()); |
|
|
|
entity.setMerchandiseName(reqBO.getDESC1()); |
|
|
@ -139,7 +151,8 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
entity.setCreateTime(new Date()); |
|
|
|
entity.setCreateTime(new Date()); |
|
|
|
entity.setDescription(reqBO.getDESCSHORT()); |
|
|
|
entity.setDescription(reqBO.getDESCSHORT()); |
|
|
|
entity.setUUID(reqBO.getUUID()); |
|
|
|
entity.setUUID(reqBO.getUUID()); |
|
|
|
if (mdmGroupTaxClassCodeMapper.insertOneOnDuplicateKey(entity) <= 0) { |
|
|
|
// if (mdmGroupTaxClassCodeMapper.insertOneOnDuplicateKey(entity) <= 0) {
|
|
|
|
|
|
|
|
if (groupTaxClassCodeMapper.insertOnDuplicateKey(entity) <= 0) { |
|
|
|
entity.setSuccess(false); |
|
|
|
entity.setSuccess(false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
entity.setSuccess(true); |
|
|
|
entity.setSuccess(true); |
|
|
@ -152,7 +165,7 @@ public class SDEnregyServiceImpl extends SDEnregyServiceAbstract { |
|
|
|
baseBO, |
|
|
|
baseBO, |
|
|
|
list, |
|
|
|
list, |
|
|
|
i -> { |
|
|
|
i -> { |
|
|
|
MdmGroupTaxClassCode t = (MdmGroupTaxClassCode) i; |
|
|
|
GroupTaxClassCodeEntity t = (GroupTaxClassCodeEntity) i; |
|
|
|
SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); |
|
|
|
SDEnergyMdmBaseRespBO resp = new SDEnergyMdmBaseRespBO(); |
|
|
|
resp.setCODE(t.getEncoding()); |
|
|
|
resp.setCODE(t.getEncoding()); |
|
|
|
resp.setUUID(t.getUUID()); |
|
|
|
resp.setUUID(t.getUUID()); |
|
|
|