Ver código fonte

删除巡检计划

wangbo 4 anos atrás
pai
commit
5543075833

+ 45 - 8
operation_manager/src/main/java/com/huaxu/task/controller/PlanManageController.java

@@ -20,10 +20,8 @@ import org.activiti.engine.task.Task;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.*;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+
+import java.util.*;
 
 @RestController
 @RequestMapping("/workflow/task/")
@@ -68,13 +66,14 @@ public class PlanManageController {
         record.setPlanName(planName);
         record.setTaskType(taskType);
         record.setTaskChecked(taskChecked);
+        record.setPlanDate(new Date());
         record.setPlanStartDate(DatesUtil.parseDate(planStartDate,"yyyy-MM-dd HH:mm:ss"));
         record.setPlanEndDate(DatesUtil.parseDate(planEndDate,"yyyy-MM-dd HH:mm:ss"));
         record.setPlanStatus(0);
         record.setTaskContent(taskContent);
         record.setTaskAreaShape(taskAreaShape);
         record.setTaskAreaName(taskAreaName);
-        record.setDateCreate(DatesUtil.parseDate(DatesUtil.formatNow(),"yyyy-MM-dd HH:mm:ss"));
+        record.setDateCreate(new Date());
         if(loginUser.getId() != null) {
             record.setPlanUserId(String.valueOf(loginUser.getId()));
             record.setCreateBy(String.valueOf(loginUser.getId()));
@@ -122,7 +121,6 @@ public class PlanManageController {
         return new AjaxMessage<>(ResultStatus.OK, pages);
     }
 
-
     @GetMapping("/plan/submit")
     @ApiOperation(value = "提交巡检计划")
     public AjaxMessage submitPlan(
@@ -177,7 +175,7 @@ public class PlanManageController {
 
     @PostMapping("/plan/update")
     @ApiOperation(value = "修改巡检计划")
-    public AjaxMessage updatePlan( @ApiParam(value = "修改巡检计划", required = true) @RequestBody PlanManage planManage) {
+    public AjaxMessage updatePlan(@ApiParam(value = "修改巡检计划", required = true) @RequestBody PlanManage planManage) {
         PlanManage record = new PlanManage();
         record.setId(planManage.getId());
         record.setUserId(planManage.getUserId());
@@ -185,7 +183,7 @@ public class PlanManageController {
         record.setTaskType(planManage.getTaskType());
         record.setTaskChecked(planManage.getTaskChecked());
         record.setPlanStartDate(planManage.getPlanStartDate());
-        record.setPlanEndDate(planManage.getPlanDate());
+        record.setPlanEndDate(planManage.getPlanEndDate());
         record.setTaskContent(planManage.getTaskContent());
         record.setTaskAreaShape(planManage.getTaskAreaShape());
         record.setTaskAreaName(planManage.getTaskAreaName());
@@ -202,5 +200,44 @@ public class PlanManageController {
     }
 
 
+    @RequestMapping(value="batchDelete" , method = RequestMethod.DELETE)
+    @ApiOperation(value = "批量删除")
+    public AjaxMessage<Integer> batchDelete( @ApiParam(value = "巡检计划ids") @RequestParam List<Integer> ids){
+        return new AjaxMessage<>(ResultStatus.OK, planManageService.batchDelete(ids));
+    }
+
+
+    @GetMapping("/plan/selecttask")
+    @ApiOperation(value = "查询巡检任务")
+    public AjaxMessage<Pagination<PlanManageDto>> selecttask(
+            @ApiParam(value = "页数", required = true)@RequestParam Integer pageNum,
+            @ApiParam(value = "条数", required = true)@RequestParam Integer pageSize,
+            @ApiParam(value = "状态", required = false) @RequestParam(required = false) Integer planStatus,
+            @ApiParam(value = "计划单号或计划名称", required = false) @RequestParam(required = false) String key,
+            @ApiParam(value = "计划安排起始日期", required = false) @RequestParam(required = false) String startDate,
+            @ApiParam(value = "计划安排截至日期", required = false) @RequestParam(required = false) String endDate){
+        PlanManageDto planManageDto = new PlanManageDto();
+        //根据用户编号,获取用户的权限
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        planManageDto.setKey(key);
+        if(!StringUtils.isEmpty(startDate)&& !StringUtils.isEmpty(endDate)) {
+            planManageDto.setStartDate(startDate);
+            planManageDto.setEndDate(endDate);
+        }
+        planManageDto.setPlanStatus(planStatus);
+        planManageDto.setTenantId(loginUser.getTenantId());
+        planManageDto.setProgramItems(loginUser.getProgramItemList());
+        planManageDto.setUserType(loginUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        planManageDto.setPermissonType(loginUser.getPermissonType());
+        IPage<PlanManageDto> iPage = new Page<>(pageNum, pageSize);
+        iPage = planManageService.selectPage(iPage, planManageDto);
+        Pagination<PlanManageDto> pages = new Pagination<>(iPage);
+        for(PlanManage plan : pages.getList()){
+            //plan.setCompanyOrgName(orgInfoUtil.getOrgName(plan.getCompanyOrgId()));
+            //plan.setDeptOrgName(orgInfoUtil.getOrgName(plan.getDeptOrgId()));
+        }
+        return new AjaxMessage<>(ResultStatus.OK, pages);
+    }
 
 }

+ 4 - 0
operation_manager/src/main/java/com/huaxu/task/dao/PlanManageMapper.java

@@ -7,6 +7,8 @@ import com.huaxu.task.entity.PlanManage;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 @Mapper
 public interface PlanManageMapper {
 
@@ -22,5 +24,7 @@ public interface PlanManageMapper {
 
     int updateByPrimaryKey(PlanManage record);
 
+    Integer batchDelete(@Param("ids") List<Integer> ids);
+
     Page<PlanManageDto> findPage(IPage<PlanManageDto> page, @Param("plan") PlanManageDto planManageDto);
 }

+ 9 - 0
operation_manager/src/main/java/com/huaxu/task/service/PlanManageService.java

@@ -3,6 +3,9 @@ package com.huaxu.task.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huaxu.task.dto.PlanManageDto;
 import com.huaxu.task.entity.PlanManage;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface PlanManageService {
     /**
@@ -36,4 +39,10 @@ public interface PlanManageService {
      */
 
     int updateByPrimaryKey(PlanManage record);
+
+
+    /**
+     * 批量删除
+     */
+    Integer batchDelete(@Param("ids") List<Integer> ids);
 }

+ 7 - 0
operation_manager/src/main/java/com/huaxu/task/service/impl/PlanManageServiceImpl.java

@@ -8,6 +8,8 @@ import com.huaxu.task.service.PlanManageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
 public class PlanManageServiceImpl implements PlanManageService {
 
@@ -43,4 +45,9 @@ public class PlanManageServiceImpl implements PlanManageService {
     public int updateByPrimaryKey(PlanManage record) {
         return planManageMapper.updateByPrimaryKey(record);
     }
+
+    @Override
+    public Integer batchDelete(List<Integer> ids) {
+        return planManageMapper.batchDelete(ids);
+    }
 }

+ 20 - 1
operation_manager/src/main/resources/mapper/task/PlanManageMapper.xml

@@ -29,6 +29,7 @@
     <result column="department_org_id" property="departmentOrgId" jdbcType="VARCHAR" />
     <result column="task_checked" property="taskChecked" jdbcType="VARCHAR" />
   </resultMap>
+
   <sql id="Base_Column_List" >
     id, plan_id, plan_name, plan_user_id, user_id, plan_date, plan_start_date, plan_end_date, 
     task_content, task_area_shape, task_area_name, task_type, plan_status, tenant_id, 
@@ -36,22 +37,26 @@
     create_by, date_create, update_by, date_update, company_org_id, department_org_id,
     task_checked
   </sql>
+
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
     select 
     <include refid="Base_Column_List" />
     from sc_plan_manage
     where id = #{id,jdbcType=INTEGER}
   </select>
+
   <select id="selectByPlanId" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select
     <include refid="Base_Column_List" />
     from sc_plan_manage
     where plan_id = #{planId,jdbcType=VARCHAR}
   </select>
+
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
     delete from sc_plan_manage
     where id = #{id,jdbcType=INTEGER}
   </delete>
+
   <insert id="insertSelective" parameterType="com.huaxu.task.entity.PlanManage" >
     insert into sc_plan_manage
     <trim prefix="(" suffix=")" suffixOverrides="," >
@@ -215,6 +220,7 @@
       </if>
     </trim>
   </insert>
+
   <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.task.entity.PlanManage" >
     update sc_plan_manage
     <set >
@@ -296,6 +302,7 @@
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
+
   <update id="updateByPrimaryKey" parameterType="com.huaxu.task.entity.PlanManage" >
     update sc_plan_manage
     set plan_id = #{planId,jdbcType=VARCHAR},
@@ -325,6 +332,7 @@
       task_checked = #{taskChecked,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
+
   <select id="findPage" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List"/>
@@ -350,7 +358,7 @@
           )
         </if>
         <if test="plan.permissonType == 4 or plan.permissonType == 3">
-          and t2.DEPT_ORG_ID in
+          and t1.DEPT_ORG_ID in
           <foreach collection="plan.programItems" item="item" open="(" close=")" separator=",">
             #{item.orgId}
           </foreach>
@@ -373,4 +381,15 @@
     </where>
     order by t1.date_create
   </select>
+
+  <!--删除-->
+  <delete id="batchDelete">
+    delete from  sc_plan_manage
+    where plan_status = 0
+    and id in
+    <foreach collection="ids" item="item" open="(" close=")" separator=",">
+      #{item}
+    </foreach>
+  </delete>
+
 </mapper>