lamphua 10 месяцев назад
Родитель
Сommit
1896014c2c

+ 0
- 1
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java Просмотреть файл

@@ -188,7 +188,6 @@ public class CmcCarApprovalController extends BaseController
188 188
             BigDecimal estimateCost = new BigDecimal(0);
189 189
             for (String car : cars) {
190 190
                 CmcCar cmcCar = cmcCarService.selectCmcCarByCarId(Integer.parseInt(car));
191
-                cmcCar.setStatus("0");
192 191
                 if (cmcCar.getDayCost() != null)
193 192
                     estimateCost = estimateCost.add(cmcCar.getDayCost().multiply(new BigDecimal(cmcCarApproval.getDays())));
194 193
             }

+ 13
- 7
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java Просмотреть файл

@@ -154,22 +154,18 @@ public class CmcDeviceApprovalController extends BaseController
154 154
             BigDecimal estimateCost = new BigDecimal(0);
155 155
             for (String device : devices) {
156 156
                 CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
157
+                cmcDevice.setStatus("0"); //确认被领用
158
+                cmcDeviceService.updateCmcDevice(cmcDevice);
157 159
                 if (cmcDevice.getDayCost() != null)
158 160
                     estimateCost = estimateCost.add(cmcDevice.getDayCost().multiply(new BigDecimal(cmcDeviceApproval.getDays())));
159 161
             }
160 162
             cmcDeviceApproval.setEstimateCost(estimateCost);
161 163
         }
162
-        if (formDataJson.getString("managerComment") != null && formDataJson.getString("confirmDate") == null) {
164
+        if (formDataJson.getString("managerComment") != null && formDataJson.getString("returnDate") == null) {
163 165
             cmcDeviceApproval.setManagerUserId(getLoginUser().getUserId());
164 166
             cmcDeviceApproval.setManagerComment(formDataJson.getString("managerComment"));
165 167
             cmcDeviceApproval.setManagerTime(new Date());
166 168
         }
167
-        if (formDataJson.getDate("confirmDate") != null && formDataJson.getDate("returnDate") == null) {
168
-            cmcDeviceApproval.setConfirmDate(new Date());
169
-            CmcDevice cmcDevice = new CmcDevice();
170
-            cmcDevice.setStatus("0"); //确认被领用
171
-            cmcDeviceService.updateCmcDevice(cmcDevice);
172
-        }
173 169
         if (formDataJson.getDate("returnDate") != null) {
174 170
             cmcDeviceApproval.setRemark(formDataJson.getString("remark"));
175 171
             if (formDataJson.getJSONArray("repairDevices").size() > 0) {
@@ -182,6 +178,16 @@ public class CmcDeviceApprovalController extends BaseController
182 178
                     cmcDeviceService.updateCmcDevice(cmcDevice);
183 179
                 }
184 180
             }
181
+            if (formDataJson.getJSONArray("returnDevices").size() > 0) {
182
+                String deviceString = formDataJson.getString("returnDevices").substring(1, formDataJson.getString("returnDevices").length() - 1);
183
+                cmcDeviceApproval.setReturnDevices(deviceString);
184
+                String[] devices = deviceString.split(",");
185
+                for (String device : devices) {
186
+                    CmcDevice cmcDevice = cmcDeviceService.selectCmcDeviceByDeviceId(Integer.parseInt(device));
187
+                    cmcDevice.setStatus("1"); //可领用
188
+                    cmcDeviceService.updateCmcDevice(cmcDevice);
189
+                }
190
+            }
185 191
             cmcDeviceApproval.setReturnDate(formDataJson.getDate("returnDate"));
186 192
         }
187 193
         cmcDeviceApprovalService.updateCmcDeviceApproval(cmcDeviceApproval);

Загрузка…
Отмена
Сохранить