Commit 341b8ba864c3b141609295e9574524e457616b25

Authored by yiming
1 parent 4eb2ddd9

归还修改

ruoyi-archives/src/main/java/com/ruoyi/service/impl/ArchivesBorrowServiceImpl.java
... ... @@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional;
12 12 import javax.annotation.Resource;
13 13 import java.time.LocalDateTime;
14 14 import java.time.format.DateTimeFormatter;
  15 +import java.util.Calendar;
15 16 import java.util.Date;
16 17 import java.util.List;
17 18 import java.util.Random;
... ... @@ -75,7 +76,7 @@ public class ArchivesBorrowServiceImpl implements IArchivesBorrowService
75 76 @Override
76 77 public int archivesRenew(Long[] ids) {
77 78 ArchivesBorrow archivesBorrow=new ArchivesBorrow();
78   - archivesBorrow.setBorrowDate(new Date());
  79 + archivesBorrow.setBorrowDate(DateUtils.truncate(new Date(), Calendar.DATE));
79 80 archivesBorrow.setStatus("3");
80 81 int i=archivesBorrowMapper.updateArchivesBorrowByIds(archivesBorrow, ids);
81 82 return i;
... ...
ruoyi-archives/src/main/resources/mapper/archives/ArchivesBorrowMapper.xml
... ... @@ -71,12 +71,11 @@
71 71 where a.collect_box_id=b.id and b.filing_dept=c.dept_id
72 72 <if test="name != null and name != ''"> and a.name = #{name}</if>
73 73 <if test="dept != null and dept != ''"> and a.dept = #{dept}</if>
74   - <if test="borrowDate != null and borrowDate != ''"> and a.borrow_date = #{borrowDate}</if>
75   - <if test="borrowDateS != null and borrowDateS != ''"> and a.borrow_date >= #{borrowDateS}</if>
76   - <if test="borrowDateE != null and borrowDateE != ''"> and a.borrow_date &lt;= #{borrowDateE}</if>
  74 + <if test="borrowDate != null "> and a.borrow_date = #{borrowDate}</if>
  75 + <if test="borrowDateS != null "> and a.borrow_date >= #{borrowDateS}</if>
  76 + <if test="borrowDateE != null "> and a.borrow_date &lt;= #{borrowDateE}</if>
77 77 <if test="borrowMark != null and borrowMark != ''"> and a.borrow_mark = #{borrowMark}</if>
78 78 <if test="filingDept != null and filingDept != ''"> AND (b.filing_dept=#{filingDept} or FIND_IN_SET(#{filingDept},c.ancestors))</if>
79   - <if test="filingDept != null and filingDept != ''"> AND (b.filing_dept=#{filingDept} or FIND_IN_SET(#{filingDept},c.ancestors))</if>
80 79 <if test="status == 'true'"> and a.status != '1'</if>
81 80 </select>
82 81  
... ... @@ -90,7 +89,8 @@
90 89 <update id="updateArchivesBorrowByIds" parameterType="ArchivesBorrow">
91 90 update archives_borrow
92 91 <trim prefix="SET" suffixOverrides=",">
93   - <if test="archivesBorrow.returnDate != null">return_date = #{archivesBorrow.returnDate},</if>
  92 + <if test="archivesBorrow.returnDate != null and archivesBorrow.returnDate != 0">return_date = #{archivesBorrow.returnDate},</if>
  93 + <if test="archivesBorrow.borrowDate != null ">borrow_date = #{archivesBorrow.borrowDate},</if>
94 94 <if test="archivesBorrow.returnedDate != null">returned_date = #{archivesBorrow.returnedDate},</if>
95 95 <if test="archivesBorrow.status != null">status = #{archivesBorrow.status},</if>
96 96 </trim>
... ...
ruoyi-ui/src/views/service/borrowReturn/index.vue
... ... @@ -37,7 +37,9 @@
37 37 <el-input v-model="queryParams.dept" />
38 38 </el-form-item>
39 39 <el-form-item label="借阅日期" prop="">
40   - <el-input v-model="queryParams.borrowDate" />
  40 + <el-date-picker
  41 + v-model="queryParams.borrowDate" type="date" value-format="yyyy-MM-dd">
  42 + </el-date-picker>
41 43 </el-form-item>
42 44 <el-form-item label="借阅单号" prop="">
43 45 <el-input v-model="queryParams.borrowMark" />
... ... @@ -59,8 +61,8 @@
59 61 <el-table-column label="借阅人" align="center" prop="name" />
60 62 <el-table-column label="部门" align="center" prop="dept" />
61 63 <el-table-column label="实体利用方式" align="center" prop="mode" />
62   - <el-table-column label="领取日期" align="center" prop="borrowDate" />
63   - <el-table-column label="借阅天数" align="center" prop="returnDate" />
  64 + <el-table-column label="借阅日期" align="center" prop="borrowDate" />
  65 + <el-table-column label="预期归还" align="center" :formatter="returnDateFormat"/>
64 66 <el-table-column label="借阅单号" align="center" prop="borrowMark" />
65 67 </el-table>
66 68 </el-col>
... ... @@ -172,8 +174,19 @@ export default {
172 174 },
173 175 borrowStatusFormat(row, column) {
174 176 return this.selectDictLabel(this.dict.type.borrowStatus, row.status);
  177 + },
  178 + returnDateFormat(row, column) {
  179 + var Dates = new Date(row.borrowDate);
  180 + Dates.setDate(Dates.getDate() + row.returnDate);
  181 + var mon = Dates.getMonth() + 1, day = Dates.getDate();
  182 + if(mon < 10){
  183 + mon = "0" + mon;//月份小于10,在前面补充0
  184 + }
  185 + if(day < 10){
  186 + day = "0" + day;//日小于10,在前面补充0
  187 + }
  188 + return Dates.getFullYear() + "-" + mon + "-" +day;
175 189 }
176   -
177 190 }
178 191 };
179 192 </script>
... ...