Commit b8aba420 by chenweisong

更新

parent d1651e33
......@@ -3,6 +3,7 @@ package com.keymobile.rest.controller;
import com.keymobile.rest.common.utils.DateUtil;
import com.keymobile.rest.common.validator.CommonValidator;
import com.keymobile.rest.controller.constant.CommonConstant;
import com.keymobile.rest.dto.DataForm;
import com.keymobile.rest.model.User;
import com.keymobile.rest.model.Activity;
import com.keymobile.rest.model.DataInfo;
......@@ -41,22 +42,19 @@ public class TemplateController {
private RuntimeService runtimeService;
@ApiOperation(value = "当前补录任务填写补录")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", required = true, value = "补录任务id", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "excelId", required = true, value = "当前模板id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "dataStr", required = true, value = "当前数据字符", dataType = "string", paramType = "body")
})
@PostMapping(value = "/excel/saveData")
public Object saveTemplateData(String taskId, long excelId, @RequestBody String dataStr) {
System.out.println(dataStr);
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
public Object saveTemplateData(@RequestBody DataForm dataForm) {
CommonValidator.notEmpty(dataForm.getTaskId(), "任务不存在");
CommonValidator.notEmpty(dataForm.getDataStr(), "数据字符不能为空");
CommonValidator.isTrue(dataForm.getExcelId() != null && dataForm.getExcelId() != 0, "模板id不能为空");
Task task = taskService.createTaskQuery().taskId(dataForm.getTaskId()).singleResult();
CommonValidator.notNull(task, "任务不存在");
Template template = templateService.findById(excelId);
Template template = templateService.findById(dataForm.getExcelId());
CommonValidator.notNull(template, "模板不存在");
User user = sessionService.getLoginUser();
try {
taskService.claim(taskId, user.getName());
taskService.claim(dataForm.getTaskId(), user.getName());
} catch (Exception e) {
System.out.println("任务已被领取,补录失败");
}
......@@ -69,7 +67,7 @@ public class TemplateController {
dataInfo.setTemplate(template);
dataInfo.setUserId(user.getId());
dataInfo.setProcess(process);
dataInfo.setData(dataStr);
dataInfo.setData(dataForm.getDataStr());
dataInfoService.save(dataInfo);
Map vars = new HashMap<>();
......
package com.keymobile.rest.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class DataForm {
@ApiModelProperty(name = "freq", required = true, value = "补录任务id", dataType = "string")
private String taskId;
@ApiModelProperty(name = "excelId", value = "模板id", required = true, dataType = "long")
private Long excelId;
@ApiModelProperty(name = "dataStr", required = true, value = "数据字符", dataType = "string")
private String dataStr;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment