package com.fgkj.controller;
|
|
import com.fgkj.util.*;
|
|
import com.fgkj.dto.*;
|
import com.fgkj.services.User_taskService;
|
import com.google.gson.reflect.TypeToken;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.text.ParseException;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.annotation.Resource;
|
|
@RequestMapping("userTask")
|
@RestController
|
@Api(tags = "userTask接口")
|
public class User_taskController{
|
@Resource
|
private User_taskService service;
|
|
|
// ,@RequestBody User_task_param utparam,@RequestBody List<BattInf> addlist, @RequestBody User_inf uinf
|
//添加作业
|
@PostMapping("/")
|
@ApiOperation(notes = "",value="添加作业TODO")
|
public ServiceModel add(@RequestBody Map<String,Object> map) throws ParseException{
|
ServiceModel model=new ServiceModel();
|
try {
|
User_task_param utparam = (User_task_param) map.get("utparam"); //TODO 参数未知
|
List<BattInf> listbinf = (List<BattInf>) map.get("listbinf");
|
User_inf uinf = (User_inf) map.get("uinf");
|
if(uinf!=null){
|
utparam.setTp_name(uinf.getuId().toString());
|
model=service.add(listbinf, utparam);
|
}
|
} catch (ParseException e) {
|
e.printStackTrace();
|
model.setMsg("添加失败");
|
return model;
|
}
|
|
return model;
|
}
|
|
//4.1作业管理(修改作业名称,作业使能,作业开始时间,作业提醒次数,作业提醒时间,作业主管提醒使能,确认作业,完成作业,完成作业确认)
|
@PutMapping("/")
|
@ApiOperation(notes = "修改作业名称,作业使能,作业开始时间,作业提醒次数,作业提醒时间,作业主管提醒使能,确认作业,完成作业,完成作业确认" +
|
"{ \"task_id\": 1000009, \"task_name\": \"\", \"task_enabled\": 0, \"task_start_date\": \"2021-01-18 08:18:59\", \"task_notice_sum\": 0, \"task_notice_starttime\": \"2021-01-18 08:18:59\", \"task_notice_endtime\": \"2021-01-18 08:18:59\", \"task_confirm\": 0, \"task_confirm_date\": \"2021-01-18 08:18:59\", \"task_complete\": 0, \"task_complete_confirm\": 0, \"notice_master_enabled\": 0 }" +
|
"",value="作业管理")
|
public ServiceModel update(@RequestBody User_task utask) {
|
ServiceModel model=service.update(utask);
|
|
return model;
|
}
|
|
//4.1删除指定的作业
|
@DeleteMapping("/")
|
@ApiOperation(notes = "",value="删除指定的作业")
|
public ServiceModel delete(@RequestParam Integer task_id,@RequestParam Integer task_type){
|
User_task utask = new User_task();
|
utask.setTask_id(task_id);
|
utask.setTask_type(task_type);
|
ServiceModel model=service.delete(utask);
|
|
return model;
|
}
|
|
//4.1作业管理查询user_task所有信息
|
@PostMapping("byCondition")
|
@ApiOperation(notes = "{\n" +
|
" \"utask\": {\n" +
|
" \"task_type\": 1,\n" +
|
" \"task_create_date\": \"2001-01-25 08:19:35\",\n" +
|
" \"task_create_date1\": \"2021-01-25 08:19:35\",\n" +
|
" \"task_complete\": 1,\n" +
|
" \"task_complete_date\": \"2001-01-25 08:19:35\",\n" +
|
" \"task_complete_date1\": \"2021-01-25 08:19:35\"\n" +
|
" },\n" +
|
" \"utest\": {\n" +
|
" \"task_usr_ids\": \"1002\",\n" +
|
" \"task_exe_date\": \"2001-01-25 08:19:35\",\n" +
|
" \"task_exe_date1\": \"2021-01-25 08:19:35\"\n" +
|
" },\n" +
|
" \"ulist\": {\n" +
|
" \"uId\": 0\n" +
|
" },\n" +
|
" \"binf\": {\n" +
|
" \"stationName\": \"\",\n" +
|
" \"stationName1\": \"\",\n" +
|
" \"battGroupId\": 0,\n" +
|
" \"battGroupName1\": \"\",\n" +
|
" \"monCapStd\": 0.0,\n" +
|
" \"monVolStd\": 0.0,\n" +
|
" \"battProducer\": \"\"\n" +
|
" },\n" +
|
" \"ucheck\": {\n" +
|
" \"task_id\": 0,\n" +
|
" \"task_exe_date\": \"2021-01-25 08:19:35\",\n" +
|
" \"task_exe_date1\": \"2021-01-25 08:19:35\"\n" +
|
" },\n" +
|
" \"uinf\": {\n" +
|
" \"uId\": 1001\n" +
|
" }\n" +
|
"}",value="作业管理查询user_task所有信息")
|
public ServiceModel serchByCondition(@RequestBody Task_Batt_Test tbt){
|
ServiceModel model=service.serchByCondition(tbt);
|
|
//System.out.println(result);
|
return model;
|
}
|
|
//4.1根据task_id查询user_task_test/user_task_check
|
@PostMapping("byInfo")
|
@ApiOperation(notes = "",value="task_id查询user_task_test/user_task_check")
|
public ServiceModel serchByInfo(@RequestParam Integer task_id,@RequestParam Integer task_type){
|
User_task utask = new User_task();
|
utask.setTask_id(task_id);
|
utask.setTask_type(task_type);
|
ServiceModel model=service.serchByInfo(utask);
|
|
return model;
|
}
|
|
//4.1查询符合条件的电池组信息
|
@PostMapping("battGroup")
|
@ApiOperation(notes = "{\n" +
|
" \"binf\": {\n" +
|
" \"stationName\": \"\",\n" +
|
" \"stationName1\": \"\",\n" +
|
" \"battGroupId\": 0,\n" +
|
" \"battGroupName1\": \"电池组1\",\n" +
|
" \"battProductDate\": \"1901-01-18 08:18:59\",\n" +
|
" \"battProductDate1\": \"2021-01-18 08:18:59\",\n" +
|
" \"battInUseDate\": \"1901-01-18 08:18:59\",\n" +
|
" \"battInUseDate1\": \"2021-01-18 08:18:59\",\n" +
|
" \"monVolStd\": 0.0,\n" +
|
" \"monCapStd\": 0.0\n" +
|
"\n" +
|
"\n" +
|
" },\n" +
|
" \"mainf\": {\n" +
|
" \"maint_done_time\": \"1901-01-18 08:18:59\",\n" +
|
" \"maint_done_time1\": \"2021-01-18 08:18:59\"\n" +
|
" },\n" +
|
" \"uinf\": {\n" +
|
" \"uName\": \"\"\n" +
|
" },\n" +
|
" \"tdata\": {\n" +
|
" \"test_type\": 0,\n" +
|
" \"record_time\": \"1901-01-18 08:18:59\",\n" +
|
" \"record_time1\": \"2021-01-18 08:18:59\"\n" +
|
" }\n" +
|
"}",value="查询符合条件的电池组信息")
|
public ServiceModel serchBattgroup(@RequestBody Batt_Maint_Dealarm bmd){
|
ServiceModel model = new ServiceModel();
|
|
List list=service.serchBattgroup(bmd);
|
if (list.size()>0) {
|
model.setCode(1);
|
model.setData(list);
|
}
|
return model;
|
}
|
|
//0.1查询指定用户的作业信息
|
@PostMapping("byUid")
|
@ApiOperation(notes = "{\n" +
|
" \"utask\": {\n" +
|
" \"task_type\": 0,\n" +
|
" \"task_close_date\": \"2006-12-30 13:26:38\",\n" +
|
" \"task_close_date1\": \"2021-01-19 13:26:38\",\n" +
|
" \"task_complete\": 1\n" +
|
" },\n" +
|
" \"uinf\": {\n" +
|
" \"uId\": 1001\n" +
|
" },\n" +
|
" \"pageBean\": {\n" +
|
" \"pageSize\":12,\n" +
|
" \"pageNum\": 0\n" +
|
" }\n" +
|
"}",value="查询指定用户的作业信息")
|
public ServiceModelOnce serchByUid(@RequestBody Task_Batt_Test tbt){
|
User_inf user=(User_inf)ActionUtil.getUser();
|
// User_inf user= new User_inf();
|
// user.setuId(1001);
|
ServiceModelOnce model=new ServiceModelOnce();
|
if(user!=null && tbt!=null){
|
tbt.setUinf(user);
|
model=service.serchByUid(tbt);
|
}
|
|
return model;
|
}
|
|
//0.1作业管理查询user_task所有信息
|
@PostMapping("byTask")
|
@ApiOperation(notes = "task_type==2 " +
|
"{\n" +
|
" \"utask\": {\n" +
|
" \"task_type\": 2,\n" +
|
" \"task_complete\": 1,\n" +
|
" \"task_complete_date\": \"2000-01-20 11:48:46\",\n" +
|
" \"task_complete_date1\": \"2031-01-20 11:48:46\"\n" +
|
" },\n" +
|
" \"binf\": {\n" +
|
" \"stationName\": \"\",\n" +
|
" \"stationName1\": \"\",\n" +
|
" \"battGroupId\": 1000003\n" +
|
" },\n" +
|
" \"ucheck\": {\n" +
|
" \"task_exe_date\": \"2001-01-20 11:48:46\",\n" +
|
" \"task_exe_date1\": \"2021-01-20 11:48:46\"\n" +
|
" },\n" +
|
" \"pageBean\": {\n" +
|
" \"pageSize\": 1,\n" +
|
" \"pageNum\": 0\n" +
|
" }\n" +
|
"}" +
|
"-------------------------" +
|
"task_type!=2 " +
|
"{\n" +
|
" \"utask\": {\n" +
|
" \"task_type\": 1,\n" +
|
" \"task_complete\": 1,\n" +
|
" \"task_complete_date\": \"2000-01-20 11:48:46\",\n" +
|
" \"task_complete_date1\": \"2031-01-20 11:48:46\"\n" +
|
" },\n" +
|
" \"utest\": {\n" +
|
" \"task_usr_ids\": \"\",\n" +
|
" \"task_exe_date\": \"2001-01-20 11:48:46\",\n" +
|
" \"task_exe_date1\": \"2031-01-20 11:48:46\"\n" +
|
" },\n" +
|
" \"binf\": {\n" +
|
" \"stationName\": \"太原市\",\n" +
|
" \"stationName1\": \"\",\n" +
|
" \"battGroupId\": 1000003\n" +
|
" },\n" +
|
" \"pageBean\": {\n" +
|
" \"pageSize\": 6,\n" +
|
" \"pageNum\": 0\n" +
|
" }\n" +
|
"}",value="作业管理查询user_task所有信息")
|
public ServiceModel serchByTask(@RequestBody Task_Batt_Test tbt){
|
ServiceModel model=service.serchByTask(tbt);
|
|
return model;
|
}
|
//4.1根据维护区查询所有的电池组和对应的包机人(模板创建)和维护人员信息以及各类作业对应的电池组信息
|
@PostMapping("serchBytemplate")
|
@ApiOperation(notes = "",value="TODO 维护区查询所有的电池组和对应的包机人(模板创建)和维护人员信息以及各类作业对应的电池组信息")
|
public ServiceModel serchBytemplate(@RequestBody User_task_batt_template utbt){
|
ServiceModel model=new ServiceModel();
|
|
AllModel allModel=service.serchBytemplate(utbt);
|
|
model.setCode(1);
|
model.setData(allModel);
|
return model;
|
}
|
|
//4.1由模板添加作业(向utask,utest,ucheck中添加数据)
|
@PostMapping("addBytemplate")
|
@ApiOperation(notes = "",value="TODO由模板添加作业(向utask,utest,ucheck中添加数据)")
|
public ServiceModel addBytemplate(@RequestBody AllModel allmodel){
|
User_inf uinf=(User_inf)ActionUtil.getSession().getAttribute("user");
|
//System.out.println(allmodel.getPmodel());
|
allmodel.getAmodel().setData(ActionUtil.getObject(ActionUtil.tojson(allmodel.getAmodel().getData()), new TypeToken<List<BattInf>>(){}.getType()));
|
allmodel.getSmodel().setData(ActionUtil.getObject(ActionUtil.tojson(allmodel.getSmodel().getData()), new TypeToken<List<BattInf>>(){}.getType()));
|
allmodel.getRmodel().setData(ActionUtil.getObject(ActionUtil.tojson(allmodel.getRmodel().getData()), new TypeToken<List<BattInf>>(){}.getType()));
|
allmodel.getUmodel().setData(ActionUtil.getObject(ActionUtil.tojson(allmodel.getUmodel().getData()), new TypeToken<List<BattInf>>(){}.getType()));
|
allmodel.getPmodel().setData(ActionUtil.getObject(ActionUtil.tojson(allmodel.getPmodel().getData()),new TypeToken<List<User_task_param>>(){}.getType()));
|
|
//System.out.println(allmodel.getPmodel());
|
if(uinf!=null && allmodel!=null){
|
allmodel.getPmodel().setMsg(uinf.getuId()+"");
|
}
|
ServiceModel model= new ServiceModel();
|
try {
|
model= service.addBytemplate(allmodel);
|
} catch (ParseException e) {
|
e.printStackTrace();
|
}
|
|
return model;
|
}
|
|
}
|