增加报名年龄限制、离退休颜色标记

This commit is contained in:
TS-QD1 2023-03-08 15:21:50 +08:00
parent cdc22399c4
commit 1ba98952ac
14 changed files with 424 additions and 288 deletions

View File

@ -0,0 +1,10 @@
package cn.com.tenlion.consts;
public interface ISignUpConsts {
String KEY_AQGL_FAMALE_MAX_AGE = "aqglFamaleMaxAge";
String KEY_AQGL_MALE_MAX_AGE = "aqglMaleMaxAge";
String KEY_TZZY_FAMALE_MAX_AGE = "tzzyFamaleMaxAge";
String KEY_TZZY_MALE_MAX_AGE = "tzzyMaleMaxAge";
}

View File

@ -1,6 +1,7 @@
package cn.com.tenlion.controller.api.apply;
import cn.com.tenlion.pojo.vos.apply.ApplyAuditVO;
import cn.com.tenlion.util.SignUpUtil;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.interfaces.consts.ISystemConstant;
@ -38,37 +39,28 @@ public class ApplyController extends DefaultBaseController {
@ApiOperation(value = "报名信息报道", notes = "报名信息报道接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateInstitutionId/{targetId}")
@CheckRequestBodyAnnotation
public SuccessResult updateInstitutionId(@PathVariable("targetId") String targetId,
@RequestBody Map<String, Object> params) {
public SuccessResult updateInstitutionId(@PathVariable("targetId") String targetId, @RequestBody Map<String, Object> params) {
String sourceIds = params.get("sourceIds").toString();
applyService.updateInstitutionId(targetId,Arrays.asList(sourceIds.split(",")));
applyService.updateInstitutionId(targetId, Arrays.asList(sourceIds.split(",")));
return new SuccessResult();
}
@ApiOperation(value = "自定义新增报名信息", notes = "自定义新增报名信息")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save-relation")
@CheckRequestBodyAnnotation
public SuccessResult saveRelation(@RequestBody ApplyVO applyVO) {
SignUpUtil.checkIdCardAge(applyVO.getApplyLeiBie(), applyVO.getApplyCardNumber());
applyService.saveRelationReturnId(applyVO);
return new SuccessResult();
}
@ApiOperation(value = "报名信息撤回", notes = "报名信息撤回接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateAuditStateRecall/{applyId}")
@CheckRequestBodyAnnotation
@ -77,15 +69,12 @@ public class ApplyController extends DefaultBaseController {
applyAuditVO.setApplyId(applyId);
applyAuditVO.setApplyAuditExplain("用户撤回报名");
applyAuditVO.setApplyAuditState(1);
applyService.updateAuditState(null,applyAuditVO);
applyService.updateAuditState(null, applyAuditVO);
return new SuccessResult();
}
@ApiOperation(value = "报名信息报道", notes = "报名信息报道接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateAuditStateReport/{applyId}")
@CheckRequestBodyAnnotation
@ -94,20 +83,18 @@ public class ApplyController extends DefaultBaseController {
applyAuditVO.setApplyId(applyId);
applyAuditVO.setApplyAuditExplain("用户进行报道");
applyAuditVO.setApplyAuditState(3);
applyService.updateAuditState(null,applyAuditVO);
applyService.updateAuditState(null, applyAuditVO);
return new SuccessResult();
}
@ApiOperation(value = "报名信息审核", notes = "报名信息审核接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"),})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("updateAuditStateAudit")
@CheckRequestBodyAnnotation
public SuccessResult updateAuditStateAudit(@RequestBody ApplyAuditVO applyAuditVO) {
applyService.audit(null,applyAuditVO);
applyService.audit(null, applyAuditVO);
return new SuccessResult();
}
@ -122,9 +109,7 @@ public class ApplyController extends DefaultBaseController {
}
@ApiOperation(value = "删除报名信息", notes = "删除报名信息接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) {
@ -133,9 +118,7 @@ public class ApplyController extends DefaultBaseController {
}
@ApiOperation(value = "修改报名信息", notes = "修改报名信息接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path")
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{applyId}")
@CheckRequestBodyAnnotation
@ -148,14 +131,13 @@ public class ApplyController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update-user-register/{applyId}")
public SuccessResult updateUserRegister(@PathVariable("applyId") String applyId, @RequestBody ApplyVO applyVO) {
SignUpUtil.checkIdCardAge(applyVO.getApplyLeiBie(), applyVO.getApplyCardNumber());
applyService.updateUserRegister(applyId, applyVO);
return new SuccessResult();
}
@ApiOperation(value = "报名信息详情", notes = "报名信息详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path")
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{applyId}")
public ApplyDTO get(@PathVariable("applyId") String applyId) {
@ -171,20 +153,14 @@ public class ApplyController extends DefaultBaseController {
}
@ApiOperation(value = "报名信息分页列表", notes = "报名信息分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiImplicitParams({@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
public SuccessResultList<List<ApplyDTO>> listPage(ListPage page) {
Map<String, Object> params = requestParams();
if(null != params.get("applyAuditStates")){
if(!StringUtils.isBlank(params.get("applyAuditStates").toString())){
params.put("applyAuditStates",Arrays.asList(params.get("applyAuditStates").toString().split(",")));
if (null != params.get("applyAuditStates")) {
if (!StringUtils.isBlank(params.get("applyAuditStates").toString())) {
params.put("applyAuditStates", Arrays.asList(params.get("applyAuditStates").toString().split(",")));
}
}
page.setParams(params);

View File

@ -58,7 +58,6 @@ public class ApplyStudentsController extends DefaultBaseController {
}
@ApiOperation(value = "新增班级学生表", notes = "新增班级学生表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("save")
@ -69,9 +68,7 @@ public class ApplyStudentsController extends DefaultBaseController {
}
@ApiOperation(value = "删除班级学生表", notes = "删除班级学生表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
})
@ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) {
@ -80,9 +77,7 @@ public class ApplyStudentsController extends DefaultBaseController {
}
@ApiOperation(value = "修改班级学生表", notes = "修改班级学生表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyStudentsId", value = "班级学生表ID", paramType = "path")
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyStudentsId", value = "班级学生表ID", paramType = "path")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PutMapping("update/{applyStudentsId}")
@CheckRequestBodyAnnotation
@ -92,9 +87,7 @@ public class ApplyStudentsController extends DefaultBaseController {
}
@ApiOperation(value = "班级学生表详情", notes = "班级学生表详情接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "applyStudentsId", value = "班级学生表ID", paramType = "path")
})
@ApiImplicitParams({@ApiImplicitParam(name = "applyStudentsId", value = "班级学生表ID", paramType = "path")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{applyStudentsId}")
public ApplyStudentsDTO get(@PathVariable("applyStudentsId") String applyStudentsId) {
@ -116,13 +109,7 @@ public class ApplyStudentsController extends DefaultBaseController {
}
@ApiOperation(value = "班级学生表分页列表", notes = "班级学生表分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiImplicitParams({@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage")
public SuccessResultList<List<ApplyStudentsDTO>> listPage(ListPage page) {
@ -148,7 +135,7 @@ public class ApplyStudentsController extends DefaultBaseController {
ExcelUtil.readExcel(file, 0, 1, listener, ApplyStudentsModel.class);
// 错误集
List<ImportFailDto> importFailDtoList = listener.getImportFailDtoList();
if(!importFailDtoList.isEmpty()) {
if (!importFailDtoList.isEmpty()) {
failDtoList = importFailDtoList;
return new SuccessResultData(importFailDtoList.size());
}
@ -163,9 +150,9 @@ public class ApplyStudentsController extends DefaultBaseController {
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"班号", "姓名", "考生身份证号码", "成绩", "失败原因"};
String[] headers = {"班号", "姓名", "考生身份证号码", "成绩", "失败原因"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
for (String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
@ -195,16 +182,16 @@ public class ApplyStudentsController extends DefaultBaseController {
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"班号", "姓名", "考生身份证号码", "考试机构", "考试开始时间", "考试结束时间", "成绩", "失败原因"};
String[] headers = {"班号", "姓名", "考生身份证号码", "考试机构", "考试开始时间", "考试结束时间", "成绩", "失败原因"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
for (String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
List<ApplyStudentsDTO> applyStudentsDTOS = applyStudentsService.list(params);
if(null == applyStudentsDTOS || applyStudentsDTOS.size() <= 0) {
if (null == applyStudentsDTOS || applyStudentsDTOS.size() <= 0) {
throw new SearchException("暂无数据,导出失败");
}
List<List<Object>> listData = new ArrayList<>();

View File

@ -158,4 +158,10 @@ public class ApplyDTO {
private String modifier;
@ApiModelProperty(name = "gmtModified", value = "修改时间")
private String gmtModified;
@ApiModelProperty(name = "age", value = "年龄")
private Integer age;
@ApiModelProperty(name = "maxAge", value = "年龄")
private Integer maxAge;
}

View File

@ -157,6 +157,10 @@ public class ApplyStudentsDTO {
private ClassPlanDTO classPlanDTO;
@ApiModelProperty(name = "joinExam", value = "是否参加考试")
private String joinExam;
@ApiModelProperty(name = "age", value = "年龄")
private Integer age;
@ApiModelProperty(name = "maxAge", value = "年龄")
private Integer maxAge;
public String getApplyInstitutionId() {
return applyInstitutionId == null ? "" : applyInstitutionId;
@ -685,4 +689,20 @@ public class ApplyStudentsDTO {
public void setJoinExam(String joinExam) {
this.joinExam = joinExam;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getMaxAge() {
return maxAge;
}
public void setMaxAge(Integer maxAge) {
this.maxAge = maxAge;
}
}

View File

@ -104,6 +104,8 @@ public class ApplyVO {
private String idCardBackPhoto;
@ApiModelProperty(name = "educationPhoto", value = "学历证书")
private String educationPhoto;
@ApiModelProperty(name = "isTzzy", value = "是否特种作业")
private Boolean isTzzy;
public String getApplyInstitutionId() {
return applyInstitutionId;
@ -448,4 +450,12 @@ public class ApplyVO {
public void setExamScoreHandsOn(String examScoreHandsOn) {
this.examScoreHandsOn = examScoreHandsOn;
}
public Boolean getTzzy() {
return isTzzy;
}
public void setTzzy(Boolean tzzy) {
isTzzy = tzzy;
}
}

View File

@ -28,6 +28,8 @@ import cn.com.tenlion.service.traininginstitutionserviceuser.ITrainingInstitutio
import cn.com.tenlion.service.traininginstitutionuser.ITrainingInstitutionUserService;
import cn.com.tenlion.service.traininginstitutionworktype.ITrainingInstitutionWorkTypeService;
import cn.com.tenlion.service.worktype.IWorkTypeService;
import cn.com.tenlion.util.IdCardVerifyUtil;
import cn.com.tenlion.util.SignUpUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
@ -121,27 +123,28 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
/**
* 修改报名机构
*
* @param targetId 目标id
* @param sourceIds 源id
*/
public void updateInstitutionId(String targetId,List<String> sourceIds){
public void updateInstitutionId(String targetId, List<String> sourceIds) {
InstitutionDTO institutionDTO = iInstitutionService.get(targetId);
if(institutionDTO == null){
if (institutionDTO == null) {
throw new SearchException("未查询到目标机构信息");
}
Map<String,Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>();
for (String sourceId : sourceIds) {
params.put("applyInstitutionId",sourceId);
params.put("applyInstitutionId", sourceId);
List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
applyAuditStates.add("2");
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
//查询源报名的人
List<ApplyDTO> applyDTOList = this.list(params);
for (ApplyDTO applyDTO : applyDTOList) {
Map<String,Object> updateParams = new HashMap<>(8);
updateParams.put("applyId",applyDTO.getApplyId());
updateParams.put("applyInstitutionId",targetId);
Map<String, Object> updateParams = new HashMap<>(8);
updateParams.put("applyId", applyDTO.getApplyId());
updateParams.put("applyInstitutionId", targetId);
setUpdateInfo(updateParams);
applyDao.update(updateParams);
//增加操作日志
@ -149,19 +152,18 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
auditLogVO.setApplyId(applyDTO.getApplyId());
auditLogVO.setApplyAuditState(0);
InstitutionDTO sourceInstitutionDTO = iInstitutionService.get(applyDTO.getApplyInstitutionId());
if(sourceInstitutionDTO == null){
if (sourceInstitutionDTO == null) {
throw new SearchException("未查询到源机构信息");
}
auditLogVO.setApplyAuditExplain("【因报名人数不足,无法开班】 报名培训机构 由原【"+sourceInstitutionDTO.getInstitutionName()+"】培训机构 调整到【"+institutionDTO.getInstitutionName()+"】培训机构");
applyAuditLogService.save(null,auditLogVO);
auditLogVO.setApplyAuditExplain("【因报名人数不足,无法开班】 报名培训机构 由原【" + sourceInstitutionDTO.getInstitutionName() + "】培训机构 调整到【" + institutionDTO.getInstitutionName() + "】培训机构");
applyAuditLogService.save(null, auditLogVO);
}
}
}
@Override
public String saveRelationReturnId(ApplyVO applyVO){
public String saveRelationReturnId(ApplyVO applyVO) {
String applyId = UUIDUtil.getUUID();
String userId = "";
Map<String, Object> params = HashMapUtil.beanToMap(applyVO);
@ -171,14 +173,14 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
params.put("gmtModified", DateUtil.getTime());
params.put("isDelete", 0);
UserDTO userDTO = userService.getByUsername(applyVO.getApplyPhone());
if(userDTO == null){
if (userDTO == null) {
UserVO userVO = new UserVO();
userVO.setUserUsername(applyVO.getApplyPhone());
userVO.setUserPassword(defaultPassword);
userVO.setUserName(applyVO.getApplyName());
userVO.setUserType(1);
userVO.setUserState(0);
userId = userService.saveAndReturnId(userVO,false);
userId = userService.saveAndReturnId(userVO, false);
Map<String, Object> basic = new HashMap<>();
basic.put("bindUserAccount", userId);
basic.put("userPhotoId", applyVO.getApplyUserCardPhoto());
@ -191,17 +193,17 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
basic.put("gmtModified", DateUtil.getTime());
basic.put("isDelete", "0");
basicUserInfoDao.save(basic);
}else{
} else {
userId = userDTO.getUserId();
}
params.put("bindUserAccount", userId);
params.put("creator", userId);
params.put("modifier", userId);
// 将健康状况和证件类型填写为默认值
params.put("applyHealth","合格");
params.put("applyCardType","b7d74045-d984-4822-b0f3-711b15b933ca");
params.put("originEducationPhoto",applyVO.getEducationPhoto());
checkSaveData(userId,applyVO);
params.put("applyHealth", "合格");
params.put("applyCardType", "b7d74045-d984-4822-b0f3-711b15b933ca");
params.put("originEducationPhoto", applyVO.getEducationPhoto());
checkSaveData(userId, applyVO);
applyDao.save(params);
return applyId;
}
@ -213,23 +215,23 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
public List<ApplyPO> listByInstitutionIdAndWorkTypeId(String institutionId,String workTypeId){
public List<ApplyPO> listByInstitutionIdAndWorkTypeId(String institutionId, String workTypeId) {
Map<String, Object> params = new HashMap<>();
params.put("applyInstitutionId",institutionId);
params.put("applyWorkTypeId",workTypeId);
params.put("applyInstitutionId", institutionId);
params.put("applyWorkTypeId", workTypeId);
List<Integer> applyAuditStates = new ArrayList<>();
applyAuditStates.add(2);
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
return this.listPO(params);
}
public SuccessResultList<List<ApplyDTO>> listPageMyApply(String token,ListPage page){
public SuccessResultList<List<ApplyDTO>> listPageMyApply(String token, ListPage page) {
if (StringUtils.isBlank(token)) {
page.getParams().put("creator",securityComponent.getCurrentUser().getUserId());
page.getParams().put("creator", securityComponent.getCurrentUser().getUserId());
} else {
AppTokenUser appTokenUser = getAppTokenUser(token);
page.getParams().put("creator",appTokenUser.getId());
page.getParams().put("creator", appTokenUser.getId());
}
PageHelper.startPage(page.getPage(), page.getRows());
List<ApplyDTO> applyDTOs = list(page.getParams());
@ -243,13 +245,13 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
states.add("1");
states.add("2");
states.add("-1");
Integer num2 = countApplyNum(applyDTO.getApplyWorkTypeId(),applyDTO.getApplyInstitutionId(),states);
Integer num2 = countApplyNum(applyDTO.getApplyWorkTypeId(), applyDTO.getApplyInstitutionId(), states);
//统计机构报名审核通过数量
states.clear();
states.add("2");
Integer num3 = countApplyNum(applyDTO.getApplyWorkTypeId(),applyDTO.getApplyInstitutionId(),states);
Integer num3 = countApplyNum(applyDTO.getApplyWorkTypeId(), applyDTO.getApplyInstitutionId(), states);
Object applyClassPlanUserNum = ConfigManager.getInstance().getConfig().get("applyClassPlanUserNum");
applyDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0:Integer.valueOf(applyClassPlanUserNum.toString()));
applyDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0 : Integer.valueOf(applyClassPlanUserNum.toString()));
applyDTO.setApplyUserNum2(num2);
applyDTO.setApplyUserNum3(num3);
// 返回当前工种父工种
@ -261,77 +263,76 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
public void audit(String token,ApplyAuditVO applyAuditVO){
public void audit(String token, ApplyAuditVO applyAuditVO) {
ApplyDTO applyDTO = this.get(applyAuditVO.getApplyId());
if(applyDTO == null){
if (applyDTO == null) {
throw new SearchException("未获取到报名信息");
}
updateAuditState(token,applyAuditVO);
updateAuditState(token, applyAuditVO);
}
public SuccessResultList<List<ApplyClassPlanDTO>> listPageApplyClassPlan(ListPage page) throws Exception{
List<ApplyClassPlanDTO> list= new ArrayList<>();
public SuccessResultList<List<ApplyClassPlanDTO>> listPageApplyClassPlan(ListPage page) throws Exception {
List<ApplyClassPlanDTO> list = new ArrayList<>();
String applyCardNumber = page.getParams().get("applyCardNumber").toString();
String workerCatalog = page.getParams().get("workerCatalog").toString();
String planType = page.getParams().get("planType").toString();
page.getParams().put("reportType",2);
page.getParams().put("signNowDate",DateUtil.getTime());
if(StringUtils.isBlank(applyCardNumber)){
page.getParams().put("reportType", 2);
page.getParams().put("signNowDate", DateUtil.getTime());
if (StringUtils.isBlank(applyCardNumber)) {
throw new ParamsException("请填写证件号");
}
if(StringUtils.isBlank(workerCatalog)){
if (StringUtils.isBlank(workerCatalog)) {
throw new ParamsException("请选择报考工种");
}
if(StringUtils.isBlank(planType)){
if (StringUtils.isBlank(planType)) {
throw new ParamsException("请选择报考类型");
}
PageHelper.startPage(page.getPage(), page.getRows());
SuccessResultList<List<ClassPlanDTO>> classPlanDTOList = classPlanService.listSignUpPage(page);
for (ClassPlanDTO classPlanDTO : classPlanDTOList.getRows()) {
ApplyClassPlanDTO applyClassPlanDTO = new ApplyClassPlanDTO();
int applyClassPlanState = countApplyCardNumber(applyCardNumber,classPlanDTO.getClassPlanId());
applyClassPlanDTO.setApplyClassPlanState(applyClassPlanState == 0 ? 0:1);
int applyClassPlanState = countApplyCardNumber(applyCardNumber, classPlanDTO.getClassPlanId());
applyClassPlanDTO.setApplyClassPlanState(applyClassPlanState == 0 ? 0 : 1);
applyClassPlanDTO.setApplyClassPlanUserNumber(countApplyClassNumber(classPlanDTO.getClassPlanId()));
BeanUtils.copyProperties(applyClassPlanDTO,classPlanDTO);
BeanUtils.copyProperties(applyClassPlanDTO, classPlanDTO);
list.add(applyClassPlanDTO);
}
return new SuccessResultList<>(list, classPlanDTOList.getPage(), classPlanDTOList.getTotal());
}
public List<ApplyWorkTypeInstitutionDTO> listApplyWorkType(String token,Map<String,Object> params) throws Exception{
public List<ApplyWorkTypeInstitutionDTO> listApplyWorkType(String token, Map<String, Object> params) throws Exception {
String workTypeId = params.get("workTypeId").toString();
AppTokenUser appTokenUser = getAppTokenUser(token);
List<ApplyWorkTypeInstitutionDTO> list= new ArrayList<>();
if(StringUtils.isBlank(workTypeId)){
List<ApplyWorkTypeInstitutionDTO> list = new ArrayList<>();
if (StringUtils.isBlank(workTypeId)) {
throw new ParamsException("请选择报考的工种");
}
List<TrainingInstitutionWorkTypeDTO> trainingInstitutionWorkTypeList = trainingInstitutionWorkTypeService.list(params);
for (TrainingInstitutionWorkTypeDTO row : trainingInstitutionWorkTypeList) {
ApplyWorkTypeInstitutionDTO trainingInstitutionWorkTypeDTO = new ApplyWorkTypeInstitutionDTO();
InstitutionDTO institutionDTO = iInstitutionService.get(row.getInstitutionId());
BeanUtils.copyProperties(trainingInstitutionWorkTypeDTO,institutionDTO);
BeanUtils.copyProperties(trainingInstitutionWorkTypeDTO, institutionDTO);
//统计机构报名数量
List<String> states = new ArrayList<>();
states.add("0");
states.add("1");
states.add("2");
states.add("-1");
Integer num2 = countApplyNum(workTypeId,row.getInstitutionId(),states);
Integer num2 = countApplyNum(workTypeId, row.getInstitutionId(), states);
//统计机构报名审核通过数量
states.clear();
states.add("2");
Integer num3 = countApplyNum(workTypeId,row.getInstitutionId(),states);
Integer num3 = countApplyNum(workTypeId, row.getInstitutionId(), states);
Object applyClassPlanUserNum = ConfigManager.getInstance().getConfig().get("applyClassPlanUserNum");
trainingInstitutionWorkTypeDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0:Integer.valueOf(applyClassPlanUserNum.toString()));
trainingInstitutionWorkTypeDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0 : Integer.valueOf(applyClassPlanUserNum.toString()));
trainingInstitutionWorkTypeDTO.setApplyUserNum2(num2);
trainingInstitutionWorkTypeDTO.setApplyUserNum3(num3);
//判断当前机构是否可以报名
if(checkApplyIsFirst(appTokenUser.getId(),workTypeId,row.getInstitutionId()) != 0){
if (checkApplyIsFirst(appTokenUser.getId(), workTypeId, row.getInstitutionId()) != 0) {
trainingInstitutionWorkTypeDTO.setApplyStatus("applyFalse");
}else{
Boolean b = examCheckService.getExamCheckFailOrBack(workTypeId,row.getInstitutionId());
trainingInstitutionWorkTypeDTO.setApplyStatus(b == true ? "applyTrue":"examCheckFalse");
} else {
Boolean b = examCheckService.getExamCheckFailOrBack(workTypeId, row.getInstitutionId());
trainingInstitutionWorkTypeDTO.setApplyStatus(b == true ? "applyTrue" : "examCheckFalse");
}
TrainingInstitutionServiceUserDTO byByInstitutionId = trainingInstitutionServiceUserService.getByByInstitutionId(row.getInstitutionId());
trainingInstitutionWorkTypeDTO.setQrCode(byByInstitutionId != null ? byByInstitutionId.getServiceUserCode() : "");
@ -342,13 +343,11 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(String token,ListPage page) throws Exception{
public SuccessResultList<List<ApplyWorkTypeInstitutionDTO>> listPageApplyWorkType(String token, ListPage page) throws Exception {
AppTokenUser appTokenUser = getAppTokenUser(token);
List<ApplyWorkTypeInstitutionDTO> list= new ArrayList<>();
List<ApplyWorkTypeInstitutionDTO> list = new ArrayList<>();
String workTypeId = page.getParams().get("workTypeId").toString();
if(StringUtils.isBlank(workTypeId)){
if (StringUtils.isBlank(workTypeId)) {
throw new ParamsException("请选择报考的工种");
}
PageHelper.startPage(page.getPage(), page.getRows());
@ -356,29 +355,29 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
for (TrainingInstitutionWorkTypeDTO row : trainingInstitutionWorkTypeList.getRows()) {
ApplyWorkTypeInstitutionDTO trainingInstitutionWorkTypeDTO = new ApplyWorkTypeInstitutionDTO();
InstitutionDTO institutionDTO = iInstitutionService.get(row.getInstitutionId());
BeanUtils.copyProperties(trainingInstitutionWorkTypeDTO,institutionDTO);
BeanUtils.copyProperties(trainingInstitutionWorkTypeDTO, institutionDTO);
//统计机构报名数量
List<String> states = new ArrayList<>();
states.add("0");
states.add("1");
states.add("2");
states.add("-1");
Integer num2 = countApplyNum(workTypeId,row.getInstitutionId(),states);
Integer num2 = countApplyNum(workTypeId, row.getInstitutionId(), states);
//统计机构报名审核通过数量
states.clear();
states.add("2");
Integer num3 = countApplyNum(workTypeId,row.getInstitutionId(),states);
Integer num3 = countApplyNum(workTypeId, row.getInstitutionId(), states);
Object applyClassPlanUserNum = ConfigManager.getInstance().getConfig().get("applyClassPlanUserNum");
trainingInstitutionWorkTypeDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0:Integer.valueOf(applyClassPlanUserNum.toString()));
trainingInstitutionWorkTypeDTO.setApplyUserNum1(applyClassPlanUserNum == null ? 0 : Integer.valueOf(applyClassPlanUserNum.toString()));
trainingInstitutionWorkTypeDTO.setApplyUserNum2(num2);
trainingInstitutionWorkTypeDTO.setApplyUserNum3(num3);
//判断当前机构是否可以报名
//判断当前机构是否可以报名
if(checkApplyIsFirst(appTokenUser.getId(),workTypeId,row.getInstitutionId()) != 0){
if (checkApplyIsFirst(appTokenUser.getId(), workTypeId, row.getInstitutionId()) != 0) {
trainingInstitutionWorkTypeDTO.setApplyStatus("applyFalse");
}else{
Boolean b = examCheckService.getExamCheckFailOrBack(workTypeId,row.getInstitutionId());
trainingInstitutionWorkTypeDTO.setApplyStatus(b == true ? "applyTrue":"examCheckFalse");
} else {
Boolean b = examCheckService.getExamCheckFailOrBack(workTypeId, row.getInstitutionId());
trainingInstitutionWorkTypeDTO.setApplyStatus(b == true ? "applyTrue" : "examCheckFalse");
}
trainingInstitutionWorkTypeDTO.setQrCode(createQrCode(row.getInstitutionId()));
@ -388,10 +387,10 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
return new SuccessResultList<>(list, trainingInstitutionWorkTypeList.getPage(), trainingInstitutionWorkTypeList.getTotal());
}
public String createQrCode(String id) throws Exception{
String content = serverProperties.getUrl()+"/approute/traininginstitutionroute/get-qrcode-view/"+id;
public String createQrCode(String id) throws Exception {
String content = serverProperties.getUrl() + "/approute/traininginstitutionroute/get-qrcode-view/" + id;
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ImageIO.write(QRCodeUtil.createQrCode(150,150,content,null), "png", stream);
ImageIO.write(QRCodeUtil.createQrCode(150, 150, content, null), "png", stream);
// 对字节数组Base64编码
Base64 base = new Base64();
String base64 = base.encodeToString(stream.toByteArray());
@ -399,19 +398,15 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
public List<ApplyDTO> listByClassId(String classId){
if(StringUtils.isBlank(classId)){
public List<ApplyDTO> listByClassId(String classId) {
if (StringUtils.isBlank(classId)) {
throw new SearchException("获取失败");
}
List<Integer> applyAuditStates = new ArrayList<>();
applyAuditStates.add(3);
Map<String, Object> params = new HashMap<>();
params.put("applyClassId",classId);
params.put("applyAuditStates",applyAuditStates);
params.put("applyClassId", classId);
params.put("applyAuditStates", applyAuditStates);
return this.list(params);
}
@ -442,33 +437,31 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
setAppSaveInfo(token, params);
}
//检查报名数据
checkSaveData(params.get("creator").toString(),applyVO);
checkSaveData(params.get("creator").toString(), applyVO);
// 健康状况默认为合格
params.put("applyHealth",params.get("applyHealth") == null ? "合格" : params.get("applyHealth"));
params.put("applyHealth", params.get("applyHealth") == null ? "合格" : params.get("applyHealth"));
applyDao.save(params);
//增加操作日志
ApplyAuditLogVO auditLogVO = new ApplyAuditLogVO();
auditLogVO.setApplyId(applyId);
auditLogVO.setApplyAuditState(0);
auditLogVO.setApplyAuditExplain("用户申请报名");
applyAuditLogService.save(token,auditLogVO);
applyAuditLogService.save(token, auditLogVO);
return applyId;
}
public void checkSaveData(String creator,ApplyVO applyVO){
public void checkSaveData(String creator, ApplyVO applyVO) {
String applyWorkTypeId = applyVO.getApplyWorkTypeId();
String applyInstitutionId = applyVO.getApplyInstitutionId();
if(checkApplyIsFirst(creator,applyWorkTypeId,applyInstitutionId) != 0){
throw new SaveException(applyVO.getApplyName() + "[" + applyVO.getApplyPhone() +
"]: 已经报名,若姓名与手机号不符,可能是手机号被注册,请联系管理人员处理或更换手机号");
if (checkApplyIsFirst(creator, applyWorkTypeId, applyInstitutionId) != 0) {
throw new SaveException(applyVO.getApplyName() + "[" + applyVO.getApplyPhone() + "]: 已经报名,若姓名与手机号不符,可能是手机号被注册,请联系管理人员处理或更换手机号");
}
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
throw new SaveException(applyVO.getApplyName() + "[" + applyVO.getApplyPhone() +
"]: 已报名其他培训机构,请勿重复报名");
if (checkApplyIsFirst(creator, applyWorkTypeId, null) != 0) {
throw new SaveException(applyVO.getApplyName() + "[" + applyVO.getApplyPhone() + "]: 已报名其他培训机构,请勿重复报名");
}
if(!examCheckService.getExamCheckFailOrBack(applyWorkTypeId,applyInstitutionId)){
if (!examCheckService.getExamCheckFailOrBack(applyWorkTypeId, applyInstitutionId)) {
throw new SaveException("已经提交开班计划,无法在审核过程中添加学员");
}
//最低学历效验
@ -512,41 +505,40 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
// }
}
public void checkUpdateData(String creator,String applyId,ApplyVO applyVO){
public void checkUpdateData(String creator, String applyId, ApplyVO applyVO) {
String applyWorkTypeId = applyVO.getApplyWorkTypeId();
String applyInstitutionId = applyVO.getApplyInstitutionId();
ApplyDTO applyDTO = this.get(applyId);
if(applyDTO == null){
if (applyDTO == null) {
throw new SearchException("未获取到报名信息");
}
if(!(applyDTO.getApplyAuditState() == -1 || applyDTO.getApplyAuditState() == 1)){
if (!(applyDTO.getApplyAuditState() == -1 || applyDTO.getApplyAuditState() == 1)) {
throw new SearchException("暂不能修改信息");
}
// if(!(applyDTO.getApplyInstitutionId().equals(applyInstitutionId) && applyDTO.getApplyWorkTypeId().equals(applyWorkTypeId))){
// throw new SaveException("您选择的工种已经在其他培训机构报名过!请勿重新报名");
// }
if(checkApplyIsFirst(creator,applyWorkTypeId,null) != 0){
if (checkApplyIsFirst(creator, applyWorkTypeId, null) != 0) {
throw new SaveException("您选择的工种已经在其他培训机构报名过!请勿重新报名");
}
if(!examCheckService.getExamCheckFailOrBack(applyWorkTypeId,applyInstitutionId)){
if (!examCheckService.getExamCheckFailOrBack(applyWorkTypeId, applyInstitutionId)) {
throw new SaveException("该机构以截止报名");
}
//最低学历效验
WorkTypeDTO workTypeDTO = workTypeService.get(applyWorkTypeId);
if(workTypeDTO == null){
if (workTypeDTO == null) {
throw new SaveException("未获取到工种信息");
}
String workTypeEducation = workTypeDTO.getWorkTypeEducation();
if(!StringUtils.isBlank(workTypeEducation)){
if (!StringUtils.isBlank(workTypeEducation)) {
DataDTO workTypeEducationDTO = dataService.get(workTypeEducation);//工种配置最低学历
DataDTO applyCultureLevelDTO = dataService.get(applyVO.getApplyCultureLevel());//报名学历
if(!(Integer.valueOf(applyCultureLevelDTO.getDataSort()) <= Integer.valueOf(workTypeEducationDTO.getDataSort()))){
if (!(Integer.valueOf(applyCultureLevelDTO.getDataSort()) <= Integer.valueOf(workTypeEducationDTO.getDataSort()))) {
throw new SaveException("您不满足报名工种的最低学历");
}
}
@ -554,8 +546,6 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
@Override
public void remove(List<String> ids) {
remove(null, ids);
@ -597,7 +587,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
//checkUpdateData(params.get("modifier").toString(),applyId,applyVO);
if(!examCheckService.getExamCheckFailOrBack(applyVO.getApplyWorkTypeId(), applyVO.getApplyInstitutionId())){
if (!examCheckService.getExamCheckFailOrBack(applyVO.getApplyWorkTypeId(), applyVO.getApplyInstitutionId())) {
throw new SaveException("该机构以截止报名");
}
Map<String, Object> query = new HashMap<>();
@ -613,7 +603,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
auditLogVO.setApplyId(applyId);
auditLogVO.setApplyAuditState(0);
auditLogVO.setApplyAuditExplain("用户更新报名信息");
applyAuditLogService.save(token,auditLogVO);
applyAuditLogService.save(token, auditLogVO);
}
@Override
@ -628,7 +618,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
@Override
public ApplyDTO get(Map<String, Object> params) {
ApplyDTO applyDTO = applyDao.get(params);
if(applyDTO == null){
if (applyDTO == null) {
return null;
}
WorkTypeDTO workTypeDTO = workTypeService.get(applyDTO.getApplyWorkTypeId());
@ -685,19 +675,24 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
@Override
public SuccessResultList<List<ApplyDTO>> listPage(ListPage page) {
if(page.getParams().get("applyInstitutionId") == null
|| "".equals(page.getParams().get("applyInstitutionId").toString())){
if (page.getParams().get("applyInstitutionId") == null || "".equals(page.getParams().get("applyInstitutionId").toString())) {
throw new SearchException("机构信息丢失,无法查看人员列表");
}
PageHelper.startPage(page.getPage(), page.getRows());
List<ApplyDTO> applyDTOs = list(page.getParams());
for(ApplyDTO item : applyDTOs){
if(item.getApplyWorkTypeId() == null || "".equals(item.getApplyWorkTypeId())){
for (ApplyDTO item : applyDTOs) {
if (item.getApplyWorkTypeId() == null || "".equals(item.getApplyWorkTypeId())) {
continue;
}
WorkTypeDTO workTypeDTO = workTypeService.get(item.getApplyWorkTypeId());
item.setApplyParentWorkTypeId(workTypeDTO.getWorkTypeParentId());
item.setApplyParentWorkTypeName(workTypeDTO.getWorkTypeParentName());
item.setMaxAge(SignUpUtil.getMaxAge(item.getApplyLeiBie(), item.getApplyCardNumber()));
if (IdCardVerifyUtil.isIDCard(item.getApplyCardNumber())) {
item.setAge(IdCardVerifyUtil.getIdCardAge(item.getApplyCardNumber()));
} else {
item.setAge(-1);
}
}
PageInfo<ApplyDTO> pageInfo = new PageInfo<>(applyDTOs);
return new SuccessResultList<>(applyDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
@ -707,25 +702,25 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
/**
* 统计当前登录账号 报名的培训计划的次数不包括撤回
*/
public Integer countApplyClassIdCreator(String creator,String applyClassId){
public Integer countApplyClassIdCreator(String creator, String applyClassId) {
Map<String, Object> params = new HashMap<>();
params.put("creator",creator);
params.put("applyClassId",applyClassId);
params.put("creator", creator);
params.put("applyClassId", applyClassId);
List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
applyAuditStates.add("2");
applyAuditStates.add("3");
applyAuditStates.add("-1");
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
public Integer countApplyNum(String applyWorkTypeId,String applyInstitutionId,List<String> applyAuditStates){
public Integer countApplyNum(String applyWorkTypeId, String applyInstitutionId, List<String> applyAuditStates) {
Map<String, Object> params = new HashMap<>();
params.put("applyWorkTypeId",applyWorkTypeId);
params.put("applyInstitutionId",applyInstitutionId);
params.put("applyAuditStates",applyAuditStates);
params.put("applyWorkTypeId", applyWorkTypeId);
params.put("applyInstitutionId", applyInstitutionId);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
@ -733,46 +728,47 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
/**
* 统计证件号码 报名的培训计划的次数不包括撤回
*/
public Integer countApplyCardNumber(String applyCardNumber,String applyClassId){
public Integer countApplyCardNumber(String applyCardNumber, String applyClassId) {
Map<String, Object> params = new HashMap<>();
params.put("applyCardNumber",applyCardNumber);
params.put("applyClassId",applyClassId);
params.put("applyCardNumber", applyCardNumber);
params.put("applyClassId", applyClassId);
List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
applyAuditStates.add("2");
applyAuditStates.add("3");
applyAuditStates.add("-1");
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
/**
* 统计计划报名人数不包括审核未通过撤回状态
*/
public Integer countApplyClassNumber(String applyClassId){
public Integer countApplyClassNumber(String applyClassId) {
Map<String, Object> params = new HashMap<>();
params.put("applyClassId",applyClassId);
params.put("applyClassId", applyClassId);
List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
applyAuditStates.add("2");
applyAuditStates.add("3");
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
/**
* 检查当前报名人的工种和培训机构是否唯一不包括审核未通过撤回状态
*/
public Integer checkApplyIsFirst(String creator,String applyWorkTypeId,String applyInstitutionId){
public Integer checkApplyIsFirst(String creator, String applyWorkTypeId, String applyInstitutionId) {
Map<String, Object> params = new HashMap<>();
params.put("applyWorkTypeId",applyWorkTypeId);
params.put("applyInstitutionId",applyInstitutionId);
params.put("creator",creator);
params.put("applyWorkTypeId", applyWorkTypeId);
params.put("applyInstitutionId", applyInstitutionId);
params.put("creator", creator);
List<String> applyAuditStates = new ArrayList<>();
applyAuditStates.add("0");
//applyAuditStates.add("1");
applyAuditStates.add("2");
//applyAuditStates.add("-1");
params.put("applyAuditStates",applyAuditStates);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
@ -783,12 +779,12 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
}
@Override
public void updateAuditState(String token, ApplyAuditVO applyAuditVO){
public void updateAuditState(String token, ApplyAuditVO applyAuditVO) {
Map<String, Object> params = new HashMap<>();
params.put("applyId",applyAuditVO.getApplyId());
params.put("applyId", applyAuditVO.getApplyId());
ApplyDTO applyDTO = applyDao.get(params);
params.put("applyAuditState",applyAuditVO.getApplyAuditState());
if(2 == applyAuditVO.getApplyAuditState()){
params.put("applyAuditState", applyAuditVO.getApplyAuditState());
if (2 == applyAuditVO.getApplyAuditState()) {
String fileId = makeWaterMark(applyDTO);
params.put("educationPhoto", fileId);
} else {
@ -800,10 +796,11 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
/**
* 给学历证书添加签名水印
*
* @param dto
* @return String 返回添加完成水印的fileId 如果出错返回 null
*/
private String makeWaterMark(ApplyDTO dto){
private String makeWaterMark(ApplyDTO dto) {
Map<String, Object> params = new HashMap<>(8);
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
@ -812,13 +809,11 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
File originFile = new File(originPO.getFilePath());
// 原图
Image srcImg = ImageIO.read(originFile);
BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null),
srcImg.getHeight(null), BufferedImage.TYPE_INT_RGB);
BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null), srcImg.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = buffImg.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null),
srcImg.getHeight(null), Image.SCALE_SMOOTH), 0, 0, null);
graphics.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null), srcImg.getHeight(null), Image.SCALE_SMOOTH), 0, 0, null);
int srcWidth = srcImg.getWidth(null);
int srcHeight = srcImg.getHeight(null);
// 水印
@ -830,10 +825,10 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
ImageIcon logoImgIcon = new ImageIcon(ImageIO.read(waterMarFile));
int logoWidth = logoImgIcon.getIconWidth();
int logoHeight = logoImgIcon.getIconHeight();
while (srcWidth * 0.8 < logoWidth){
while (srcWidth * 0.8 < logoWidth) {
logoWidth = (int) (logoWidth * 0.9);
}
while (srcHeight * 0.6 < logoHeight){
while (srcHeight * 0.6 < logoHeight) {
logoHeight = (int) (logoHeight * 0.9);
}
Image logoImg = logoImgIcon.getImage().getScaledInstance(logoWidth, logoHeight, Image.SCALE_SMOOTH);
@ -852,7 +847,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
//水印 的位置
//graphics.drawImage(logoImg, buffImg.getWidth() / 3, buffImg.getHeight() / 2, null);
// 这里默认固定在右上角
graphics.drawImage(logoImg, buffImg.getWidth() - logoWidth , 0, null);
graphics.drawImage(logoImg, buffImg.getWidth() - logoWidth, 0, null);
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
graphics.dispose();
@ -863,7 +858,7 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
MultipartFile multipartFile = new MockMultipartFile(resultFileName, resultFileName, null, input);
params.clear();
return fileService.uploadSingleByUserId("1", multipartFile, UploadTypeEnum.IMAGE, params);
} catch (Exception e){
} catch (Exception e) {
// 如果出错 返回的水印图片为空
e.printStackTrace();
return null;
@ -873,35 +868,36 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic
/**
* 统计培训机构全部计划报名人数
*
* @param applyInstitutionId 机构ID
* @param applyAuditStates 机构状态
* @return
*/
public Integer countAllApplyNum(String applyInstitutionId, List<String> applyAuditStates){
public Integer countAllApplyNum(String applyInstitutionId, List<String> applyAuditStates) {
Map<String, Object> params = new HashMap<>();
params.put("applyInstitutionId",applyInstitutionId);
params.put("applyAuditStates",applyAuditStates);
params.put("applyInstitutionId", applyInstitutionId);
params.put("applyAuditStates", applyAuditStates);
return count(params);
}
public Map<String, Object> countWeekNum(String weekTime,String applyInstitutionId,String applyWorkTypeId) {
public Map<String, Object> countWeekNum(String weekTime, String applyInstitutionId, String applyWorkTypeId) {
Map<String, Object> params = new HashMap<>();
params.put("weekTime",weekTime);
params.put("applyInstitutionId",applyInstitutionId);
params.put("applyWorkTypeId",applyWorkTypeId);
params.put("weekTime", weekTime);
params.put("applyInstitutionId", applyInstitutionId);
params.put("applyWorkTypeId", applyWorkTypeId);
Map<String, Object> result = applyDao.countWeekNum(params);
if(result == null){
if (result == null) {
params.clear();
params.put("0",0);
params.put("1",0);
params.put("2",0);
params.put("3",0);
params.put("-1",0);
params.put("weekTime",weekTime);
params.put("0", 0);
params.put("1", 0);
params.put("2", 0);
params.put("3", 0);
params.put("-1", 0);
params.put("weekTime", weekTime);
return params;
}
result.put("weekTime",weekTime);
result.put("weekTime", weekTime);
return result;
}
}

View File

@ -17,6 +17,8 @@ import cn.com.tenlion.service.applystudentsnew.IApplyStudentsNewService;
import cn.com.tenlion.service.classplan.IClassPlanService;
import cn.com.tenlion.service.examapply.IExamApplyService;
import cn.com.tenlion.service.worktype.IWorkTypeService;
import cn.com.tenlion.util.IdCardVerifyUtil;
import cn.com.tenlion.util.SignUpUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import ink.wgink.common.base.DefaultBaseService;
@ -271,6 +273,12 @@ public class ApplyStudentsServiceImpl extends DefaultBaseService implements IApp
Iterator<ApplyStudentsDTO> applyStudentsDTOIterator = list.iterator();
while (applyStudentsDTOIterator.hasNext()) {
ApplyStudentsDTO applyStudentsDTO = applyStudentsDTOIterator.next();
applyStudentsDTO.setMaxAge(SignUpUtil.getMaxAge(applyStudentsDTO.getApplyLeiBie(), applyStudentsDTO.getApplyCardNumber()));
if (IdCardVerifyUtil.isIDCard(applyStudentsDTO.getApplyCardNumber())) {
applyStudentsDTO.setAge(IdCardVerifyUtil.getIdCardAge(applyStudentsDTO.getApplyCardNumber()));
} else {
applyStudentsDTO.setAge(-1);
}
if(null != searchClassPlanDto) {
if(!searchClassPlanDto.getClassPlanId().equals(applyStudentsDTO.getApplyClassId())) {
applyStudentsDTOIterator.remove();
@ -344,4 +352,8 @@ public class ApplyStudentsServiceImpl extends DefaultBaseService implements IApp
return count == null ? 0 : count;
}
private void setMarkAge(List<ApplyStudentsDTO> applyStudentsDTOS) {
}
}

View File

@ -1,5 +1,14 @@
package cn.com.tenlion.util;
import ink.wgink.exceptions.base.SystemException;
import ink.wgink.interfaces.consts.ISystemConstant;
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.Years;
import org.joda.time.format.DateTimeFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -9,11 +18,13 @@ import java.util.Map;
/**
* 1518位身份证号验证工具类
*
* @author renpc
*/
public class IdCardVerifyUtil {
final static Map<Integer, String> zoneNum = new HashMap<Integer, String>();
static {
zoneNum.put(11, "北京");
zoneNum.put(12, "天津");
@ -52,7 +63,7 @@ public class IdCardVerifyUtil {
}
final static int[] PARITYBIT = {'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
final static int[] POWER_LIST = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
final static int[] POWER_LIST = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
public IdCardVerifyUtil() {
@ -60,66 +71,67 @@ public class IdCardVerifyUtil {
/**
* 身份证验证
*@param certNo 号码内容
*@return 是否有效 null和"" 都是false
*
* @param certNo 号码内容
* @return 是否有效 null和"" 都是false
*/
public static boolean isIDCard(String certNo){
if(certNo == null || (certNo.length() != 15 && certNo.length() != 18)){
public static boolean isIDCard(String certNo) {
if (certNo == null || (certNo.length() != 15 && certNo.length() != 18)) {
return false;
}
final char[] cs = certNo.toUpperCase().toCharArray();
//校验位数
int power = 0;
for(int i=0; i<cs.length; i++){
if(i==cs.length-1 && cs[i] == 'X'){
for (int i = 0; i < cs.length; i++) {
if (i == cs.length - 1 && cs[i] == 'X') {
break;//最后一位可以 是X或x
}
if(cs[i]<'0' || cs[i]>'9'){
if (cs[i] < '0' || cs[i] > '9') {
return false;
}
if(i < cs.length -1){
if (i < cs.length - 1) {
power += (cs[i] - '0') * POWER_LIST[i];
}
}
//校验区位码
if(!zoneNum.containsKey(Integer.valueOf(certNo.substring(0,2)))){
if (!zoneNum.containsKey(Integer.valueOf(certNo.substring(0, 2)))) {
return false;
}
//校验年份
String year = null;
year = certNo.length() == 15 ? getIdCardCalendar(certNo):certNo.substring(6, 10);
year = certNo.length() == 15 ? getIdCardCalendar(certNo) : certNo.substring(6, 10);
final int iyear = Integer.parseInt(year);
if(iyear < 1900 || iyear > Calendar.getInstance().get(Calendar.YEAR)){
if (iyear < 1900 || iyear > Calendar.getInstance().get(Calendar.YEAR)) {
//1900年的PASS超过今年的PASS
return false;
}
//校验月份
String month = certNo.length() == 15 ? certNo.substring(8, 10) : certNo.substring(10,12);
String month = certNo.length() == 15 ? certNo.substring(8, 10) : certNo.substring(10, 12);
final int imonth = Integer.parseInt(month);
if(imonth <1 || imonth >12){
if (imonth < 1 || imonth > 12) {
return false;
}
//校验天数
String day = certNo.length() ==15 ? certNo.substring(10, 12) : certNo.substring(12, 14);
String day = certNo.length() == 15 ? certNo.substring(10, 12) : certNo.substring(12, 14);
final int iday = Integer.parseInt(day);
if(iday < 1 || iday > 31){
if (iday < 1 || iday > 31) {
return false;
}
//校验"校验码"
if(certNo.length() == 15){
if (certNo.length() == 15) {
return true;
}
return cs[cs.length -1 ] == PARITYBIT[power % 11];
return cs[cs.length - 1] == PARITYBIT[power % 11];
}
private static String getIdCardCalendar(String certNo){
private static String getIdCardCalendar(String certNo) {
// 获取出生年月日
String birthday = certNo.substring(6, 12);
SimpleDateFormat ft = new SimpleDateFormat("yyMMdd");
@ -137,67 +149,74 @@ public class IdCardVerifyUtil {
/**
* 获取身份证号中的出生日期
*
* @param cardNo 身份证号
* @return xxxx-xx-xx
*/
public static String getIdCardBirthday(String cardNo) {
try {
if(cardNo == null || cardNo.length() == 0){
if (cardNo == null || cardNo.length() == 0) {
return "身份证号为空";
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
if(cardNo.length() == 15){
String birthday = "19" + cardNo.substring(6,12);
if (cardNo.length() == 15) {
String birthday = "19" + cardNo.substring(6, 12);
Date date = sdf.parse(birthday);
sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);
}
if(cardNo.length() == 18){
String birthday = cardNo.substring(6,14);
if (cardNo.length() == 18) {
String birthday = cardNo.substring(6, 14);
Date date = sdf.parse(birthday);
sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(date);
}
} catch (Exception e){}
return "";
} catch (Exception e) {
throw new SystemException(e);
}
throw new SystemException("身份证格式异常");
}
public static Integer getIdCardAge(String cardNo) {
String birthday = getIdCardBirthday(cardNo);
DateTime nowDateTime = DateTime.now();
DateTime birthdayDateTime = DateTime.parse(birthday, DateTimeFormat.forPattern(ISystemConstant.DATE_FORMATTER_YYYY_MM_DD));
return Years.yearsBetween(birthdayDateTime, nowDateTime).getYears();
}
/**
* 获取身份证号中的性别
*
* @param cardNo
* @return -1 无法获取 1男性0女性
*/
public static String getIdCardGender(String cardNo){
public static String getIdCardGender(String cardNo) {
try {
if(cardNo == null || cardNo.length() == 0){
if (cardNo == null || cardNo.length() == 0) {
return "-1";
}
if(cardNo.length() == 15){
if (cardNo.length() == 15) {
String genderCode = cardNo.substring(cardNo.length() - 1);
int res = Integer.parseInt(genderCode);
if(res % 2 == 0){
if (res % 2 == 0) {
return "0";
} else {
return "1";
}
}
if(cardNo.length() == 18){
if (cardNo.length() == 18) {
String genderCode = cardNo.substring(cardNo.length() - 2, cardNo.length() - 1);
int res = Integer.parseInt(genderCode);
if(res % 2 == 0){
if (res % 2 == 0) {
return "0";
} else {
return "1";
}
}
} catch (Exception e){}
return "-1";
} catch (Exception e) {
}
public static void main(String[] args) {
boolean isTrue = isIDCard("612701198410267049");
System.out.println(isTrue);
System.out.println(getIdCardGender("152822199310146919"));
return "-1";
}
}

View File

@ -0,0 +1,76 @@
package cn.com.tenlion.util;
import cn.com.tenlion.consts.ISignUpConsts;
import ink.wgink.common.manager.env.EnvManager;
import ink.wgink.common.pojo.Env;
import ink.wgink.exceptions.ParamsException;
import ink.wgink.exceptions.base.SystemException;
import org.apache.commons.lang3.StringUtils;
public class SignUpUtil {
public static Integer getMaxAge(String type, String idCard) {
if (!StringUtils.equals("安全管理人员", type) && !StringUtils.isBlank(type)) {
return -1;
}
if (!IdCardVerifyUtil.isIDCard(idCard)) {
return -1;
}
String gender = IdCardVerifyUtil.getIdCardGender(idCard);
Env env = EnvManager.getInstance().getEnv();
String maxAge = null;
// 安全管理
if (StringUtils.equals("安全管理人员", type)) {
//
if (StringUtils.equals("0", gender)) {
maxAge = env.get(ISignUpConsts.KEY_AQGL_FAMALE_MAX_AGE);
}
//
if (StringUtils.equals("1", gender)) {
maxAge = env.get(ISignUpConsts.KEY_AQGL_MALE_MAX_AGE);
}
if (StringUtils.isBlank(maxAge)) {
throw new SystemException("年龄校验失败请检查aqglFamaleMaxAge和aqglMaleMaxAge配置");
}
}
// 特种作业
if (StringUtils.isBlank(type)) {
//
if (StringUtils.equals("0", gender)) {
maxAge = env.get(ISignUpConsts.KEY_TZZY_FAMALE_MAX_AGE);
}
//
if (StringUtils.equals("1", gender)) {
maxAge = env.get(ISignUpConsts.KEY_TZZY_MALE_MAX_AGE);
}
if (StringUtils.isBlank(maxAge)) {
throw new SystemException("年龄校验失败请检查tzzyFamaleMaxAge和tzzyMaleMaxAge配置");
}
}
return Integer.parseInt(maxAge);
}
/**
* 检查身份证年龄
*
* @param type
* @param idCard
*/
public static void checkIdCardAge(String type, String idCard) {
if (!StringUtils.equals("安全管理人员", type) && !StringUtils.isBlank(type)) {
return;
}
if (!IdCardVerifyUtil.isIDCard(idCard)) {
throw new ParamsException("身份证格式错误");
}
Integer age = IdCardVerifyUtil.getIdCardAge(idCard);
Integer maxAge = getMaxAge(type, idCard);
if (maxAge == -1) {
return;
}
if (age >= maxAge) {
throw new ParamsException("身份证年龄大于或等于退休年龄:" + maxAge);
}
}
}

View File

@ -75,6 +75,25 @@
$('#add-apply-user').show();
}
function setColumnColor(age, maxAge, rowData) {
if(age === -1) {
return rowData;
}
if(maxAge === -1) {
return rowData;
}
if(maxAge - age <= 1) {
return `<div style="color: #FFFFFF; background-color: #FF0000; font-weight: bold; border-radius: 15px;">${rowData}</div>`;
}
if(maxAge - age <= 2) {
return `<div style="background-color: #FFFF00; font-weight: bold; border-radius: 15px;">${rowData}</div>`;
}
if(maxAge - age <= 3) {
return `<div style="background-color: #00FF00; font-weight: bold; border-radius: 15px;">${rowData}</div>`;
}
return rowData;
}
// 初始化表格
function initTable() {
table.render({
@ -106,8 +125,8 @@
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
return setColumnColor(row.age, row.maxAge, rowData);
},
},
{field: 'applyCardNumber', width: 180, title: '证件号码', align:'center',
templet: function(row) {
@ -115,8 +134,8 @@
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
return setColumnColor(row.age, row.maxAge, rowData);
},
},
{field: 'applyPhone', width: 140, title: '联系方式', align:'center',
templet: function(row) {
@ -124,8 +143,8 @@
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
return setColumnColor(row.age, row.maxAge, rowData);
},
},
{field: 'applyWorkTypeName', width: 140, title: '准操项目', align:'center',
templet: function(row) {
@ -134,7 +153,7 @@
return '-';
}
return rowData;
}
},
},
{field: 'applyFenLei', width: 120, title: '初训复训', align:'center',
templet: function(row) {
@ -149,7 +168,7 @@
return '<span style="color: #9900a6">换证</span>';
}
return '-';
}
},
},
{field: 'examScore', width: 100, title: '知识成绩', align:'center',
templet: function(row) {
@ -158,7 +177,7 @@
return '-';
}
return rowData + '分';
}
},
},
{field: 'examScoreHandsOn', width: 100, title: '实操成绩', align:'center',
templet: function(row) {
@ -167,14 +186,14 @@
return '-';
}
return rowData + '分';
}
},
{field: 'cz', width: 180, title: '操作', align:'center', fixed: 'right',
},
{field: 'cz', width: 140, title: '操作', align:'center', fixed: 'right',
templet: function(row) {
var rowData ='<button type="button" class="layui-btn layui-btn-xs" lay-event="show">详情</button>';
rowData +='<button type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="archivesEvent">存档表</button>'
return rowData;
}
},
},
]
],
@ -266,10 +285,12 @@
return;
}
var url = '';
if(parentWorkType == '530279c5-32a9-44db-bbf0-a04ef1cdae66'){
url = top.restAjax.path('route/classplan/save-user-register2.html?orgId={arg}&workerCatalog={arg1}', [orgId,workerCatalog]);
if(parentWorkType == '530279c5-32a9-44db-bbf0-a04ef1cdae66') {
// 企业负责人及安全管理人员
url = top.restAjax.path('route/classplan/save-user-register2.html?orgId={arg}&workerCatalog={arg1}', [orgId, workerCatalog]);
} else {
url = top.restAjax.path('route/classplan/save-user-register1.html?orgId={arg}&workerCatalog={arg1}', [orgId,workerCatalog]);
// 特种作业
url = top.restAjax.path('route/classplan/save-user-register1.html?orgId={arg}&workerCatalog={arg1}', [orgId, workerCatalog]);
}
parent.layer.open({
type: 2,

View File

@ -394,8 +394,9 @@
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var viewerObj = {};
var orgId = top.restAjax.params(window.location.href).orgId;
var workerCatalog = top.restAjax.params(window.location.href).workerCatalog;
var queryParams = top.restAjax.params(window.location.href);
var orgId = queryParams.orgId;
var workerCatalog = queryParams.workerCatalog;
$('.layui-card').height($(window).height());
@ -879,6 +880,7 @@
form.on('submit(submitForm)', function(formData) {
formData.field.applyWorkTypeId = workerCatalog;
formData.field.applyInstitutionId = orgId;
formData.field.workType = true;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;

View File

@ -926,6 +926,7 @@
form.on('submit(submitForm)', function(formData) {
formData.field.applyWorkTypeId = workerCatalog;
formData.field.applyInstitutionId = orgId;
formData.field.workType = false;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;

View File

@ -236,7 +236,7 @@
return chargePerson + '(' + chargePhone + ')';
}
},
{field: 'checkStatus', width: 150, title: '当前状态', align:'center',fixed: 'right',
{field: 'checkStatus', width: 150, title: '当前状态', align:'center',
templet: function(row) {
var rowData = row[this.field];
var point = row['point'];
@ -255,7 +255,7 @@
return rowData + '[ ' + point + ' ]';
}
},
{field: 'teacher', fixed: 'right', width: 250, title: '操作按钮', align:'left',
{field: 'teacher', fixed: 'right', width: 270, title: '操作按钮', align:'left',
templet: function(row) {
var rowData = '';
rowData += '<div class="layui-btn-group">'