From 4f3b666cd625381e4acb07d8ae4d68ae9554b1b8 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 06 十一月 2023 18:12:49 +0800
Subject: [PATCH] Merge branch 'xinghong-dev' of http://git.homecommunity.cn/supervip/MicroCommunity
---
service-store/src/main/java/com/java110/store/cmd/collection/GoodsCollectionCmd.java | 46 +++++++---------------------------------------
1 files changed, 7 insertions(+), 39 deletions(-)
diff --git a/service-store/src/main/java/com/java110/store/cmd/collection/GoodsCollectionCmd.java b/service-store/src/main/java/com/java110/store/cmd/collection/GoodsCollectionCmd.java
index c1734cf..08e61e0 100644
--- a/service-store/src/main/java/com/java110/store/cmd/collection/GoodsCollectionCmd.java
+++ b/service-store/src/main/java/com/java110/store/cmd/collection/GoodsCollectionCmd.java
@@ -17,7 +17,6 @@
import com.java110.dto.store.StorehouseDto;
import com.java110.dto.user.UserDto;
import com.java110.dto.user.UserStorehouseDto;
-import com.java110.intf.common.IGoodCollectionUserInnerServiceSMO;
import com.java110.intf.common.IOaWorkflowActivitiInnerServiceSMO;
import com.java110.intf.oa.IOaWorkflowInnerServiceSMO;
import com.java110.intf.store.*;
@@ -49,7 +48,6 @@
@Autowired
private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
-
@Autowired
private IPurchaseApplyInnerServiceSMO purchaseApplyInnerServiceSMOImpl;
@@ -63,9 +61,8 @@
private IOaWorkflowActivitiInnerServiceSMO oaWorkflowActivitiInnerServiceSMOImpl;
@Autowired
- private IGoodCollectionUserInnerServiceSMO goodCollectionUserInnerServiceSMOImpl;
- @Autowired
private IResourceStoreInnerServiceSMO resourceStoreInnerServiceSMOImpl;
+
@Autowired
private IPurchaseApplyDetailInnerServiceSMO purchaseApplyDetailInnerServiceSMOImpl;
@@ -83,10 +80,8 @@
Assert.hasKeyAndValue(reqJson, "endUserName", "蹇呭~锛岃濉啓閲囪喘鑱旂郴浜�");
Assert.hasKeyAndValue(reqJson, "endUserTel", "蹇呭~锛岃濉啓閲囪喘鑱旂郴鐢佃瘽");
Assert.hasKeyAndValue(reqJson, "communityId", "蹇呭~锛岃濉啓灏忓尯淇℃伅");
-
JSONArray resourceStores = reqJson.getJSONArray("resourceStores");
String storeId = CmdContextUtils.getStoreId(context);
-
if (resourceStores == null || resourceStores.size() < 1) {
throw new CmdException("鏈寘鍚鐢ㄧ墿鍝�");
}
@@ -95,38 +90,29 @@
for (int resourceStoreIndex = 0; resourceStoreIndex < resourceStores.size(); resourceStoreIndex++) {
JSONObject resourceStore = resourceStores.getJSONObject(resourceStoreIndex);
Assert.hasKeyAndValue(resourceStore, "timesId", "蹇呭~锛屾湭閫夋嫨浠锋牸");
-
ResourceStoreTimesDto resourceStoreTimesDto = new ResourceStoreTimesDto();
resourceStoreTimesDto.setTimesId(resourceStore.getString("timesId"));
resourceStoreTimesDto.setStoreId(storeId);
List<ResourceStoreTimesDto> resourceStoreTimesDtos = resourceStoreTimesV1InnerServiceSMOImpl.queryResourceStoreTimess(resourceStoreTimesDto);
-
Assert.listOnlyOne(resourceStoreTimesDtos, "浠锋牸涓嶅瓨鍦�");
-
quanitity = resourceStore.getIntValue("quantity");
-
if (quanitity < 1) {
throw new CmdException("鐢宠鏁伴噺涓嶆纭�");
}
stock = Integer.parseInt(resourceStoreTimesDtos.get(0).getStock());
-
if (quanitity > stock) {
throw new CmdException(resourceStoreTimesDtos.get(0).getResCode() + "鍑哄簱涓嶈冻,搴撳瓨涓�=" + stock + ",鐢宠鏁颁负=" + quanitity);
}
-
resourceStore.put("resourceStoreTimesDtos", resourceStoreTimesDtos);
}
-
//todo 鏌ヨ浠撳簱鏄惁瀛樺湪
StorehouseDto storehouseDto = new StorehouseDto();
storehouseDto.setShId(reqJson.getString("shId"));
List<StorehouseDto> storehouseDtos = storehouseV1InnerServiceSMOImpl.queryStorehouses(storehouseDto);
Assert.listOnlyOne(storehouseDtos, "浠撳簱涓嶅瓨鍦�");
-
if (!StorehouseDto.SWITCH_ON.equals(storehouseDtos.get(0).getUseSwitch())) {
return;
}
-
OaWorkflowDto oaWorkflowDto = new OaWorkflowDto();
oaWorkflowDto.setStoreId(storeId);
oaWorkflowDto.setFlowId(storehouseDtos.get(0).getUseFlowId());
@@ -135,12 +121,9 @@
if (!OaWorkflowDto.STATE_COMPLAINT.equals(oaWorkflowDtos.get(0).getState())) {
throw new IllegalArgumentException(oaWorkflowDtos.get(0).getFlowName() + "娴佺▼鏈儴缃�");
}
-
if (StringUtil.isEmpty(oaWorkflowDtos.get(0).getProcessDefinitionKey())) {
throw new IllegalArgumentException(oaWorkflowDtos.get(0).getFlowName() + "娴佺▼鏈儴缃�");
}
-
-
}
/**
@@ -157,21 +140,16 @@
public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
String storeId = context.getReqHeaders().get("store-id");
String userId = context.getReqHeaders().get("user-id");
-
//todo 鏌ヨ浠撳簱鏄惁瀛樺湪
StorehouseDto storehouseDto = new StorehouseDto();
storehouseDto.setShId(reqJson.getString("shId"));
List<StorehouseDto> storehouseDtos = storehouseV1InnerServiceSMOImpl.queryStorehouses(storehouseDto);
Assert.listOnlyOne(storehouseDtos, "浠撳簱涓嶅瓨鍦�");
-
UserDto userDto = new UserDto();
userDto.setUserId(userId);
List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
-
Assert.listOnlyOne(userDtos, "鏈寘鍚敤鎴�");
-
String userName = userDtos.get(0).getName();
-
PurchaseApplyPo purchaseApplyPo = new PurchaseApplyPo();
purchaseApplyPo.setApplyOrderId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_applyOrderId));
purchaseApplyPo.setDescription(reqJson.getString("description"));
@@ -201,7 +179,6 @@
purchaseApplyDetailPo.setTimesId(resourceStoreTimesDtos.get(0).getTimesId());
purchaseApplyDetailPo.setOriginalStock(resourceStoreTimesDtos.get(0).getStock());
purchaseApplyDetailPo.setPurchaseQuantity(resourceStore.getString("quantity"));
-
//todo 鑾峰彇鎵规閲囪喘鍙傝�冧环鏍�
String consultPrice = null;
JSONArray timeList = resourceStore.getJSONArray("times");
@@ -217,9 +194,7 @@
purchaseApplyDetailPos.add(purchaseApplyDetailPo);
}
purchaseApplyPo.setPurchaseApplyDetailPos(purchaseApplyDetailPos);
-
int saveFlag = purchaseApplyInnerServiceSMOImpl.savePurchaseApply(purchaseApplyPo);
-
if (saveFlag < 1) {
throw new CmdException("鐗╁搧棰嗙敤鐢宠澶辫触");
}
@@ -228,7 +203,6 @@
purchaseApplyDto.setNextStaffId(reqJson.getString("staffId"));
//todo 鍚姩瀹℃牳娴佺▼
toStartWorkflow(purchaseApplyDto, storehouseDtos.get(0), reqJson);
-
context.setResponseEntity(ResultVo.createResponseEntity(ResultVo.CODE_OK, "鐗╁搧棰嗙敤鎴愬姛"));
}
@@ -238,18 +212,15 @@
* @param purchaseApplyDto
*/
private void toStartWorkflow(PurchaseApplyDto purchaseApplyDto, StorehouseDto storehouseDto, JSONObject reqJson) {
-
if (!StorehouseDto.SWITCH_ON.equals(storehouseDto.getUseSwitch())) {
//todo 鐩存帴鍏ュ簱
toPurchaseOutStorehouse(purchaseApplyDto, storehouseDto, reqJson);
return;
}
-
OaWorkflowDto oaWorkflowDto = new OaWorkflowDto();
oaWorkflowDto.setStoreId(purchaseApplyDto.getStoreId());
oaWorkflowDto.setFlowId(storehouseDto.getUseFlowId());
List<OaWorkflowDto> oaWorkflowDtos = oaWorkflowInnerServiceSMOImpl.queryOaWorkflows(oaWorkflowDto);
-
//todo 鎻愪氦瀹℃牳
JSONObject flowJson = new JSONObject();
flowJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey());
@@ -260,13 +231,16 @@
flowJson.put("storeId", purchaseApplyDto.getStoreId());
reqJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey());
JSONObject result = oaWorkflowActivitiInnerServiceSMOImpl.startProcess(flowJson);
-
JSONObject audit = reqJson.getJSONObject("audit");
String nextUserId = "-1";
if (audit != null) {
- nextUserId = reqJson.getJSONObject("audit").getString("staffId");
+ String staffId = reqJson.getJSONObject("audit").getString("staffId");
+ if (!StringUtil.isEmpty(staffId)) {
+ nextUserId = reqJson.getJSONObject("audit").getString("staffId");
+ } else {
+ nextUserId = reqJson.getJSONObject("audit").getString("assignee");
+ }
}
-
//鎻愪氦鑰呮彁浜�
flowJson = new JSONObject();
flowJson.put("processInstanceId", result.getString("processInstanceId"));
@@ -275,7 +249,6 @@
flowJson.put("storeId", purchaseApplyDto.getStoreId());
flowJson.put("id", purchaseApplyDto.getApplyOrderId());
flowJson.put("flowId", oaWorkflowDtos.get(0).getFlowId());
-
oaWorkflowActivitiInnerServiceSMOImpl.autoFinishFirstTask(flowJson);
}
@@ -287,16 +260,13 @@
* @param reqJson
*/
private void toPurchaseOutStorehouse(PurchaseApplyDto purchaseApplyDto, StorehouseDto storehouseDto, JSONObject reqJson) {
-
PurchaseApplyDetailDto purchaseApplyDetailDto = new PurchaseApplyDetailDto();
purchaseApplyDetailDto.setApplyOrderId(purchaseApplyDto.getApplyOrderId());
purchaseApplyDetailDto.setStoreId(purchaseApplyDto.getStoreId());
List<PurchaseApplyDetailDto> purchaseApplyDetailDtos = purchaseApplyDetailInnerServiceSMOImpl.queryPurchaseApplyDetails(purchaseApplyDetailDto);
-
if (purchaseApplyDetailDtos == null || purchaseApplyDetailDtos.size() < 1) {
return;
}
-
int stock = 0;
for (PurchaseApplyDetailDto tmpPurchaseApplyDetailDto : purchaseApplyDetailDtos) {
ResourceStorePo resourceStorePo = new ResourceStorePo();
@@ -330,7 +300,6 @@
// }
// resourceStorePo.setMiniStock(String.valueOf(nowMiniStock));
resourceStoreInnerServiceSMOImpl.updateResourceStore(resourceStorePo);
-
// 淇濆瓨鑷� 鐗╁搧 times琛�
ResourceStoreTimesPo resourceStoreTimesPo = new ResourceStoreTimesPo();
resourceStoreTimesPo.setApplyOrderId(tmpPurchaseApplyDetailDto.getApplyOrderId());
@@ -359,7 +328,6 @@
* @param resourceStoreDtos
*/
private void addPersonStorehouse(PurchaseApplyDto purchaseApplyDto, List<ResourceStoreDto> resourceStoreDtos, PurchaseApplyDetailDto purchaseApplyDetailDto) {
-
//鑾峰彇鐗╁搧鍗曚綅
String unitCode = resourceStoreDtos.get(0).getUnitCode();
//鑾峰彇鐗╁搧鏈�灏忚閲忓崟浣�
--
Gitblit v1.8.0