Browse Source

新增是否租车、单日成本字段

根据申请人id获取部门主任
lamphua 1 year ago
parent
commit
b98791e8ca
20 changed files with 266 additions and 45 deletions
  1. 3
    13
      oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java
  2. 18
    0
      oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java
  3. 70
    8
      oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java
  4. 19
    1
      oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceController.java
  5. 11
    1
      oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
  6. 28
    0
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcCar.java
  7. 17
    3
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcDevice.java
  8. 16
    0
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcDeviceApproval.java
  9. 1
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcDeviceMapper.java
  10. 1
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcDeviceService.java
  11. 1
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcDeviceServiceImpl.java
  12. 9
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java
  13. 11
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java
  14. 6
    1
      oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java
  15. 11
    1
      oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcCarMapper.xml
  16. 6
    1
      oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceApprovalMapper.xml
  17. 7
    2
      oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceMapper.xml
  18. 11
    3
      oa-back/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml
  19. 3
    0
      oa-back/sql/sql.sql
  20. 17
    6
      oa-ui/src/views/oa/car/index.vue

+ 3
- 13
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java View File

@@ -165,22 +165,12 @@ public class CmcCarApprovalController extends BaseController
165 165
             cmcCarApproval.setCars(formDataJson.getString("cars"));
166 166
             cmcCarApproval.setDrivers(formDataJson.getString("drivers"));
167 167
             String[] cars = formDataJson.getString("cars").split(",");
168
+            BigDecimal estimateCost = new BigDecimal(0);
168 169
             for (String car : cars) {
169 170
                 CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
170
-                if (cmcCar.getAcquisitionTime() != null && cmcCar.getCost() != null) {
171
-                    // 年数总和法折旧
172
-                    int acquisitionYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(cmcCar.getAcquisitionTime()));
173
-                    int life = cmcCar.getExpectLife() == null ? 0 : cmcCar.getExpectLife();
174
-                    int total = 0;
175
-                    for (int i = 0; i < life + 1; i++)
176
-                        total += i;
177
-                    if (total > 0) {
178
-                        int currentYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(DateUtils.getNowDate()));
179
-                        int num = life - (currentYear - acquisitionYear) + 1;
180
-                        cmcCarApproval.setEstimateCost(new BigDecimal(num  * 0.95 / total).multiply(cmcCar.getCost()));
181
-                    }
182
-                }
171
+                estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
183 172
             }
173
+            cmcCarApproval.setEstimateCost(estimateCost);
184 174
         }
185 175
         cmcCarApprovalService.updateCmcCarApproval(cmcCarApproval);
186 176
         return AjaxResult.success("修改用车审批表成功");

+ 18
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarController.java View File

@@ -1,8 +1,11 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3
+import java.math.BigDecimal;
4
+import java.text.SimpleDateFormat;
3 5
 import java.util.List;
4 6
 import javax.servlet.http.HttpServletResponse;
5 7
 
8
+import com.ruoyi.common.utils.DateUtils;
6 9
 import org.springframework.beans.factory.annotation.Autowired;
7 10
 import org.springframework.web.bind.annotation.GetMapping;
8 11
 import org.springframework.web.bind.annotation.PostMapping;
@@ -72,6 +75,21 @@ public class CmcCarController extends BaseController
72 75
     @PostMapping
73 76
     public AjaxResult add(@RequestBody CmcCar cmcCar)
74 77
     {
78
+        if (cmcCar.getIsRent())
79
+        if (cmcCar.getAcquisitionTime() != null && cmcCar.getCost() != null && cmcCar.getDayCost() != null) {
80
+            // 年数总和法折旧
81
+            int acquisitionYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(cmcCar.getAcquisitionTime()));
82
+            int life = cmcCar.getExpectLife() == null ? 0 : cmcCar.getExpectLife();
83
+            int total = 0;
84
+            for (int i = 0; i < life + 1; i++)
85
+                total += i;
86
+            if (total > 0) {
87
+                int currentYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(DateUtils.getNowDate()));
88
+                int num = life - (currentYear - acquisitionYear) + 1;
89
+                BigDecimal estimateCost = new BigDecimal(num  * 0.95 * 10000 / total / 365).multiply(cmcCar.getCost());
90
+                cmcCar.setDayCost(estimateCost);
91
+            }
92
+        }
75 93
         return toAjax(cmcCarService.insertCmcCar(cmcCar));
76 94
     }
77 95
 

+ 70
- 8
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java View File

@@ -1,17 +1,19 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3
+import java.math.BigDecimal;
4
+import java.text.SimpleDateFormat;
3 5
 import java.util.List;
4 6
 import javax.servlet.http.HttpServletResponse;
7
+
8
+import com.alibaba.fastjson2.JSONObject;
9
+import com.ruoyi.common.utils.DateUtils;
10
+import com.ruoyi.oa.domain.CmcCar;
11
+import com.ruoyi.oa.domain.CmcDevice;
12
+import com.ruoyi.oa.domain.CmcDeviceApproval;
13
+import com.ruoyi.oa.service.ICmcDeviceService;
5 14
 import org.springframework.security.access.prepost.PreAuthorize;
6 15
 import org.springframework.beans.factory.annotation.Autowired;
7
-import org.springframework.web.bind.annotation.GetMapping;
8
-import org.springframework.web.bind.annotation.PostMapping;
9
-import org.springframework.web.bind.annotation.PutMapping;
10
-import org.springframework.web.bind.annotation.DeleteMapping;
11
-import org.springframework.web.bind.annotation.PathVariable;
12
-import org.springframework.web.bind.annotation.RequestBody;
13
-import org.springframework.web.bind.annotation.RequestMapping;
14
-import org.springframework.web.bind.annotation.RestController;
16
+import org.springframework.web.bind.annotation.*;
15 17
 import com.ruoyi.common.annotation.Log;
16 18
 import com.ruoyi.common.core.controller.BaseController;
17 19
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -34,6 +36,9 @@ public class CmcDeviceApprovalController extends BaseController
34 36
     @Autowired
35 37
     private ICmcDeviceApprovalService cmcDeviceApprovalService;
36 38
 
39
+    @Autowired
40
+    private ICmcDeviceService cmcDeviceService;
41
+
37 42
     /**
38 43
      * 查询cmc设备审批列表
39 44
      */
@@ -76,6 +81,27 @@ public class CmcDeviceApprovalController extends BaseController
76 81
         return toAjax(cmcDeviceApprovalService.insertCmcDeviceApproval(cmcDeviceApproval));
77 82
     }
78 83
 
84
+    /**
85
+     * 新增cmc设备审批
86
+     */
87
+    @Log(title = "cmc设备审批", businessType = BusinessType.INSERT)
88
+    @PostMapping("/submit")
89
+    public AjaxResult submit(@RequestParam("form")String formData)
90
+    {
91
+        JSONObject formDataJson = JSONObject.parse(formData);
92
+        CmcDeviceApproval cmcDeviceApproval = new CmcDeviceApproval();
93
+        cmcDeviceApproval.setDeviceId(formDataJson.getString("formId"));
94
+        cmcDeviceApproval.setApplier(getLoginUser().getUserId());
95
+        cmcDeviceApproval.setApplyDate(DateUtils.getNowDate());
96
+        cmcDeviceApproval.setProjectNumber(formDataJson.getString("projectNumber"));
97
+        cmcDeviceApproval.setApplyReason(formDataJson.getString("applyReason"));
98
+        cmcDeviceApproval.setBeginDate(formDataJson.getDate("startTime"));
99
+        cmcDeviceApproval.setEndDate(formDataJson.getDate("endTime"));
100
+        cmcDeviceApproval.setDays(formDataJson.getLong("day"));
101
+        cmcDeviceApprovalService.insertCmcDeviceApproval(cmcDeviceApproval);
102
+        return AjaxResult.success("提交设备审批表成功");
103
+    }
104
+
79 105
     /**
80 106
      * 修改cmc设备审批
81 107
      */
@@ -86,6 +112,42 @@ public class CmcDeviceApprovalController extends BaseController
86 112
         return toAjax(cmcDeviceApprovalService.updateCmcDeviceApproval(cmcDeviceApproval));
87 113
     }
88 114
 
115
+    /**
116
+     * 修改cmc设备审批
117
+     */
118
+    @Log(title = "cmc设备审批", businessType = BusinessType.UPDATE)
119
+    @PutMapping("/modify")
120
+    public AjaxResult modify(@RequestParam("form")String formData)
121
+    {
122
+        JSONObject formDataJson = JSONObject.parse(formData);
123
+        CmcDeviceApproval cmcDeviceApproval = cmcDeviceApprovalService.selectCmcDeviceApprovalByDeviceApplyId(formDataJson.getString("deviceApplyId"));
124
+        if (formDataJson.getString("deptComment") != null) {
125
+            cmcDeviceApproval.setDeptUserId(getLoginUser().getUserId());
126
+            cmcDeviceApproval.setDeptComment(formDataJson.getString("deptComment"));
127
+        }
128
+        if (formDataJson.getString("managerComment") != null) {
129
+            cmcDeviceApproval.setManagerUserId(getLoginUser().getUserId());
130
+            cmcDeviceApproval.setManagerComment(formDataJson.getString("managerComment"));
131
+        }
132
+
133
+        if (formDataJson.getDate("returnDate") != null) {
134
+            cmcDeviceApproval.setReturnDate(formDataJson.getDate("returnDate"));
135
+        }
136
+        if (formDataJson.getString("dispatchComment") != null) {
137
+            cmcDeviceApproval.setDispatcher(getLoginUser().getUserId());
138
+            cmcDeviceApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
139
+            String[] devices = formDataJson.getString("devices").split(",");
140
+            BigDecimal estimateCost = new BigDecimal(0);
141
+            for (String device : devices) {
142
+                CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
143
+                estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
144
+            }
145
+            cmcDeviceApproval.setEstimateCost(estimateCost);
146
+        }
147
+        cmcDeviceApprovalService.updateCmcDeviceApproval(cmcDeviceApproval);
148
+        return AjaxResult.success("修改设备审批表成功");
149
+    }
150
+
89 151
     /**
90 152
      * 删除cmc设备审批
91 153
      */

+ 19
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceController.java View File

@@ -1,7 +1,11 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3
+import java.math.BigDecimal;
4
+import java.text.SimpleDateFormat;
3 5
 import java.util.List;
4 6
 import javax.servlet.http.HttpServletResponse;
7
+
8
+import com.ruoyi.common.utils.DateUtils;
5 9
 import org.springframework.security.access.prepost.PreAuthorize;
6 10
 import org.springframework.beans.factory.annotation.Autowired;
7 11
 import org.springframework.web.bind.annotation.GetMapping;
@@ -61,7 +65,7 @@ public class CmcDeviceController extends BaseController
61 65
      * 获取cmc设备信息详细信息
62 66
      */
63 67
     @GetMapping(value = "/{deviceId}")
64
-    public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId)
68
+    public AjaxResult getInfo(@PathVariable("deviceId") Integer deviceId)
65 69
     {
66 70
         return success(cmcDeviceService.selectCmcDeviceByDeviceId(deviceId));
67 71
     }
@@ -73,6 +77,20 @@ public class CmcDeviceController extends BaseController
73 77
     @PostMapping
74 78
     public AjaxResult add(@RequestBody CmcDevice cmcDevice)
75 79
     {
80
+        if (cmcDevice.getAcquisitionTime() != null && cmcDevice.getCost() != null && cmcDevice.getDayCost() != null) {
81
+            // 年数总和法折旧
82
+            int acquisitionYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(cmcDevice.getAcquisitionTime()));
83
+            int life = cmcDevice.getExpectLife() == null ? 0 : cmcDevice.getExpectLife();
84
+            int total = 0;
85
+            for (int i = 0; i < life + 1; i++)
86
+                total += i;
87
+            if (total > 0) {
88
+                int currentYear = Integer.parseInt(new SimpleDateFormat("yyyy").format(DateUtils.getNowDate()));
89
+                int num = life - (currentYear - acquisitionYear) + 1;
90
+                BigDecimal estimateCost = new BigDecimal(num  * 0.95 * 10000 / total / 365).multiply(cmcDevice.getCost());
91
+                cmcDevice.setDayCost(estimateCost);
92
+            }
93
+        }
76 94
         return toAjax(cmcDeviceService.insertCmcDevice(cmcDevice));
77 95
     }
78 96
 

+ 11
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java View File

@@ -56,10 +56,20 @@ public class SysPostController extends BaseController
56 56
     public TableDataInfo driverList()
57 57
     {
58 58
         startPage();
59
-        List<SysUser> list = postService.driverList();
59
+        List<SysUser> list = postService.selectDriverList();
60 60
         return getDataTable(list);
61 61
     }
62 62
 
63
+    /**
64
+     * 获取部门主任
65
+     */
66
+    @GetMapping("/deptLeader")
67
+    public AjaxResult getDeptLeader(String userId)
68
+    {
69
+        SysUser deptLeader = postService.selectDeptLeaderByUserId(userId);
70
+        return success(deptLeader);
71
+    }
72
+
63 73
     @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
64 74
     @PreAuthorize("@ss.hasPermi('system:post:export')")
65 75
     @PostMapping("/export")

+ 28
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcCar.java View File

@@ -50,6 +50,14 @@ public class CmcCar extends BaseEntity
50 50
     @Excel(name = "车级")
51 51
     private String level;
52 52
 
53
+    /** 是否为租车 */
54
+    @Excel(name = "是否为租车")
55
+    private String isRent;
56
+
57
+    /** 单日成本 */
58
+    @Excel(name = "单日成本")
59
+    private BigDecimal dayCost;
60
+
53 61
     public void setCarId(Integer carId)
54 62
     {
55 63
         this.carId = carId;
@@ -122,6 +130,24 @@ public class CmcCar extends BaseEntity
122 130
     {
123 131
         return level;
124 132
     }
133
+    public void setIsRent(String isRent)
134
+    {
135
+        this.isRent = isRent;
136
+    }
137
+
138
+    public String getIsRent()
139
+    {
140
+        return isRent;
141
+    }
142
+    public void setDayCost(BigDecimal dayCost)
143
+    {
144
+        this.dayCost = dayCost;
145
+    }
146
+
147
+    public BigDecimal getDayCost()
148
+    {
149
+        return dayCost;
150
+    }
125 151
 
126 152
     @Override
127 153
     public String toString() {
@@ -134,6 +160,8 @@ public class CmcCar extends BaseEntity
134 160
                 .append("expectLife", getExpectLife())
135 161
                 .append("series", getSeries())
136 162
                 .append("level", getLevel())
163
+                .append("isRent", getIsRent())
164
+                .append("dayCost", getDayCost())
137 165
                 .toString();
138 166
     }
139 167
 }

+ 17
- 3
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcDevice.java View File

@@ -19,7 +19,7 @@ public class CmcDevice extends BaseEntity
19 19
     private static final long serialVersionUID = 1L;
20 20
 
21 21
     /** 设备id */
22
-    private Long deviceId;
22
+    private Integer deviceId;
23 23
 
24 24
     /** 设备编号 */
25 25
     @Excel(name = "设备编号")
@@ -46,12 +46,16 @@ public class CmcDevice extends BaseEntity
46 46
     @Excel(name = "设备系列")
47 47
     private String series;
48 48
 
49
-    public void setDeviceId(Long deviceId) 
49
+    /** 单日成本 */
50
+    @Excel(name = "单日成本")
51
+    private BigDecimal dayCost;
52
+
53
+    public void setDeviceId(Integer deviceId)
50 54
     {
51 55
         this.deviceId = deviceId;
52 56
     }
53 57
 
54
-    public Long getDeviceId() 
58
+    public Integer getDeviceId()
55 59
     {
56 60
         return deviceId;
57 61
     }
@@ -109,6 +113,15 @@ public class CmcDevice extends BaseEntity
109 113
     {
110 114
         return series;
111 115
     }
116
+    public void setDayCost(BigDecimal dayCost)
117
+    {
118
+        this.dayCost = dayCost;
119
+    }
120
+
121
+    public BigDecimal getDayCost()
122
+    {
123
+        return dayCost;
124
+    }
112 125
 
113 126
     @Override
114 127
     public String toString() {
@@ -120,6 +133,7 @@ public class CmcDevice extends BaseEntity
120 133
             .append("cost", getCost())
121 134
             .append("expectLife", getExpectLife())
122 135
             .append("series", getSeries())
136
+            .append("dayCost", getDayCost())
123 137
             .toString();
124 138
     }
125 139
 }

+ 16
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcDeviceApproval.java View File

@@ -92,6 +92,11 @@ public class CmcDeviceApproval extends BaseEntity
92 92
     @Excel(name = "申请日期", width = 30, dateFormat = "yyyy-MM-dd")
93 93
     private Date applyDate;
94 94
 
95
+    /** 归还日期 */
96
+    @JsonFormat(pattern = "yyyy-MM-dd")
97
+    @Excel(name = "归还日期", width = 30, dateFormat = "yyyy-MM-dd")
98
+    private Date returnDate;
99
+
95 100
     public void setDeviceApplyId(String deviceApplyId) 
96 101
     {
97 102
         this.deviceApplyId = deviceApplyId;
@@ -254,6 +259,16 @@ public class CmcDeviceApproval extends BaseEntity
254 259
     {
255 260
         return applyDate;
256 261
     }
262
+    public void setReturnDate(Date returnDate)
263
+    {
264
+        this.returnDate = returnDate;
265
+    }
266
+
267
+    public Date getReturnDate()
268
+    {
269
+        return returnDate;
270
+    }
271
+
257 272
     @Override
258 273
     public String toString() {
259 274
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -275,6 +290,7 @@ public class CmcDeviceApproval extends BaseEntity
275 290
             .append("dispatchComment", getDispatchComment())
276 291
             .append("estimateCost", getEstimateCost())
277 292
             .append("applyDate", getApplyDate())
293
+            .append("returnDate", getReturnDate())
278 294
             .toString();
279 295
     }
280 296
 }

+ 1
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcDeviceMapper.java View File

@@ -17,7 +17,7 @@ public interface CmcDeviceMapper
17 17
      * @param deviceId cmc设备信息主键
18 18
      * @return cmc设备信息
19 19
      */
20
-    public CmcDevice selectCmcDeviceByDeviceId(Long deviceId);
20
+    public CmcDevice selectCmcDeviceByDeviceId(Integer deviceId);
21 21
 
22 22
     /**
23 23
      * 查询cmc设备信息列表

+ 1
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcDeviceService.java View File

@@ -17,7 +17,7 @@ public interface ICmcDeviceService
17 17
      * @param deviceId cmc设备信息主键
18 18
      * @return cmc设备信息
19 19
      */
20
-    public CmcDevice selectCmcDeviceByDeviceId(Long deviceId);
20
+    public CmcDevice selectCmcDeviceByDeviceId(Integer deviceId);
21 21
 
22 22
     /**
23 23
      * 查询cmc设备信息列表

+ 1
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcDeviceServiceImpl.java View File

@@ -26,7 +26,7 @@ public class CmcDeviceServiceImpl implements ICmcDeviceService
26 26
      * @return cmc设备信息
27 27
      */
28 28
     @Override
29
-    public CmcDevice selectCmcDeviceByDeviceId(Long deviceId)
29
+    public CmcDevice selectCmcDeviceByDeviceId(Integer deviceId)
30 30
     {
31 31
         return cmcDeviceMapper.selectCmcDeviceByDeviceId(deviceId);
32 32
     }

+ 9
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java View File

@@ -50,5 +50,13 @@ public interface SysUserPostMapper
50 50
      * @param
51 51
      * @return 驾驶员列表
52 52
      */
53
-    List<SysUser> selectDriverList();
53
+    public List<SysUser> selectDriverList();
54
+
55
+    /**
56
+     * 查询部门主任
57
+     *
58
+     * @param
59
+     * @return 查询部门主任
60
+     */
61
+    public SysUser selectDeptLeaderByUserId(String userId);
54 62
 }

+ 11
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java View File

@@ -35,6 +35,7 @@ public interface ISysPostService
35 35
      */
36 36
     public SysPost selectPostById(Long postId);
37 37
 
38
+
38 39
     /**
39 40
      * 根据用户ID获取岗位选择框列表
40 41
      * 
@@ -105,5 +106,14 @@ public interface ISysPostService
105 106
      * @param
106 107
      * @return 驾驶员列表
107 108
      */
108
-    List<SysUser> driverList();
109
+    public List<SysUser> selectDriverList();
110
+
111
+    /**
112
+     * 查询部门主任
113
+     *
114
+     * @param
115
+     * @return 查询部门主任
116
+     */
117
+    public SysUser selectDeptLeaderByUserId(String userId);
118
+
109 119
 }

+ 6
- 1
oa-back/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java View File

@@ -185,7 +185,12 @@ public class SysPostServiceImpl implements ISysPostService
185 185
      * @return 驾驶员列表
186 186
      */
187 187
     @Override
188
-    public List<SysUser> driverList() {
188
+    public List<SysUser> selectDriverList() {
189 189
         return userPostMapper.selectDriverList();
190 190
     }
191
+
192
+    @Override
193
+    public SysUser selectDeptLeaderByUserId(String userId) {
194
+        return userPostMapper.selectDeptLeaderByUserId(userId);
195
+    }
191 196
 }

+ 11
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcCarMapper.xml View File

@@ -13,10 +13,12 @@
13 13
         <result property="expectLife"    column="expect_life"    />
14 14
         <result property="series"    column="series"    />
15 15
         <result property="level"    column="level"    />
16
+        <result property="isRent"    column="is_rent"    />
17
+        <result property="dayCost"    column="day_cost"    />
16 18
     </resultMap>
17 19
 
18 20
     <sql id="selectCmcCarVo">
19
-        select car_id, license_plate, driver, acquisition_time, cost, expect_life, series, level from cmc_car
21
+        select car_id, license_plate, driver, acquisition_time, cost, expect_life, series, level, is_rent, day_cost from cmc_car
20 22
     </sql>
21 23
 
22 24
     <select id="selectCmcCarList" parameterType="CmcCar" resultMap="CmcCarResult">
@@ -29,6 +31,8 @@
29 31
             <if test="expectLife != null "> and expect_life = #{expectLife}</if>
30 32
             <if test="series != null  and series != ''"> and series like concat('%', #{series}, '%')</if>
31 33
             <if test="level != null  and level != ''"> and level like concat('%', #{level}, '%')</if>
34
+            <if test="isRent != null  and isRent != ''"> and isRent = #{isRent}</if>
35
+            <if test="dayCost != null  and dayCost != ''"> and day_cost = #{dayCost}</if>
32 36
         </where>
33 37
     </select>
34 38
 
@@ -47,6 +51,8 @@
47 51
             <if test="expectLife != null">expect_life,</if>
48 52
             <if test="series != null">series,</if>
49 53
             <if test="level != null">level,</if>
54
+            <if test="isRent != null">is_rent,</if>
55
+            <if test="dayCost != null">day_cost,</if>
50 56
         </trim>
51 57
         <trim prefix="values (" suffix=")" suffixOverrides=",">
52 58
             <if test="licensePlate != null">#{licensePlate},</if>
@@ -56,6 +62,8 @@
56 62
             <if test="expectLife != null">#{expectLife},</if>
57 63
             <if test="series != null">#{series},</if>
58 64
             <if test="level != null">#{level},</if>
65
+            <if test="isRent != null">#{isRent},</if>
66
+            <if test="dayCost != null">#{dayCost},</if>
59 67
         </trim>
60 68
     </insert>
61 69
 
@@ -69,6 +77,8 @@
69 77
             <if test="expectLife != null">expect_life = #{expectLife},</if>
70 78
             <if test="series != null">series = #{series},</if>
71 79
             <if test="level != null">level = #{level},</if>
80
+            <if test="isRent != null">is_rent = #{isRent},</if>
81
+            <if test="dayCost != null">day_cost = #{dayCost},</if>
72 82
         </trim>
73 83
         where car_id = #{carId}
74 84
     </update>

+ 6
- 1
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceApprovalMapper.xml View File

@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
11 11
         <result property="projectNumber"    column="project_number"    />
12 12
         <result property="applyReason"    column="apply_reason"    />
13 13
         <result property="applyDate"    column="apply_date"    />
14
+        <result property="returnDate"    column="return_date"    />
14 15
         <result property="beginDate"    column="begin_date"    />
15 16
         <result property="beginHalfday"    column="begin_halfday"    />
16 17
         <result property="endDate"    column="end_date"    />
@@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
26 27
     </resultMap>
27 28
 
28 29
     <sql id="selectCmcDeviceApprovalVo">
29
-        select device_apply_id, applier, device_id, project_number, apply_reason, apply_date, begin_date, begin_halfday, end_date, end_halfday, days, dept_user_id, dept_comment, manager_user_id, manager_comment, dispatcher, dispatch_comment, estimate_cost from cmc_device_approval
30
+        select device_apply_id, applier, device_id, project_number, apply_reason, apply_date, return_date, begin_date, begin_halfday, end_date, end_halfday, days, dept_user_id, dept_comment, manager_user_id, manager_comment, dispatcher, dispatch_comment, estimate_cost from cmc_device_approval
30 31
     </sql>
31 32
 
32 33
     <select id="selectCmcDeviceApprovalList" parameterType="CmcDeviceApproval" resultMap="CmcDeviceApprovalResult">
@@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
37 38
             <if test="projectNumber != null  and projectNumber != ''"> and project_number = #{projectNumber}</if>
38 39
             <if test="applyReason != null  and applyReason != ''"> and apply_reason = #{applyReason}</if>
39 40
             <if test="applyDate != null "> and apply_date = #{applyDate}</if>
41
+            <if test="returnDate != null "> and return_date = #{returnDate}</if>
40 42
             <if test="beginDate != null "> and begin_date = #{beginDate}</if>
41 43
             <if test="beginHalfday != null  and beginHalfday != ''"> and begin_halfday = #{beginHalfday}</if>
42 44
             <if test="endDate != null "> and end_date = #{endDate}</if>
@@ -66,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
66 68
             <if test="projectNumber != null">project_number,</if>
67 69
             <if test="applyReason != null">apply_reason,</if>
68 70
             <if test="applyDate != null">apply_date,</if>
71
+            <if test="returnDate != null">return_date,</if>
69 72
             <if test="beginDate != null">begin_date,</if>
70 73
             <if test="beginHalfday != null">begin_halfday,</if>
71 74
             <if test="endDate != null">end_date,</if>
@@ -86,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
86 89
             <if test="projectNumber != null">#{projectNumber},</if>
87 90
             <if test="applyReason != null">#{applyReason},</if>
88 91
             <if test="applyDate != null">#{applyDate},</if>
92
+            <if test="returnDate != null">#{returnDate},</if>
89 93
             <if test="beginDate != null">#{beginDate},</if>
90 94
             <if test="beginHalfday != null">#{beginHalfday},</if>
91 95
             <if test="endDate != null">#{endDate},</if>
@@ -109,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
109 113
             <if test="projectNumber != null">project_number = #{projectNumber},</if>
110 114
             <if test="applyReason != null">apply_reason = #{applyReason},</if>
111 115
             <if test="applyDate != null">apply_date = #{applyDate},</if>
116
+            <if test="returnDate != null">return_date = #{returnDate},</if>
112 117
             <if test="beginDate != null">begin_date = #{beginDate},</if>
113 118
             <if test="beginHalfday != null">begin_halfday = #{beginHalfday},</if>
114 119
             <if test="endDate != null">end_date = #{endDate},</if>

+ 7
- 2
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcDeviceMapper.xml View File

@@ -12,10 +12,11 @@
12 12
         <result property="cost"    column="cost"    />
13 13
         <result property="expectLife"    column="expect_life"    />
14 14
         <result property="series"    column="series"    />
15
+        <result property="dayCost"    column="dayCost"    />
15 16
     </resultMap>
16 17
 
17 18
     <sql id="selectCmcDeviceVo">
18
-        select device_id, code, type, acquisition_time, cost, expect_life, series from cmc_device
19
+        select device_id, code, type, acquisition_time, cost, expect_life, series, day_cost from cmc_device
19 20
     </sql>
20 21
 
21 22
     <select id="selectCmcDeviceList" parameterType="CmcDevice" resultMap="CmcDeviceResult">
@@ -25,12 +26,13 @@
25 26
             <if test="type != null  and type != ''"> and type like concat('%', #{type}, '%')</if>
26 27
             <if test="acquisitionTime != null "> and acquisition_time = #{acquisitionTime}</if>
27 28
             <if test="cost != null "> and cost = #{cost}</if>
29
+            <if test="dayCost != null "> and day_cost = #{dayCost}</if>
28 30
             <if test="expectLife != null "> and expect_life = #{expectLife}</if>
29 31
             <if test="series != null  and series != ''"> and series like concat('%', #{series}, '%')</if>
30 32
         </where>
31 33
     </select>
32 34
 
33
-    <select id="selectCmcDeviceByDeviceId" parameterType="Long" resultMap="CmcDeviceResult">
35
+    <select id="selectCmcDeviceByDeviceId" parameterType="Integer" resultMap="CmcDeviceResult">
34 36
         <include refid="selectCmcDeviceVo"/>
35 37
         where device_id = #{deviceId}
36 38
     </select>
@@ -42,6 +44,7 @@
42 44
             <if test="type != null">type,</if>
43 45
             <if test="acquisitionTime != null">acquisition_time,</if>
44 46
             <if test="cost != null">cost,</if>
47
+            <if test="dayCost != null">day_cost,</if>
45 48
             <if test="expectLife != null">expect_life,</if>
46 49
             <if test="series != null">series,</if>
47 50
         </trim>
@@ -50,6 +53,7 @@
50 53
             <if test="type != null">#{type},</if>
51 54
             <if test="acquisitionTime != null">#{acquisitionTime},</if>
52 55
             <if test="cost != null">#{cost},</if>
56
+            <if test="dayCost != null">#{dayCost},</if>
53 57
             <if test="expectLife != null">#{expectLife},</if>
54 58
             <if test="series != null">#{series},</if>
55 59
         </trim>
@@ -62,6 +66,7 @@
62 66
             <if test="type != null">type = #{type},</if>
63 67
             <if test="acquisitionTime != null">acquisition_time = #{acquisitionTime},</if>
64 68
             <if test="cost != null">cost = #{cost},</if>
69
+            <if test="dayCost != null">day_cost = #{dayCost},</if>
65 70
             <if test="expectLife != null">expect_life = #{expectLife},</if>
66 71
             <if test="series != null">series = #{series},</if>
67 72
         </trim>

+ 11
- 3
oa-back/ruoyi-system/src/main/resources/mapper/system/SysUserPostMapper.xml View File

@@ -14,14 +14,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
14 14
 		<result property="nickName"     column="nick_name"    />
15 15
 	</resultMap>
16 16
 
17
-	<select id="selectDriverList" parameterType="SysUser" resultMap="SysUserResult">
18
-		select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.pm_level, u.titles, u.update_reason, u.engineer_level, u.entry_date, u.age,
19
-			   up.post_id
17
+	<select id="selectDriverList" resultMap="SysUserResult">
18
+		select u.user_id, u.nick_name
20 19
 		from sys_user u
21 20
 				 left join sys_user_post up on u.user_id = up.user_id
22 21
 		where up.post_id = 27
23 22
 	</select>
24 23
 
24
+	<select id="selectDeptLeaderByUserId" parameterType="String" resultMap="SysUserResult">
25
+		select r.user_id, r.nick_name, up.post_id from
26
+		(select u1.user_id, u1.nick_name, u.dept_id from
27
+		sys_user as u, sys_user as u1 where u.user_id = #{param} and u1.dept_id = u.dept_id) as r
28
+		left join sys_user_post as up
29
+		on r.user_id = up.user_id
30
+		where up.post_id = 12
31
+	</select>
32
+
25 33
 	<delete id="deleteUserPostByUserId" parameterType="Long">
26 34
 		delete from sys_user_post where user_id=#{userId}
27 35
 	</delete>

+ 3
- 0
oa-back/sql/sql.sql View File

@@ -1407,6 +1407,8 @@ create table `cmc_car`  (
1407 1407
   `expect_life`			int					default null				comment '预计使用年限',
1408 1408
   `series`				varchar(10)			default null				comment '车系',
1409 1409
   `level`				varchar(10)			default null				comment '车级',
1410
+  `is_rent`				char(1)				default null				comment '是否为租车',
1411
+  `day_cost`			decimal(10,2)		default null				comment '单日成本',
1410 1412
   primary key (`car_id`)
1411 1413
 ) engine = innodb comment = 'cmc车辆信息表';
1412 1414
 
@@ -1490,6 +1492,7 @@ create table `cmc_device_approval`  (
1490 1492
   `dispatch_comment`	varchar(255)	default null 	comment '调度审批意见',
1491 1493
   `estimate_cost`		decimal(10,2)	default null	comment '预计设备成本',
1492 1494
   `apply_date`			date			default null 	comment '申请日期',
1495
+  `return_date`			date			default null 	comment '归还日期',
1493 1496
   primary key (`device_apply_id`)
1494 1497
 ) engine = innodb comment = 'cmc设备审批表';
1495 1498
 

+ 17
- 6
oa-ui/src/views/oa/car/index.vue View File

@@ -40,21 +40,22 @@
40 40
       <!-- <el-table-column label="驾驶员" align="center" prop="driver" /> -->
41 41
       <el-table-column label="车系" align="center" prop="series" />
42 42
       <el-table-column label="车级" align="center" prop="level" />
43
-      <el-table-column label="购卖时间" align="center" prop="acquisitionTime" />
43
+      <el-table-column label="购置时间" align="center" prop="acquisitionTime" />
44
+      <el-table-column label="是否为租车" align="center" prop="isRent" >{{ idRent == "0" ? "否" : "是" }}</el-table-column>
44 45
       <el-table-column label="总价" align="center" prop="cost">
45 46
         <template slot-scope="scope">
46 47
           {{ scope.row.cost + '万元' }}
47 48
         </template>
48 49
       </el-table-column>
49 50
       <el-table-column label="预计使用年限" align="center" prop="expectLife" />
50
-      <!-- <el-table-column label="使用成本(天)" align="center" prop="driver" /> -->
51
+      <el-table-column label="使用成本(天)" align="center" prop="dayCost" />
51 52
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
52 53
 
53 54
         <template slot-scope="scope">
54 55
           <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
55 56
             v-hasPermi="['oa:car:edit']">修改</el-button>
56
-          <el-button size="mini" type="text" icon="el-icon-delete" style="color: #fc0000;" @click="handleDelete(scope.row)"
57
-            v-hasPermi="['oa:car:remove']">删除</el-button>
57
+          <el-button size="mini" type="text" icon="el-icon-delete" style="color: #fc0000;"
58
+            @click="handleDelete(scope.row)" v-hasPermi="['oa:car:remove']">删除</el-button>
58 59
         </template>
59 60
       </el-table-column>
60 61
     </el-table>
@@ -74,7 +75,7 @@
74 75
         <el-form-item label="车级" prop="level">
75 76
           <el-input v-model="form.level" placeholder="请输入车级" />
76 77
         </el-form-item>
77
-        <el-form-item label="购时间" prop="acquisitionTime">
78
+        <el-form-item label="购时间" prop="acquisitionTime">
78 79
           <el-date-picker v-model="form.acquisitionTime" type="date" placeholder="选择日期" format="yyyy-MM-dd"
79 80
             value-format="yyyy-MM-dd">
80 81
           </el-date-picker>
@@ -84,7 +85,7 @@
84 85
           <span>万元</span>
85 86
         </el-form-item>
86 87
         <el-form-item label="预计使用年限" prop="expectLife">
87
-          <el-input v-model="form.expectLife" placeholder="请输入年限"  style="width:130px;margin-right:10px;" />
88
+          <el-input v-model="form.expectLife" placeholder="请输入年限" style="width:130px;margin-right:10px;" />
88 89
           <span>年</span>
89 90
         </el-form-item>
90 91
         <el-form-item label="驾驶员" prop="driver">
@@ -93,6 +94,16 @@
93 94
             </el-option>
94 95
           </el-select>
95 96
         </el-form-item>
97
+        <el-form-item label="是否为租车" prop="isRent">
98
+          <el-radio-group v-model="form.isRent">
99
+            <el-radio label="0">否</el-radio>
100
+            <el-radio label="1">是</el-radio>
101
+          </el-radio-group>
102
+        </el-form-item>
103
+        <el-form-item v-if="form.isRent == '1'" label="使用成本(天)" prop="dayCost">
104
+          <el-input style="width:130px;margin-right:10px;" v-model="form.dayCost" placeholder="请输入金额" />
105
+          <span>元</span>
106
+        </el-form-item>
96 107
       </el-form>
97 108
       <div slot="footer" class="dialog-footer">
98 109
         <el-button type="primary" @click="submitForm">确 定</el-button>

Loading…
Cancel
Save