|
|
@@ -4,13 +4,15 @@ import jp.yamoto.farm.common.core.domain.model.LoginUser;
|
|
|
import jp.yamoto.farm.common.core.enums.DelFlgEnum;
|
|
|
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.DecryptUtils;
|
|
|
+import jp.yamoto.farm.common.utils.MessageUtils;
|
|
|
+import jp.yamoto.farm.common.utils.SecurityUtils;
|
|
|
+import jp.yamoto.farm.common.utils.ValueUtils;
|
|
|
import jp.yamoto.farm.common.utils.uuid.IdUtils;
|
|
|
+import jp.yamoto.farm.crm.biz.constants.CrmConstants;
|
|
|
import jp.yamoto.farm.crm.biz.master.domain.bo.MastCustomerBo;
|
|
|
import jp.yamoto.farm.crm.biz.master.domain.entity.MastCustomer;
|
|
|
-import jp.yamoto.farm.crm.biz.master.domain.entity.MastFarmer;
|
|
|
import jp.yamoto.farm.crm.biz.master.domain.vo.MastCustomerVo;
|
|
|
-import jp.yamoto.farm.crm.biz.master.domain.vo.MastFarmerVo;
|
|
|
import jp.yamoto.farm.crm.biz.master.mapper.MastCustomerMapper;
|
|
|
import jp.yamoto.farm.crm.biz.master.service.IMastCustomerService;
|
|
|
import lombok.SneakyThrows;
|
|
|
@@ -179,6 +181,14 @@ public class MastCustomerServiceImpl implements IMastCustomerService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int deleteLogicByIdAndVersion(MastCustomer mastCustomer) {
|
|
|
+ // 削除が許可されるかどうかを決定します。
|
|
|
+ MastCustomerVo mastCustomerVo = mastCustomerMapper.selectById(mastCustomer.getId());
|
|
|
+ if (ValueUtils.isNotEmpty(mastCustomerVo)) {
|
|
|
+ if (ValueUtils.isEqual(CrmConstants.SYS_SOURCE_FLG_R, mastCustomerVo.getSystemSourceFlg())) {
|
|
|
+ throw new ServiceException(MessageUtils.message("E0063", MessageUtils.message("label.customer")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 該当データは既に別のユーザーより削除されました。
|
|
|
int result = mastCustomerMapper.deleteLogicByIdAndVersion(mastCustomer);
|
|
|
if (result < 1) {
|