问题优化
This commit is contained in:
parent
6f0f9c06f6
commit
3b45aa9e0f
|
|
@ -114,9 +114,9 @@ public class BmAgreementInfoController extends BaseController
|
|||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:info:remove")
|
||||
@SysLog(title = "协议管理", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除协议管理")
|
||||
@DeleteMapping("/{agreementIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] agreementIds)
|
||||
@DeleteMapping("/{agreementId}")
|
||||
public AjaxResult remove(@PathVariable("agreementId") Long agreementId)
|
||||
{
|
||||
return toAjax(bmAgreementInfoService.deleteBmAgreementInfoByAgreementIds(agreementIds));
|
||||
return toAjax(bmAgreementInfoService.deleteBmAgreementInfoByAgreementId(agreementId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,11 @@ public interface BmAgreementInfoMapper
|
|||
public int selectNumByMonth(Date nowDate);
|
||||
|
||||
String getProtocol(String agreementId);
|
||||
|
||||
/**
|
||||
* 根据协议id查询协议信息
|
||||
* @param agreementId
|
||||
* @return
|
||||
*/
|
||||
int selectByagreementId(Long agreementId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,17 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
|
|||
@Override
|
||||
public AjaxResult updateBmAgreementInfo(BmAgreementInfo bmAgreementInfo)
|
||||
{
|
||||
// 根据unitId和projectId判断,修改的单位和工程是否已经关联协议
|
||||
BmAgreementInfo agreementInfo = new BmAgreementInfo();
|
||||
agreementInfo.setUnitId(bmAgreementInfo.getUnitId());
|
||||
agreementInfo.setProjectId(bmAgreementInfo.getProjectId());
|
||||
List<BmAgreementInfo> list = bmAgreementInfoMapper.selectBmAgreementInfoList(agreementInfo);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
BmAgreementInfo info = list.get(0);
|
||||
if (info != null && info.getAgreementId() != null && !info.getAgreementId().equals(bmAgreementInfo.getAgreementId())) {
|
||||
return AjaxResult.error("该单位和工程已关联协议,请勿重复创建!");
|
||||
}
|
||||
}
|
||||
bmAgreementInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
int count = bmAgreementInfoMapper.updateBmAgreementInfo(bmAgreementInfo);
|
||||
if (count > 0) {
|
||||
|
|
@ -168,6 +179,12 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
|
|||
@Override
|
||||
public int deleteBmAgreementInfoByAgreementId(Long agreementId)
|
||||
{
|
||||
//查询该协议是否存在领料任务,有的话不能删除
|
||||
int res = bmAgreementInfoMapper.selectByagreementId(agreementId);
|
||||
if (res > 0) {
|
||||
throw new ServiceException("该协议存在领料任务,不能删除");
|
||||
} else {
|
||||
return bmAgreementInfoMapper.deleteBmAgreementInfoByAgreementId(agreementId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.basic.domain.BmUnit;
|
||||
import com.bonus.material.basic.mapper.BmUnitMapper;
|
||||
|
|
@ -150,6 +152,9 @@ public class BmUnitPersonServiceImpl implements IBmUnitPersonService
|
|||
if (unit.getTypeId() != null) {
|
||||
unit.setTypeName(labelMap.get(unit.getTypeId().toString()) == null ? "" : labelMap.get(unit.getTypeId().toString()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(unit.getTelphone())) {
|
||||
unit.setTelphone(Sm4Utils.decrypt(unit.getTelphone()));
|
||||
}
|
||||
AjaxResult ajaxResult = remoteDeptService.getInfo(unit.getDeptId(), SecurityConstants.INNER);
|
||||
//健壮性判断
|
||||
if (ajaxResult.isSuccess()) {
|
||||
|
|
|
|||
|
|
@ -125,15 +125,13 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
if (unit != null) {
|
||||
return AjaxResult.error(HttpCodeEnum.NAME_DUPLICATE.getCode(), HttpCodeEnum.NAME_DUPLICATE.getMsg());
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (StringUtils.isNotBlank(bmUnit.getTelphone()) && !PhoneUtil.isMobile(bmUnit.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
if (StringUtils.isNotBlank(bmUnit.getTelphone())) {
|
||||
String telPhone = Sm4Utils.encrypt(bmUnit.getTelphone());
|
||||
bmUnit.setTelphone(telPhone);
|
||||
} else {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
//判断手机号是否合法
|
||||
if (!PhoneUtil.isMobile(bmUnit.getTelphone())) {
|
||||
return AjaxResult.error(HttpCodeEnum.INVALID_PHONE_FORMAT.getCode(), HttpCodeEnum.INVALID_PHONE_FORMAT.getMsg());
|
||||
}
|
||||
bmUnit.setCreateTime(DateUtils.getNowDate());
|
||||
bmUnit.setCreateBy(SecurityUtils.getUserId().toString());
|
||||
|
|
|
|||
|
|
@ -133,4 +133,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from bm_agreement_info
|
||||
where agreement_id = #{agreementId}
|
||||
</select>
|
||||
|
||||
<select id="selectByagreementId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
tm_task_agreement
|
||||
WHERE
|
||||
agreement_id = #{agreementId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
|
||||
group by bu.unit_id
|
||||
order by bu.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue