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-acct/src/main/java/com/java110/acct/cmd/couponProperty/SaveCouponPropertyPoolCmd.java | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/service-acct/src/main/java/com/java110/acct/cmd/couponProperty/SaveCouponPropertyPoolCmd.java b/service-acct/src/main/java/com/java110/acct/cmd/couponProperty/SaveCouponPropertyPoolCmd.java
index 118d913..9ac73de 100644
--- a/service-acct/src/main/java/com/java110/acct/cmd/couponProperty/SaveCouponPropertyPoolCmd.java
+++ b/service-acct/src/main/java/com/java110/acct/cmd/couponProperty/SaveCouponPropertyPoolCmd.java
@@ -15,6 +15,7 @@
*/
package com.java110.acct.cmd.couponProperty;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
import com.java110.core.annotation.Java110Transactional;
@@ -23,13 +24,16 @@
import com.java110.core.event.cmd.CmdEvent;
import com.java110.core.factory.GenerateCodeFactory;
import com.java110.dto.community.CommunityDto;
-import com.java110.dto.couponPropertyPool.CouponPropertyPoolDto;
+import com.java110.dto.coupon.CouponPropertyPoolDto;
+import com.java110.intf.acct.ICouponPropertyPoolConfigV1InnerServiceSMO;
import com.java110.intf.acct.ICouponPropertyPoolV1InnerServiceSMO;
import com.java110.intf.community.ICommunityV1InnerServiceSMO;
-import com.java110.po.couponPropertyPool.CouponPropertyPoolPo;
+import com.java110.po.coupon.CouponPropertyPoolPo;
+import com.java110.po.coupon.CouponPropertyPoolConfigPo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,6 +62,9 @@
private ICouponPropertyPoolV1InnerServiceSMO couponPropertyPoolV1InnerServiceSMOImpl;
@Autowired
+ private ICouponPropertyPoolConfigV1InnerServiceSMO couponPropertyPoolConfigV1InnerServiceSMOImpl;
+
+ @Autowired
private ICommunityV1InnerServiceSMO communityV1InnerServiceSMOImpl;
@Override
@@ -67,6 +74,28 @@
Assert.hasKeyAndValue(reqJson, "toType", "璇锋眰鎶ユ枃涓湭鍖呭惈toType");
Assert.hasKeyAndValue(reqJson, "stock", "璇锋眰鎶ユ枃涓湭鍖呭惈stock");
Assert.hasKeyAndValue(reqJson, "validityDay", "璇锋眰鎶ユ枃涓湭鍖呭惈validityDay");
+
+ if(!reqJson.containsKey("toTypes")){
+ throw new CmdException("鏈寘鍚敤閫�");
+ }
+
+ JSONArray toTypes = reqJson.getJSONArray("toTypes");
+
+ if(toTypes == null || toTypes.size()< 1){
+ throw new CmdException("鏈寘鍚敤閫�");
+ }
+
+ JSONObject typeObj = null;
+ for(int typeIndex = 0;typeIndex < toTypes.size(); typeIndex++){
+ typeObj = toTypes.getJSONObject(typeIndex);
+ if(!typeObj.containsKey("columnValue")){
+ throw new CmdException(typeObj.getString("name")+"鏈~鍐欏��");
+ }
+
+ if(StringUtil.isEmpty(typeObj.getString("columnValue"))){
+ throw new CmdException(typeObj.getString("name")+"鏈~鍐欏��");
+ }
+ }
}
@@ -92,6 +121,20 @@
throw new CmdException("淇濆瓨鏁版嵁澶辫触");
}
+ JSONArray toTypes = reqJson.getJSONArray("toTypes");
+
+ JSONObject typeObj = null;
+ CouponPropertyPoolConfigPo couponPropertyPoolConfigPo = null;
+ for(int typeIndex = 0;typeIndex < toTypes.size(); typeIndex++){
+ typeObj = toTypes.getJSONObject(typeIndex);
+ couponPropertyPoolConfigPo = new CouponPropertyPoolConfigPo();
+ couponPropertyPoolConfigPo.setColumnKey(typeObj.getString("columnKey"));
+ couponPropertyPoolConfigPo.setColumnValue(typeObj.getString("columnValue"));
+ couponPropertyPoolConfigPo.setConfigId(GenerateCodeFactory.getGeneratorId("11"));
+ couponPropertyPoolConfigPo.setCouponId(couponPropertyPoolPo.getCppId());
+ couponPropertyPoolConfigV1InnerServiceSMOImpl.saveCouponPropertyPoolConfig(couponPropertyPoolConfigPo);
+ }
+
cmdDataFlowContext.setResponseEntity(ResultVo.success());
}
}
--
Gitblit v1.8.0