ソースを参照

Merge remote-tracking branch 'origin/master'

11868 1 日 前
コミット
44bfda0996

+ 111 - 0
supervision-admin/src/main/java/com/supervision/web/controller/militaryvehicleManagement/BdglAccessPeople.java

@@ -0,0 +1,111 @@
+package com.supervision.web.controller.militaryvehicleManagement;
+
+import com.github.pagehelper.PageInfo;
+import com.supervision.common.core.domain.AjaxResult;
+import com.supervision.militaryvehicleManagement.domain.AccessPeople;
+import com.supervision.militaryvehicleManagement.service.IBdglAccessPeopleService;
+import io.swagger.models.auth.In;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 审批人员管理
+ */
+@RestController
+@RequestMapping("/militaryvehicleManagement/thebusConfig")
+public class BdglAccessPeople {
+    @Autowired
+    private IBdglAccessPeopleService iBdglAccessPeopleService;
+
+    /**
+     * 新增审批人员
+     *
+     * @param accessPeople
+     * @return
+     */
+    @PostMapping("/addAccessPeople")
+    public AjaxResult addAccessPeople(@RequestBody AccessPeople accessPeople) {
+        iBdglAccessPeopleService.add(accessPeople);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 查询审批人员信息
+     *
+     * @param name
+     * @param level
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/listAccessPeople")
+    public AjaxResult listAccessPeople(@RequestParam(required = false) String name,
+                                       @RequestParam(required = false) Integer level,
+                                       @RequestParam(defaultValue = "1") int pageNum,
+                                       @RequestParam(defaultValue = "10") int pageSize) {
+        PageInfo<AccessPeople> pageInfo = iBdglAccessPeopleService.queryPage(name, level, pageNum, pageSize);
+        Map<String, Object> result = new HashMap<>();
+        result.put("total", pageInfo.getTotal());
+        result.put("list", pageInfo.getList());
+
+        return AjaxResult.success(result);
+    }
+
+    /**
+     * 删除审批人员
+     *
+     * @param ids
+     * @return
+     */
+    @DeleteMapping("/del")
+    public AjaxResult delete(@RequestBody List<Integer> ids) {
+        int result = iBdglAccessPeopleService.deleteByIds(ids);
+        if (result > 0) {
+            return AjaxResult.success(result);
+        } else {
+            return AjaxResult.error("删除失败");
+        }
+    }
+
+    /**
+     * 根据id获取审批人员信息
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("/getAccessPeople/{id}")
+    public AjaxResult getAccessPeople(@PathVariable int id) {
+        AccessPeople accessPeople = iBdglAccessPeopleService.getById(id);
+        if (accessPeople != null) {
+            return AjaxResult.success(accessPeople);
+        } else {
+            return AjaxResult.error("未找到对应的审批人员");
+        }
+    }
+
+    /**
+     * 修改审批人员
+     * @param accessPeople
+     * @return
+     */
+    @PutMapping("/updateAccessPeople")
+    public AjaxResult updateAccessPeople(@RequestBody AccessPeople accessPeople) {
+        // 检查是否传入了 id
+        if (accessPeople.getId() == 0) {
+            return AjaxResult.error("缺少人员ID,无法更新");
+        }
+
+        // 调用业务层更新
+        boolean success = iBdglAccessPeopleService.updateById(accessPeople);
+
+        if (success) {
+            return AjaxResult.success("修改成功");
+        } else {
+            return AjaxResult.error("修改失败,未找到对应人员");
+        }
+    }
+}

+ 3 - 2
supervision-admin/src/main/java/com/supervision/web/controller/militaryvehicleManagement/BdglThebusApplyController.java

@@ -74,7 +74,8 @@ public class BdglThebusApplyController extends BaseController {
         //获取当前登陆人的id
         LoginUser loginUser = getLoginUser();
         Long userId = loginUser.getUserId();
-        //1、判断当前人员是不是营级审批人、
+        //1、判断当前人员是不是营级审批人
+
         //2、判断当前人员是不是初审员
         //3、判断是不是一级审批
         //4、判断是不是二级审批
@@ -622,7 +623,7 @@ public class BdglThebusApplyController extends BaseController {
     /**
      * 查看出车列表
      *
-     * @param bdglThebusApply
+     * @param
      * @return
      */
     @GetMapping("/lookchuchelist/{id}")

+ 1 - 0
supervision-admin/src/main/java/com/supervision/web/noticeManage/entity/Notice.java

@@ -11,4 +11,5 @@ public class Notice {
     private String attachment; // 存放前端传过来的文件URL
     private LocalDateTime createTime;
     private LocalDateTime updateTime;
+    private String fileType;
 }

+ 33 - 0
supervision-system/src/main/java/com/supervision/militaryvehicleManagement/domain/AccessPeople.java

@@ -0,0 +1,33 @@
+package com.supervision.militaryvehicleManagement.domain;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class AccessPeople {
+    /**
+     * 审批人员id
+     */
+    private int id;
+
+    /**
+     * 审批人员姓名
+     */
+    private String name;
+
+    /**
+     * 审批人员职别
+     */
+    private Integer level;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createTime;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateTime;
+}

+ 18 - 0
supervision-system/src/main/java/com/supervision/militaryvehicleManagement/mapper/BdglAccessPeopleMapper.java

@@ -0,0 +1,18 @@
+package com.supervision.militaryvehicleManagement.mapper;
+
+import com.supervision.militaryvehicleManagement.domain.AccessPeople;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BdglAccessPeopleMapper {
+    void add(AccessPeople accessPeople);
+
+    List<AccessPeople> queryList(AccessPeople accessPeople);
+
+    int deleteByIds(@Param("ids")List<Integer> ids);
+
+    AccessPeople selectById(@Param("id")int id);
+
+    boolean updateById(AccessPeople accessPeople);
+}

+ 19 - 0
supervision-system/src/main/java/com/supervision/militaryvehicleManagement/service/IBdglAccessPeopleService.java

@@ -0,0 +1,19 @@
+package com.supervision.militaryvehicleManagement.service;
+
+import com.github.pagehelper.PageInfo;
+import com.supervision.common.core.domain.AjaxResult;
+import com.supervision.militaryvehicleManagement.domain.AccessPeople;
+
+import java.util.List;
+
+public interface IBdglAccessPeopleService {
+    void add(AccessPeople accessPeople);
+
+    PageInfo<AccessPeople> queryPage(String name, Integer level,  int pageNum, int pageSize);
+
+    int deleteByIds(List<Integer> ids);
+
+    AccessPeople getById(int id);
+
+    boolean updateById(AccessPeople accessPeople);
+}

+ 58 - 0
supervision-system/src/main/java/com/supervision/militaryvehicleManagement/service/impl/IBdglAccessPeopleServiceImpl.java

@@ -0,0 +1,58 @@
+package com.supervision.militaryvehicleManagement.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.supervision.militaryvehicleManagement.domain.AccessPeople;
+import com.supervision.militaryvehicleManagement.mapper.BdglAccessPeopleMapper;
+import com.supervision.militaryvehicleManagement.service.IBdglAccessPeopleService;
+import com.supervision.militaryvehicleManagement.service.IBdglDepartureInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+@Service
+public class IBdglAccessPeopleServiceImpl implements IBdglAccessPeopleService {
+    @Autowired
+    private BdglAccessPeopleMapper bdglAccessPeopleMapper;
+    @Override
+    public void add(AccessPeople accessPeople) {
+        bdglAccessPeopleMapper.add(accessPeople);
+    }
+
+    @Override
+    public PageInfo<AccessPeople> queryPage(String name, Integer level, int pageNum, int pageSize) {
+        //开启分页
+        PageHelper.startPage(pageNum, pageSize);
+
+        AccessPeople accessPeople = new AccessPeople();
+        accessPeople.setName(name);
+        accessPeople.setLevel(level);
+        //执行查询
+        List<AccessPeople> list =  bdglAccessPeopleMapper.queryList(accessPeople);
+
+        //封装结果
+        return new PageInfo<>(list);
+    }
+
+    @Override
+    public int deleteByIds(List<Integer> ids) {
+        if (ids == null || ids.isEmpty()) {
+            return 0;
+        }
+        return bdglAccessPeopleMapper.deleteByIds(ids);
+    }
+
+    @Override
+    public AccessPeople getById(int id) {
+        return bdglAccessPeopleMapper.selectById(id);
+    }
+
+    @Override
+    public boolean updateById(AccessPeople accessPeople) {
+        return bdglAccessPeopleMapper.updateById(accessPeople);
+    }
+
+
+}

+ 41 - 20
supervision-system/src/main/java/com/supervision/safety/mapper/SafetyIssueMapper.java

@@ -1,6 +1,8 @@
 package com.supervision.safety.mapper;
 
-import com.supervision.safety.domain.*;
+import com.supervision.safety.domain.IssueStatus;
+import com.supervision.safety.domain.RiskLevel;
+import com.supervision.safety.domain.SafetyIssue;
 import org.apache.ibatis.annotations.*;
 import org.apache.ibatis.type.EnumTypeHandler;
 
@@ -11,25 +13,44 @@ import java.util.Map;
 @Mapper
 public interface SafetyIssueMapper {
 
-    // === 基础 ===
+    // ========= 基础 =========
     @Select("SELECT id, description, risk_level, status, found_at, rectified_at, deleted, create_time, update_time " +
             "FROM safety_issue WHERE id=#{id} AND deleted=0")
-    @Results(id="IssueMap", value = {
-            @Result(column="risk_level", property="riskLevel", javaType=RiskLevel.class,
-                    typeHandler=EnumTypeHandler.class),
-            @Result(column="status", property="status", javaType=IssueStatus.class,
-                    typeHandler=EnumTypeHandler.class)
+    @Results(id = "IssueMap", value = {
+            // 显式列 -> 属性映射(关键修复)
+            @Result(column = "id",           property = "id"),
+            @Result(column = "description",  property = "description"),
+            @Result(column = "risk_level",   property = "riskLevel",
+                    javaType = RiskLevel.class,  typeHandler = EnumTypeHandler.class),
+            @Result(column = "status",       property = "status",
+                    javaType = IssueStatus.class, typeHandler = EnumTypeHandler.class),
+            @Result(column = "found_at",     property = "foundAt"),
+            @Result(column = "rectified_at", property = "rectifiedAt"),
+            @Result(column = "deleted",      property = "deleted"),
+            @Result(column = "create_time",  property = "createTime"),
+            @Result(column = "update_time",  property = "updateTime")
     })
     SafetyIssue findById(@Param("id") Long id);
 
-    @Insert("INSERT INTO safety_issue(description, risk_level, status, found_at, rectified_at, deleted, create_time, update_time) " +
-            "VALUES(#{description}, #{riskLevel,typeHandler=org.apache.ibatis.type.EnumTypeHandler}, " +
-            "#{status,typeHandler=org.apache.ibatis.type.EnumTypeHandler}, #{foundAt}, #{rectifiedAt}, 0, NOW(), NOW())")
-    @Options(useGeneratedKeys = true, keyProperty = "id")
+    @Insert("INSERT INTO safety_issue " +
+            "(description, risk_level, status, found_at, rectified_at, deleted, create_time, update_time) VALUES " +
+            "(#{description}, " +
+            " #{riskLevel, typeHandler=org.apache.ibatis.type.EnumTypeHandler}, " +
+            " #{status,    typeHandler=org.apache.ibatis.type.EnumTypeHandler}, " +
+            " COALESCE(#{foundAt}, NOW()), " +     // 兜底,未传 foundAt 用当前时间
+            " #{rectifiedAt}, 0, NOW(), NOW())")
+    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
     int insert(SafetyIssue issue);
 
-    @Update("UPDATE safety_issue SET status=#{status,typeHandler=org.apache.ibatis.type.EnumTypeHandler}, " +
-            "rectified_at=#{rectifiedAt}, update_time=NOW() WHERE id=#{id} AND deleted=0")
+    @Update("UPDATE safety_issue SET " +
+            " status = #{status, typeHandler=org.apache.ibatis.type.EnumTypeHandler}, " +
+            " rectified_at = CASE " +
+            "   WHEN #{status, typeHandler=org.apache.ibatis.type.EnumTypeHandler} = 'RECTIFIED' " +
+            "     THEN COALESCE(#{rectifiedAt}, NOW()) " +  // 置为 RECTIFIED 时自动写整改时间
+            "   ELSE rectified_at " +
+            " END, " +
+            " update_time = NOW() " +
+            "WHERE id = #{id} AND deleted = 0")
     int updateStatus(@Param("id") Long id,
                      @Param("status") IssueStatus status,
                      @Param("rectifiedAt") Date rectifiedAt);
@@ -37,8 +58,8 @@ public interface SafetyIssueMapper {
     @Update("UPDATE safety_issue SET deleted=1, update_time=NOW() WHERE id=#{id} AND deleted=0")
     int logicalDelete(@Param("id") Long id);
 
-    // === 查询/分页 ===
-    @SelectProvider(type=SafetyIssueSqlProvider.class, method="searchSql")
+    // ========= 查询 / 分页 =========
+    @SelectProvider(type = SafetyIssueSqlProvider.class, method = "searchSql")
     @ResultMap("IssueMap")
     List<SafetyIssue> search(@Param("keyword") String keyword,
                              @Param("level") RiskLevel level,
@@ -48,22 +69,22 @@ public interface SafetyIssueMapper {
                              @Param("limit") int limit,
                              @Param("offset") int offset);
 
-    @SelectProvider(type=SafetyIssueSqlProvider.class, method="countSql")
+    @SelectProvider(type = SafetyIssueSqlProvider.class, method = "countSql")
     long count(@Param("keyword") String keyword,
                @Param("level") RiskLevel level,
                @Param("status") IssueStatus status,
                @Param("from") Date from,
                @Param("to") Date to);
 
-    // === 统计 ===
-    @SelectProvider(type=SafetyIssueSqlProvider.class, method="countPendingByLevelSql")
+    // ========= 统计 =========
+    @SelectProvider(type = SafetyIssueSqlProvider.class, method = "countPendingByLevelSql")
     List<Map<String, Object>> countPendingByLevel();
 
-    @SelectProvider(type=SafetyIssueSqlProvider.class, method="trendByDaySql")
+    @SelectProvider(type = SafetyIssueSqlProvider.class, method = "trendByDaySql")
     List<Map<String, Object>> trendByDay(@Param("from") Date from,
                                          @Param("to") Date to);
 
-    @SelectProvider(type=SafetyIssueSqlProvider.class, method="top5HighSql")
+    @SelectProvider(type = SafetyIssueSqlProvider.class, method = "top5HighSql")
     @ResultMap("IssueMap")
     List<SafetyIssue> top5High();
 }

+ 1 - 1
supervision-system/src/main/java/com/supervision/safety/mapper/SafetyIssueSqlProvider.java

@@ -46,4 +46,4 @@ public class SafetyIssueSqlProvider {
                 "FROM safety_issue WHERE deleted=0 AND risk_level='HIGH' AND status='PENDING' " +
                 "ORDER BY found_at DESC LIMIT 5";
     }
-}
+}

+ 65 - 0
supervision-system/src/main/resources/mapper/militaryvehicleManagement/BdglAccessPeopleMapper.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.supervision.militaryvehicleManagement.mapper.BdglAccessPeopleMapper">
+    <resultMap type="AccessPeople" id="AccessPeopleResult">
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="level"    column="level"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+    <insert id="add" parameterType="com.supervision.militaryvehicleManagement.domain.AccessPeople">
+        insert into access_people
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="name != null">name,</if>
+            <if test="level != null">level,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="VALUES (" suffix=")" suffixOverrides=",">
+            <if test="name != null">#{name},</if>
+            <if test="level != null">#{level},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+    <update id="updateById">
+        UPDATE access_people
+        <set>
+            <if test="name != null">name = #{name},</if>
+            <if test="level != null">level = #{level},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </set>
+        WHERE id = #{id}
+    </update>
+    <delete id="deleteByIds">
+        DELETE FROM access_people
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <select id="queryList" resultType="com.supervision.militaryvehicleManagement.domain.AccessPeople">
+        SELECT *
+        FROM access_people
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE CONCAT('%', #{name}, '%')
+            </if>
+            <if test="level != null">
+                AND level = #{level}
+            </if>
+        </where>
+        ORDER BY create_time DESC
+    </select>
+    <select id="selectById" resultType="com.supervision.militaryvehicleManagement.domain.AccessPeople">
+        SELECT *
+        FROM access_people
+        WHERE id = #{id}
+    </select>
+
+
+
+</mapper>
+

+ 1 - 1
supervision-system/src/main/resources/mapper/militaryvehicleManagement/BdglThebusApplyMapper.xml

@@ -196,7 +196,7 @@
             <if test="tjtsYuanyin != null  and tjtsYuanyin != ''"> and tjts_yuanyin = #{tjtsYuanyin}</if>
             <if test="sjtsYuanyin != null  and sjtsYuanyin != ''"> and sjts_yuanyin = #{sjtsYuanyin}</if>
 
-            <if test="peopleName != null  and peopleName != ''"> and people_name = #{peopleName}</if>
+            <if test="peopleName != null  and peopleName != ''"> and people_name LIKE CONCAT('%', #{peopleName}, '%')</if>
             <if test="unitName != null  and unitName != ''"> and unit_name = #{unitName}</if>
 
             <if test="bdglDepartureYuanyin != null  and bdglDepartureYuanyin != ''"> and bdgl_departure_yuanyin = #{bdglDepartureYuanyin}</if>