|
@@ -1,16 +1,24 @@
|
|
|
package com.huaxu.task.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.huaxu.model.AjaxMessage;
|
|
|
+import com.huaxu.model.LoginUser;
|
|
|
+import com.huaxu.model.Pagination;
|
|
|
import com.huaxu.model.ResultStatus;
|
|
|
import com.huaxu.task.entity.PlanManage;
|
|
|
import com.huaxu.task.service.PlanManageService;
|
|
|
import com.huaxu.util.DatesUtil;
|
|
|
+import com.huaxu.util.UserUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/workflow/task/")
|
|
@@ -20,7 +28,6 @@ public class PlanManageController {
|
|
|
@Autowired
|
|
|
PlanManageService planManageService;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 新增巡检计划
|
|
|
* @param planName 任务名称
|
|
@@ -28,44 +35,82 @@ public class PlanManageController {
|
|
|
* @param planStartDate 计划开始时间
|
|
|
* @param planEndDate 计划结束时间
|
|
|
* @param userId 计划巡检人ID
|
|
|
- * @param planUserId 计划安排人ID
|
|
|
* @param taskContent 任务内容
|
|
|
* @param taskAreaShape 任务区域坐标
|
|
|
* @param taskAreaName 任务区域名称
|
|
|
- * @param createBy 创建者
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/plan/add")
|
|
|
@ApiOperation(value = "新增巡检计划")
|
|
|
public AjaxMessage addPlan(@ApiParam(value = "任务名称", required = true) @RequestParam(required = true) String planName,
|
|
|
@ApiParam(value = "任务类型", required = true) @RequestParam(required = true) Integer taskType,
|
|
|
- @ApiParam(value = "计划开始时间", required = true) @RequestParam(required = true) Date planStartDate,
|
|
|
- @ApiParam(value = "计划结束时间", required = true) @RequestParam(required = true) Date planEndDate,
|
|
|
+ @ApiParam(value = "计划开始时间", required = true) @RequestParam(required = true) String planStartDate,
|
|
|
+ @ApiParam(value = "计划结束时间", required = true) @RequestParam(required = true) String planEndDate,
|
|
|
@ApiParam(value = "计划巡检人ID", required = true) @RequestParam(required = true) String userId,
|
|
|
- @ApiParam(value = "计划安排人ID", required = true) @RequestParam(required = true) String planUserId,
|
|
|
@ApiParam(value = "任务内容", required = true) @RequestParam(required = true) String taskContent,
|
|
|
@ApiParam(value = "任务区域坐标", required = true) @RequestParam(required = true) String taskAreaShape,
|
|
|
- @ApiParam(value = "任务区域名称", required = true) @RequestParam(required = true) String taskAreaName,
|
|
|
- @ApiParam(value = "创建者ID", required = true) @RequestParam(required = true) String createBy) {
|
|
|
+ @ApiParam(value = "任务区域名称", required = true) @RequestParam(required = true) String taskAreaName) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
String planId=DatesUtil.formatDate(new Date(),"yyyyMMddHHmmss")+String.valueOf((int) (Math.random()*(9999-1000)+1000));
|
|
|
PlanManage record = new PlanManage();
|
|
|
record.setUserId(userId);
|
|
|
record.setPlanId(planId);
|
|
|
record.setPlanName(planName);
|
|
|
record.setTaskType(taskType);
|
|
|
- record.setPlanStartDate(planStartDate);
|
|
|
- record.setPlanEndDate(planEndDate);
|
|
|
+ record.setPlanStartDate(DatesUtil.parseDate(planStartDate,"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ record.setPlanEndDate(DatesUtil.parseDate(planEndDate,"yyyy-MM-dd HH:mm:ss"));
|
|
|
record.setUserId(userId);
|
|
|
- record.setPlanUserId(planUserId);
|
|
|
+ record.setPlanUserId(loginUser.getId().toString());
|
|
|
record.setTaskContent(taskContent);
|
|
|
record.setTaskAreaShape(taskAreaShape);
|
|
|
record.setTaskAreaName(taskAreaName);
|
|
|
- record.setCreateBy(createBy);
|
|
|
- record.setDateCreate(new Date(System.currentTimeMillis()));
|
|
|
+ record.setCreateBy(loginUser.getId().toString());
|
|
|
+ record.setTenantId(loginUser.getTenantId());
|
|
|
+ record.setDateCreate(DatesUtil.parseDate(DatesUtil.formatNow(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
int rows = planManageService.insertSelective(record);
|
|
|
if(rows > 0) {
|
|
|
return new AjaxMessage(ResultStatus.OK);
|
|
|
}
|
|
|
return new AjaxMessage(ResultStatus.ERROR);
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ @GetMapping("/plan/select")
|
|
|
+ @ApiOperation(value = "查询巡检计划")
|
|
|
+ public AjaxMessage<List<PlanManage>> selectPlan(
|
|
|
+ @ApiParam(value = "页数", required = true)@RequestParam Integer pageNum,
|
|
|
+ @ApiParam(value = "条数", required = true)@RequestParam Integer pageSize,
|
|
|
+ @ApiParam(value = "计划单号或计划名称", required = true) @RequestParam(required = false) String key,
|
|
|
+ @ApiParam(value = "计划安排起始日期", required = true) @RequestParam(required = false) String startDate,
|
|
|
+ @ApiParam(value = "计划安排截至日期", required = true) @RequestParam(required = false) String endDate){
|
|
|
+
|
|
|
+ //根据用户编号,获取用户的权限
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ Map<String,Object> map =new HashMap<String,Object>();
|
|
|
+ map.put("tenantId",loginUser.getTenantId());
|
|
|
+ map.put("key",key);
|
|
|
+ map.put("startDate",startDate);
|
|
|
+ map.put("endDate",endDate);
|
|
|
+ map.put("permissonType",loginUser.getPermissonType());
|
|
|
+
|
|
|
+ IPage<List<PlanManage>> iPage = new Page<>(pageNum, pageSize);
|
|
|
+
|
|
|
+
|
|
|
+// iPage = planManageService.selectPlanByIdAndDate(iPage, alarmSettingDto);
|
|
|
+// Pagination<AlarmSettingDto> pages = new Pagination<>(iPage);
|
|
|
+// for(AlarmSettingDto alarm : pages.getList()){
|
|
|
+// alarm.setCompanyOrgName(orgInfoUtil.getOrgName(alarm.getCompanyOrgId()));
|
|
|
+// alarm.setDeptOrgName(orgInfoUtil.getOrgName(alarm.getDeptOrgId()));
|
|
|
+// }
|
|
|
+// return new AjaxMessage<>(ResultStatus.OK, pages);
|
|
|
+
|
|
|
+ List<PlanManage> list = planManageService.selectPlanByIdAndDate(map);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return new AjaxMessage<List<PlanManage>>(ResultStatus.OK,list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|