Преглед изворни кода

新增过期提醒 告警提醒

车车 пре 1 година
родитељ
комит
e9358986a4

+ 42 - 2
ktg-iscs/src/main/java/com/ktg/iscs/controller/IsMaterialsLoanController.java

@@ -7,8 +7,12 @@ import com.ktg.common.enums.BusinessType;
 import com.ktg.common.pojo.CommonResult;
 import com.ktg.common.utils.poi.ExcelUtil;
 import com.ktg.iscs.domain.IsMaterialsLoan;
+import com.ktg.iscs.domain.dto.materialsLoan.AddLoanDTO;
 import com.ktg.iscs.domain.dto.materialsLoan.MaterialsLoanPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReminderPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReturnLoanDTO;
 import com.ktg.iscs.domain.vo.materialsLoan.MaterialsLoanPageVO;
+import com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO;
 import com.ktg.iscs.service.IIsMaterialsLoanService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -85,9 +89,18 @@ public class IsMaterialsLoanController extends BaseController
     @PreAuthorize("@ss.hasPermi('iscs:loan:add')")
     @Log(title = "物资借出", businessType = BusinessType.INSERT)
     @PostMapping("/insertIsMaterialsLoan")
-    public CommonResult<Boolean> insertIsMaterialsLoan(@RequestBody @Parameter(name = "isMaterialsLoan", description = "新增数据类,放到body") IsMaterialsLoan isMaterialsLoan)
+    public CommonResult<Boolean> insertIsMaterialsLoan(@RequestBody @Parameter(name = "dto", description = "新增数据类,放到body") AddLoanDTO dto)
     {
-        return CommonResult.success(isMaterialsLoanService.insertIsMaterialsLoan(isMaterialsLoan) == 1);
+        return CommonResult.success(isMaterialsLoanService.insertIsMaterialsLoan(dto) == 1);
+    }
+
+    @ApiOperation("物资归还")
+    @PreAuthorize("@ss.hasPermi('iscs:loan:add')")
+    @Log(title = "物资归还", businessType = BusinessType.INSERT)
+    @PostMapping("/returnIsMaterialsLoan")
+    public CommonResult<Boolean> returnIsMaterialsLoan(@RequestBody @Parameter(name = "dto", description = "新增数据类,放到body") ReturnLoanDTO dto)
+    {
+        return CommonResult.success(isMaterialsLoanService.returnIsMaterialsLoan(dto));
     }
 
     /**
@@ -113,4 +126,31 @@ public class IsMaterialsLoanController extends BaseController
     {
         return CommonResult.success(isMaterialsLoanService.deleteIsMaterialsLoanByMaterialsLoanIds(materialsLoanIds) != 0);
     }
+
+    @ApiOperation("归还提醒-分页")
+    @Parameters({
+            @Parameter(name = "page", description = "Page"),
+            @Parameter(name = "dto", description = "实体参数")
+    })
+    @PreAuthorize("@ss.hasPermi('iscs:loan:list')")
+    @GetMapping("/getReturnReminderPage")
+    public CommonResult<Page<ReminderPageVO>> getReturnReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto)
+    {
+        Page<ReminderPageVO> result = isMaterialsLoanService.getReturnReminderPage(page, dto);
+        return CommonResult.success(result);
+    }
+
+    @ApiOperation("过期提醒-分页")
+    @Parameters({
+            @Parameter(name = "page", description = "Page"),
+            @Parameter(name = "dto", description = "实体参数")
+    })
+    @PreAuthorize("@ss.hasPermi('iscs:loan:list')")
+    @GetMapping("/getExpiredReminderPage")
+    public CommonResult<Page<ReminderPageVO>> getReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto)
+    {
+        Page<ReminderPageVO> result = isMaterialsLoanService.getExpiredReminderPage(page, dto);
+        return CommonResult.success(result);
+    }
+
 }

+ 12 - 2
ktg-iscs/src/main/java/com/ktg/iscs/domain/IsMaterialsLoan.java

@@ -57,11 +57,21 @@ public class IsMaterialsLoan extends BaseBean
     @Excel(name = "归还柜ID")
     private Long restitutionToId;
 
-    @ApiModelProperty(value = "归还时间")
+    @ApiModelProperty(value = "理应归还时间")
     @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
-    @Excel(name = "归还时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @Excel(name = "理应归还时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date restitutionTime;
 
+    @ApiModelProperty(value = "实际归还时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "实际归还时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date actualRestitutionTime;
+
+    @ApiModelProperty(value = "超时报警")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "超时报警", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date timeoutAlarm;
+
     @ApiModelProperty(value = "是否需要归还")
     @Excel(name = "是否需要归还")
     private Integer restitutionRequired;

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

@@ -70,6 +70,9 @@ public class IsWorkarea extends BaseBean
     @ApiModelProperty(value = "状态")
     private String status;
 
+    @ApiModelProperty(value = "区域地图")
+    private String mapImg;
+
     @TableField(exist = false)
     private List<?> children = new ArrayList<>();
 

+ 23 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/materialsLoan/AddLoanDTO.java

@@ -0,0 +1,23 @@
+package com.ktg.iscs.domain.dto.materialsLoan;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 物资借出对象 is_materials_loan
+ *
+ * @author cgj
+ * @date 2024-11-08
+ */
+@Data
+public class AddLoanDTO
+{
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "物资ID")
+    private Long materialsId;
+
+    @ApiModelProperty(value = "领取人ID")
+    private Long loanUserId;
+
+}

+ 40 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/materialsLoan/ReminderPageDTO.java

@@ -0,0 +1,40 @@
+package com.ktg.iscs.domain.dto.materialsLoan;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 物资借出对象 is_materials_loan
+ *
+ * @author cgj
+ * @date 2024-11-08
+ */
+@Data
+public class ReminderPageDTO
+{
+
+    @ApiModelProperty(value = "物资编号")
+    private String materialsCode;
+
+    @ApiModelProperty(value = "物资名称")
+    private String materialsName;
+
+    @ApiModelProperty(value = "领取人ID")
+    private Long loanUserId;
+
+    @ApiModelProperty(value = "领取人Name")
+    private String loanUserName;
+
+    @ApiModelProperty(value = "领取柜ID")
+    private Long loanFromId;
+
+    @ApiModelProperty(value = "领取柜Name")
+    private String loanFromName;
+
+    @ApiModelProperty(value = "startTime")
+    private String startTime;
+
+    @ApiModelProperty(value = "endTime")
+    private String endTime;
+
+}

+ 26 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/dto/materialsLoan/ReturnLoanDTO.java

@@ -0,0 +1,26 @@
+package com.ktg.iscs.domain.dto.materialsLoan;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 物资借出对象 is_materials_loan
+ *
+ * @author cgj
+ * @date 2024-11-08
+ */
+@Data
+public class ReturnLoanDTO
+{
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "物资ID")
+    private Long materialsId;
+
+    @ApiModelProperty(value = "归还人ID")
+    private Long restitutionUserId;
+
+    @ApiModelProperty(value = "归还柜ID")
+    private Long restitutionToId;
+
+}

+ 11 - 1
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/materialsLoan/MaterialsLoanPageVO.java

@@ -71,11 +71,21 @@ public class MaterialsLoanPageVO extends BaseBean
     @ApiModelProperty(value = "归还柜Name")
     private String restitutionToName;
 
-    @ApiModelProperty(value = "归还时间")
+    @ApiModelProperty(value = "理应归还时间")
     @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
     @Excel(name = "归还时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date restitutionTime;
 
+    @ApiModelProperty(value = "实际归还时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "实际归还时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date actualRestitutionTime;
+
+    @ApiModelProperty(value = "超时报警")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    @Excel(name = "超时报警", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date timeoutAlarm;
+
     @ApiModelProperty(value = "是否需要归还")
     @Excel(name = "是否需要归还")
     private Integer restitutionRequired;

+ 91 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/materialsLoan/ReminderPageVO.java

@@ -0,0 +1,91 @@
+package com.ktg.iscs.domain.vo.materialsLoan;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ktg.common.core.domain.model.BaseBean;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 物资借出对象 is_materials_loan
+ *
+ * @author cgj
+ * @date 2024-11-08
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ReminderPageVO extends BaseBean
+{
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "出借记录ID")
+    @TableId(type = IdType.AUTO)
+    private Long materialsLoanId;
+
+    @ApiModelProperty(value = "物资ID")
+    private Long materialsId;
+
+    @ApiModelProperty(value = "物资编号")
+    private String materialsCode;
+
+    @ApiModelProperty(value = "物资名称")
+    private String materialsName;
+
+    @ApiModelProperty(value = "领取人ID")
+    private Long loanUserId;
+
+    @ApiModelProperty(value = "领取人Name")
+    private String loanUserName;
+
+    @ApiModelProperty(value = "领取柜ID")
+    private Long loanFromId;
+
+    @ApiModelProperty(value = "领取柜Name")
+    private String loanFromName;
+
+    @ApiModelProperty(value = "领取时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    private Date loanTime;
+
+    @ApiModelProperty(value = "提醒时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    private Date reminderTime;
+
+    @ApiModelProperty(value = "归还人ID")
+    private Long restitutionUserId;
+
+    @ApiModelProperty(value = "归还人Name")
+    private String restitutionUserName;
+
+    @ApiModelProperty(value = "归还柜ID")
+    private Long restitutionToId;
+
+    @ApiModelProperty(value = "归还柜Name")
+    private String restitutionToName;
+
+    @ApiModelProperty(value = "理应归还时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    private Date restitutionTime;
+
+    @ApiModelProperty(value = "实际归还时间")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    private Date actualRestitutionTime;
+
+    @ApiModelProperty(value = "超时报警")
+    @JsonFormat(timezone="GMT+8", pattern = "yyyy-MM-dd")
+    private Date timeoutAlarm;
+
+    @ApiModelProperty(value = "是否需要归还")
+    private Integer restitutionRequired;
+
+    @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
+    private String delFlag;
+
+
+
+
+}

+ 3 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/workarea/PageWorkareaVO.java

@@ -67,4 +67,7 @@ public class PageWorkareaVO extends BaseBean
     @ApiModelProperty(value = "状态")
     private String status;
 
+    @ApiModelProperty(value = "区域地图")
+    private String mapImg;
+
 }

+ 3 - 0
ktg-iscs/src/main/java/com/ktg/iscs/domain/vo/workarea/PointsMapVO.java

@@ -48,4 +48,7 @@ public class PointsMapVO implements Serializable {
     @ApiModelProperty(value = "隔离点图片")
     private String pointPicture;
 
+    @ApiModelProperty(value = "区域地图")
+    private String mapImg;
+
 }

+ 7 - 0
ktg-iscs/src/main/java/com/ktg/iscs/mapper/IsMaterialsLoanMapper.java

@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ktg.common.mapper.BaseMapperX;
 import com.ktg.iscs.domain.IsMaterialsLoan;
 import com.ktg.iscs.domain.dto.materialsLoan.MaterialsLoanPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReminderPageDTO;
 import com.ktg.iscs.domain.vo.materialsLoan.MaterialsLoanPageVO;
+import com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -68,4 +70,9 @@ public interface IsMaterialsLoanMapper extends BaseMapperX<IsMaterialsLoan>
     int deleteIsMaterialsLoanByMaterialsLoanIds(Long[] materialsLoanIds);
 
     Page<MaterialsLoanPageVO> getIsMaterialsLoanPage(Page<IsMaterialsLoan> page, @Param(value = "dto") MaterialsLoanPageDTO dto);
+
+    Page<ReminderPageVO> getReturnReminderPage(Page<IsMaterialsLoan> page, @Param(value = "dto") ReminderPageDTO dto);
+
+    Page<ReminderPageVO> getExpiredReminderPage(Page<IsMaterialsLoan> page, @Param(value = "dto") ReminderPageDTO dto);
+
 }

+ 29 - 2
ktg-iscs/src/main/java/com/ktg/iscs/service/IIsMaterialsLoanService.java

@@ -3,8 +3,12 @@ package com.ktg.iscs.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ktg.iscs.domain.IsMaterialsLoan;
+import com.ktg.iscs.domain.dto.materialsLoan.AddLoanDTO;
 import com.ktg.iscs.domain.dto.materialsLoan.MaterialsLoanPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReminderPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReturnLoanDTO;
 import com.ktg.iscs.domain.vo.materialsLoan.MaterialsLoanPageVO;
+import com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO;
 
 import java.util.List;
 
@@ -35,10 +39,10 @@ public interface IIsMaterialsLoanService extends IService<IsMaterialsLoan>
     /**
      * 新增物资借出
      *
-     * @param isMaterialsLoan 物资借出
+     * @param dto 物资借出
      * @return 结果
      */
-    int insertIsMaterialsLoan(IsMaterialsLoan isMaterialsLoan);
+    int insertIsMaterialsLoan(AddLoanDTO dto);
 
     /**
      * 修改物资借出
@@ -65,4 +69,27 @@ public interface IIsMaterialsLoanService extends IService<IsMaterialsLoan>
     int deleteIsMaterialsLoanByMaterialsLoanId(Long materialsLoanId);
 
     Page<MaterialsLoanPageVO> getIsMaterialsLoanPage(Page<IsMaterialsLoan> page, MaterialsLoanPageDTO dto);
+
+    /**
+     * 物资归还
+     * @param dto
+     * @return
+     */
+    Boolean returnIsMaterialsLoan(ReturnLoanDTO dto);
+
+    /**
+     * 归还提醒
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<ReminderPageVO> getReturnReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto);
+
+    /**
+     * 归还提醒
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<ReminderPageVO> getExpiredReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto);
 }

+ 76 - 14
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsLoanServiceImpl.java

@@ -1,14 +1,20 @@
 package com.ktg.iscs.service.impl;
 
 import cn.hutool.core.lang.Assert;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ktg.common.core.text.Convert;
 import com.ktg.common.utils.DateUtils;
+import com.ktg.common.utils.bean.BeanUtils;
 import com.ktg.iscs.domain.IsMaterials;
 import com.ktg.iscs.domain.IsMaterialsLoan;
+import com.ktg.iscs.domain.dto.materialsLoan.AddLoanDTO;
 import com.ktg.iscs.domain.dto.materialsLoan.MaterialsLoanPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReminderPageDTO;
+import com.ktg.iscs.domain.dto.materialsLoan.ReturnLoanDTO;
 import com.ktg.iscs.domain.vo.materialsLoan.MaterialsLoanPageVO;
+import com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO;
 import com.ktg.iscs.domain.vo.materialsType.MaterialsTypePageVO;
 import com.ktg.iscs.mapper.IsMaterialsLoanMapper;
 import com.ktg.iscs.service.IIsMaterialsLoanService;
@@ -16,6 +22,7 @@ import com.ktg.iscs.service.IIsMaterialsService;
 import com.ktg.iscs.service.IIsMaterialsTypeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.time.Instant;
 import java.util.Date;
@@ -64,33 +71,50 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
     /**
      * 新增物资借出
      *
-     * @param isMaterialsLoan 物资借出
+     * @param dto 物资借出
      * @return 结果
      */
+    @Transactional
     @Override
-    public int insertIsMaterialsLoan(IsMaterialsLoan isMaterialsLoan)
+    public int insertIsMaterialsLoan(AddLoanDTO dto)
     {
         Date nowDate = DateUtils.getNowDate();
+        IsMaterialsLoan isMaterialsLoan = BeanUtils.toBean(dto, IsMaterialsLoan.class);
         isMaterialsLoan.setLoanTime(nowDate);
         isMaterialsLoan.setCreateTime(nowDate);
-        // 开始读取类型和规则,然后计算归还时间,提醒时间
+        // 1.物资信息
         IsMaterials materials = isMaterialsService.getById(isMaterialsLoan.getMaterialsId());
+        // 1.2开始读取类型和规则,然后计算归还时间,提醒时间
         if (materials != null) {
+            // 1.2.1填充字段
+            isMaterialsLoan.setLoanFromId(materials.getMaterialsCabinetId());
             MaterialsTypePageVO materialsTypePageVO = isMaterialsTypeService.selectIsMaterialsTypeByMaterialsTypeId(materials.getMaterialsTypeId());
-            if (materialsTypePageVO != null && materialsTypePageVO.getLoanDuration() != null) {
-                // 计算应该归还时间
-                Date date = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration());
-                if (materialsTypePageVO.getReminderTime() != null) {
-                    // 计算提醒时间
-                    Date reminderTime = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() - materialsTypePageVO.getReminderTime());
-                }
-                if (materialsTypePageVO.getTimeoutAlarm() != null) {
-                    // 计算告警时间
-                    Date timeoutAlarm = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() + materialsTypePageVO.getTimeoutAlarm());
+            if (materialsTypePageVO != null) {
+                // 1.2.1.1填充字段
+                isMaterialsLoan.setRestitutionRequired(materialsTypePageVO.getRestitutionRequired());
+                if (materialsTypePageVO.getLoanDuration() != null) {
+                    // 1.2.2计算应该归还时间
+                    Date restitutionTime = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration());
+                    isMaterialsLoan.setReminderTime(restitutionTime);
+                    if (materialsTypePageVO.getReminderTime() != null) {
+                        // 1.2.3计算提醒时间
+                        Date reminderTime = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() - materialsTypePageVO.getReminderTime());
+                        isMaterialsLoan.setReminderTime(reminderTime);
+                    }
+                    if (materialsTypePageVO.getTimeoutAlarm() != null) {
+                        // 1.2.4计算告警时间
+                        Date timeoutAlarm = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() + materialsTypePageVO.getTimeoutAlarm());
+                        isMaterialsLoan.setTimeoutAlarm(timeoutAlarm);
+                    }
                 }
             }
         }
-        return isMaterialsLoanMapper.insertIsMaterialsLoan(isMaterialsLoan);
+        int i = isMaterialsLoanMapper.insertIsMaterialsLoan(isMaterialsLoan);
+        // 2.开始更新物资信息为借出状态
+        isMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()
+                .eq(IsMaterials::getMaterialsId, isMaterialsLoan.getMaterialsId())
+                .set(IsMaterials::getLoanState, 0));
+        return i;
     }
 
     // 格式化日期时间的方法
@@ -150,4 +174,42 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
     public Page<MaterialsLoanPageVO> getIsMaterialsLoanPage(Page<IsMaterialsLoan> page, MaterialsLoanPageDTO dto) {
         return isMaterialsLoanMapper.getIsMaterialsLoanPage(page, dto);
     }
+
+    @Transactional
+    @Override
+    public Boolean returnIsMaterialsLoan(ReturnLoanDTO dto) {
+        Assert.notNull(dto.getMaterialsId(), "物资id不能为空!");
+        Assert.notNull(dto.getRestitutionUserId(), "归还人id不能为空!");
+        Assert.notNull(dto.getRestitutionToId(), "归还柜id不能为空!");
+        // 1.检查借出数据
+        List<IsMaterialsLoan> loanList = list(Wrappers.<IsMaterialsLoan>lambdaQuery()
+                .eq(IsMaterialsLoan::getMaterialsId, dto.getMaterialsId())
+                .isNull(IsMaterialsLoan::getRestitutionUserId)
+                .isNull(IsMaterialsLoan::getRestitutionToId)
+        );
+        Assert.isFalse(loanList.isEmpty(), "尚未找到该物资的借出信息!");
+        Assert.isFalse(loanList.size() > 1, "该物资的借出信息出现多条!");
+        // 2.开始更新loan表数据
+        boolean update = update(Wrappers.<IsMaterialsLoan>lambdaUpdate()
+                .eq(IsMaterialsLoan::getMaterialsLoanId, loanList.get(0).getMaterialsLoanId())
+                .set(IsMaterialsLoan::getRestitutionUserId, dto.getRestitutionUserId())
+                .set(IsMaterialsLoan::getRestitutionToId, dto.getRestitutionToId())
+                .set(IsMaterialsLoan::getActualRestitutionTime, new Date()));
+        // 3.开始更新物资信息
+        isMaterialsService.update(Wrappers.<IsMaterials>lambdaUpdate()
+                .eq(IsMaterials::getMaterialsId, dto.getMaterialsId())
+                .set(IsMaterials::getLoanState, 1));
+        return update;
+    }
+
+    @Override
+    public Page<ReminderPageVO> getReturnReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto) {
+        return isMaterialsLoanMapper.getReturnReminderPage(page, dto);
+    }
+
+    @Override
+    public Page<ReminderPageVO> getExpiredReminderPage(Page<IsMaterialsLoan> page, ReminderPageDTO dto) {
+        return isMaterialsLoanMapper.getExpiredReminderPage(page, dto);
+    }
+
 }

+ 95 - 1
ktg-iscs/src/main/resources/mapper/IsMaterialsLoanMapper.xml

@@ -21,10 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="updateBy"    column="update_by"    />
+        <result property="actualRestitutionTime"    column="actual_restitution_time"    />
+        <result property="timeoutAlarm"    column="timeout_alarm"    />
     </resultMap>
 
     <sql id="selectIsMaterialsLoanVo">
-        select materials_loan_id, materials_id, loan_user_id, loan_from_id, loan_time, reminder_time, restitution_user_id, restitution_to_id, restitution_time, remark, del_flag, create_by, create_time, update_time, update_by from is_materials_loan
+        select materials_loan_id, materials_id, loan_user_id, loan_from_id, loan_time, reminder_time, restitution_user_id,
+               restitution_to_id, restitution_time, remark, del_flag, create_by, create_time, update_time, update_by,
+               actual_restitution_time, timeout_alarm
+               from is_materials_loan
     </sql>
 
     <select id="selectIsMaterialsLoanList" parameterType="IsMaterialsLoan" resultMap="IsMaterialsLoanResult">
@@ -64,6 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="updateBy != null">update_by,</if>
+            <if test="actualRestitutionTime != null">actual_restitution_time,</if>
+            <if test="timeoutAlarm != null">timeout_alarm,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="materialsId != null">#{materialsId},</if>
@@ -81,6 +88,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
+            <if test="actualRestitutionTime != null">#{actualRestitutionTime},</if>
+            <if test="timeoutAlarm != null">#{timeoutAlarm},</if>
          </trim>
     </insert>
 
@@ -102,6 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="actualRestitutionTime != null">actual_restitution_time = #{actualRestitutionTime},</if>
+            <if test="timeoutAlarm != null">timeout_alarm = #{timeoutAlarm},</if>
         </trim>
         where materials_loan_id = #{materialsLoanId}
     </update>
@@ -153,4 +164,87 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         ORDER BY l.materials_loan_id DESC
     </select>
+    <select id="getReturnReminderPage" resultType="com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO">
+        SELECT
+        l.*,
+        m.materials_code,
+        m.materials_name,
+        c1.cabinet_name as loan_from_name,
+        c2.cabinet_name as restitution_to_name,
+        u.user_name as loan_user_name
+        FROM
+        is_materials_loan l
+        LEFT JOIN is_materials m ON m.materials_id = l.materials_id
+        LEFT JOIN is_materials_cabinet c1 ON c1.cabinet_id = l.loan_from_id
+        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
+        <where>
+            l.reminder_time &lt; NOW()
+            and NOW() &lt; l.timeout_alarm
+            and actual_restitution_time is null
+            <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.loanFromId != null">
+                and l.loan_from_id = #{dto.loanFromId}
+            </if>
+            <if test="dto.loanFromName != null and dto.loanFromName.trim != ''">
+                and c1.cabinet_name like concat('%',#{dto.loanFromName},'%')
+            </if>
+            <if test="dto.startTime != null and dto.startTime.trim != ''">
+                and l.loan_time &gt;= #{dto.startTime}
+            </if>
+            <if test="dto.endTime != null and dto.endTime.trim != ''">
+                and l.loan_time &lt;= #{dto.endTime}
+            </if>
+        </where>
+        ORDER BY l.materials_loan_id DESC
+    </select>
+    <select id="getExpiredReminderPage" resultType="com.ktg.iscs.domain.vo.materialsLoan.ReminderPageVO">
+        SELECT
+        l.*,
+        m.materials_code,
+        m.materials_name,
+        c1.cabinet_name as loan_from_name,
+        c2.cabinet_name as restitution_to_name,
+        u.user_name as loan_user_name
+        FROM
+        is_materials_loan l
+        LEFT JOIN is_materials m ON m.materials_id = l.materials_id
+        LEFT JOIN is_materials_cabinet c1 ON c1.cabinet_id = l.loan_from_id
+        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
+        <where>
+            l.timeout_alarm &lt; NOW()
+            and actual_restitution_time is null
+            <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.loanFromId != null">
+                and l.loan_from_id = #{dto.loanFromId}
+            </if>
+            <if test="dto.loanFromName != null and dto.loanFromName.trim != ''">
+                and c1.cabinet_name like concat('%',#{dto.loanFromName},'%')
+            </if>
+            <if test="dto.startTime != null and dto.startTime.trim != ''">
+                and l.timeout_alarm &gt;= #{dto.startTime}
+            </if>
+            <if test="dto.endTime != null and dto.endTime.trim != ''">
+                and l.timeout_alarm &lt;= #{dto.endTime}
+            </if>
+        </where>
+        ORDER BY l.materials_loan_id DESC
+    </select>
 </mapper>

+ 7 - 1
ktg-iscs/src/main/resources/mapper/IsWorkareaMapper.xml

@@ -20,12 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="ancestors"    column="ancestors"    />
         <result property="orderNum"    column="order_num"    />
         <result property="status"    column="status"    />
+        <result property="status"    column="status"    />
+        <result property="mapImg"    column="map_img"    />
     </resultMap>
 
     <sql id="selectIsWorkareaVo">
         select workarea_id, workarea_code, workarea_name,
                workarea_type, workshop_id, map, del_flag, create_by,
-               create_time, update_time, update_by, parent_id, ancestors, order_num, status
+               create_time, update_time, update_by, parent_id, ancestors, order_num, status,
+               map_img
         from is_workarea
     </sql>
 
@@ -62,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="ancestors != null and ancestors != ''">ancestors,</if>
             <if test="orderNum != null">order_num,</if>
             <if test="status != null and status != ''">status,</if>
+            <if test="mapImg != null and mapImg != ''">map_img,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="workareaCode != null and workareaCode != ''">#{workareaCode},</if>
@@ -78,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
             <if test="orderNum != null">#{orderNum},</if>
             <if test="status != null">#{status},</if>
+            <if test="mapImg != null and mapImg != ''">#{mapImg},</if>
          </trim>
     </insert>
 
@@ -98,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="status != null">status = #{status},</if>
+            <if test="mapImg != null and mapImg != ''">map_img = #{mapImg},</if>
         </trim>
         where workarea_id = #{workareaId}
     </update>