销项管理系统开放接口v6新增SdEnergyMdmKsSyncBuyerInfo,同步山能MDM客商API数据;数据库新增字段invoice_name,invoice_taxno,mdm_multicode_json存放山能数据

gongquanlin 2 years ago committed by WangQi
parent 0330839b89
commit 59be0d87e9
  1. 16
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/model/BuyerEntity.java
  2. 15
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/protocol/GmfxxtbReqBO.java
  3. 27
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/protocol/sdenergy/MdmGmfxxtbMulticodeBO.java
  4. 54
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/protocol/sdenergy/MdmGmfxxtbMulticodeValuelistBO.java
  5. 187
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/protocol/sdenergy/MdmGmfxxtbReqBO.java
  6. 250
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java
  7. 44
      order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml
  8. 5
      order-management-common/src/main/java/com/dxhy/order/constant/ConfigurerInfo.java
  9. 134
      order-management-consumer/src/main/java/com/dxhy/order/consumer/openapi/api/InvoiceRestApiV6.java
  10. 8
      order-management-consumer/src/main/java/com/dxhy/order/consumer/utils/BeanTransitionUtils.java

@ -100,4 +100,20 @@ public class BuyerEntity implements Serializable {
* 是否大数据结果,仅供前端判断是否调用精确查询使用
*/
private String isPlatform;
/**
* 山能 MDM 客户API 里的开票名称字段DESC48
*/
private String invoiceName;
/**
* 山能 MDM 客户API 里的开票税号字段DESC49
*/
private String invoiceTaxno;
/**
* 山能 MDM 客户API 里的MULTICODE字段json
*/
private String mdmMulticodeJson;
}

@ -22,4 +22,19 @@ public class GmfxxtbReqBO extends GmfxxBO implements Serializable {
* 操作类型
*/
private String CZLX;
/**
* 山能 MDM 客户API 里的MULTICODE字段json
*/
private String MDM_MULTICODE_JSON;
/**
* 山能 MDM 客户API 里的开票名称字段DESC48
*/
private String INVOICE_NAME;
/**
* 山能 MDM 客户API 里的开票税号字段DESC49
*/
private String INVOICE_TAXNO;
}

@ -0,0 +1,27 @@
package com.dxhy.order.baseservice.module.buyer.protocol.sdenergy;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.ToString;
import java.util.List;
/**
* @Description MdmGmfxxtbReqBO中的MULTICODE字段
* @Author 巩权林
* @Date 2023/2/9 09:33
**/
@ToString
public class MdmGmfxxtbMulticodeBO {
@JSONField(name = "VALUELIST")
private List<MdmGmfxxtbMulticodeValuelistBO> VALUELIST;
public void setVALUELIST(List<MdmGmfxxtbMulticodeValuelistBO> VALUELIST) {
this.VALUELIST = VALUELIST;
}
public List<MdmGmfxxtbMulticodeValuelistBO> getVALUELIST() {
return VALUELIST;
}
}

@ -0,0 +1,54 @@
package com.dxhy.order.baseservice.module.buyer.protocol.sdenergy;
import lombok.ToString;
/**
* @Description MdmGmfxxtbMulticodeReqBO中的VALUELIST字段
* @Author 巩权林
* @Date 2023/2/9 09:33
**/
@ToString
public class MdmGmfxxtbMulticodeValuelistBO {
// 银行名称的值
private String DESC3;
// 银行账号的值
private String DESC4;
// 节点编码的值
private String LISTCODE;
// A4
private String SPECIALITYCODE;
public void setDESC3(String DESC3) {
this.DESC3 = DESC3;
}
public String getDESC3() {
return DESC3;
}
public void setDESC4(String DESC4) {
this.DESC4 = DESC4;
}
public String getDESC4() {
return DESC4;
}
public void setLISTCODE(String LISTCODE) {
this.LISTCODE = LISTCODE;
}
public String getLISTCODE() {
return LISTCODE;
}
public void setSPECIALITYCODE(String SPECIALITYCODE) {
this.SPECIALITYCODE = SPECIALITYCODE;
}
public String getSPECIALITYCODE() {
return SPECIALITYCODE;
}
}

@ -0,0 +1,187 @@
package com.dxhy.order.baseservice.module.buyer.protocol.sdenergy;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.ToString;
/**
* @Description 山东能源 MDM 客商 购买方信息接口BO
* @Author 巩权林
* @Date 2023/2/9 09:31
**/
@ToString
public class MdmGmfxxtbReqBO {
// 主编码的值
private String CODE;
// 业务伙伴全称的值
private String DESC1;
// 法人代表的值
private String DESC12;
// 统一社会信用代码(税号)的值
private String DESC14;
// 省份的值
private String DESC22;
// 城市的值
private String DESC23;
// 街道/门牌号的值
private String DESC24;
// 公司电话的值
private String DESC26;
// 手机号
private String DESC27;
// 邮箱
private String DESC29;
// 是否客户的值
private String DESC38;
// 是否供应商的值
private String DESC39;
// 开票名称的值
private String DESC48;
// 开票税号的值
private String DESC49;
@JSONField(name = "MULTICODE")
private MdmGmfxxtbMulticodeBO MULTICODE;
private String UUID;
public void setCODE(String CODE) {
this.CODE = CODE;
}
public String getCODE() {
return CODE;
}
public void setDESC1(String DESC1) {
this.DESC1 = DESC1;
}
public String getDESC1() {
return DESC1;
}
public void setDESC12(String DESC12) {
this.DESC12 = DESC12;
}
public String getDESC12() {
return DESC12;
}
public void setDESC14(String DESC14) {
this.DESC14 = DESC14;
}
public String getDESC14() {
return DESC14;
}
public void setDESC22(String DESC22) {
this.DESC22 = DESC22;
}
public String getDESC22() {
return DESC22;
}
public void setDESC23(String DESC23) {
this.DESC23 = DESC23;
}
public String getDESC23() {
return DESC23;
}
public void setDESC24(String DESC24) {
this.DESC24 = DESC24;
}
public String getDESC24() {
return DESC24;
}
public void setDESC26(String DESC26) {
this.DESC26 = DESC26;
}
public String getDESC26() {
return DESC26;
}
public void setDESC38(String DESC38) {
this.DESC38 = DESC38;
}
public String getDESC38() {
return DESC38;
}
public void setDESC39(String DESC39) {
this.DESC39 = DESC39;
}
public String getDESC39() {
return DESC39;
}
public void setDESC48(String DESC48) {
this.DESC48 = DESC48;
}
public String getDESC48() {
return DESC48;
}
public void setDESC49(String DESC49) {
this.DESC49 = DESC49;
}
public String getDESC49() {
return DESC49;
}
public void setMULTICODE(MdmGmfxxtbMulticodeBO MULTICODE) {
this.MULTICODE = MULTICODE;
}
public MdmGmfxxtbMulticodeBO getMULTICODE() {
return MULTICODE;
}
public void setUUID(String UUID) {
this.UUID = UUID;
}
public String getUUID() {
return UUID;
}
public String getDESC27() {
return DESC27;
}
public void setDESC27(String DESC27) {
this.DESC27 = DESC27;
}
public String getDESC29() {
return DESC29;
}
public void setDESC29(String DESC29) {
this.DESC29 = DESC29;
}
}

@ -38,24 +38,24 @@ import java.util.*;
@Slf4j
@Service
public class BuyerServiceImpl implements BuyerService {
private static final String LOGGER_MSG = "(购方信息业务实现类)";
@Resource
private BuyerMapper buyerMapper;
@Resource
private BaseService baseService;
@Resource
private VerifyBuyerManageInfoService verifyBuyerManageInfoService;
@Resource
private BaseServiceConfig baseServiceConfig;
@Resource
private OpenApiService openApiService;
@Override
public PageUtils queryBuyerList(Map<String, Object> paramMap, List<String> shList) {
int pageSize = Integer.parseInt(String.valueOf(paramMap.get(ConfigureConstant.STRING_PAGE_SIZE)));
@ -66,11 +66,11 @@ public class BuyerServiceImpl implements BuyerService {
PageInfo<BuyerEntity> pageInfo = new PageInfo<>(list);
PageUtils page = new PageUtils(pageInfo.getList(), (int) pageInfo.getTotal(), pageInfo.getPageSize(),
pageInfo.getPageNum());
log.info("{}返回值{} ", LOGGER_MSG, page);
return page;
}
/**
* 接口提供根据名称模糊查询
*
@ -92,7 +92,7 @@ public class BuyerServiceImpl implements BuyerService {
return null;
}
}
@Override
public R removeBuyerbyId(List<Map> ids) {
R r = new R();
@ -110,10 +110,10 @@ public class BuyerServiceImpl implements BuyerService {
}
return r;
}
@Override
public R importBuyerByExcel(List<BuyerEntity> buyerEntityList) {
long t2 = System.currentTimeMillis();
List<Map<String, Object>> list = new ArrayList<>();
List<Map<String, String>> checkResultMapList = new ArrayList<>();
@ -128,7 +128,7 @@ public class BuyerServiceImpl implements BuyerService {
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
String key = buyerEntity.getXhfNsrsbh() + buyerEntity.getXhfMc() + buyerEntity.getTaxpayerCode() + buyerEntity.getPurchaseName();
if (repeatMap.get(key) != null) {
Map<String, String> checkResultMap1 = new HashMap<>(2);
@ -139,18 +139,18 @@ public class BuyerServiceImpl implements BuyerService {
} else {
repeatMap.put(key, buyerEntity);
}
List<String> shList = new ArrayList<>();
shList.add(buyerEntity.getXhfNsrsbh());
Map<String, String> param = new HashMap<>(5);
GmfxxtbReqBO gmfxxtbReqBo = transGmfxxtbReqBo(buyerEntity);
List<Map<String, String>> checkResultMap = verifyBuyerManageInfoService.checkSyncBuyerRequestParam(gmfxxtbReqBo, preStr);
if (ObjectUtil.isNotEmpty(checkResultMap)) {
checkResultMapList.addAll(checkResultMap);
}
if (StringUtils.isNotEmpty(buyerEntity.getTaxpayerCode())) {
param.put("taxpayerCode", buyerEntity.getTaxpayerCode());
int i = buyerMapper.selectBuyerByName(param, shList);
@ -171,7 +171,7 @@ public class BuyerServiceImpl implements BuyerService {
checkResultMapList.add(checkResultMap1);
}
}
}
if (ObjectUtil.isNotEmpty(checkResultMapList)) {
for (Map<String, String> stringStringMap : checkResultMapList) {
@ -180,7 +180,7 @@ public class BuyerServiceImpl implements BuyerService {
}
long t3 = System.currentTimeMillis();
log.debug("{}校验耗时:{}", LOGGER_MSG, (t3 - t2));
//导入成功的条数
int importSuccessCount = 0;
Map<String, Object> resultMap = new HashMap<>(10);
@ -197,7 +197,7 @@ public class BuyerServiceImpl implements BuyerService {
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
}
if (buyerEntityList.size() < ConfigureConstant.BATCH_INSERT) {
buyerMapper.insertBuyerByList(buyerEntityList);
@ -219,11 +219,11 @@ public class BuyerServiceImpl implements BuyerService {
resultMap.put("list", list);
}
log.info("{}数据库插入耗时:{}", LOGGER_MSG, (System.currentTimeMillis() - t3));
return result.put(OrderManagementConstant.DATA, resultMap).put("count", importSuccessCount)
.put("importResult", "导入数据共" + buyerEntityList.size() + "条,成功" + importSuccessCount + "条");
}
@Override
public BuyerEntity queryBuyerByPurchaseName(String purchaseName, String xhfNsrsbh) {
List<String> shList = new ArrayList<>();
@ -237,8 +237,8 @@ public class BuyerServiceImpl implements BuyerService {
return null;
}
}
@Override
public BuyerEntity queryBuyerInfoByxhfNsrsbhAndBuyerCode(String xhfNsrsbh, String buyerCode) {
log.info("{}根据销方税号:{}和自编ID查询购方信息{}", LOGGER_MSG, xhfNsrsbh, buyerCode);
@ -254,7 +254,7 @@ public class BuyerServiceImpl implements BuyerService {
return null;
}
}
@Override
public R syncBuyer(BuyerEntity buyerEntity, String operationType) {
OrderInfoContentEnum orderInfoContentEnum = OrderInfoContentEnum.BUYER_MESSAGE_SYNC_SUCCESS;
@ -287,6 +287,18 @@ public class BuyerServiceImpl implements BuyerService {
orderInfoContentEnum = OrderInfoContentEnum.BUYER_MESSAGE_SYNC_DELETE;
}
break;
case "3":
// 先查后更新,针对山能MDM可能回重复推送的问题,先查,如果存在则更新,不存在则udpate
if (Objects.nonNull(buyerEntityOld)) {
// 存在则更新
buyerEntity.setId(buyerEntityOld.getId());
buyerMapper.updateBuyer(buyerEntity, shList);
} else if (Objects.isNull(buyerEntityOld)) {
// 不存在则插入
buyerEntity.setId(baseService.getGenerateShotKey());
buyerMapper.insertBuyer(buyerEntity);
}
break;
default:
log.error("不存在的类型");
break;
@ -298,34 +310,34 @@ public class BuyerServiceImpl implements BuyerService {
log.info("{}同步购买方信息:{}", LOGGER_MSG, orderInfoContentEnum.getMessage());
return R.setCodeAndMsg(orderInfoContentEnum, null);
}
@Override
public R saveOrUpdateBuyerInfo(BuyerEntity buyerEntity) {
/**
* 根据入参进行判断是新增还是修改
*/
List<String> shList = new ArrayList<>();
shList.add(buyerEntity.getXhfNsrsbh());
R r = new R();
if (ConfigureConstant.STRING_1.equals(buyerEntity.getIsEdit()) && StringUtils.isBlank(buyerEntity.getId())) {
BuyerEntity existBuyer = isExistBuyer(buyerEntity);
if (ObjectUtil.isNotNull(existBuyer)) {
buyerEntity.setId(existBuyer.getId());
}
}
if (StringUtils.isNotBlank(buyerEntity.getId())) {
buyerEntity.setModifyTime(new Date());
int i = buyerMapper.updateBuyer(buyerEntity, shList);
if (i <= 0) {
r.put("message", "修改失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
} else {
BuyerEntity buyerEntity1 = new BuyerEntity();
buyerEntity1.setBuyerCode(buyerEntity.getBuyerCode());
@ -333,18 +345,18 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntity1.setPurchaseName(buyerEntity.getPurchaseName());
List<BuyerEntity> queryBuyerEntity = buyerMapper.selectBuyerByBuyerEntity(buyerEntity1, shList);
if (queryBuyerEntity != null && queryBuyerEntity.size() > 0) {
buyerEntity.setModifyTime(new Date());
buyerEntity.setBuyerCode(queryBuyerEntity.get(0).getBuyerCode());
buyerEntity.setId(queryBuyerEntity.get(0).getId());
//更新客户信息
int i = buyerMapper.updateBuyer(buyerEntity, shList);
if (i <= 0) {
r.put("message", "修改失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
} else {
//新增购方信息
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
@ -353,34 +365,34 @@ public class BuyerServiceImpl implements BuyerService {
String uuid = baseService.getGenerateShotKey();
log.info("{}添加开始执行开始执行 uuid = {}", LOGGER_MSG, uuid);
buyerEntity.setId(uuid);
int i = buyerMapper.insertBuyer(buyerEntity);
if (i <= 0) {
r.put("message", "添加失败").put(OrderManagementConstant.CODE, ConfigureConstant.STRING_9999);
}
}
}
return R.ok().put(OrderManagementConstant.MESSAGE, "保存成功!");
}
@Transactional(rollbackFor = Exception.class)
@Override
public R saveBuyerInfoList(List<BuyerEntity> buyerList, String userId) {
//业务挪到provider
if (ObjectUtil.isEmpty(buyerList)) {
return R.error(OrderInfoContentEnum.GENERATE_READY_ORDER_DATA_ERROR);
}
List<R> errorList = new ArrayList<>();
//数据校验
for (BuyerEntity buyerEntity : buyerList) {
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_01.getKey());
if (StringUtils.isEmpty(buyerEntity.getTaxpayerCode())) {
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_03.getKey());
@ -389,7 +401,7 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
GmfxxtbReqBO gmfxxtbReqBo = transGmfxxtbReqBo(buyerEntity);
List<Map<String, String>> checkResultMap = verifyBuyerManageInfoService.checkSyncBuyerRequestParam(gmfxxtbReqBo, "");
if (ObjectUtil.isNotEmpty(checkResultMap)) {
StringBuilder errorMsg = new StringBuilder();
@ -399,16 +411,16 @@ public class BuyerServiceImpl implements BuyerService {
}
return R.error(errorMsg.toString()).put("errorList", errorList);
}
boolean isEdit = ConfigureConstant.STRING_1.equals(buyerEntity.getIsEdit());
if (!isEdit) {
//税号非空校验
if (StringUtils.isBlank(buyerEntity.getXhfNsrsbh())) {
return R.error(OrderInfoContentEnum.GENERATE_READY_ORDER_DATA_ERROR);
}
//是否重复校验
/**
* 如果id不为空说明是编辑过来的数据,优先使用id进行查询,查询结果如果和入参一样,则代表更新操作,不进行拦截
@ -419,7 +431,7 @@ public class BuyerServiceImpl implements BuyerService {
*/
BuyerEntity existBuyer = isExistBuyer(buyerEntity);
if (ObjectUtil.isNotNull(existBuyer)) {
if (StringUtils.isNotBlank(existBuyer.getTaxpayerCode()) || StringUtils.isNotBlank(existBuyer.getPurchaseName())) {
if (StringUtils.isBlank(existBuyer.getTaxpayerCode())) {
existBuyer.setTaxpayerCode("");
@ -444,11 +456,11 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntity.setId(existBuyer.getId());
errorList.add(R.error().put("xhfNsrsbh", buyerEntity.getXhfNsrsbh()).put("xhfMc", buyerEntity.getXhfMc())
.put("ghfMc", buyerEntity.getPurchaseName()).put("ghfNsrsbh", buyerEntity.getTaxpayerCode()));
}
}
}
} else {
buyerEntity.setId(existBuyer.getId());
@ -456,20 +468,20 @@ public class BuyerServiceImpl implements BuyerService {
.put("ghfMc", buyerEntity.getPurchaseName()).put("ghfNsrsbh", buyerEntity.getTaxpayerCode()));
}
}
}
}
if (ObjectUtil.isNotEmpty(errorList)) {
return R.error().put("errorList", errorList).put(OrderManagementConstant.CODE, "9095").put(OrderManagementConstant.MESSAGE, "购方名称和税号重复").put(OrderManagementConstant.DATA, buyerList);
}
}
//数据补全入库
for (BuyerEntity buyerEntity : buyerList) {
buyerEntity.setPurchaseName(StringUtil.replaceStr(buyerEntity.getPurchaseName(), true));
buyerEntity.setModifyUserId(userId);
buyerEntity.setCreateUserId(userId);
@ -477,7 +489,7 @@ public class BuyerServiceImpl implements BuyerService {
}
return R.ok();
}
/**
* 销方下购方信息是否存在
*
@ -485,7 +497,7 @@ public class BuyerServiceImpl implements BuyerService {
* @return
*/
private BuyerEntity isExistBuyer(BuyerEntity buyerEntity) {
BuyerEntity queryBuyerEntity = new BuyerEntity();
if (StringUtils.isNotBlank(buyerEntity.getId())) {
queryBuyerEntity.setId(buyerEntity.getId());
@ -493,7 +505,7 @@ public class BuyerServiceImpl implements BuyerService {
queryBuyerEntity.setTaxpayerCode(buyerEntity.getTaxpayerCode());
queryBuyerEntity.setPurchaseName(buyerEntity.getPurchaseName());
}
List<String> shList = new ArrayList<>();
shList.add(buyerEntity.getXhfNsrsbh());
List<BuyerEntity> result = buyerMapper.selectBuyerByBuyerEntity(queryBuyerEntity, shList);
@ -501,10 +513,10 @@ public class BuyerServiceImpl implements BuyerService {
log.debug("{}购方名称和税号信息已存在,数据为:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(result));
return result.get(0);
}
return null;
}
/**
* 封装错误信息
*
@ -518,7 +530,7 @@ public class BuyerServiceImpl implements BuyerService {
map.put(OrderManagementConstant.MESSAGE, msg);
return map;
}
/**
* 购买方信息转换,
*
@ -541,44 +553,46 @@ public class BuyerServiceImpl implements BuyerService {
gmfxxtbReq.setGMFYX(buyerEntity.getEmail());
gmfxxtbReq.setGMFSJH(buyerEntity.getSjh());
gmfxxtbReq.setBZ(buyerEntity.getRemarks());
return gmfxxtbReq;
}
/**
* 自动获取购方企业信息
*
* @param ghfMc
* @param shList
* @return
*/
public List<BuyerEntity> autoQueryBuyerInfoList(String ghfMc, List<String> shList, List<String> entList) {
log.info("{}自动查询购方信息,请求纳税人识别号:{},数据权限列表:{},请求购方名称为:{}",LOGGER_MSG, shList,entList,ghfMc);
List<BuyerEntity> dataList = queryBuyerByName(ghfMc, shList,entList);
log.info("{}自动查询购方信息,请求纳税人识别号:{},数据权限列表:{},请求购方名称为:{}", LOGGER_MSG, shList, entList, ghfMc);
List<BuyerEntity> dataList = queryBuyerByName(ghfMc, shList, entList);
log.info("{}本地调用购方发票列表结果{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(dataList));
if (ObjectUtil.isEmpty(dataList) && ConfigureConstant.STRING_Y.equals(baseServiceConfig.configUseBigDataProcessBuyer())) {
log.info("{}本地调用购方发票列表数据为空,开始调用大数据接口", LOGGER_MSG);
dataList = queryEnterpriseInfoList(ghfMc);
log.info("{}本地调用大数据接口 结果{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(dataList));
}
return dataList;
}
/**
* 自动获取购方企业信息
*
* @param ghfMc
* @param shList
* @return
*/
public BuyerEntity autoQueryBuyerInfo(String ghfMc, List<String> shList, List<String> entList) {
BuyerEntity buyerEntity = new BuyerEntity();
log.info("{}自动查询购方信息,请求纳税人识别号:{},请求购方名称为:{}",LOGGER_MSG, shList,ghfMc);
List<BuyerEntity> dataList = queryBuyerByName(ghfMc, shList,entList);
log.info("{}自动查询购方信息,请求纳税人识别号:{},请求购方名称为:{}", LOGGER_MSG, shList, ghfMc);
List<BuyerEntity> dataList = queryBuyerByName(ghfMc, shList, entList);
log.info("{}本地调用购方发票列表结果{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(dataList));
if(ObjectUtil.isNotEmpty(dataList)){
if (ObjectUtil.isNotEmpty(dataList)) {
buyerEntity = dataList.get(0);
}else{
} else {
//如果返回数据为空或者返回数据不为空,但是购方地址或购方银行为空时
boolean usePlatform = false;
if (ObjectUtil.isEmpty(dataList)) {
@ -594,40 +608,41 @@ public class BuyerServiceImpl implements BuyerService {
log.info("{}本地调用大数据接口 结果{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(buyerEntity));
}
}
return buyerEntity;
}
/**
* 调用大象云平台企业模糊查询
*
* @param purchaseName
* @return
*/
private List<BuyerEntity> queryEnterpriseInfoList(String purchaseName) {
List<BuyerEntity> buyerEntityList = new ArrayList<>();
try {
//判断使用新版还是旧版,
String useOpenApiNew = baseServiceConfig.getUseOpenApiNew();
if(StringUtils.isNotBlank(useOpenApiNew) && ConfigureConstant.STRING_Y.equals(useOpenApiNew)) {
if (StringUtils.isNotBlank(useOpenApiNew) && ConfigureConstant.STRING_Y.equals(useOpenApiNew)) {
OpenApiGfxxCxReq openApiGfxxCxReq = new OpenApiGfxxCxReq();
openApiGfxxCxReq.setNsrmc(purchaseName);
log.info("{}调用开放平台企业模糊查询接口content内容:{}",LOGGER_MSG, JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
Map<String, Object> response = openApiService.openApiGfxxCx(baseServiceConfig.configFuzzyQuery(),JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
log.info("{}调用开放平台企业模糊查询接口content内容:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
Map<String, Object> response = openApiService.openApiGfxxCx(baseServiceConfig.configFuzzyQuery(), JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
log.info("{}调用开放平台企业模糊查询结果:{} ", LOGGER_MSG, JsonUtils.getInstance().toJsonString(response));
if (ObjectUtil.isNotEmpty(response) && ConfigureConstant.STRING_0000.equals(String.valueOf(response.get(OrderManagementConstant.CODE)))) {
List<OpenApiGfxxCxData> buyerList = JsonUtils.getInstance().parseObject(String.valueOf(response.get(OrderManagementConstant.DATA)), OpenApiFzyyQueryRsp.class).getData();
if (ObjectUtil.isNotEmpty(buyerList) && buyerList.size() > ConfigureConstant.INT_10) {
buyerList = buyerList.subList(ConfigureConstant.INT_0, ConfigureConstant.INT_10);
}
for (OpenApiGfxxCxData openApiGfxxCxData : buyerList) {
BuyerEntity buyerEntity = new BuyerEntity();
buyerEntity.setPurchaseName(openApiGfxxCxData.getNsrmc());
@ -637,9 +652,9 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntityList.add(buyerEntity);
}
}
}else{
} else {
Map<String, String> headMap = new HashMap<>(2);
Map<String, String> requestMap = new HashMap<>(2);
requestMap.put("ptcode", baseServiceConfig.configBigDataPtCode());
@ -648,14 +663,14 @@ public class BuyerServiceImpl implements BuyerService {
headMap.put("Authorization", baseServiceConfig.configBigDataAuthId());
log.debug("{}调用大象云平台企业模糊查询请求信息为:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(requestMap));
String result = HttpUtils.doPostWithHeader(baseServiceConfig.configBigDataQueryEnterprise(), JsonUtils.getInstance().toJsonString(requestMap), headMap);
log.info("{}调用大象云平台企业模糊查询 {} ", LOGGER_MSG, JsonUtils.getInstance().toJsonString(result));
if (ObjectUtil.isNotEmpty(result)) {
List<String> buyerList = JSON.parseArray(result, String.class);
if (ObjectUtil.isNotEmpty(buyerList) && buyerList.size() > ConfigureConstant.INT_10) {
buyerList = buyerList.subList(ConfigureConstant.INT_0, ConfigureConstant.INT_10);
}
for (String buyer : buyerList) {
JSONObject jsonObject = JSON.parseObject(buyer);
BuyerEntity buyerEntity = new BuyerEntity();
@ -667,38 +682,39 @@ public class BuyerServiceImpl implements BuyerService {
}
}
}
} catch (Exception e) {
log.error("{}调用大象平台企业模糊查询异常:{}", LOGGER_MSG, e);
}
return buyerEntityList;
}
/**
* 调用大象云平台企业精确查询
*
* @param purchaseName
* @return
*/
private BuyerEntity queryEnterpriseInfo(String purchaseName) {
BuyerEntity buyerEntity = new BuyerEntity();
try {
String useOpenApiNew = baseServiceConfig.getUseOpenApiNew();
if(StringUtils.isNotBlank(useOpenApiNew) && ConfigureConstant.STRING_Y.equals(useOpenApiNew)){
if (StringUtils.isNotBlank(useOpenApiNew) && ConfigureConstant.STRING_Y.equals(useOpenApiNew)) {
OpenApiGfxxCxReq openApiGfxxCxReq = new OpenApiGfxxCxReq();
openApiGfxxCxReq.setNsrmc(purchaseName);
log.info("{}调用开放平台企业精确查询接口content内容:{}",LOGGER_MSG, JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
Map<String, Object> response = openApiService.openApiGfxxCx(baseServiceConfig.configExactQuery(),JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
log.info("{}调用开放平台企业精确查询接口content内容:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
Map<String, Object> response = openApiService.openApiGfxxCx(baseServiceConfig.configExactQuery(), JsonUtils.getInstance().toJsonString(openApiGfxxCxReq));
log.info("{}调用开放平台企业精确查询结果:{} ", LOGGER_MSG, JsonUtils.getInstance().toJsonString(response));
if (ObjectUtil.isNotEmpty(response) && ConfigureConstant.STRING_0000.equals(String.valueOf(response.get(OrderManagementConstant.CODE)))) {
OpenApiGfxxCxData openApiGfxxCxData = JsonUtils.getInstance().parseObject(String.valueOf(response.get(OrderManagementConstant.DATA)), OpenApiExactQueryRsp.class).getData();
if(ObjectUtil.isNotNull(openApiGfxxCxData)){
if (ObjectUtil.isNotNull(openApiGfxxCxData)) {
buyerEntity.setPurchaseName(openApiGfxxCxData.getNsrmc());
buyerEntity.setTaxpayerCode(openApiGfxxCxData.getNsrsbh());
buyerEntity.setAddress(openApiGfxxCxData.getZcdwdz());
@ -707,9 +723,9 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntity.setBankNumber(openApiGfxxCxData.getKhzh());
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_01.getKey());
}
}
}else{
} else {
Map<String, String> headMap = new HashMap<>(2);
Map<String, String> requestMap = new HashMap<>(2);
requestMap.put("ptcode", baseServiceConfig.configBigDataPtCode());
@ -718,11 +734,11 @@ public class BuyerServiceImpl implements BuyerService {
headMap.put("Authorization", baseServiceConfig.configBigDataAuthId());
log.debug("{}调用大象云平台企业精确查询请求信息为:{}", LOGGER_MSG, JsonUtils.getInstance().toJsonString(requestMap));
String result = HttpUtils.doPostWithHeader(baseServiceConfig.configBigDataExactQueryEnterprise(), JsonUtils.getInstance().toJsonString(requestMap), headMap);
log.info("{}调用大象云平台企业精确查询结果:{} ", LOGGER_MSG, JsonUtils.getInstance().toJsonString(result));
if (ObjectUtil.isNotEmpty(result)) {
JSONObject jsonObject = JSON.parseObject(result);
buyerEntity.setPurchaseName(jsonObject.get("nsrmc") + "");
buyerEntity.setTaxpayerCode(jsonObject.get(ConfigureConstant.REQUEST_PARAM_NSRSBH) + "");
buyerEntity.setAddress(jsonObject.get("zcdz") + "");
@ -732,8 +748,8 @@ public class BuyerServiceImpl implements BuyerService {
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_01.getKey());
}
}
} catch (Exception e) {
log.error("{}调用大象平台企业精确查询异常:{}", LOGGER_MSG, e);
}

@ -21,11 +21,13 @@
<result column="xhf_nsrsbh" jdbcType="VARCHAR" property="xhfNsrsbh"/>
<result column="xhf_mc" jdbcType="VARCHAR" property="xhfMc"/>
<result column="buyer_code" jdbcType="VARCHAR" property="buyerCode"/>
<result column="invoice_name" jdbcType="VARCHAR" property="invoiceName"/>
<result column="invoice_taxno" jdbcType="VARCHAR" property="invoiceTaxno"/>
<result column="mdm_multicode_json" jdbcType="VARCHAR" property="mdmMulticodeJson"/>
</resultMap>
<sql id="Buyer_Base_Column_List">
id
,taxpayer_code,purchase_name,address,phone,bank_of_deposit,bank_number,email,sjh,remarks,create_time,create_user_id,modify_time,modify_user_id,ghf_qylx,xhf_nsrsbh,xhf_mc,buyer_code
id,taxpayer_code,purchase_name,address,phone,bank_of_deposit,bank_number,email,sjh,remarks,create_time,create_user_id,modify_time,modify_user_id,ghf_qylx,xhf_nsrsbh,xhf_mc,buyer_code,invoice_name,invoice_taxno,mdm_multicode_json
</sql>
<!-- 查询 -->
<select parameterType="map" id="selectBuyerList" resultMap="BaseResultMap">
@ -228,6 +230,15 @@
<if test="buyer.buyerCode != null ">
buyer_code = #{buyer.buyerCode,jdbcType=VARCHAR},
</if>
<if test="buyer.invoiceName != null ">
invoice_name = #{buyer.invoiceName,jdbcType=VARCHAR},
</if>
<if test="buyer.invoiceTaxno != null ">
invoice_taxno = #{buyer.invoiceTaxno,jdbcType=VARCHAR},
</if>
<if test="buyer.mdmMulticodeJson != null ">
mdm_multicode_json = #{buyer.mdmMulticodeJson,jdbcType=VARCHAR},
</if>
</set>
<where>
id = #{buyer.id,jdbcType=VARCHAR}
@ -304,6 +315,16 @@
<if test="buyerCode != null">
buyer_code,
</if>
<if test="invoiceName != null">
invoice_name,
</if>
<if test="invoiceTaxno != null">
invoice_taxno,
</if>
<if test="mdmMulticodeJson != null">
mdm_multicode_json,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -364,6 +385,15 @@
<if test="buyerCode != null">
#{buyerCode,jdbcType=VARCHAR},
</if>
<if test="invoiceName != null">
#{invoiceName,jdbcType=VARCHAR},
</if>
<if test="invoiceTaxno != null">
#{invoiceTaxno,jdbcType=VARCHAR},
</if>
<if test="mdmMulticodeJson != null">
#{mdmMulticodeJson,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="insertBuyerByList">
@ -385,7 +415,10 @@
ghf_qylx,
xhf_nsrsbh,
xhf_mc,
buyer_code
buyer_code,
invoice_name,
invoice_taxno,
mdm_multicode_json
)
values
<foreach collection="list" item="item" index="index"
@ -408,7 +441,10 @@
#{item.ghfQylx,jdbcType=VARCHAR},
#{item.xhfNsrsbh,jdbcType=VARCHAR},
#{item.xhfMc,jdbcType=VARCHAR},
#{item.buyerCode,jdbcType=VARCHAR}
#{item.buyerCode,jdbcType=VARCHAR},
#{item.invoiceName,jdbcType=VARCHAR},
#{item.invoiceTaxno,jdbcType=VARCHAR},
#{item.mdmMulticodeJson,jdbcType=VARCHAR}
)
</foreach>
</insert>

@ -232,6 +232,11 @@ public class ConfigurerInfo {
* 购买方信息同步接口
*/
public static final String SYNCBUYERINFO = "SyncBuyerInfo";
/**
* 山能MDM客商购买方信息同步接口
*/
public static final String SDENERGY_MDM_KS_SYNCBUYERINFO = "SdEnergyMdmKsSyncBuyerInfo";
/**
* 税控设备信息同步接口

@ -6,6 +6,8 @@ import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxcxReqBO;
import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxcxRspBO;
import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxtbReqBO;
import com.dxhy.order.baseservice.module.buyer.protocol.GmfxxtbRspBO;
import com.dxhy.order.baseservice.module.buyer.protocol.sdenergy.MdmGmfxxtbMulticodeValuelistBO;
import com.dxhy.order.baseservice.module.buyer.protocol.sdenergy.MdmGmfxxtbReqBO;
import com.dxhy.order.baseservice.module.commodity.model.protocol.SpxxcxReqBO;
import com.dxhy.order.constant.ConfigureConstant;
import com.dxhy.order.constant.ConfigurerInfo;
@ -39,18 +41,21 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import static org.joda.time.DateTime.now;
/**
* 订单对外接口入口
*
* @author: <a href="yaoxuguang@ele-cloud.com">yaoxuguang</a>
* @createDate: Created in 2022-10-10
*/
@ -63,37 +68,37 @@ public class InvoiceRestApiV6 {
@Resource
private CommonInterfaceService commonInterfaceService;
@Resource
private CommonDisposeService commonDisposeService;
@Resource
private InterfaceServiceV3 interfaceServiceV3;
@Resource
private InterfaceServiceV5 interfaceServiceV5;
@Resource
private InterfaceServiceV6 interfaceServiceV6;
/**
* 统一SDK对外接口方法
* @author <a href="yaoxuguang@ele-cloud.com">yaoxuguang</a>
* @date 2022-10-10
* @param request servlet请求
* @param response servlet响应
*
* @param request servlet请求
* @param response servlet响应
* @param interfaceName 接口名
* @param content 请求报文
* @param content 请求报文
* @return java.lang.String 响应报文
* @author <a href="yaoxuguang@ele-cloud.com">yaoxuguang</a>
* @date 2022-10-10
*/
@ApiOperation(value = "订单对外统一接口", notes = "订单对外统一接口入口")
@RequestMapping(path = "/invoice/api/v6/{interfaceName}", method = {RequestMethod.POST, RequestMethod.GET})
public String orderApiV6(HttpServletRequest request, HttpServletResponse response,
@PathVariable("interfaceName") String interfaceName,
@ApiParam(name = "requestParam", value = "请求内容", required = true) @RequestBody String content) {
log.debug("{}订单对外统一接口请求内容:{}", LOGGER_MSG, content);
DxhyInterfaceResponse dxhyInterfaceResponse = new DxhyInterfaceResponse(RespStatusEnum.FAIL2);
@ -107,7 +112,7 @@ public class InvoiceRestApiV6 {
if (ObjectUtil.isNull(dxhyInterfaceRequest)) {
throw new OrderReceiveException(RespStatusEnum.FAIL1.getCode(), RespStatusEnum.FAIL1.getDescribe());
}
//校验接口入参是否为空
CheckResult result = commonInterfaceService.checkInterfaceParamV6(ConfigurerInfo.INTERFACE_VERSION_V6,
interfaceName, dxhyInterfaceRequest.getSecretId(), dxhyInterfaceRequest.getDataExchangeId(),
@ -118,7 +123,7 @@ public class InvoiceRestApiV6 {
throw new OrderReceiveException(result.getCode(), result.getMsg());
}
final DateTime begin1 = now();
//鉴权
String reqUrl = request.getRequestURL().toString();
if (reqUrl.contains(ConfigureConstant.STRING_WH)) {
@ -160,7 +165,7 @@ public class InvoiceRestApiV6 {
long end = System.currentTimeMillis();
log.debug("{}接口:{},请求耗时:{}", LOGGER_MSG, interfaceName, end - start);
log.debug("{},接口返回数据:{}", LOGGER_MSG, returnJsonString);
if (!StringUtils.isBlank(returnJsonString)) {
commonRequestParam.setContent(returnJsonString);
//加密
@ -190,71 +195,128 @@ public class InvoiceRestApiV6 {
public String orderApiV6HandingBusiness(String interfaceName, String reqStr, String secretId) {
//返回参数
String returnJsonString;
if(ConfigurerInfo.GENERATE_QD_INVOICE.equals(interfaceName)){
if (ConfigurerInfo.GENERATE_QD_INVOICE.equals(interfaceName)) {
//全电开票接口
PoCommonRequestParam requestParam = JsonUtils.getInstance().parseObject(reqStr, PoCommonRequestParam.class);
DdpcxxReqBO ddpcxxReq = BeanTransitionUtils.transitionPoKpReq(requestParam);
DdpcxxRspV5 ddpcxxRspV5 = interfaceServiceV6.generateQdInvoiceV6(ddpcxxReq, secretId, null);
PoCommonResponseParam poCommonResponseParam = BeanTransitionUtils.transitionPoKpResp(ddpcxxRspV5);
returnJsonString = JsonUtils.getInstance().toJsonString(poCommonResponseParam);
} else if (ConfigurerInfo.GETORDERINFOANDINVOICEINFO.equals(interfaceName)){
} else if (ConfigurerInfo.GETORDERINFOANDINVOICEINFO.equals(interfaceName)) {
//订单和发票数据查询接口
DdfpcxReqV5 ddfpcxReq = JsonUtils.getInstance().parseObject(reqStr, DdfpcxReqV5.class);
DdfpcxRspV5 ddfpcxRsp = interfaceServiceV5.getOrderInfoAndInvoiceInfoV5(ddfpcxReq);
returnJsonString = JsonUtils.getInstance().toJsonString(ddfpcxRsp);
} else if (ConfigurerInfo.QUERYCOMMODITYINFO.equals(interfaceName)){
} else if (ConfigurerInfo.QUERYCOMMODITYINFO.equals(interfaceName)) {
//商品信息查询接口
SpxxcxReqBO spxxcxReq = JsonUtils.getInstance().parseObject(reqStr, SpxxcxReqBO.class);
SpxxcxRspBO spxxcxRsp = interfaceServiceV3.queryCommodityMessage(spxxcxReq, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(spxxcxRsp);
} else if (ConfigurerInfo.SYNCCOMMODITYINFO.equals(interfaceName)){
} else if (ConfigurerInfo.SYNCCOMMODITYINFO.equals(interfaceName)) {
//商品信息同步接口
List<SpxxtbReqBO> spxxtbReqList = JSONObject.parseArray(reqStr, SpxxtbReqBO.class);
List<SpxxtbRspBO> spxxtbRspList = interfaceServiceV3.syncCommodityMessage(spxxtbReqList, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(spxxtbRspList);
} else if (ConfigurerInfo.QUERYBUYERINFO.equals(interfaceName)){
} else if (ConfigurerInfo.QUERYBUYERINFO.equals(interfaceName)) {
//购买方信息查询接口
GmfxxcxReqBO gmfxxcxReq = JsonUtils.getInstance().parseObject(reqStr, GmfxxcxReqBO.class);
GmfxxcxRspBO gmfxxcxRsp = interfaceServiceV3.queryBuyerMessage(gmfxxcxReq, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(gmfxxcxRsp);
} else if (ConfigurerInfo.SYNCBUYERINFO.equals(interfaceName)){
} else if (ConfigurerInfo.SYNCBUYERINFO.equals(interfaceName)) {
//购买方信息同步接口
List<GmfxxtbReqBO> gmfxxtbReqList = JSONObject.parseArray(reqStr, GmfxxtbReqBO.class);
List<GmfxxtbRspBO> gmfxxtbRspList = interfaceServiceV3.syncBuyerMessage(gmfxxtbReqList, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(gmfxxtbRspList);
} else if (ConfigurerInfo.QUERYINVOICESTORE.equals(interfaceName)){
} else if (ConfigurerInfo.QUERYINVOICESTORE.equals(interfaceName)) {
//发票余量查询接口
FpylcxReqBO fpylcxReq = JsonUtils.getInstance().parseObject(reqStr, FpylcxReqBO.class);
List<FpylcxRspBO> fpylcxRsps = interfaceServiceV3.queryInvoiceStore(fpylcxReq, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(fpylcxRsps);
} else if (ConfigurerInfo.QUERYTAXPAYERGENERALINFO.equals(interfaceName)){
} else if (ConfigurerInfo.QUERYTAXPAYERGENERALINFO.equals(interfaceName)) {
//企业基本信息查询接口
QyjbxxCxReqBO qyjbxxCxReqBO = JsonUtils.getInstance().parseObject(reqStr, QyjbxxCxReqBO.class);
QyjbxxCxRspBO qyjbxxCxRspBO = interfaceServiceV3.queryTaxpayerGeneralInfo(qyjbxxCxReqBO, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(qyjbxxCxRspBO);
} else if (ConfigurerInfo.QUERY_RED_CONFIRMATION_LIST.equals(interfaceName)
|| ConfigurerInfo.QUERY_RED_CONFIRMATION_ITEM_LIST.equals(interfaceName)
|| ConfigurerInfo.RED_CONFIRMATION_APPLY.equals(interfaceName)
|| ConfigurerInfo.RED_CONFIRMATION_CONFIRM.equals(interfaceName)){
|| ConfigurerInfo.RED_CONFIRMATION_CONFIRM.equals(interfaceName)) {
//红字确认单接口-查询列表,查询明细列表,申请,确认
HzqrdRspV6 hzqrdRspV6 = interfaceServiceV6.processRedConfirmation(interfaceName, reqStr);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(hzqrdRspV6);
} else if (ConfigurerInfo.ORDER_STATUS_UPDATE.equals(interfaceName)){
} else if (ConfigurerInfo.ORDER_STATUS_UPDATE.equals(interfaceName)) {
//订单驳回状态更新接口-(销售结算报账单的驳回状态传给发票系统(ERP-FI-INT-046))
PoCommonRequestParam requestParam = JsonUtils.getInstance().parseObject(reqStr, PoCommonRequestParam.class);
PoCommonResponseParam poCommonResponseParam = interfaceServiceV6.updateOrderStatus(requestParam, secretId);
returnJsonString = JsonUtils.getInstance().toJsonString(poCommonResponseParam);
}else {
} else if (ConfigurerInfo.SDENERGY_MDM_KS_SYNCBUYERINFO.equals(interfaceName)) {
// 山东能源 MDM 客商 购买方信息同步接口
List<MdmGmfxxtbReqBO> mdmGmfxxtbReqBOS = JSONObject.parseArray(reqStr, MdmGmfxxtbReqBO.class);
List<GmfxxtbReqBO> gmfxxtbReqList = new ArrayList<>();
for (MdmGmfxxtbReqBO tempMdmGmfxxtbReqBO : mdmGmfxxtbReqBOS) {
GmfxxtbReqBO gmfxxtbReqBO = new GmfxxtbReqBO();
gmfxxtbReqBO.setGMFBM(tempMdmGmfxxtbReqBO.getCODE()); // 取code
gmfxxtbReqBO.setXHFSBH(tempMdmGmfxxtbReqBO.getDESC14());
gmfxxtbReqBO.setXHFMC(tempMdmGmfxxtbReqBO.getDESC1());
// 判断下DESC14是否为身份证,如果为身份证,则填写03,否则填写01,其余情况置空
// 身份证正则表达式
String idCardRegex = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)";
// 税号正则表达式
String taxNoRegex = "^[a-zA-Z0-9]{15,20}$";
gmfxxtbReqBO.setGMFLX("");
if (StringUtils.isNotEmpty(tempMdmGmfxxtbReqBO.getDESC14())) {
if (tempMdmGmfxxtbReqBO.getDESC14().matches(idCardRegex)) {
gmfxxtbReqBO.setGMFLX("03"); // 有可能出现个人
}
if (tempMdmGmfxxtbReqBO.getDESC14().matches(taxNoRegex)) {
gmfxxtbReqBO.setGMFLX("01");
}
}
gmfxxtbReqBO.setGMFMC(tempMdmGmfxxtbReqBO.getDESC48());
gmfxxtbReqBO.setGMFSBH(tempMdmGmfxxtbReqBO.getDESC49());
gmfxxtbReqBO.setGMFDH(tempMdmGmfxxtbReqBO.getDESC26()); // ?
// 根据要求,取VALUELIST中的第一组数据作为银行数据
if (tempMdmGmfxxtbReqBO.getMULTICODE() != null && !CollectionUtils.isEmpty(tempMdmGmfxxtbReqBO.getMULTICODE().getVALUELIST())) {
// 处理开户行银行
MdmGmfxxtbMulticodeValuelistBO firstValueList = tempMdmGmfxxtbReqBO.getMULTICODE().getVALUELIST().get(0);
if (firstValueList != null) {
gmfxxtbReqBO.setGMFYH(firstValueList.getDESC3());
gmfxxtbReqBO.setGMFZH(firstValueList.getDESC4());
}
}
gmfxxtbReqBO.setGMFSJH(tempMdmGmfxxtbReqBO.getDESC27());
gmfxxtbReqBO.setGMFYX(tempMdmGmfxxtbReqBO.getDESC29());
gmfxxtbReqBO.setCZLX("3"); // 可能重复推送,重复推送可能出现更新的情况,增加先查询,存在则更新不存在则插入的逻辑
// 拼接邮箱和地址
String buyerAddress = "";
buyerAddress = buyerAddress.concat(StringUtils.isEmpty(tempMdmGmfxxtbReqBO.getDESC22()) ? "" : tempMdmGmfxxtbReqBO.getDESC22());
buyerAddress = buyerAddress.concat(StringUtils.isEmpty(tempMdmGmfxxtbReqBO.getDESC23()) ? "" : tempMdmGmfxxtbReqBO.getDESC23());
buyerAddress = buyerAddress.concat(StringUtils.isEmpty(tempMdmGmfxxtbReqBO.getDESC24()) ? "" : tempMdmGmfxxtbReqBO.getDESC24());
gmfxxtbReqBO.setGMFDZ(buyerAddress);
gmfxxtbReqBO.setINVOICE_NAME(tempMdmGmfxxtbReqBO.getDESC48());
gmfxxtbReqBO.setINVOICE_TAXNO(tempMdmGmfxxtbReqBO.getDESC49());
gmfxxtbReqBO.setMDM_MULTICODE_JSON(JsonUtils.getInstance().toJsonStringNullToEmpty(tempMdmGmfxxtbReqBO.getMULTICODE()));
gmfxxtbReqList.add(gmfxxtbReqBO);
}
List<GmfxxtbRspBO> gmfxxtbRspList = interfaceServiceV3.syncBuyerMessage(gmfxxtbReqList, secretId);
returnJsonString = JsonUtils.getInstance().toJsonStringNullToEmpty(gmfxxtbRspList);
} else {
returnJsonString = "";
}
return returnJsonString;

@ -2795,6 +2795,14 @@ public class BeanTransitionUtils {
buyerEntity.setSjh(gmfxxtbReq.getGMFSJH());
//备注
buyerEntity.setRemarks(gmfxxtbReq.getBZ());
// 山能定制开发字段
// 山能 MDM 开票名称
buyerEntity.setInvoiceName(gmfxxtbReq.getINVOICE_NAME());
// 山能 MDM 开票税号
buyerEntity.setInvoiceTaxno(gmfxxtbReq.getINVOICE_TAXNO());
// 山能 MDM mdmMulticodeJson
buyerEntity.setMdmMulticodeJson(gmfxxtbReq.getMDM_MULTICODE_JSON());
return buyerEntity;
}

Loading…
Cancel
Save