瀏覽代碼

调整物资清单,调整领取管理

车车 10 月之前
父節點
當前提交
0184e8e0e8

+ 3 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/IsMaterialsLoan.java

@@ -79,5 +79,8 @@ public class IsMaterialsLoan extends BaseBean
     @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
     private String delFlag;
 
+    @ApiModelProperty(value = "状态(0-待归还 1-已归还 2-超时未归还)")
+    private String status;
+
 
 }

+ 7 - 5
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/materials/MaterialsPageDTO.java

@@ -16,24 +16,23 @@ public class MaterialsPageDTO
     private static final long serialVersionUID = 1L;
 
     @ApiModelProperty(value = "物资编号")
-    @Excel(name = "物资编号")
     private String materialsCode;
 
     @ApiModelProperty(value = "物资名称")
-    @Excel(name = "物资名称")
     private String materialsName;
 
     @ApiModelProperty(value = "物资类型ID")
     private Long materialsTypeId;
 
     @ApiModelProperty(value = "区域ID")
-    @Excel(name = "区域ID")
     private Long workareaId;
 
     @ApiModelProperty(value = "物资柜ID")
-    @Excel(name = "物资柜ID")
     private Long materialsCabinetId;
 
+    @ApiModelProperty(value = "物资柜Name")
+    private String cabinetName;
+
     @ApiModelProperty(value = "状态(0-借出 1-柜中)")
     private String loanState;
 
@@ -50,7 +49,10 @@ public class MaterialsPageDTO
     private String endExpirationDate;
 
     @ApiModelProperty(value = "供应商")
-    @Excel(name = "供应商")
     private String supplier;
 
+    @ApiModelProperty(value = "物资RFID")
+    @Excel(name = "物资RFID")
+    private String materialsRfid;
+
 }

+ 24 - 3
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/materialsLoan/MaterialsLoanPageDTO.java

@@ -21,9 +21,6 @@ public class MaterialsLoanPageDTO
     @ApiModelProperty(value = "物资名称")
     private String materialsName;
 
-    @ApiModelProperty(value = "领取人Name")
-    private String loanUserName;
-
     @ApiModelProperty(value = "是否需要归还")
     private Integer restitutionRequired;
 
@@ -33,4 +30,28 @@ public class MaterialsLoanPageDTO
     @ApiModelProperty(value = "归还柜ID")
     private Long restitutionToId;
 
+    @ApiModelProperty(value = "物资类型ID")
+    private Long materialsTypeId;
+
+    @ApiModelProperty(value = "领取人Name")
+    private String loanUserName;
+
+    @ApiModelProperty(value = "领取开始时间")
+    private String loanTimeStart;
+
+    @ApiModelProperty(value = "领取结束时间")
+    private String loanTimeEnd;
+
+    @ApiModelProperty(value = "归还人Name")
+    private String restitutionUserName;
+
+    @ApiModelProperty(value = "归还开始时间")
+    private String restitutionTimeStart;
+
+    @ApiModelProperty(value = "归还结束时间")
+    private String restitutionTimeEnd;
+
+    @ApiModelProperty(value = "状态(0-待归还 1-已归还 2-超时未归还)")
+    private String status;
+
 }

+ 6 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/materials/MaterialsPageVO.java

@@ -91,4 +91,10 @@ public class MaterialsPageVO extends BaseBean
     @Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date expirationDate;
 
+    @ApiModelProperty(value = "物资类型图标")
+    private String materialsTypeIcon;
+
+    @ApiModelProperty(value = "物资类型缩略图")
+    private String materialsTypePicture;
+
 }

+ 15 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/materialsLoan/MaterialsLoanPageVO.java

@@ -101,7 +101,22 @@ public class MaterialsLoanPageVO extends BaseBean
     @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
     private String delFlag;
 
+    @ApiModelProperty(value = "物资类型ID")
+    private Long materialsTypeId;
 
+    @ApiModelProperty(value = "物资类型Name")
+    private String materialsTypeName;
 
+    @ApiModelProperty(value = "物资类型图标")
+    private String materialsTypeIcon;
+
+    @ApiModelProperty(value = "物资类型缩略图")
+    private String materialsTypePicture;
+
+    @ApiModelProperty(value = "状态(0-待归还 1-已归还 2-超时未归还)")
+    private String status;
+
+    @ApiModelProperty(value = "借出时长")
+    private String loanDuration;
 
 }

+ 24 - 7
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsLoanServiceImpl.java

@@ -103,6 +103,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
         redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
     }
 
+    /**
+     * 发送归还提醒
+     * @param messageId
+     */
     private void sendReminderMessage(String messageId) {
         Long materialsLoanId = messages.get(messageId);
         if (materialsLoanId != null) {
@@ -112,9 +116,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
             IsMaterialsLoan materialsLoan = getById(materialsLoanId);
             if (materialsLoan != null) {
                 // 1.1数据存在开始判断消息是否需要发送
-                if (materialsLoan.getRestitutionUserId() == null
-                        && materialsLoan.getActualRestitutionTime() == null
-                        && materialsLoan.getRestitutionToId() == null) {
+                // if (materialsLoan.getRestitutionUserId() == null
+                //         && materialsLoan.getActualRestitutionTime() == null
+                //         && materialsLoan.getRestitutionToId() == null) {
+                if (!"1".equals(materialsLoan.getStatus())) {
                         // 没有归还则需要开始新增提醒消息
                     IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
                     Map<String, Object> templateParams = new HashMap<>();
@@ -145,7 +150,12 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
         redisCache.setCacheObject(MATERIALS_LOAN + messageId, materialsLoanId, (int) delayInSeconds, TimeUnit.SECONDS);
     }
 
-    private void sendAlarmMessage(String messageId) {
+    /**
+     * 发送归还报警
+     * @param messageId
+     */
+    @Transactional
+    public void sendAlarmMessage(String messageId) {
         Long materialsLoanId = messages.get(messageId);
         if (materialsLoanId != null) {
             // 发送消息的逻辑
@@ -154,9 +164,11 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
             IsMaterialsLoan materialsLoan = getById(materialsLoanId);
             if (materialsLoan != null) {
                 // 1.1数据存在开始判断消息是否需要发送
-                if (materialsLoan.getRestitutionUserId() == null
-                        && materialsLoan.getActualRestitutionTime() == null
-                        && materialsLoan.getRestitutionToId() == null) {
+                // if (materialsLoan.getRestitutionUserId() == null
+                //         && materialsLoan.getActualRestitutionTime() == null
+                //         && materialsLoan.getRestitutionToId() == null) {
+
+                if (!"1".equals(materialsLoan.getStatus())) {
                     // 没有归还则需要开始新增提醒消息
                     IsMaterials materials = isMaterialsService.getById(materialsLoan.getMaterialsId());
                     Map<String, Object> templateParams = new HashMap<>();
@@ -171,6 +183,10 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
                     isMaterialsReminder.setReminderType(1);
                     isMaterialsReminder.setReadFlag(0);
                     iIsMaterialsReminderService.save(isMaterialsReminder);
+                    // 更新借出记录为-超时未归还
+                    update(Wrappers.<IsMaterialsLoan>lambdaUpdate()
+                            .eq(IsMaterialsLoan::getMaterialsLoanId, materialsLoanId)
+                            .set(IsMaterialsLoan::getStatus, 2));
                 }
             }
         }
@@ -345,6 +361,7 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
                 .eq(IsMaterialsLoan::getMaterialsLoanId, loanList.get(0).getMaterialsLoanId())
                 .set(IsMaterialsLoan::getRestitutionUserId, dto.getRestitutionUserId())
                 .set(IsMaterialsLoan::getRestitutionToId, dto.getRestitutionToId())
+                .set(IsMaterialsLoan::getStatus, 1)
                 .set(IsMaterialsLoan::getActualRestitutionTime, new Date()));
         // 3.开始更新物资信息
         isMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()

+ 3 - 0
ktg-iscs/src/main/resources/mapper/IsMachineryMapper.xml

@@ -29,6 +29,9 @@
             <if test="isMachinery.machineryType != null and isMachinery.machineryType.trim != ''">
                 and t.machinery_type = #{isMachinery.machineryType}
             </if>
+            <if test="isMachinery.parentId != null">
+                and t.parent_id = #{isMachinery.parentId}
+            </if>
         </where>
         ORDER BY
         t.machinery_id DESC

+ 43 - 7
ktg-iscs/src/main/resources/mapper/IsMaterialsLoanMapper.xml

@@ -136,7 +136,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             c1.cabinet_name as loan_from_name,
             c2.cabinet_name as restitution_to_name,
             u.user_name as loan_user_name,
-            u1.user_name as restitution_user_name
+            u1.user_name as restitution_user_name,
+            m.materials_type_id,
+            mt.materials_type_name,
+            mt.materials_type_icon,
+            mt.materials_type_picture,
+        CASE
+        WHEN l.actual_restitution_time IS NOT NULL THEN
+        CONCAT(
+        FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 3600 ),
+        '小时 ',
+        MOD ( FLOOR( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ) / 60 ), 60 ),
+        '分 ',
+        MOD ( TIMESTAMPDIFF( SECOND, l.loan_time, l.actual_restitution_time ), 60 ),
+        '秒'
+        ) ELSE null
+        END AS loan_duration
+
         FROM
             is_materials_loan l
         LEFT JOIN is_materials m ON m.materials_id = l.materials_id
@@ -144,16 +160,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN is_materials_cabinet c2 ON c2.cabinet_id = l.restitution_to_id
         LEFT JOIN sys_user u ON u.user_id = l.loan_user_id
         LEFT JOIN sys_user u1 ON u1.user_id = l.restitution_user_id
+        LEFT JOIN is_materials_type mt ON mt.materials_type_id = m.materials_type_id
         <where>
-            <if test="dto.materialsCode != null and dto.materialsCode.trim != ''">
-                and m.materials_code like concat('%',#{dto.materialsCode},'%')
-            </if>
             <if test="dto.materialsName != null and dto.materialsName.trim != ''">
                 and m.materials_name like concat('%',#{dto.materialsName},'%')
             </if>
-            <if test="dto.loanUserName != null and dto.loanUserName.trim != ''">
-                and u.user_name like concat('%',#{dto.loanUserName},'%')
-            </if>
             <if test="dto.restitutionRequired != null">
                 and l.restitution_required = #{dto.restitutionRequired}
             </if>
@@ -163,6 +174,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.restitutionToId != null">
                 and l.restitution_to_id = #{dto.restitutionToId}
             </if>
+            <if test="dto.materialsTypeId != null">
+                and m.materials_type_id = #{dto.materialsTypeId}
+            </if>
+            <if test="dto.loanUserName != null and dto.loanUserName.trim != ''">
+                and u.user_name like concat('%',#{dto.loanUserName},'%')
+            </if>
+            <if test="dto.loanTimeStart != null and dto.loanTimeStart.trim != ''">
+                and l.loan_time &gt;= #{dto.loanTimeStart}
+            </if>
+            <if test="dto.loanTimeEnd != null and dto.loanTimeEnd.trim != ''">
+                and l.loan_time &lt;= #{dto.loanTimeEnd}
+            </if>
+            <if test="dto.restitutionUserName != null and dto.restitutionUserName.trim != ''">
+                and u1.user_name like concat('%',#{dto.restitutionUserName},'%')
+            </if>
+            <if test="dto.restitutionTimeStart != null and dto.restitutionTimeStart.trim != ''">
+                and l.actual_restitution_time &gt;= #{dto.restitutionTimeStart}
+            </if>
+            <if test="dto.restitutionTimeEnd != null and dto.restitutionTimeEnd.trim != ''">
+                and l.actual_restitution_time &lt;= #{dto.restitutionTimeEnd}
+            </if>
+            <if test="dto.status != null and dto.status.trim != ''">
+                and l.status = #{dto.status}
+            </if>
+
         </where>
         ORDER BY l.materials_loan_id DESC
     </select>

+ 6 - 1
ktg-iscs/src/main/resources/mapper/IsMaterialsMapper.xml

@@ -143,7 +143,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
         m.*,
         t.materials_type_name,
-        c.cabinet_name
+        c.cabinet_name,
+        t.materials_type_icon,
+        t.materials_type_picture
         FROM
         is_materials m
         LEFT JOIN is_materials_type t ON t.materials_type_id = m.materials_type_id
@@ -179,6 +181,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.supplier != null and dto.supplier.trim != ''">
                 and m.supplier like concat('%',#{dto.supplier},'%')
             </if>
+            <if test="dto.materialsRfid != null and dto.materialsRfid.trim != ''">
+                and m.materials_rfid like concat('%',#{dto.materialsRfid},'%')
+            </if>
         </where>
         ORDER BY m.materials_id DESC
     </select>