Browse Source

顾客CSV导入时,顾客ID自动采番修改

于俊龙 3 weeks ago
parent
commit
8154528213

+ 8 - 2
farm-sankin-biz/src/main/java/jp/yamoto/farm/sankin/biz/service/impl/MastCustomerServiceImpl.java

@@ -9,6 +9,7 @@ import jp.yamoto.farm.common.biz.service.IMastAddressBaseService;
 import jp.yamoto.farm.common.biz.service.ISysConfigService;
 import jp.yamoto.farm.common.constant.Constants;
 import jp.yamoto.farm.common.core.domain.ImportFileErrorVo;
+import jp.yamoto.farm.common.core.service.IRangedSeqService;
 import jp.yamoto.farm.common.exception.ServiceException;
 import jp.yamoto.farm.common.utils.*;
 import jp.yamoto.farm.common.utils.file.FileUtils;
@@ -59,6 +60,9 @@ public class MastCustomerServiceImpl implements IMastCustomerService {
     @Autowired
     private ISysConfigService sysConfigService;
 
+    @Autowired
+    private IRangedSeqService rangedSeqService;
+
     /**
      * 顧客マスタの検索
      *
@@ -294,6 +298,9 @@ public class MastCustomerServiceImpl implements IMastCustomerService {
                 mastCustomerEntity.setVersion(1);
                 // 登録プログラムID
                 mastCustomerEntity.setCreatePgId(SankinPgIdEnum.N015.getCode());
+                // 顧客ID
+                String autoCustomerId = rangedSeqService.generateSerialNo(IRangedSeqService.SERIAL_TYPE_CUSTOMER);
+                mastCustomerEntity.setCustomerId(autoCustomerId);
             }
 
             BeanUtils.copyProperties(data, mastCustomerEntity);
@@ -330,8 +337,7 @@ public class MastCustomerServiceImpl implements IMastCustomerService {
 
             // 顧客名
             mastCustomerEntity.setCustomerName(StringUtils.join(data.getFirstName(), data.getLastName()));
-            // 顧客ID = 会員ID
-            mastCustomerEntity.setCustomerId(data.getMemberId());
+
             // 住所
             mastCustomerEntity.setAddress(StringUtils.join(data.getKenName(), data.getCityName(), data.getTownName(), data.getBuildingEtc()));
             // 農家ID