diff --git a/src/main/java/cn/com/tenlion/controller/api/classplan/ClassPlanController.java b/src/main/java/cn/com/tenlion/controller/api/classplan/ClassPlanController.java index 53a9dc2..c2ef39b 100644 --- a/src/main/java/cn/com/tenlion/controller/api/classplan/ClassPlanController.java +++ b/src/main/java/cn/com/tenlion/controller/api/classplan/ClassPlanController.java @@ -109,4 +109,16 @@ public class ClassPlanController extends DefaultBaseController { return new SuccessResultData<>(classPlanService.count(params)); } + @ApiOperation(value = "修改报备状态", notes = "修改报备状态接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "classPlanId", value = "ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("update-report/{classPlanId}") + @CheckRequestBodyAnnotation + public SuccessResult updateReportType(@PathVariable("classPlanId") String classPlanId, @RequestBody ClassPlanVO classPlanVO) { + classPlanService.updateReportType(classPlanId, classPlanVO); + return new SuccessResult(); + } + } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/pojo/vos/classplan/ClassPlanVO.java b/src/main/java/cn/com/tenlion/pojo/vos/classplan/ClassPlanVO.java index dbe966a..732e069 100644 --- a/src/main/java/cn/com/tenlion/pojo/vos/classplan/ClassPlanVO.java +++ b/src/main/java/cn/com/tenlion/pojo/vos/classplan/ClassPlanVO.java @@ -1,7 +1,5 @@ package cn.com.tenlion.pojo.vos.classplan; -import ink.wgink.annotation.CheckEmptyAnnotation; -import ink.wgink.annotation.CheckNumberAnnotation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -31,19 +29,14 @@ public class ClassPlanVO { @ApiModelProperty(name = "workerCatalog", value = "培训工种") private String workerCatalog; @ApiModelProperty(name = "planPersonNum", value = "计划人数") - @CheckNumberAnnotation(name = "计划人数") private Integer planPersonNum; @ApiModelProperty(name = "planStartTime", value = "培训开始时间") - @CheckEmptyAnnotation(name = "培训开始时间", verifyType = "datetime") private String planStartTime; @ApiModelProperty(name = "planEndTime", value = "培训结束时间") - @CheckEmptyAnnotation(name = "培训结束时间", verifyType = "datetime") private String planEndTime; @ApiModelProperty(name = "signUpStartTime", value = "报名时间开始") - @CheckEmptyAnnotation(name = "报名时间开始", verifyType = "datetime") private String signUpStartTime; @ApiModelProperty(name = "signUpEndTime", value = "报名时间截止") - @CheckEmptyAnnotation(name = "报名时间截止", verifyType = "datetime") private String signUpEndTime; @ApiModelProperty(name = "planAddress", value = "培训地点") private String planAddress; diff --git a/src/main/java/cn/com/tenlion/service/classplan/IClassPlanService.java b/src/main/java/cn/com/tenlion/service/classplan/IClassPlanService.java index 2388292..1dc2fd4 100644 --- a/src/main/java/cn/com/tenlion/service/classplan/IClassPlanService.java +++ b/src/main/java/cn/com/tenlion/service/classplan/IClassPlanService.java @@ -191,4 +191,11 @@ public interface IClassPlanService { * @param obj */ void saveJson(JSONObject obj); + + /** + * 提交培训计划报备 + * @param classPlanId + * @param classPlanVO + */ + void updateReportType(String classPlanId, ClassPlanVO classPlanVO); } \ No newline at end of file diff --git a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java index 61c0787..2c77d06 100644 --- a/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/classplan/impl/ClassPlanServiceImpl.java @@ -5,7 +5,9 @@ import cn.com.tenlion.pojo.bos.classplan.ClassPlanBO; import cn.com.tenlion.pojo.dtos.classplan.ClassPlanDTO; import cn.com.tenlion.pojo.pos.classplan.ClassPlanPO; import cn.com.tenlion.pojo.vos.classplan.ClassPlanVO; +import cn.com.tenlion.pojo.vos.examcheck.ExamCheckVO; import cn.com.tenlion.service.classplan.IClassPlanService; +import cn.com.tenlion.service.examcheck.IExamCheckService; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; @@ -35,6 +37,9 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl @Autowired private IClassPlanDao classPlanDao; + @Autowired + private IExamCheckService examCheckService; + @Override public void save(ClassPlanVO classPlanVO) { saveReturnId(classPlanVO); @@ -143,6 +148,20 @@ public class ClassPlanServiceImpl extends DefaultBaseService implements IClassPl classPlanDao.update(params); } + @Override + public void updateReportType(String classPlanId, ClassPlanVO classPlanVO) { + Map params = HashMapUtil.beanToMap(classPlanVO); + params.put("classPlanId", classPlanId); + classPlanDao.update(params); + String reportType = classPlanVO.getReportType(); + if("1".equals(reportType)){ + //向报备审批表中添加申请记录 + ExamCheckVO examCheckVO = new ExamCheckVO(); + examCheckVO.setPlanId(classPlanId); + examCheckService.save(examCheckVO); + } + } + @Override public ClassPlanDTO get(Map params) { return classPlanDao.get(params); diff --git a/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml b/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml index f95a193..9021a1c 100644 --- a/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml +++ b/src/main/resources/mybatis/mapper/classplan/class-plan-mapper.xml @@ -143,7 +143,7 @@ worker_catalog = #{workerCatalog}, - + plan_person_num = #{planPersonNum}, diff --git a/src/main/resources/static/route/classplan/list.html b/src/main/resources/static/route/classplan/list.html index 12e78d0..c08d5d1 100644 --- a/src/main/resources/static/route/classplan/list.html +++ b/src/main/resources/static/route/classplan/list.html @@ -86,6 +86,18 @@ [ {type:'checkbox', fixed: 'left'}, {field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '{{d.LAY_INDEX}}'}, + {width:100, title: '操作', fixed: 'left', align:'center', + templet: function(row) { + var dom = ''; + if(row['reportType'] === '0'){ + return '报备'; + } + if(row['reportType'] === '1'){ + return '报备待审'; + } + return dom; + } + }, {field: 'planNumber', width: 180, title: '培训计划编号', align:'center', templet: function(row) { var rowData = row[this.field]; @@ -330,6 +342,32 @@ } } }); + + table.on('tool(dataTable)', function(obj) { + var layEvent = obj.event; + if(layEvent == 'reportEvent'){ + top.dialog.msg('确认提交报备?', { + time: 0, + btn: [top.dataMessage.button.yes, top.dataMessage.button.no], + shade: 0.3, + yes: function (index) { + top.dialog.close(index); + var layIndex; + top.restAjax.put(top.restAjax.path('api/classplan/update-report/{classPlanId}', [obj.data.classPlanId]), {reportType: '1'}, null, function (code, data) { + top.dialog.msg('提交成功', {time: 1000}); + reloadTable(); + }, function (code, data) { + top.dialog.msg(data.msg); + }, function () { + layIndex = top.dialog.msg('提交中', {icon: 16, time: 0, shade: 0.3}); + }, function () { + top.dialog.close(layIndex); + }); + } + }); + + } + }) });