|
|
@@ -113,7 +113,7 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
|
|
|
MastCustomerSearchBo mastCustomer = new MastCustomerSearchBo();
|
|
|
mastCustomer.setDiscontinuedFlg(DelFlgEnum.OFF.getCode());
|
|
|
- mastCustomer.setPhoneNumber(mastCustomerBo.getPhoneNumber());
|
|
|
+ mastCustomer.setPhoneNumber( DecryptUtils.encryptAES(mastCustomerBo.getPhoneNumber()));
|
|
|
|
|
|
// データを取得
|
|
|
List<MastCustomerVo> list = mastCustomerMapper.selectList(mastCustomer);
|
|
|
@@ -133,6 +133,12 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
customerId = item.getCustomerId();
|
|
|
continue;
|
|
|
}
|
|
|
+ // 関連付けを設定
|
|
|
+ mastCustomerBo.setId(item.getId());
|
|
|
+ mastCustomerBo.setCustomerId(item.getCustomerId());
|
|
|
+ mastCustomerBo.setVersion(item.getVersion());
|
|
|
+ mastCustomerBo.setPhoneNoCheckFlg(true);
|
|
|
+ mastCustomerBo.setCustomerName(mastCustomerBo.getCustomerName());
|
|
|
this.updateInfo(mastCustomerBo);
|
|
|
}
|
|
|
return customerId;
|
|
|
@@ -242,12 +248,16 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
MastAddressEntity addressEntity = new MastAddressEntity();
|
|
|
StringBuilder addressBuilder = new StringBuilder();
|
|
|
// 都道府県
|
|
|
- addressEntity = addressBaseService.selectMastAddress(new MastAddressEntity(mastCustomer.getKenId()));
|
|
|
- addressBuilder.append(ValueUtils.isNotEmpty(addressEntity.getKenName()) ? addressEntity.getKenName() : "");
|
|
|
+ if(ValueUtils.isNotEmpty(mastCustomer.getKenId())) {
|
|
|
+ addressEntity = addressBaseService.selectMastAddress(new MastAddressEntity(mastCustomer.getKenId()));
|
|
|
+ addressBuilder.append(ValueUtils.isNotEmpty(addressEntity.getKenName()) ? addressEntity.getKenName() : "");
|
|
|
+ }
|
|
|
|
|
|
// 市区町村
|
|
|
- addressEntity = addressBaseService.selectMastAddress(new MastAddressEntity(null, mastCustomer.getCityId()));
|
|
|
- addressBuilder.append(ValueUtils.isNotEmpty(addressEntity.getCityName()) ? addressEntity.getCityName() : "");
|
|
|
+ if(ValueUtils.isNotEmpty(mastCustomer.getCityId())) {
|
|
|
+ addressEntity = addressBaseService.selectMastAddress(new MastAddressEntity(null, mastCustomer.getCityId()));
|
|
|
+ addressBuilder.append(ValueUtils.isNotEmpty(addressEntity.getCityName()) ? addressEntity.getCityName() : "");
|
|
|
+ }
|
|
|
|
|
|
// 町域・番地
|
|
|
addressBuilder.append(ValueUtils.isNotEmpty(mastCustomer.getTownName()) ? mastCustomer.getTownName() : "");
|
|
|
@@ -255,7 +265,9 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
// ビル等
|
|
|
addressBuilder.append(ValueUtils.isNotEmpty(mastCustomer.getBuildingEtc()) ? mastCustomer.getBuildingEtc() : "");
|
|
|
// 住所
|
|
|
- mastCustomer.setAddress(addressBuilder.toString());
|
|
|
+ if(ValueUtils.isNotEmpty(mastCustomer.getKenId()) && !addressBuilder.isEmpty()) {
|
|
|
+ mastCustomer.setAddress(addressBuilder.toString());
|
|
|
+ }
|
|
|
|
|
|
// データを暗号化
|
|
|
// メールアドレス
|
|
|
@@ -263,7 +275,7 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
mastCustomer.setMailAddress(DecryptUtils.encryptAES(mastCustomer.getMailAddress()));
|
|
|
}
|
|
|
// 電話番号
|
|
|
- if (ValueUtils.isNotEmpty(mastCustomer.getMailAddress())) {
|
|
|
+ if (ValueUtils.isNotEmpty(mastCustomer.getPhoneNumber())) {
|
|
|
mastCustomer.setPhoneNumber(DecryptUtils.encryptAES(mastCustomer.getPhoneNumber()));
|
|
|
}
|
|
|
|
|
|
@@ -284,7 +296,7 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
mastCustomerVo.setPhoneNumber(phoneNumber);
|
|
|
|
|
|
// プレーンテキストメール
|
|
|
- if (isDecryptMail) {
|
|
|
+ if (isDecryptMail && ValueUtils.isNotEmpty(mastCustomerVo.getMailAddress())) {
|
|
|
String mailAddress = DecryptUtils.decryptAES(mastCustomerVo.getMailAddress());
|
|
|
mastCustomerVo.setMailAddress(mailAddress);
|
|
|
}
|
|
|
@@ -314,10 +326,13 @@ public class MastCustomerServiceImpl extends MastCustomerBaseServiceImpl impleme
|
|
|
}
|
|
|
|
|
|
// 電話番号の重複チェック
|
|
|
- farmerSearchCheckBo.setPhoneNumber(DecryptUtils.encryptAES(mastCustomerBo.getPhoneNumber()));
|
|
|
- int mastFarmerCount = mastCustomerMapper.getCustomerInfoCount(farmerSearchCheckBo);
|
|
|
- if (mastFarmerCount > 0) {
|
|
|
- throw new ServiceException(MessageUtils.message("E0001", MessageUtils.message("label.phoneNumber")));
|
|
|
+ if(!mastCustomerBo.getPhoneNoCheckFlg()) {
|
|
|
+ farmerSearchCheckBo.setPhoneNumber(DecryptUtils.encryptAES(mastCustomerBo.getPhoneNumber()));
|
|
|
+ int mastFarmerCount = mastCustomerMapper.getCustomerInfoCount(farmerSearchCheckBo);
|
|
|
+ if (mastFarmerCount > 0) {
|
|
|
+ throw new ServiceException(MessageUtils.message("E0001", MessageUtils.message("label.phoneNumber")));
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|