|
|
|
@ -1,8 +1,10 @@ |
|
|
|
|
package com.dxhy.order.baseservice.module.buyer.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONException; |
|
|
|
|
import com.dxhy.order.baseservice.module.buyer.protocol.MdmBankListBO; |
|
|
|
|
import com.dxhy.order.constant.ConfigureConstant; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoContentEnum; |
|
|
|
|
import com.dxhy.order.constant.OrderInfoEnum; |
|
|
|
@ -111,20 +113,43 @@ public class BuyerController { |
|
|
|
|
return R.error(OrderInfoContentEnum.TAXCODE_ISNULL); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//购货方企业类型 默认值01 企业
|
|
|
|
|
// 购货方企业类型 默认值01 企业
|
|
|
|
|
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_01.getKey()); |
|
|
|
|
|
|
|
|
|
//购方名称 带中文括号的转换成英文括号
|
|
|
|
|
// 购方名称 带中文括号的转换成英文括号
|
|
|
|
|
buyerEntity.setPurchaseName(StringUtil.replaceStr(buyerEntity.getPurchaseName(), true)); |
|
|
|
|
|
|
|
|
|
//获取当前登录人id
|
|
|
|
|
// 获取当前登录人id
|
|
|
|
|
Long userId = userInfoService.getUser().getUserId(); |
|
|
|
|
String id = buyerEntity.getId(); |
|
|
|
|
|
|
|
|
|
// 处理MDM默认银行账户等信息
|
|
|
|
|
List<MdmBankListBO> bankListBOS = new ArrayList<>(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(buyerEntity.getBanks())) { |
|
|
|
|
buyerEntity.getBanks().forEach(i -> { |
|
|
|
|
MdmBankListBO temp = new MdmBankListBO(); |
|
|
|
|
temp.setAddress(i.getAddress()); |
|
|
|
|
temp.setPhone(i.getPhone()); |
|
|
|
|
temp.setBankNumber(i.getBankNumber()); |
|
|
|
|
temp.setBankOfDeposit(i.getBankOfDeposit()); |
|
|
|
|
bankListBOS.add(temp); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (buyerEntity.getBankDefaultIndex() != null) { |
|
|
|
|
buyerEntity.getBanks().get(buyerEntity.getBankDefaultIndex()); |
|
|
|
|
Integer index = buyerEntity.getBankDefaultIndex(); |
|
|
|
|
buyerEntity.setAddress(buyerEntity.getBanks().get(index).getAddress()); |
|
|
|
|
buyerEntity.setPhone(buyerEntity.getBanks().get(index).getPhone()); |
|
|
|
|
buyerEntity.setBankNumber(buyerEntity.getBanks().get(index).getBankNumber()); |
|
|
|
|
buyerEntity.setBankOfDeposit(buyerEntity.getBanks().get(index).getBankOfDeposit()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(id)) { |
|
|
|
|
//修改
|
|
|
|
|
// 修改
|
|
|
|
|
buyerEntity.setModifyUserId(userId.toString()); |
|
|
|
|
} else { |
|
|
|
|
//添加
|
|
|
|
|
// 添加
|
|
|
|
|
buyerEntity.setModifyUserId(userId.toString()); |
|
|
|
|
buyerEntity.setCreateUserId(userId.toString()); |
|
|
|
|
} |
|
|
|
@ -137,7 +162,7 @@ public class BuyerController { |
|
|
|
|
@PostMapping("/saveBuyerInfoList") |
|
|
|
|
public R saveBuyerInfoList(@RequestBody List<BuyerEntity> buyerList) { |
|
|
|
|
|
|
|
|
|
//业务逻辑放到provider
|
|
|
|
|
// 业务逻辑放到provider
|
|
|
|
|
return buyerService.saveBuyerInfoList(buyerList, |
|
|
|
|
userInfoService.getUser().getUserId() == null ? "" : String.valueOf(userInfoService.getUser().getUserId())); |
|
|
|
|
} |
|
|
|
@ -178,12 +203,12 @@ public class BuyerController { |
|
|
|
|
|
|
|
|
|
R r = new R(); |
|
|
|
|
try { |
|
|
|
|
//从excel中读取数据
|
|
|
|
|
// 从excel中读取数据
|
|
|
|
|
long t1 = System.currentTimeMillis(); |
|
|
|
|
log.debug("{}excel读取开始,当前时间:{}", LOGGER_MSG, t1); |
|
|
|
|
Map<String, String> headToProperty = new HashMap<>(10); |
|
|
|
|
|
|
|
|
|
//转换枚举类
|
|
|
|
|
// 转换枚举类
|
|
|
|
|
for (BuyerImportExcelEnum importExcelEnum : BuyerImportExcelEnum.values()) { |
|
|
|
|
headToProperty.put(importExcelEnum.getKey(), importExcelEnum.getValue()); |
|
|
|
|
} |
|
|
|
@ -222,7 +247,7 @@ public class BuyerController { |
|
|
|
|
if (StringUtils.isEmpty(buyerEntity.getTaxpayerCode())) { |
|
|
|
|
buyerEntity.setGhfQylx(OrderInfoEnum.GHF_QYLX_03.getKey()); |
|
|
|
|
} |
|
|
|
|
//购方名称 带中文括号的转换成英文括号
|
|
|
|
|
// 购方名称 带中文括号的转换成英文括号
|
|
|
|
|
buyerEntity.setPurchaseName(StringUtil.replaceStr(buyerEntity.getPurchaseName(), true)); |
|
|
|
|
buyerEntityList.add(buyerEntity); |
|
|
|
|
} |
|
|
|
|