From 7958f1dddb8a7f4e70d232b07a7703955ecedae0 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: 星期六, 26 八月 2023 12:45:33 +0800
Subject: [PATCH] 优化diamante
---
service-fee/src/main/java/com/java110/fee/cmd/oweFeeCallable/SaveOweFeeCallableCmd.java | 73 ++++++++++++++++++++++++++----------
1 files changed, 53 insertions(+), 20 deletions(-)
diff --git a/service-fee/src/main/java/com/java110/fee/cmd/oweFeeCallable/SaveOweFeeCallableCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/oweFeeCallable/SaveOweFeeCallableCmd.java
index 9b1c3d3..5c51e3a 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/oweFeeCallable/SaveOweFeeCallableCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/oweFeeCallable/SaveOweFeeCallableCmd.java
@@ -15,6 +15,7 @@
*/
package com.java110.fee.cmd.oweFeeCallable;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.annotation.Java110Transactional;
@@ -22,7 +23,12 @@
import com.java110.core.event.cmd.Cmd;
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.data.DatabusDataDto;
+import com.java110.dto.oweFeeCallable.OweFeeCallableDto;
+import com.java110.dto.wechat.SmallWeChatDto;
import com.java110.intf.fee.IOweFeeCallableV1InnerServiceSMO;
+import com.java110.intf.job.IDataBusInnerServiceSMO;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
import com.java110.po.oweFeeCallable.OweFeeCallablePo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
@@ -49,26 +55,47 @@
public static final String CODE_PREFIX_ID = "10";
+
@Autowired
- private IOweFeeCallableV1InnerServiceSMO oweFeeCallableV1InnerServiceSMOImpl;
+ private IDataBusInnerServiceSMO dataBusInnerServiceSMOImpl;
+
+ @Autowired
+ private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
@Override
public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
Assert.hasKeyAndValue(reqJson, "communityId", "璇锋眰鎶ユ枃涓湭鍖呭惈communityId");
- Assert.hasKeyAndValue(reqJson, "ownerName", "璇锋眰鎶ユ枃涓湭鍖呭惈ownerName");
- Assert.hasKeyAndValue(reqJson, "ownerId", "璇锋眰鎶ユ枃涓湭鍖呭惈ownerId");
- Assert.hasKeyAndValue(reqJson, "payerObjType", "璇锋眰鎶ユ枃涓湭鍖呭惈payerObjType");
- Assert.hasKeyAndValue(reqJson, "payerObjId", "璇锋眰鎶ユ枃涓湭鍖呭惈payerObjId");
- Assert.hasKeyAndValue(reqJson, "payerObjName", "璇锋眰鎶ユ枃涓湭鍖呭惈payerObjName");
- Assert.hasKeyAndValue(reqJson, "configId", "璇锋眰鎶ユ枃涓湭鍖呭惈configId");
- Assert.hasKeyAndValue(reqJson, "feeId", "璇锋眰鎶ユ枃涓湭鍖呭惈feeId");
- Assert.hasKeyAndValue(reqJson, "feeName", "璇锋眰鎶ユ枃涓湭鍖呭惈feeName");
- Assert.hasKeyAndValue(reqJson, "amountdOwed", "璇锋眰鎶ユ枃涓湭鍖呭惈amountdOwed");
Assert.hasKeyAndValue(reqJson, "callableWay", "璇锋眰鎶ユ枃涓湭鍖呭惈callableWay");
- Assert.hasKeyAndValue(reqJson, "staffId", "璇锋眰鎶ユ枃涓湭鍖呭惈staffId");
- Assert.hasKeyAndValue(reqJson, "staffName", "璇锋眰鎶ユ枃涓湭鍖呭惈staffName");
- Assert.hasKeyAndValue(reqJson, "state", "璇锋眰鎶ユ枃涓湭鍖呭惈state");
- Assert.hasKeyAndValue(reqJson, "remark", "璇锋眰鎶ユ枃涓湭鍖呭惈remark");
+
+ if (!reqJson.containsKey("roomIds")) {
+ throw new CmdException("鏈寘鍚埧灞嬩俊鎭�");
+ }
+
+ JSONArray roomIds = reqJson.getJSONArray("roomIds");
+
+ if (roomIds == null || roomIds.size() < 1) {
+ throw new CmdException("鏈寘鍚埧灞嬩俊鎭�");
+ }
+
+ if (!reqJson.containsKey("feeId") && !reqJson.containsKey("feeIds") && !reqJson.containsKey("configIds")) {
+ throw new CmdException("鏈寘鍚渶瑕佸偓缂寸殑璐圭敤");
+ }
+
+
+ //todo 鍏紬鍙锋牎楠�
+ if (OweFeeCallableDto.CALLABLE_WAY_WECHAT.equals(reqJson.getString("callableWay"))) {
+ SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
+ smallWeChatDto.setObjId(reqJson.getString("communityId"));
+ smallWeChatDto.setWeChatType(SmallWeChatDto.WECHAT_TYPE_PUBLIC);
+ smallWeChatDto.setWechatType(smallWeChatDto.WECHAT_TYPE_PUBLIC);
+ int count = smallWechatV1InnerServiceSMOImpl.querySmallWechatsCount(smallWeChatDto);
+ if (count < 1) {
+ throw new CmdException("鏈厤缃叕浼楀彿");
+ }
+ }
+
+ //todo 鐭俊鏆備笉鏍¢獙
+
}
@@ -76,13 +103,19 @@
@Java110Transactional
public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
- OweFeeCallablePo oweFeeCallablePo = BeanConvertUtil.covertBean(reqJson, OweFeeCallablePo.class);
- oweFeeCallablePo.setOfcId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
- int flag = oweFeeCallableV1InnerServiceSMOImpl.saveOweFeeCallable(oweFeeCallablePo);
- if (flag < 1) {
- throw new CmdException("淇濆瓨鏁版嵁澶辫触");
- }
+ String userId = cmdDataFlowContext.getReqHeaders().get("user-id");
+
+ reqJson.put("staffId", userId);
+ dataBusInnerServiceSMOImpl.databusData(new DatabusDataDto(DatabusDataDto.BUSINESS_TYPE_OWE_FEE_CALLABLE, reqJson));
+
+// OweFeeCallablePo oweFeeCallablePo = BeanConvertUtil.covertBean(reqJson, OweFeeCallablePo.class);
+// oweFeeCallablePo.setOfcId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+// int flag = oweFeeCallableV1InnerServiceSMOImpl.saveOweFeeCallable(oweFeeCallablePo);
+//
+// if (flag < 1) {
+// throw new CmdException("淇濆瓨鏁版嵁澶辫触");
+// }
cmdDataFlowContext.setResponseEntity(ResultVo.success());
}
--
Gitblit v1.8.0