添加报备申请的逻辑

This commit is contained in:
wans 2021-05-04 18:46:39 +08:00
parent 600b0567e1
commit cdd8af5854
6 changed files with 77 additions and 8 deletions

View File

@ -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();
}
}

View File

@ -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;

View File

@ -191,4 +191,11 @@ public interface IClassPlanService {
* @param obj
*/
void saveJson(JSONObject obj);
/**
* 提交培训计划报备
* @param classPlanId
* @param classPlanVO
*/
void updateReportType(String classPlanId, ClassPlanVO classPlanVO);
}

View File

@ -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<String, Object> 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<String, Object> params) {
return classPlanDao.get(params);

View File

@ -143,7 +143,7 @@
<if test="workerCatalog != null and workerCatalog != ''">
worker_catalog = #{workerCatalog},
</if>
<if test="planPersonNum != null">
<if test="planPersonNum != null and planPersonNum != 0">
plan_person_num = #{planPersonNum},
</if>
<if test="planStartTime != null and planStartTime != ''">

View File

@ -86,6 +86,18 @@
[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{width:100, title: '操作', fixed: 'left', align:'center',
templet: function(row) {
var dom = '';
if(row['reportType'] === '0'){
return '<a type="button" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="reportEvent">报备</a>';
}
if(row['reportType'] === '1'){
return '<a type="button" class="layui-btn layui-btn-warm layui-btn-xs">报备待审</a>';
}
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);
});
}
});
}
})
});
</script>
</body>