Просмотр исходного кода

修改投票和兑换道具逻辑

silent 4 лет назад
Родитель
Сommit
0c41ecfa18

+ 20 - 28
src/main/java/org/springblade/gateway/active_gateway/controller/AppActiveProductController.java

@@ -1,20 +1,12 @@
 package org.springblade.gateway.active_gateway.controller;
 
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springblade.common.utils.IPUtils;
 import org.springblade.core.boot.ctrl.BladeController;
-import org.springblade.core.log.annotation.ApiLog;
-import org.springblade.core.tool.api.R;
 import org.springblade.gateway.active_gateway.service.AppActiveProductService;
-import org.springblade.sing.active.entity.ActiveHelpRecord;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * @Author: Silent
@@ -30,23 +22,23 @@ import javax.validation.Valid;
 public class AppActiveProductController extends BladeController {
 	private AppActiveProductService activeService;
 
-	/**
-	 * 作品助力
-	 */
-	@ApiLog("作品助力")
-	@PostMapping("/productHelp")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "作品助力", notes = "传入activeHelpRecord")
-	public R<String> productHelp(@Valid ActiveHelpRecord activeHelpRecord, HttpServletRequest request){
-		try {
-			//获取用户IP地址
-			activeHelpRecord.setIp(IPUtils.getRealIp(request));
-			activeService.activeHelp(activeHelpRecord);
-			return R.success("助力成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage());
-			return R.fail(e.getMessage());
-		}
-	}
+//	/**
+//	 * 作品助力
+//	 */
+//	@ApiLog("作品助力")
+//	@PostMapping("/productHelp")
+//	@ApiOperationSupport(order = 1)
+//	@ApiOperation(value = "作品助力", notes = "传入activeHelpRecord")
+//	public R<String> productHelp(@Valid ActiveHelpRecord activeHelpRecord, HttpServletRequest request){
+//		try {
+//			//获取用户IP地址
+//			activeHelpRecord.setIp(IPUtils.getRealIp(request));
+//			activeService.activeHelp(activeHelpRecord);
+//			return R.success("助力成功!");
+//		} catch (Exception e) {
+//			log.error(e.getMessage());
+//			return R.fail(e.getMessage());
+//		}
+//	}
 
 }

+ 5 - 3
src/main/java/org/springblade/gateway/active_gateway/service/impl/AppActiveProductServiceImpl.java

@@ -30,6 +30,7 @@ import org.springblade.sing.user.entity.LoginUser;
 import org.springblade.sing.user.service.ILoginUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
@@ -67,7 +68,7 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 	 * @return
 	 */
 	@Override
-	@Transactional(rollbackFor = Exception.class)
+	@Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
 	public void activeHelp(ActiveHelpRecord activeHelpRecord) {
 		//获取作品
 		ActiveProductRecord activeProductRecord = activeProductRecordService.getById(activeHelpRecord.getProductId());
@@ -99,9 +100,9 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 
 		//判断该用户对该活动助力是否达到上限(-1表示无上限)
 		if (!Long.valueOf(-1).equals(helpGoods.getActiveVote())) {
-			Map<String, Object> map = activeHelpRecordService.getMap(Wrappers.<ActiveHelpRecord>query().select(new StringBuilder("sum(ifnull(")
+			Map<String, Object> map = activeHelpRecordService.getMap(Wrappers.<ActiveHelpRecord>query().select(new StringBuilder("ifnull(sum(")
 					.append(BeanPropertyUtil.getFieldNameToUnder(ActiveHelpRecord::getVoteCount))
-					.append(",0)) as count")
+					.append("),0) as count")
 					.toString())
 				.lambda()
 				.eq(ActiveHelpRecord::getProductId, activeProductRecord.getId()) //判断作品ID
@@ -169,6 +170,7 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 			//修改参赛用户选手信息
 			Assert.isTrue(loginUserService.updateById(productUser), "投票失败");
 		}
+
 		//修改活动作品信息
 		Assert.isTrue(activeProductRecordService.updateById(activeProductRecord));
 

+ 2 - 2
src/main/java/org/springblade/gateway/goods_gateway/service/impl/AppHelpGoodsServiceImpl.java

@@ -86,9 +86,9 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 		//判断用户今天购买该商品次数是否超过限制(-1标识不限制次数)
 		if(!helpGoods.getTotal().equals(-1L)){
 			Map<String, Object> map = goodsRecordService.getMap(Wrappers.<GoodsRecord>query()
-				.select(new StringBuilder("sum(ifnull(")
+				.select(new StringBuilder("ifnull(sum(")
 					.append(BeanPropertyUtil.getFieldNameToUnder(GoodsRecord::getNum))
-					.append(",0)) as count")
+					.append("),0) as count")
 					.toString())
 				.lambda()
 				.eq(GoodsRecord::getUserId, loginUser.getId())

+ 6 - 0
src/main/java/org/springblade/payment/cmcc/config/CmccPointConfig.java

@@ -32,6 +32,12 @@ public class CmccPointConfig {
 	@ApiModelProperty("签名key")
 	private String signKey;
 
+	@ApiModelProperty("appId")
+	private String appId;
+
+	@ApiModelProperty("appkey")
+	private String appkey;
+
 	@ApiModelProperty("商户号")
 	private String partnerId;
 

+ 7 - 7
src/main/resources/application-prod.yml

@@ -55,15 +55,15 @@ cmcc:
     # 地址
     url: https://api.kunbiaowangluo.com/
     # 商户号
-    partnerId: KB_001
+    partnerId: KB_100020
     # 专区号
-    storeId: S9990141_best_store1
-    # AesKey
-    aesKey: 4a13b832815aaf20
-    # aesIv
-    aesIv: 1234567812345678
+    storeId: GX_1
+    # appId
+    appId: 5308e20b
+    # appId
+    appkey: 3daf27ea2fe840ada6af8e1ec0d7b760
     # 签名key
-    signKey: b47366a9df9d
+    signKey: f0463e4f8823
     # 回调地址
     callbackUrl: https://ldt.guosen-fumao.cn/wapp/auth.html