|
@@ -29,10 +29,11 @@ public class WarehousingOrderListener extends AbstractWorkflowTaskListener {
|
|
|
|
|
|
@Override
|
|
|
public void handleStatusChanged(String businessKey, String status, String statusEn, boolean processIsEnd) {
|
|
|
- List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id",businessKey));
|
|
|
+ List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id", businessKey));
|
|
|
StatusRecord statusRecord = new StatusRecord();
|
|
|
StatusRecord statusRecord1 = statusRecordMapper.selectById(businessKey);
|
|
|
- for(WarehousingOrder warehousingOrder : list){
|
|
|
+ int flag = 0;
|
|
|
+ for (WarehousingOrder warehousingOrder : list) {
|
|
|
if (warehousingOrder == null) {
|
|
|
return;
|
|
|
}
|
|
@@ -41,28 +42,41 @@ public class WarehousingOrderListener extends AbstractWorkflowTaskListener {
|
|
|
warehousingOrder.setStatus(StatusEnum.NOT_COLLECTION_PAY.getName());
|
|
|
warehousingOrder.setWorkflowId(null);
|
|
|
warehousingOrder.setApproveStatus(null);
|
|
|
-
|
|
|
- if(statusRecord1 != null){
|
|
|
- statusRecord1.setStatus(StatusEnum.ORDER_PASSED.getName());
|
|
|
-// statusRecordMapper.updateById(statusRecord1);
|
|
|
- }
|
|
|
- else{
|
|
|
- statusRecord.setId(businessKey);
|
|
|
- statusRecord.setStatus(StatusEnum.ORDER_PASSED.getName());
|
|
|
-// statusRecordMapper.insert(statusRecord);
|
|
|
+ if (flag == 0) {
|
|
|
+ if (statusRecord1 != null) {
|
|
|
+ statusRecord1.setStatus(StatusEnum.ORDER_PASSED.getName());
|
|
|
+ statusRecordMapper.updateById(statusRecord1);
|
|
|
+ } else {
|
|
|
+ statusRecord.setId(businessKey);
|
|
|
+ statusRecord.setStatus(StatusEnum.ORDER_PASSED.getName());
|
|
|
+ statusRecordMapper.insert(statusRecord);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
warehousingOrder.setApproveStatus(status);
|
|
|
+ if (flag == 0) {
|
|
|
+ if (statusRecord1 != null) {
|
|
|
+ statusRecord1.setStatus(status);
|
|
|
+ statusRecordMapper.updateById(statusRecord1);
|
|
|
+ } else {
|
|
|
+ statusRecord.setId(businessKey);
|
|
|
+ statusRecord.setStatus(status);
|
|
|
+ statusRecordMapper.insert(statusRecord);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
warehousingOrderService.updateAllColumnById(warehousingOrder);
|
|
|
+ flag++;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void handleRejectApplicationRepulsed(String workflowId, String businessKey, boolean needReapply) {
|
|
|
- List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id",businessKey));
|
|
|
- for(WarehousingOrder warehousingOrder : list){
|
|
|
+ List<WarehousingOrder> list = warehousingOrderService.selectList(new EntityWrapper<WarehousingOrder>().eq("batch_id", businessKey));
|
|
|
+ for (WarehousingOrder warehousingOrder : list) {
|
|
|
warehousingOrder = warehousingOrderService.selectById(warehousingOrder.getId());
|
|
|
if (warehousingOrder == null) {
|
|
|
return;
|
|
@@ -75,14 +89,13 @@ public class WarehousingOrderListener extends AbstractWorkflowTaskListener {
|
|
|
|
|
|
StatusRecord statusRecord = new StatusRecord();
|
|
|
StatusRecord statusRecord1 = statusRecordMapper.selectById(businessKey);
|
|
|
- if(statusRecord1 != null){
|
|
|
+ if (statusRecord1 != null) {
|
|
|
statusRecord1.setStatus(StatusEnum.PURCHASE_FAILED.getName());
|
|
|
-// statusRecordMapper.updateById(statusRecord1);
|
|
|
- }
|
|
|
- else{
|
|
|
+ statusRecordMapper.updateById(statusRecord1);
|
|
|
+ } else {
|
|
|
statusRecord.setId(businessKey);
|
|
|
statusRecord.setStatus(StatusEnum.PURCHASE_FAILED.getName());
|
|
|
-// statusRecordMapper.insert(statusRecord);
|
|
|
+ statusRecordMapper.insert(statusRecord);
|
|
|
}
|
|
|
}
|
|
|
|