|
@@ -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);
|