1、工种增加编码唯一判断

2、报名修改报名错误返回提示
This commit is contained in:
ly19960718 2021-05-04 15:21:53 +08:00
parent dfff74bdd4
commit ab59e5fcbd
3 changed files with 19 additions and 2 deletions

View File

@ -181,7 +181,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
begin.setTime(df.parse(planStartTime));
end.setTime(df.parse(planEndTime));
if (!(date.after(begin) && date.before(end))) {
throw new ParamsException("该计划已截止报名");
throw new ParamsException("未在该计划的报名时间段");
}
} catch (ParseException e) {
e.printStackTrace();
@ -309,7 +309,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
/**
* 统计证件号码 报名培训计划的次数不包括撤回
* 统计证件号码 报名培训计划的次数不包括撤回
*/
public Integer countApplyCardNumber(String applyCardNumber,String applyClassId){
Map<String, Object> params = new HashMap<>();

View File

@ -2,6 +2,7 @@ package cn.com.tenlion.service.worktype.impl;
import cn.com.tenlion.pojo.dtos.worktype.WorkTypeZTreeDTO;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultList;
@ -78,6 +79,7 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType
@Override
public String saveReturnId(String token, WorkTypeVO workTypeVO) {
checkCode(workTypeVO.getWorkTypeCode());
String workTypeId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(workTypeVO);
params.put("workTypeId", workTypeId);
@ -121,6 +123,7 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType
@Override
public void update(String token, String workTypeId, WorkTypeVO workTypeVO) {
checkCode(workTypeVO.getWorkTypeCode());
Map<String, Object> params = HashMapUtil.beanToMap(workTypeVO);
params.put("workTypeId", workTypeId);
if (StringUtils.isBlank(token)) {
@ -194,6 +197,17 @@ public class WorkTypeServiceImpl extends DefaultBaseService implements IWorkType
return new SuccessResultList<>(workTypeDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
private void checkCode(String code) {
Map<String, Object> params = new HashMap<>();
params.put("workTypeCode",code);
int count = this.count(params);
if(count != 0){
throw new ParamsException("编码已存在");
}
}
@Override
public Integer count(Map<String, Object> params) {
Integer count = workTypeDao.count(params);

View File

@ -356,6 +356,9 @@
<if test="workTypeParentId != null and workTypeParentId != ''">
AND work_type_parent_id = #{workTypeParentId}
</if>
<if test="workTypeCode != null and workTypeCode != ''">
AND work_type_code = #{workTypeCode}
</if>
</select>
</mapper>