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

Merge remote-tracking branch 'origin/master'

xiaoqiang 4 лет назад
Родитель
Сommit
fee58759f4
18 измененных файлов с 145 добавлено и 570 удалено
  1. 5 1
      src/main/java/org/springblade/gateway/active_gateway/controller/AppActiveProductController.java
  2. 103 77
      src/main/java/org/springblade/gateway/active_gateway/service/impl/AppActiveProductServiceImpl.java
  3. 2 1
      src/main/java/org/springblade/gateway/goods_gateway/controller/AppHelpGoodsController.java
  4. 1 1
      src/main/java/org/springblade/gateway/goods_gateway/service/AppHelpGoodsService.java
  5. 22 25
      src/main/java/org/springblade/gateway/goods_gateway/service/impl/AppHelpGoodsServiceImpl.java
  6. 0 129
      src/main/java/org/springblade/sing/active/controller/UserHelpVoteController.java
  7. 0 34
      src/main/java/org/springblade/sing/active/dto/UserHelpVoteDTO.java
  8. 3 3
      src/main/java/org/springblade/sing/active/entity/ActiveHelpRecord.java
  9. 0 57
      src/main/java/org/springblade/sing/active/entity/UserHelpVote.java
  10. 0 42
      src/main/java/org/springblade/sing/active/mapper/UserHelpVoteMapper.java
  11. 0 25
      src/main/java/org/springblade/sing/active/mapper/UserHelpVoteMapper.xml
  12. 0 41
      src/main/java/org/springblade/sing/active/service/IUserHelpVoteService.java
  13. 0 41
      src/main/java/org/springblade/sing/active/service/impl/UserHelpVoteServiceImpl.java
  14. 0 36
      src/main/java/org/springblade/sing/active/vo/UserHelpVoteVO.java
  15. 0 49
      src/main/java/org/springblade/sing/active/wrapper/UserHelpVoteWrapper.java
  16. 6 5
      src/main/java/org/springblade/sing/goods/entity/HelpGoods.java
  17. 1 1
      src/main/resources/application-dev.yml
  18. 2 2
      src/main/resources/application-prod.yml

+ 5 - 1
src/main/java/org/springblade/gateway/active_gateway/controller/AppActiveProductController.java

@@ -5,6 +5,7 @@ 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;
@@ -12,6 +13,7 @@ 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;
 
 /**
@@ -35,8 +37,10 @@ public class AppActiveProductController extends BladeController {
 	@PostMapping("/productHelp")
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "作品助力", notes = "传入activeHelpRecord")
-	public R<String> productHelp(@Valid ActiveHelpRecord 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) {

+ 103 - 77
src/main/java/org/springblade/gateway/active_gateway/service/impl/AppActiveProductServiceImpl.java

@@ -1,14 +1,17 @@
 package org.springblade.gateway.active_gateway.service.impl;
 
+import cn.hutool.core.map.MapUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.jsonwebtoken.lang.Assert;
 import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
+import org.springblade.common.utils.BeanPropertyUtil;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.gateway.active_gateway.exception.AppActiveProductException;
 import org.springblade.gateway.active_gateway.service.AppActiveProductService;
 import org.springblade.gateway.active_gateway.util.ActiveProductUtil;
 import org.springblade.gateway.common_gateway.dto.ActiveSettingDto;
 import org.springblade.gateway.common_gateway.util.PlatformSettingUtil;
+import org.springblade.gateway.goods_gateway.exception.HelpGoodsException;
 import org.springblade.gateway.heat_gateway.enums.HeatTypeEnum;
 import org.springblade.gateway.point_gateway.enums.PointTypeEnum;
 import org.springblade.sing.active.entity.ActiveHelpRecord;
@@ -17,6 +20,8 @@ import org.springblade.sing.active.entity.ActiveRecord;
 import org.springblade.sing.active.service.IActiveHelpRecordService;
 import org.springblade.sing.active.service.IActiveProductRecordService;
 import org.springblade.sing.active.service.IActiveRecordService;
+import org.springblade.sing.goods.entity.HelpGoods;
+import org.springblade.sing.goods.service.IHelpGoodsService;
 import org.springblade.sing.heat.entity.HeatRecord;
 import org.springblade.sing.heat.service.IHeatRecordService;
 import org.springblade.sing.point.entity.PointRecord;
@@ -28,6 +33,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.Map;
 
 /**
  * @Author: Silent
@@ -50,103 +56,123 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 	@Autowired
 	private IActiveRecordService activeRecordService;
 	@Autowired
+	private IHelpGoodsService helpGoodsService;
+	@Autowired
 	private PlatformSettingUtil platformSettingUtil;
 
 	/**
 	 * 活动助力
+	 *
 	 * @param activeHelpRecord
 	 * @return
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void activeHelp(ActiveHelpRecord activeHelpRecord) {
-		//获取登录用户
-		LoginUser loginUser = loginUserService.getById(activeHelpRecord.getUserId());
-		Assert.notNull(loginUser,"没有找到用户");
 		//获取作品
 		ActiveProductRecord activeProductRecord = activeProductRecordService.getById(activeHelpRecord.getProductId());
-		Assert.notNull(activeProductRecord,"没有找到作品");
+		Assert.notNull(activeProductRecord, "没有找到作品");
+
 		//判断作品是否禁用
-		Assert.isTrue(Integer.valueOf(1).equals(activeProductRecord.getStatus()),"作品已被禁用");
+		Assert.isTrue(Integer.valueOf(1).equals(activeProductRecord.getStatus()), "作品已被禁用");
+
+		//获取登录用户
+		LoginUser loginUser = loginUserService.getById(activeHelpRecord.getUserId());
+		Assert.notNull(loginUser, "没有找到用户");
+
+		//获取道具记录
+		HelpGoods helpGoods = helpGoodsService.getById(activeHelpRecord.getHelpGoodsId());
+		Assert.notNull(helpGoods, "没有找到该道具");
+
 		//获取活动
 		ActiveRecord activeRecord = activeRecordService.getById(activeProductRecord.getActiveId());
-		Assert.notNull(activeRecord,"没有找到该活动");
+		Assert.notNull(activeRecord, "没有找到该活动");
+
 		//判断活动是否开始(活动开始时间>当前时间)
-		if(activeRecord.getStartTime().getTime()>DateUtil.now().getTime()){
+		if (activeRecord.getStartTime().getTime() > DateUtil.now().getTime()) {
 			throw new AppActiveProductException("活动还未开始哦~");
 		}
 		//判断当前活动是否结束(活动结束时间<当前时间)
-		if(activeRecord.getEndTime().getTime()<DateUtil.now().getTime()){
+		if (activeRecord.getEndTime().getTime() < DateUtil.now().getTime()) {
 			throw new AppActiveProductException("活动已结束哦~");
 		}
 
-//		//判断票数是否小于当前票数
-//		Long voteCount = loginUser.getVoteCount();
-//		Assert.notNull(voteCount,"用户没有票数");
-//		Assert.notNull(activeHelpRecord.getVoteCount(),"投票数为空");
-//		if(activeHelpRecord.getVoteCount()<1 || loginUser.getVoteCount()<activeHelpRecord.getVoteCount()){
-//			throw new AppActiveProductException("用户所拥有的票数少于所投的票数");
-//		}
-//		//获取平台参数配置
-//		ActiveSettingDto activeSetting = platformSettingUtil.getActiveSetting();
-//		Assert.notNull(activeSetting,"平台没有配置投票参数");
-//
-//
-//		//TODO 减去投票数
-//		loginUser.setVoteCount(loginUser.getVoteCount()-activeHelpRecord.getVoteCount());
-//
-//		//判断是否普法积分
-//		if(ObjectUtils.isNotEmpty(activeSetting.getVoteAndPointRate()) && !activeSetting.getVoteAndPointRate().equals(BigDecimal.ZERO)){
-//			//修改普法积分(票数*积分比例+原有积分)
-//			BigDecimal puFaPoint = activeSetting.getVoteAndPointRate()
-//				.multiply(BigDecimal.valueOf(activeHelpRecord.getVoteCount()));
-//			//添加普法积分赠送记录=>赠送给投票的用户
-//			PointRecord pointRecord = new PointRecord();
-//			pointRecord.setPoint(BigDecimal.valueOf(puFaPoint.doubleValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
-//			pointRecord.setPointType(PointTypeEnum.PUFA_POINT_SEND);
-//			pointRecord.setActiveProductId(activeHelpRecord.getProductId());
-//			pointRecord.setUserId(activeHelpRecord.getUserId());
-//			Assert.notNull(pointRecordService.save(pointRecord),"投票失败");
-//			loginUser.setPufaPoint(puFaPoint.add(loginUser.getPufaPoint()));
-//		}
-//		//修改投票用户信息
-//		Assert.isTrue(loginUserService.updateById(loginUser),"投票失败");
-//
-//
-//		//TODO 修改活动热力值和票数
-//		activeProductRecord.setVoteCount(activeProductRecord.getVoteCount()+1);
-//		//判断是否赠送热力值
-//		if(ObjectUtils.isNotEmpty(activeSetting.getVoteAndHeatRate()) && !activeSetting.getVoteAndHeatRate().equals(BigDecimal.ZERO)){
-//			//查询参赛用户
-//			LoginUser productUser = loginUserService.getById(activeProductRecord.getUserId());
-//			Assert.notNull(productUser,"没有找到该参赛选手");
-//
-//			//热力值=活动票数*热力值比例
-//			BigDecimal heatValue = activeSetting.getVoteAndHeatRate()
-//				.multiply(BigDecimal.valueOf(activeHelpRecord.getVoteCount()));
-//
-//			//原热力值+投票热力值
-//			productUser.setHeatValue(BigDecimal.valueOf(heatValue.doubleValue()).add(productUser.getHeatValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
-//
-//			//添加热力值赠送记录=>赠送给参赛用户
-//			HeatRecord heatRecord = new HeatRecord();
-//			heatRecord.setActiveProductId(activeHelpRecord.getProductId());
-//			heatRecord.setHeatValue(BigDecimal.valueOf(heatValue.doubleValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
-//			heatRecord.setHeatType(HeatTypeEnum.HEAT_VALUE_SEND);
-//			heatRecord.setUserId(activeProductRecord.getUserId());
-//			Assert.isTrue(heatRecordService.save(heatRecord),"投票失败");
-//			//修改活动热力值
-//			activeProductRecord.setHeatValue(heatValue.add(activeProductRecord.getHeatValue()));
-//			//放入ZSET缓存排名(缓存名:活动id,作品id,热力值)
-//			Assert.isTrue(ActiveProductUtil.addProductRank(activeProductRecord),"投票失败");
-//
-//			//修改参赛用户选手信息
-//			Assert.isTrue(loginUserService.updateById(productUser),"投票失败");
-//		}
-//		//修改活动作品信息
-//		Assert.isTrue(activeProductRecordService.updateById(activeProductRecord));
-//
-//		//TODO 添加活动记录
-//		Assert.isTrue(activeHelpRecordService.save(activeHelpRecord),"投票失败");
+		//判断该用户对该活动助力是否达到上限(-1表示无上限)
+		if (!Long.valueOf(-1).equals(helpGoods.getActiveVote())) {
+			Map<String, Object> map = activeHelpRecordService.getMap(Wrappers.<ActiveHelpRecord>query().select(new StringBuilder("sum(ifnull(")
+					.append(BeanPropertyUtil.getFieldNameToUnder(ActiveHelpRecord::getVoteCount))
+					.append(",0)) as count")
+					.toString())
+				.lambda()
+				.eq(ActiveHelpRecord::getProductId, activeProductRecord.getId()) //判断作品ID
+				.eq(ActiveHelpRecord::getUserId, loginUser.getId())    //判断用户ID
+				.eq(ActiveHelpRecord::getHelpGoodsId, helpGoods.getId()) //判断道具ID
+				.last(new StringBuilder("and date_format(")
+					.append(BeanPropertyUtil.getFieldNameToUnder(PointRecord::getCreateTime))
+					.append(",\"%Y-%m-%d\")=\"")
+					.append(DateUtil.format(DateUtil.now(), "yyyy-MM-dd").trim()).append("\"").toString()));
+			if ((MapUtil.getLong(map, "count") + activeHelpRecord.getVoteCount()) > helpGoods.getActiveVote()) {
+				throw new HelpGoodsException("您今日对该活动投票次数超过上限");
+			}
+		}
+
+		//获取平台参数配置
+		ActiveSettingDto activeSetting = platformSettingUtil.getActiveSetting();
+		Assert.notNull(activeSetting, "平台没有配置投票参数");
+
+		//判断是否普法积分
+		if (ObjectUtils.isNotEmpty(activeSetting.getVoteAndPointRate()) && !activeSetting.getVoteAndPointRate().equals(BigDecimal.ZERO)) {
+			//修改普法积分(票数*积分比例+原有积分)
+			BigDecimal puFaPoint = activeSetting.getVoteAndPointRate()
+				.multiply(BigDecimal.valueOf(activeHelpRecord.getVoteCount()));
+			//添加普法积分赠送记录=>赠送给投票的用户
+			PointRecord pointRecord = new PointRecord();
+			pointRecord.setPoint(BigDecimal.valueOf(puFaPoint.doubleValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
+			pointRecord.setPointType(PointTypeEnum.PUFA_POINT_SEND);
+			pointRecord.setActiveProductId(activeHelpRecord.getProductId());
+			pointRecord.setUserId(activeHelpRecord.getUserId());
+			Assert.notNull(pointRecordService.save(pointRecord), "投票失败");
+			loginUser.setPufaPoint(puFaPoint.add(loginUser.getPufaPoint()));
+		}
+
+		//修改投票用户信息
+		Assert.isTrue(loginUserService.updateById(loginUser), "投票失败");
+
+
+		//修改活动热力值和票数
+		activeProductRecord.setVoteCount(activeProductRecord.getVoteCount() + 1);
+		//判断是否赠送热力值
+		if (ObjectUtils.isNotEmpty(activeSetting.getVoteAndHeatRate()) && !activeSetting.getVoteAndHeatRate().equals(BigDecimal.ZERO)) {
+			//查询参赛用户
+			LoginUser productUser = loginUserService.getById(activeProductRecord.getUserId());
+			Assert.notNull(productUser, "没有找到该参赛选手");
+
+			//热力值=活动票数*热力值比例
+			BigDecimal heatValue = activeSetting.getVoteAndHeatRate()
+				.multiply(BigDecimal.valueOf(activeHelpRecord.getVoteCount()));
+
+			//原热力值+投票热力值
+			productUser.setHeatValue(BigDecimal.valueOf(heatValue.doubleValue()).add(productUser.getHeatValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
+
+			//添加热力值赠送记录=>赠送给参赛用户
+			HeatRecord heatRecord = new HeatRecord();
+			heatRecord.setActiveProductId(activeHelpRecord.getProductId());
+			heatRecord.setHeatValue(BigDecimal.valueOf(heatValue.doubleValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
+			heatRecord.setHeatType(HeatTypeEnum.HEAT_VALUE_SEND);
+			heatRecord.setUserId(activeProductRecord.getUserId());
+			Assert.isTrue(heatRecordService.save(heatRecord), "投票失败");
+			//修改活动热力值
+			activeProductRecord.setHeatValue(heatValue.add(activeProductRecord.getHeatValue()));
+			//放入ZSET缓存排名(缓存名:活动id,作品id,热力值)
+			Assert.isTrue(ActiveProductUtil.addProductRank(activeProductRecord), "投票失败");
+
+			//修改参赛用户选手信息
+			Assert.isTrue(loginUserService.updateById(productUser), "投票失败");
+		}
+		//修改活动作品信息
+		Assert.isTrue(activeProductRecordService.updateById(activeProductRecord));
+
+		//添加活动记录
+		Assert.isTrue(activeHelpRecordService.save(activeHelpRecord), "投票失败");
 	}
 }

+ 2 - 1
src/main/java/org/springblade/gateway/goods_gateway/controller/AppHelpGoodsController.java

@@ -46,13 +46,14 @@ public class AppHelpGoodsController {
 	public R<String> exchangeProps(@ApiParam(value = "道具ID",required = true) @RequestParam Long helpGoodsId,
 						   @ApiParam(value = "用户ID",required = true) @RequestParam Long userId,
 						   @ApiParam(value = "购买数量",required = true) @RequestParam BigDecimal num,
+						   @ApiParam(value = "作品ID",required = true) @RequestParam Long productId,
 						   CmccDectOrderRequest cmccDectOrderRequest){
 		try {
 			CmccPointRecord cmccPointRecord = new CmccPointRecord();
 			cmccPointRecord.setHelpGoodsId(helpGoodsId);
 			cmccPointRecord.setUserId(userId);
 			cmccPointRecord.setNum(num);
-			appHelpGoodsService.exchangeProps(cmccPointRecord,cmccDectOrderRequest);
+			appHelpGoodsService.exchangeProps(cmccPointRecord,cmccDectOrderRequest,productId);
 			return R.success("兑换成功");
 		} catch (Exception e) {
 			log.error(e.getMessage());

+ 1 - 1
src/main/java/org/springblade/gateway/goods_gateway/service/AppHelpGoodsService.java

@@ -11,7 +11,7 @@ import org.springblade.sing.point.entity.CmccPointRecord;
  * @Modified By:
  */
 public interface AppHelpGoodsService {
-	void exchangeProps(CmccPointRecord cmccPointRecord, CmccDectOrderRequest cmccDectOrderRequest);
+	void exchangeProps(CmccPointRecord cmccPointRecord, CmccDectOrderRequest cmccDectOrderRequest,Long productId);
 
 	void createPropsOrder(CmccPointRecord cmccPointRecord, CmccPlaceOrderRequest cmccPlaceOrderRequest);
 }

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

@@ -8,7 +8,9 @@ import io.jsonwebtoken.lang.Assert;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springblade.common.utils.BeanPropertyUtil;
+import org.springblade.common.utils.IPUtils;
 import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.gateway.active_gateway.service.AppActiveProductService;
 import org.springblade.gateway.goods_gateway.exception.HelpGoodsException;
 import org.springblade.gateway.goods_gateway.service.AppHelpGoodsService;
 import org.springblade.gateway.point_gateway.enums.CmccPayStatus;
@@ -17,6 +19,7 @@ import org.springblade.payment.cmcc.exception.CmccRequestException;
 import org.springblade.payment.cmcc.request.CmccDectOrderRequest;
 import org.springblade.payment.cmcc.request.CmccPlaceOrderRequest;
 import org.springblade.payment.cmcc.util.CmccUtil;
+import org.springblade.sing.active.entity.ActiveHelpRecord;
 import org.springblade.sing.goods.entity.GoodsRecord;
 import org.springblade.sing.goods.entity.HelpGoods;
 import org.springblade.sing.goods.enums.GoodsRecordType;
@@ -32,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.Map;
@@ -55,6 +59,10 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 	private ICmccPointRecordService cmccPointRecordService;
 	@Autowired
 	private IGoodsRecordService goodsRecordService;
+	@Autowired
+	private AppActiveProductService appActiveProductService;
+	@Autowired
+	private HttpServletRequest request;
 
 	/**
 	 * 移动积分兑换道具
@@ -63,7 +71,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void exchangeProps(CmccPointRecord cmccPointRecord,CmccDectOrderRequest cmccDectOrderRequest) {
+	public void exchangeProps(CmccPointRecord cmccPointRecord,CmccDectOrderRequest cmccDectOrderRequest,Long productId) {
 		//获取道具商品
 		HelpGoods helpGoods = helpGoodsService.getById(cmccPointRecord.getHelpGoodsId());
 		Assert.notNull(helpGoods,"没有找到该道具");
@@ -91,31 +99,11 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 					.append(",\"%Y-%m-%d\")=\"")
 					.append(DateUtil.format(DateUtil.now(), "yyyy-MM-dd").trim()).append("\"").toString()));
 			//购买次数>=允许购买的次数
-			if((cmccPointRecord.getNum().longValue() + MapUtil.getInt(map,"count"))>helpGoods.getTotal()){
+			if((cmccPointRecord.getNum().longValue() + MapUtil.getLong(map,"count"))>helpGoods.getTotal()){
 				throw new HelpGoodsException("您购买次数超过上限");
 			}
 		}
 
-		//判断是否赠送积分
-		if(ObjectUtils.isNotEmpty(helpGoods.getPufaPointRate()) && helpGoods.getPufaPointRate().intValue()>0){
-			//赠送用户普法积分(积分*数量+原积分)
-			loginUser.setPufaPoint(loginUser.getPufaPoint().add(helpGoods.getPufaPointRate().multiply(cmccPointRecord.getNum())));
-
-			//添加普法积分增加(赠送积分*数量)
-			PointRecord pufaPointRecord = new PointRecord();
-			pufaPointRecord.setPoint(helpGoods.getPufaPointRate().multiply(cmccPointRecord.getNum()));
-			pufaPointRecord.setUserId(loginUser.getId());
-			pufaPointRecord.setHelpGoodsId(helpGoods.getId());
-			pufaPointRecord.setPointType(PointTypeEnum.PUFA_POINT_SEND);
-			Assert.isTrue(pointRecordService.save(pufaPointRecord),"兑换失败");
-		}
-
-		//判断是否赠送票数
-		if(ObjectUtils.isNotEmpty(helpGoods.getVotePointRate()) && helpGoods.getVotePointRate().intValue()>0){
-			//设置票数(数量*票数+原有票数)
-
-		}
-
 		//修改用户信息
 		Assert.isTrue(loginUserService.updateById(loginUser),"兑换失败");
 
@@ -127,7 +115,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 		goodsRecord.setType(GoodsRecordType.HELP_GOODS_EXCHANGE);
 		Assert.isTrue(goodsRecordService.save(goodsRecord),"兑换失败");
 
-		//TODO 对接移动积分接口
+		//对接移动积分接口
 		if(ObjectUtils.isNotEmpty(helpGoods.getPoint()) && helpGoods.getPoint().longValue()>0L){
 			Assert.notNull(cmccDectOrderRequest.getOutOrderId(),"订单号不能为空");
 
@@ -159,15 +147,24 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 			//更新支付状态
 			Assert.isTrue(cmccPointRecordService.updateById(oldCmccPointRecord));
 
-			// TODO 移动支付逻辑
+			//移动支付逻辑
 			cmccDectOrderRequest.setMobile(oldCmccPointRecord.getPhone());
 			try {
 				CmccUtil.dectOrder(cmccDectOrderRequest);
 			} catch (CmccRequestException e) {
-				// TODO 支付失败逻辑
+				//支付失败逻辑
 				throw new HelpGoodsException(e.getMessage());
 			}
 		}
+
+		//兑换完成后直接助力
+		ActiveHelpRecord activeHelpRecord = new ActiveHelpRecord();
+		activeHelpRecord.setProductId(productId);
+		activeHelpRecord.setUserId(loginUser.getId());
+		activeHelpRecord.setHelpGoodsId(helpGoods.getId());
+		activeHelpRecord.setIp(IPUtils.getRealIp(request));
+		activeHelpRecord.setVoteCount(helpGoods.getVotePointRate().longValue());
+		appActiveProductService.activeHelp(activeHelpRecord);
 	}
 
 	/**

+ 0 - 129
src/main/java/org/springblade/sing/active/controller/UserHelpVoteController.java

@@ -1,129 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.controller;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
-import org.springblade.core.mp.support.Condition;
-import org.springblade.core.mp.support.Query;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.bind.annotation.RequestParam;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springblade.sing.active.entity.UserHelpVote;
-import org.springblade.sing.active.vo.UserHelpVoteVO;
-import org.springblade.sing.active.wrapper.UserHelpVoteWrapper;
-import org.springblade.sing.active.service.IUserHelpVoteService;
-import org.springblade.core.boot.ctrl.BladeController;
-
-/**
- * 用户助力票数表 控制器
- *
- * @author BladeX
- * @since 2021-11-18
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("sing_active/userhelpvote")
-@Api(value = "用户助力票数表", tags = "用户助力票数表接口")
-public class UserHelpVoteController extends BladeController {
-
-	private final IUserHelpVoteService userHelpVoteService;
-
-	/**
-	 * 详情
-	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "详情", notes = "传入userHelpVote")
-	public R<UserHelpVoteVO> detail(UserHelpVote userHelpVote) {
-		UserHelpVote detail = userHelpVoteService.getOne(Condition.getQueryWrapper(userHelpVote));
-		return R.data(UserHelpVoteWrapper.build().entityVO(detail));
-	}
-
-	/**
-	 * 分页 用户助力票数表
-	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "分页", notes = "传入userHelpVote")
-	public R<IPage<UserHelpVoteVO>> list(UserHelpVote userHelpVote, Query query) {
-		IPage<UserHelpVote> pages = userHelpVoteService.page(Condition.getPage(query), Condition.getQueryWrapper(userHelpVote));
-		return R.data(UserHelpVoteWrapper.build().pageVO(pages));
-	}
-
-
-	/**
-	 * 自定义分页 用户助力票数表
-	 */
-	@GetMapping("/page")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "分页", notes = "传入userHelpVote")
-	public R<IPage<UserHelpVoteVO>> page(UserHelpVoteVO userHelpVote, Query query) {
-		IPage<UserHelpVoteVO> pages = userHelpVoteService.selectUserHelpVotePage(Condition.getPage(query), userHelpVote);
-		return R.data(pages);
-	}
-
-	/**
-	 * 新增 用户助力票数表
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "新增", notes = "传入userHelpVote")
-	public R save(@Valid @RequestBody UserHelpVote userHelpVote) {
-		return R.status(userHelpVoteService.save(userHelpVote));
-	}
-
-	/**
-	 * 修改 用户助力票数表
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "修改", notes = "传入userHelpVote")
-	public R update(@Valid @RequestBody UserHelpVote userHelpVote) {
-		return R.status(userHelpVoteService.updateById(userHelpVote));
-	}
-
-	/**
-	 * 新增或修改 用户助力票数表
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "新增或修改", notes = "传入userHelpVote")
-	public R submit(@Valid @RequestBody UserHelpVote userHelpVote) {
-		return R.status(userHelpVoteService.saveOrUpdate(userHelpVote));
-	}
-
-	
-	/**
-	 * 删除 用户助力票数表
-	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "逻辑删除", notes = "传入ids")
-	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
-		return R.status(userHelpVoteService.deleteLogic(Func.toLongList(ids)));
-	}
-
-	
-}

+ 0 - 34
src/main/java/org/springblade/sing/active/dto/UserHelpVoteDTO.java

@@ -1,34 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.dto;
-
-import org.springblade.sing.active.entity.UserHelpVote;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 用户助力票数表数据传输对象实体类
- *
- * @author BladeX
- * @since 2021-11-18
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class UserHelpVoteDTO extends UserHelpVote {
-	private static final long serialVersionUID = 1L;
-
-}

+ 3 - 3
src/main/java/org/springblade/sing/active/entity/ActiveHelpRecord.java

@@ -46,18 +46,18 @@ public class ActiveHelpRecord extends BaseEntity {
 	@NotNull
 	private Long userId;
 	/**
-	 * 活动记录ID
+	 * 作品ID
 	 */
 	@ApiModelProperty(value = "作品ID",required = true)
 	@NotNull
 	private Long productId;
 	/**
-	 * 活动记录ID
+	 * 用户IP
 	 */
 	@ApiModelProperty(value = "用户IP",required = true)
 	private String ip;
 	/**
-	 * 活动记录ID
+	 * 助力道具ID
 	 */
 	@ApiModelProperty(value = "助力道具ID",required = true)
 	@NotNull

+ 0 - 57
src/main/java/org/springblade/sing/active/entity/UserHelpVote.java

@@ -1,57 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import org.springblade.core.mp.base.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-/**
- * 用户助力票数表实体类
- *
- * @author BladeX
- * @since 2021-11-18
- */
-@Data
-@TableName("sing_user_help_vote")
-@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "UserHelpVote对象", description = "用户助力票数表")
-public class UserHelpVote extends BaseEntity {
-
-	private static final long serialVersionUID = 1L;
-
-	/**
-	* 用户ID
-	*/
-		@ApiModelProperty(value = "用户ID")
-		private Long userId;
-	/**
-	* 助力道具ID
-	*/
-		@ApiModelProperty(value = "助力道具ID")
-		private Long helpGoodsId;
-	/**
-	* 剩余票数
-	*/
-		@ApiModelProperty(value = "剩余票数")
-		private Long voteCount;
-
-
-}

+ 0 - 42
src/main/java/org/springblade/sing/active/mapper/UserHelpVoteMapper.java

@@ -1,42 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.mapper;
-
-import org.springblade.sing.active.entity.UserHelpVote;
-import org.springblade.sing.active.vo.UserHelpVoteVO;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import java.util.List;
-
-/**
- * 用户助力票数表 Mapper 接口
- *
- * @author BladeX
- * @since 2021-11-18
- */
-public interface UserHelpVoteMapper extends BaseMapper<UserHelpVote> {
-
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param userHelpVote
-	 * @return
-	 */
-	List<UserHelpVoteVO> selectUserHelpVotePage(IPage page, UserHelpVoteVO userHelpVote);
-
-}

+ 0 - 25
src/main/java/org/springblade/sing/active/mapper/UserHelpVoteMapper.xml

@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.springblade.sing.active.mapper.UserHelpVoteMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="userHelpVoteResultMap" type="org.springblade.sing.active.entity.UserHelpVote">
-        <result column="id" property="id"/>
-        <result column="create_user" property="createUser"/>
-        <result column="create_dept" property="createDept"/>
-        <result column="create_time" property="createTime"/>
-        <result column="update_user" property="updateUser"/>
-        <result column="update_time" property="updateTime"/>
-        <result column="status" property="status"/>
-        <result column="is_deleted" property="isDeleted"/>
-        <result column="user_id" property="userId"/>
-        <result column="help_goods_id" property="helpGoodsId"/>
-        <result column="vote_count" property="voteCount"/>
-    </resultMap>
-
-
-    <select id="selectUserHelpVotePage" resultMap="userHelpVoteResultMap">
-        select * from sing_user_help_vote where is_deleted = 0
-    </select>
-
-</mapper>

+ 0 - 41
src/main/java/org/springblade/sing/active/service/IUserHelpVoteService.java

@@ -1,41 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.service;
-
-import org.springblade.sing.active.entity.UserHelpVote;
-import org.springblade.sing.active.vo.UserHelpVoteVO;
-import org.springblade.core.mp.base.BaseService;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-/**
- * 用户助力票数表 服务类
- *
- * @author BladeX
- * @since 2021-11-18
- */
-public interface IUserHelpVoteService extends BaseService<UserHelpVote> {
-
-	/**
-	 * 自定义分页
-	 *
-	 * @param page
-	 * @param userHelpVote
-	 * @return
-	 */
-	IPage<UserHelpVoteVO> selectUserHelpVotePage(IPage<UserHelpVoteVO> page, UserHelpVoteVO userHelpVote);
-
-}

+ 0 - 41
src/main/java/org/springblade/sing/active/service/impl/UserHelpVoteServiceImpl.java

@@ -1,41 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.service.impl;
-
-import org.springblade.sing.active.entity.UserHelpVote;
-import org.springblade.sing.active.vo.UserHelpVoteVO;
-import org.springblade.sing.active.mapper.UserHelpVoteMapper;
-import org.springblade.sing.active.service.IUserHelpVoteService;
-import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-/**
- * 用户助力票数表 服务实现类
- *
- * @author BladeX
- * @since 2021-11-18
- */
-@Service
-public class UserHelpVoteServiceImpl extends BaseServiceImpl<UserHelpVoteMapper, UserHelpVote> implements IUserHelpVoteService {
-
-	@Override
-	public IPage<UserHelpVoteVO> selectUserHelpVotePage(IPage<UserHelpVoteVO> page, UserHelpVoteVO userHelpVote) {
-		return page.setRecords(baseMapper.selectUserHelpVotePage(page, userHelpVote));
-	}
-
-}

+ 0 - 36
src/main/java/org/springblade/sing/active/vo/UserHelpVoteVO.java

@@ -1,36 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.vo;
-
-import org.springblade.sing.active.entity.UserHelpVote;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import io.swagger.annotations.ApiModel;
-
-/**
- * 用户助力票数表视图实体类
- *
- * @author BladeX
- * @since 2021-11-18
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ApiModel(value = "UserHelpVoteVO对象", description = "用户助力票数表")
-public class UserHelpVoteVO extends UserHelpVote {
-	private static final long serialVersionUID = 1L;
-
-}

+ 0 - 49
src/main/java/org/springblade/sing/active/wrapper/UserHelpVoteWrapper.java

@@ -1,49 +0,0 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
-package org.springblade.sing.active.wrapper;
-
-import org.springblade.core.mp.support.BaseEntityWrapper;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.sing.active.entity.UserHelpVote;
-import org.springblade.sing.active.vo.UserHelpVoteVO;
-import java.util.Objects;
-
-/**
- * 用户助力票数表包装类,返回视图层所需的字段
- *
- * @author BladeX
- * @since 2021-11-18
- */
-public class UserHelpVoteWrapper extends BaseEntityWrapper<UserHelpVote, UserHelpVoteVO>  {
-
-	public static UserHelpVoteWrapper build() {
-		return new UserHelpVoteWrapper();
- 	}
-
-	@Override
-	public UserHelpVoteVO entityVO(UserHelpVote userHelpVote) {
-		UserHelpVoteVO userHelpVoteVO = Objects.requireNonNull(BeanUtil.copy(userHelpVote, UserHelpVoteVO.class));
-
-		//User createUser = UserCache.getUser(userHelpVote.getCreateUser());
-		//User updateUser = UserCache.getUser(userHelpVote.getUpdateUser());
-		//userHelpVoteVO.setCreateUserName(createUser.getName());
-		//userHelpVoteVO.setUpdateUserName(updateUser.getName());
-
-		return userHelpVoteVO;
-	}
-
-}

+ 6 - 5
src/main/java/org/springblade/sing/goods/entity/HelpGoods.java

@@ -44,21 +44,25 @@ public class HelpGoods extends BaseEntity {
 	 */
 	@ApiModelProperty(value = "商品名称")
 	private String name;
+
 	/**
 	 * 商品图片地址
 	 */
 	@ApiModelProperty(value = "商品图片地址")
 	private String imgUrl;
+
 	/**
 	 * 移动商品道具ID
 	 */
 	@ApiModelProperty(value = "移动商品道具ID")
 	private String cmccGoodsId;
+
 	/**
 	 * 积分
 	 */
 	@ApiModelProperty(value = "积分")
 	private BigDecimal point;
+
 	/**
 	 * 商品总数(每人可购买次数)
 	 */
@@ -69,16 +73,13 @@ public class HelpGoods extends BaseEntity {
 	 */
 	@ApiModelProperty(value = "同一个活动投票次数/天/人")
 	private Long activeVote;
-	/**
-	 * 普法积分率(购买一个可获得多少普法积分)
-	 */
-	@ApiModelProperty(value = "普法积分率(购买一个可获得多少普法积分)")
-	private BigDecimal pufaPointRate;
+
 	/**
 	 * 票数积分率(购买一个可获得多少张票)
 	 */
 	@ApiModelProperty(value = "票数积分率(购买一个可获得多少张票)")
 	private BigDecimal votePointRate;
+
 	/**
 	 * 商品内容
 	 */

+ 1 - 1
src/main/resources/application-dev.yml

@@ -64,5 +64,5 @@ cmcc:
     # 签名key
     signKey: b47366a9df9d
     # 回调地址
-    callbackUrl: http://ldt.guosen-fumao.cn/
+    callbackUrl: https://ldt.guosen-fumao.cn/wapp/auth.html
 

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

@@ -53,7 +53,7 @@ blade:
 cmcc:
   pay:
     # 地址
-    url: http://api-test.kunbiaowangluo.com/
+    url: https://api.kunbiaowangluo.com/
     # 商户号
     partnerId: KB_001
     # 专区号
@@ -65,5 +65,5 @@ cmcc:
     # 签名key
     signKey: b47366a9df9d
     # 回调地址
-    callbackUrl: http://ldt.guosen-fumao.cn/
+    callbackUrl: https://ldt.guosen-fumao.cn/wapp/auth.html