呼出手机号 标签 标签组编辑时未修改内容也允许更新
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
from hy_outbound_mobile
|
||||
where deleted = 0
|
||||
<if test="id != null">
|
||||
id = #{id}
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="mobile != null and mobile != ''">
|
||||
and mobile = #{mobile}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.cool.store.dto.outbound.DeleteNumberDTO;
|
||||
import com.cool.store.dto.outbound.OutboundListDTO;
|
||||
import com.cool.store.dto.outbound.UpdateNumberDTO;
|
||||
import com.cool.store.entity.HyOutboundMobileDO;
|
||||
import com.cool.store.entity.HyPartnerLabelGroupDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
import com.cool.store.mapper.HyOutboundMobileMapper;
|
||||
@@ -41,12 +42,12 @@ public class HyOutboundServiceImpl implements HyOutboundService {
|
||||
*/
|
||||
@Override
|
||||
public void addOutboundNumber(AddNumberDTO dto) throws ApiException {
|
||||
if (whetherRepeat(dto.getOutboundNumber())) {
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setMobile(dto.getOutboundNumber());
|
||||
if (whetherRepeat(hyOutboundMobile)) {
|
||||
throw new ApiException(ErrorCodeEnum.OUTBOUND_NUMBER_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setMobile(dto.getOutboundNumber());
|
||||
hyOutboundMobile.setEditUserId(userId);
|
||||
hyOutboundMobile.setCreateUserId(userId);
|
||||
hyOutboundMobile.setUpdateUserId(userId);
|
||||
@@ -59,13 +60,13 @@ public class HyOutboundServiceImpl implements HyOutboundService {
|
||||
*/
|
||||
@Override
|
||||
public void updateOutboundNumber(UpdateNumberDTO dto) throws ApiException {
|
||||
if (whetherRepeat(dto.getNewOutboundNumber())) {
|
||||
throw new ApiException(ErrorCodeEnum.OUTBOUND_NUMBER_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
HyOutboundMobileDO hyOutboundMobile = new HyOutboundMobileDO();
|
||||
hyOutboundMobile.setId(dto.getId());
|
||||
hyOutboundMobile.setMobile(dto.getNewOutboundNumber());
|
||||
if (whetherRepeat(hyOutboundMobile)) {
|
||||
throw new ApiException(ErrorCodeEnum.OUTBOUND_NUMBER_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
hyOutboundMobile.setEditUserId(userId);
|
||||
hyOutboundMobile.setUpdateUserId(userId);
|
||||
outboundMobileMapper.updateByPrimaryKeySelective(hyOutboundMobile);
|
||||
@@ -87,14 +88,22 @@ public class HyOutboundServiceImpl implements HyOutboundService {
|
||||
|
||||
/**
|
||||
* 查询某个手机号是否重复
|
||||
* @param number 手机号
|
||||
* @param hyOutboundMobileDO 手机号信息
|
||||
* @return 是否重复
|
||||
*/
|
||||
public boolean whetherRepeat(String number) {
|
||||
HyOutboundMobileDO hyOutboundMobileDO = new HyOutboundMobileDO();
|
||||
hyOutboundMobileDO.setMobile(number);
|
||||
public boolean whetherRepeat(HyOutboundMobileDO hyOutboundMobileDO) {
|
||||
Long id = hyOutboundMobileDO.getId();
|
||||
hyOutboundMobileDO.setId(null);
|
||||
List<HyOutboundMobileDO> outboundMobileList = outboundMobileMapper.selectByPrimarySelective(hyOutboundMobileDO);
|
||||
return outboundMobileList != null && outboundMobileList.size() != 0;
|
||||
//如果修改后的号码与原号码一致也不算重复,但是要记录更新人
|
||||
if (outboundMobileList != null && outboundMobileList.size() > 0) {
|
||||
//更新操作还要检查是否与原号码信息相同,相同的话也不算重复
|
||||
if (outboundMobileList.get(0).getId().equals(id)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.cool.store.dto.label.LabelGroupAddDTO;
|
||||
import com.cool.store.dto.label.LabelGroupDeleteDTO;
|
||||
import com.cool.store.dto.label.LabelGroupListDTO;
|
||||
import com.cool.store.dto.label.LabelGroupUpdateDTO;
|
||||
import com.cool.store.entity.HyPartnerLabelDO;
|
||||
import com.cool.store.entity.HyPartnerLabelGroupDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ApiException;
|
||||
@@ -117,8 +118,18 @@ public class LabelGroupServiceImpl implements LabelGroupService {
|
||||
}
|
||||
|
||||
private Boolean whetherGroupDuplicated(HyPartnerLabelGroupDO labelGroupDO) {
|
||||
Long id = labelGroupDO.getId();
|
||||
labelGroupDO.setId(null);
|
||||
List<HyPartnerLabelGroupDO> hyPartnerLabelGroupDOS = labelGroupMapper.selectSelective(labelGroupDO);
|
||||
return hyPartnerLabelGroupDOS != null && hyPartnerLabelGroupDOS.size() > 0;
|
||||
//如果修改后的标签组名与原标签组名一致也不算重复,但是要记录更新人
|
||||
if (hyPartnerLabelGroupDOS != null && hyPartnerLabelGroupDOS.size() > 0) {
|
||||
//更新操作还要检查是否与原标签组信息相同,相同的话也不算重复
|
||||
if (hyPartnerLabelGroupDOS.get(0).getId().equals(id)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ public class LabelServiceImpl implements LabelService {
|
||||
@Override
|
||||
public void updateLabel(LabelUpdateDTO dto) throws ApiException {
|
||||
HyPartnerLabelDO labelDO = new HyPartnerLabelDO();
|
||||
labelDO.setId(dto.getId());
|
||||
labelDO.setLabelName(dto.getLabelName());
|
||||
if (whetherLabelRepeat(labelDO)) {
|
||||
throw new ApiException(ErrorCodeEnum.LABEL_EXIST);
|
||||
}
|
||||
String userId = CurrentUserHolder.getUserId();
|
||||
labelDO.setId(dto.getId());
|
||||
labelDO.setLabelGroupId(dto.getLabelGroupId());
|
||||
labelDO.setEditUserId(userId);
|
||||
labelDO.setEditDate(new Date());
|
||||
@@ -99,8 +99,15 @@ public class LabelServiceImpl implements LabelService {
|
||||
}
|
||||
|
||||
private Boolean whetherLabelRepeat(HyPartnerLabelDO label) throws ApiException {
|
||||
Long id = label.getId();
|
||||
label.setId(null);
|
||||
List<HyPartnerLabelDO> hyPartnerLabelDOS = labelMapper.selectSelective(label);
|
||||
//如果修改后的标签名与原标签名一致也不算重复,但是要记录更新人
|
||||
if (hyPartnerLabelDOS != null && hyPartnerLabelDOS.size() > 0) {
|
||||
//更新操作还要检查是否与原标签信息相同,相同的话也不算重复
|
||||
if (hyPartnerLabelDOS.get(0).getId().equals(id)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
|
||||
Reference in New Issue
Block a user