|
@@ -1,17 +1,26 @@
|
|
package com.hz.employmentsite.controller.taskAndLog;
|
|
package com.hz.employmentsite.controller.taskAndLog;
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.hz.employmentsite.filter.exception.BaseErrorEnum;
|
|
|
|
+import com.hz.employmentsite.filter.exception.BaseException;
|
|
import com.hz.employmentsite.filter.exception.BaseResponse;
|
|
import com.hz.employmentsite.filter.exception.BaseResponse;
|
|
import com.hz.employmentsite.filter.exception.RespGenerstor;
|
|
import com.hz.employmentsite.filter.exception.RespGenerstor;
|
|
|
|
+import com.hz.employmentsite.services.service.AccountService;
|
|
import com.hz.employmentsite.services.service.companyService.PostService;
|
|
import com.hz.employmentsite.services.service.companyService.PostService;
|
|
import com.hz.employmentsite.services.service.taskAndLog.DotaskService;
|
|
import com.hz.employmentsite.services.service.taskAndLog.DotaskService;
|
|
|
|
+import com.hz.employmentsite.util.DateUtils;
|
|
|
|
+import com.hz.employmentsite.util.ExcelHelper;
|
|
import com.hz.employmentsite.vo.taskAndLog.DoTaskUserVo;
|
|
import com.hz.employmentsite.vo.taskAndLog.DoTaskUserVo;
|
|
import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
|
|
import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
|
|
import com.hz.employmentsite.vo.taskAndLog.SiteUserVo;
|
|
import com.hz.employmentsite.vo.taskAndLog.SiteUserVo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value = "/api/taskAndLog/dotask")
|
|
@RequestMapping(value = "/api/taskAndLog/dotask")
|
|
@@ -19,30 +28,103 @@ public class DotaskController {
|
|
@Autowired
|
|
@Autowired
|
|
private DotaskService dotaskService;
|
|
private DotaskService dotaskService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private AccountService accountService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private DateUtils dateUtils;
|
|
|
|
+
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@GetMapping("/getList")
|
|
@GetMapping("/getList")
|
|
public BaseResponse getList(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
|
|
public BaseResponse getList(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
|
|
- @RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
|
|
|
|
- @RequestParam(required = false) String endTime, @RequestParam(required = false) String finishStartTime,
|
|
|
|
- @RequestParam(required = false) String finishEndTime, @RequestParam(required = false) String regionCode,
|
|
|
|
- @RequestParam(required = false) String streetCode, @RequestParam(required = false) String workTypeId
|
|
|
|
- ){
|
|
|
|
- PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize,name, startTime, endTime,finishStartTime,finishEndTime,regionCode,streetCode,workTypeId);
|
|
|
|
|
|
+ @RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
|
|
|
|
+ @RequestParam(required = false) String endTime, @RequestParam(required = false) String finishStartTime,
|
|
|
|
+ @RequestParam(required = false) String finishEndTime, @RequestParam(required = false) String regionCode,
|
|
|
|
+ @RequestParam(required = false) String streetCode, @RequestParam(required = false) String workTypeId
|
|
|
|
+ ) {
|
|
|
|
+ PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize, name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
|
|
|
|
+ return RespGenerstor.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @GetMapping("/getDataById")
|
|
|
|
+ public BaseResponse getDataById(String id) {
|
|
|
|
+ var result = dotaskService.getDataById(id);
|
|
|
|
+ if (result == null) {
|
|
|
|
+ result = new DotaskVo();
|
|
|
|
+ result.setDotaskID(UUID.randomUUID().toString());
|
|
|
|
+ }
|
|
|
|
+ return RespGenerstor.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @PostMapping("/save")
|
|
|
|
+ public BaseResponse save(@RequestBody DotaskVo data) {
|
|
|
|
+ var result = dotaskService.save(data, accountService.getLoginUserID());
|
|
return RespGenerstor.success(result);
|
|
return RespGenerstor.success(result);
|
|
}
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@GetMapping("/getWorkUserList")
|
|
@GetMapping("/getWorkUserList")
|
|
- public BaseResponse getWorkUserList(@RequestParam(required = false) String dotaskID){
|
|
|
|
- List<DoTaskUserVo> list=dotaskService.getWorkUserList(dotaskID);
|
|
|
|
- return RespGenerstor.success(list);
|
|
|
|
|
|
+ public BaseResponse getWorkUserList(@RequestParam(required = false) String id) {
|
|
|
|
+ if (id == null)
|
|
|
|
+ return null;
|
|
|
|
+ List<DoTaskUserVo> list = dotaskService.getWorkUserList(id);
|
|
|
|
+ return RespGenerstor.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@GetMapping("/getUserList")
|
|
@GetMapping("/getUserList")
|
|
- public BaseResponse getUserList(){
|
|
|
|
- List<SiteUserVo> list=dotaskService.getUserList();
|
|
|
|
|
|
+ public BaseResponse getUserList() {
|
|
|
|
+ List<SiteUserVo> list = dotaskService.getUserList();
|
|
return RespGenerstor.success(list);
|
|
return RespGenerstor.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ResponseBody
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
+ public BaseResponse delete(@RequestBody List<String> ids) {
|
|
|
|
+ int result = dotaskService.delete(ids);
|
|
|
|
+ if (result <= 0)
|
|
|
|
+ throw new BaseException(BaseErrorEnum.DELETE_NOT_DATA_ERROR);
|
|
|
|
+ return RespGenerstor.success(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/export")
|
|
|
|
+ public BaseResponse export(HttpServletResponse response, @RequestParam(required = false) Boolean isExport,
|
|
|
|
+ @RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
|
|
|
|
+ @RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
|
|
|
|
+ @RequestParam(required = false) String endTime, @RequestParam(required = false) String finishStartTime,
|
|
|
|
+ @RequestParam(required = false) String finishEndTime, @RequestParam(required = false) String regionCode,
|
|
|
|
+ @RequestParam(required = false) String streetCode, @RequestParam(required = false) String workTypeId) throws Exception {
|
|
|
|
+
|
|
|
|
+ PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize, name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
|
|
|
|
+ if (isExport == null || !isExport) {
|
|
|
|
+ return RespGenerstor.success(result);
|
|
|
|
+ } else {
|
|
|
|
+ ExcelHelper excelHelper = new ExcelHelper();
|
|
|
|
+ ExcelHelper.ExcelData data = excelHelper.new ExcelData();
|
|
|
|
+ data.setTitles(Arrays.asList(new String[]{"序号", "任务名称", "任务类型", "任务完成时间", "所属县区", "所属街道", "执行用户数", "下达时间", "下达人"}));
|
|
|
|
+ int i = 0;
|
|
|
|
+ List<List<Object>> rowDatas = new ArrayList();
|
|
|
|
+ for (DotaskVo item : result.getList()) {
|
|
|
|
+ List<Object> row = new ArrayList();
|
|
|
|
+ ++i;
|
|
|
|
+ row.add(i);
|
|
|
|
+ row.add(item.dotaskName);
|
|
|
|
+ row.add(item.workTypeName);
|
|
|
|
+ row.add(dateUtils.dateToStr(item.finishTime));
|
|
|
|
+ row.add(item.regionName);
|
|
|
|
+ row.add(item.streetName);
|
|
|
|
+ row.add(item.userCount);
|
|
|
|
+ row.add(dateUtils.dateToStr(item.createTime));
|
|
|
|
+ row.add(item.createName);
|
|
|
|
+ rowDatas.add(row);
|
|
|
|
+ }
|
|
|
|
+ data.setRows(rowDatas);
|
|
|
|
+ excelHelper.exportExcel(response, data);
|
|
|
|
+
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|