feature:购方信息导入

release
gaorl 2 years ago
parent 5aedbec1c1
commit 7aee7498ac
  1. 72
      order-management-base-service/src/main/java/com/dxhy/order/baseservice/module/buyer/service/impl/BuyerServiceImpl.java
  2. 3
      order-management-base-service/src/main/resources/mybatis/mapper/BuyerMapper.xml

@ -207,7 +207,7 @@ public class BuyerServiceImpl implements BuyerService {
}
if (StringUtils.isNotEmpty(buyerEntity.getEntId())&&StringUtils.isNotEmpty(buyerEntity.getBuyerCode())) {
param = new HashMap<>(5);
param.put("ent_id", buyerEntity.getEntId());
param.put("entId", buyerEntity.getEntId());
param.put("buyerCode", buyerEntity.getBuyerCode());
int i = buyerMapper.selectBuyerByName(param, shList);
if (i > 0) {
@ -245,44 +245,46 @@ public class BuyerServiceImpl implements BuyerService {
// .put(OrderManagementConstant.MESSAGE, "上传失败");
// } else {
importSuccessCount = buyerEntitys.size();
for (BuyerEntity buyerEntity : buyerEntitys) {
//数据重复性校验
buyerEntity.setId(baseService.getGenerateShotKey());
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
List<BuyerEntityDetail> buyerEntityDetail = new ArrayList<>();
BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail();
buyerEntityDetail1.setBuyerManageId(buyerEntity.getId());
buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber());
buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit());
buyerEntityDetail1.setAddress(buyerEntity.getAddress());
buyerEntityDetail1.setPhone(buyerEntity.getPhone());
buyerEntityDetail1.setCreateTime(new Date());
buyerEntityDetail1.setDefaultMark("0");
try {
buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString());
} catch (Exception e) {
buyerEntityDetail1.setCreateUser("");
}
buyerEntityDetail.add(buyerEntityDetail1);
buyerMapper.batchInsertBuyerDetail(buyerEntityDetail);
}
if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) {
buyerMapper.insertBuyerByList(buyerEntitys);
} else {
List<BuyerEntity> insertBuyerList = new ArrayList<>();
int i = 0;
if (importSuccessCount > 0){
for (BuyerEntity buyerEntity : buyerEntitys) {
if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) {
buyerMapper.insertBuyerByList(insertBuyerList);
insertBuyerList = new ArrayList<>();
//数据重复性校验
buyerEntity.setId(baseService.getGenerateShotKey());
if (StringUtils.isBlank(buyerEntity.getBuyerCode())) {
buyerEntity.setBuyerCode(baseService.getGenerateShotKey());
}
insertBuyerList.add(buyerEntity);
i++;
List<BuyerEntityDetail> buyerEntityDetail = new ArrayList<>();
BuyerEntityDetail buyerEntityDetail1 = new BuyerEntityDetail();
buyerEntityDetail1.setBuyerManageId(buyerEntity.getId());
buyerEntityDetail1.setBankAccount(buyerEntity.getBankNumber());
buyerEntityDetail1.setBankName(buyerEntity.getBankOfDeposit());
buyerEntityDetail1.setAddress(buyerEntity.getAddress());
buyerEntityDetail1.setPhone(buyerEntity.getPhone());
buyerEntityDetail1.setCreateTime(new Date());
buyerEntityDetail1.setDefaultMark("0");
try {
buyerEntityDetail1.setCreateUser(userInfoService.getUser().getUserId().toString());
} catch (Exception e) {
buyerEntityDetail1.setCreateUser("");
}
buyerEntityDetail.add(buyerEntityDetail1);
buyerMapper.batchInsertBuyerDetail(buyerEntityDetail);
}
if (buyerEntitys.size() > 0) {
if (buyerEntitys.size() < ConfigureConstant.BATCH_INSERT) {
buyerMapper.insertBuyerByList(buyerEntitys);
} else {
List<BuyerEntity> insertBuyerList = new ArrayList<>();
int i = 0;
for (BuyerEntity buyerEntity : buyerEntitys) {
if (i != 0 && i % ConfigureConstant.BATCH_INSERT == 0) {
buyerMapper.insertBuyerByList(insertBuyerList);
insertBuyerList = new ArrayList<>();
}
insertBuyerList.add(buyerEntity);
i++;
}
if (buyerEntitys.size() > 0) {
buyerMapper.insertBuyerByList(buyerEntitys);
}
}
}
resultMap.put("list", list);

@ -908,6 +908,9 @@
<if test="map.buyerCode != null and map.buyerCode != ''">
AND buyer_code =#{map.buyerCode,jdbcType=VARCHAR}
</if>
<if test="map.entId != null and map.entId != ''">
AND ent_id =#{map.entId,jdbcType=VARCHAR}
</if>
</where>
</select>

Loading…
Cancel
Save