Procházet zdrojové kódy

Merge branch 'master' of http://myway.zicp.vip:47620/lianghanqiang/SING_FOR_ME

 Conflicts:
	src/main/resources/application-prod.yml
lianghanqiang před 4 roky
rodič
revize
9c9a4bad7d
37 změnil soubory, kde provedl 994 přidání a 60 odebrání
  1. 1 1
      src/main/java/org/springblade/gateway/active_gateway/controller/AppActiveProductController.java
  2. 40 0
      src/main/java/org/springblade/gateway/active_gateway/controller/IActiveHelpController.java
  3. 25 0
      src/main/java/org/springblade/gateway/active_gateway/controller/ProductSortController.java
  4. 2 2
      src/main/java/org/springblade/gateway/active_gateway/service/AppActiveProductService.java
  5. 12 10
      src/main/java/org/springblade/gateway/active_gateway/service/impl/AppActiveProductServiceImpl.java
  6. 3 0
      src/main/java/org/springblade/gateway/common_gateway/dto/ActiveSettingDto.java
  7. 42 0
      src/main/java/org/springblade/gateway/common_gateway/dto/PointGoodsSettingDto.java
  8. 19 3
      src/main/java/org/springblade/gateway/common_gateway/enums/PlatformSettingEnum.java
  9. 27 2
      src/main/java/org/springblade/gateway/common_gateway/util/PlatformSettingUtil.java
  10. 5 4
      src/main/java/org/springblade/gateway/goods_gateway/service/impl/AppHelpGoodsServiceImpl.java
  11. 72 3
      src/main/java/org/springblade/gateway/login_gateway/controller/LoginController.java
  12. 3 2
      src/main/java/org/springblade/gateway/point_gateway/controller/PointExchangeController.java
  13. 1 1
      src/main/java/org/springblade/gateway/point_gateway/service/PointExchangeService.java
  14. 1 1
      src/main/java/org/springblade/gateway/point_gateway/service/impl/PointExchangeServiceImpl.java
  15. 129 0
      src/main/java/org/springblade/sing/active/controller/ActiveHelpController.java
  16. 2 1
      src/main/java/org/springblade/sing/active/controller/ActiveProductRecordController.java
  17. 1 0
      src/main/java/org/springblade/sing/active/controller/ActiveRecordController.java
  18. 34 0
      src/main/java/org/springblade/sing/active/dto/ActiveHelpDTO.java
  19. 58 0
      src/main/java/org/springblade/sing/active/entity/ActiveHelp.java
  20. 5 0
      src/main/java/org/springblade/sing/active/entity/ActiveHelpRecord.java
  21. 44 0
      src/main/java/org/springblade/sing/active/mapper/ActiveHelpMapper.java
  22. 28 0
      src/main/java/org/springblade/sing/active/mapper/ActiveHelpMapper.xml
  23. 47 0
      src/main/java/org/springblade/sing/active/service/IActiveHelpService.java
  24. 68 0
      src/main/java/org/springblade/sing/active/service/impl/ActiveHelpServiceImpl.java
  25. 36 0
      src/main/java/org/springblade/sing/active/vo/ActiveHelpVO.java
  26. 49 0
      src/main/java/org/springblade/sing/active/wrapper/ActiveHelpWrapper.java
  27. 5 0
      src/main/java/org/springblade/sing/heat/entity/HeatRecord.java
  28. 16 8
      src/main/java/org/springblade/sing/heat/entity/UserHeat.java
  29. 6 0
      src/main/java/org/springblade/sing/point/entity/PointRecord.java
  30. 16 8
      src/main/java/org/springblade/sing/point/entity/UserPufaPoint.java
  31. 88 3
      src/main/java/org/springblade/sing/user/controller/UserAddressController.java
  32. 21 0
      src/main/java/org/springblade/sing/user/entity/UserAddress.java
  33. 4 0
      src/main/java/org/springblade/sing/user/mapper/UserAddressMapper.xml
  34. 9 9
      src/main/resources/application-dev.yml
  35. 2 1
      src/main/resources/application-prod.yml
  36. 1 1
      src/main/resources/wxConfig.properties
  37. 72 0
      src/test/resources/static/test.html

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

@@ -70,7 +70,7 @@ public class AppActiveProductController extends BladeController {
 		try {
 			//获取用户IP地址
 			activeHelpRecord.setIp(IPUtils.getRealIp(request));
-			activeService.activeHelp(activeHelpRecord,null);
+			activeService.activeHelp(activeHelpRecord);
 			return R.success("助力成功!");
 		} catch (Exception e) {
 			log.error(e.getMessage());

+ 40 - 0
src/main/java/org/springblade/gateway/active_gateway/controller/IActiveHelpController.java

@@ -0,0 +1,40 @@
+package org.springblade.gateway.active_gateway.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+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.core.mp.support.Query;
+import org.springblade.core.redis.cache.BladeRedis;
+import org.springblade.core.tool.api.R;
+import org.springblade.gateway.active_gateway.service.ProductSortService;
+import org.springblade.gateway.active_gateway.vo.ProductSortVO;
+import org.springblade.sing.active.entity.ActiveHelp;
+import org.springblade.sing.active.service.IActiveHelpService;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import org.springblade.sing.active.vo.ActiveProductRecordVO;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RequestMapping("app/active")
+@RestController
+@AllArgsConstructor
+@Api(value = "排行", tags = "排行接口")
+@Slf4j
+public class IActiveHelpController {
+
+	private IActiveHelpService activeHelpService;
+
+	@GetMapping("/help")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "我的代言", notes = "传入activeHelpVO")
+	public R<ActiveHelp> list(ActiveHelpVO activeHelpVO) throws IllegalAccessException {
+		return R.data(activeHelpService.queryIndex(activeHelpVO));
+	}
+
+}

+ 25 - 0
src/main/java/org/springblade/gateway/active_gateway/controller/ProductSortController.java

@@ -2,6 +2,7 @@ package org.springblade.gateway.active_gateway.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -12,7 +13,13 @@ import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.core.tool.api.R;
 import org.springblade.gateway.active_gateway.service.ProductSortService;
 import org.springblade.gateway.active_gateway.vo.ProductSortVO;
+import org.springblade.sing.active.entity.ActiveHelpRecord;
+import org.springblade.sing.active.entity.ActiveProductRecord;
+import org.springblade.sing.active.service.IActiveProductRecordService;
+import org.springblade.sing.active.vo.ActiveHelpRecordVO;
 import org.springblade.sing.active.vo.ActiveProductRecordVO;
+import org.springblade.sing.active.wrapper.ActiveHelpRecordWrapper;
+import org.springblade.sing.active.wrapper.ActiveProductRecordWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +27,9 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
+/**
+ * @author cy-computer
+ */
 @RequestMapping("app/active/product")
 @RestController
 @AllArgsConstructor
@@ -28,6 +38,7 @@ import java.util.List;
 public class ProductSortController {
 
 	private ProductSortService productSortService;
+	private IActiveProductRecordService activeProductRecordService;
 	private BladeRedis bladeRedis;
 
 	@GetMapping("/sortList")
@@ -45,4 +56,18 @@ public class ProductSortController {
 		IPage page= productSortService.sortListQuery(productSortVO, query);
 		return R.data(page);
 	}
+
+
+	/**
+	 * 分页 活动作品搜索
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入activeProductRecord")
+	public R<IPage<ActiveProductRecordVO>> list(ActiveProductRecord activeProductRecord, Query query) {
+		IPage<ActiveProductRecord> pages = activeProductRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(activeProductRecord).lambda().orderByAsc(ActiveProductRecord::getProductNo));
+		return R.data(ActiveProductRecordWrapper.build(bladeRedis).pageVO(pages));
+	}
+
+
 }

+ 2 - 2
src/main/java/org/springblade/gateway/active_gateway/service/AppActiveProductService.java

@@ -14,11 +14,11 @@ import org.springblade.sing.user.entity.LoginUser;
  */
 public interface AppActiveProductService {
 
-	void activeHelp(ActiveHelpRecord activeHelpRecord,String phone);
+	void activeHelp(ActiveHelpRecord activeHelpRecord);
 
 	void updateProductVoteAndHeat(ActiveHelpRecord activeHelpRecord, ActiveProductRecord activeProductRecord, ActiveSettingDto activeSetting);
 
-	void userPuFaPointUpdate(ActiveHelpRecord activeHelpRecord, String phone, ActiveSettingDto activeSetting);
+	void userPuFaPointUpdate(ActiveHelpRecord activeHelpRecord, ActiveSettingDto activeSetting);
 
 	void userHelpCountCheck(ActiveHelpRecord activeHelpRecord, ActiveProductRecord activeProductRecord, LoginUser loginUser, HelpGoods helpGoods);
 }

+ 12 - 10
src/main/java/org/springblade/gateway/active_gateway/service/impl/AppActiveProductServiceImpl.java

@@ -76,7 +76,7 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 	 */
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public void activeHelp(ActiveHelpRecord activeHelpRecord,String phone) {
+	public void activeHelp(ActiveHelpRecord activeHelpRecord) {
 		//获取作品
 		ActiveProductRecord activeProductRecord = activeProductRecordService.getById(activeHelpRecord.getProductId());
 		Assert.notNull(activeProductRecord, "没有找到作品");
@@ -113,9 +113,7 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 		Assert.notNull(activeSetting, "平台没有配置投票参数");
 
 		//更新用户普法积分
-		if(!BigDecimal.ZERO.equals(helpGoods.getPoint())){
-			userPuFaPointUpdate(activeHelpRecord, phone, activeSetting);
-		}
+		userPuFaPointUpdate(activeHelpRecord, activeSetting);
 
 		//更新活动作品的票数和热力值
 		updateProductVoteAndHeat(activeHelpRecord, activeProductRecord, activeSetting);
@@ -187,6 +185,7 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 				userHeat = new UserHeat();
 				userHeat.setPhone(activeProductRecord.getPhone());
 				userHeat.setHeatValue(BigDecimal.ZERO);
+				userHeat.setUserId(activeProductRecord.getUserId());
 			}
 
 			//热力值=活动票数*热力值比例
@@ -200,8 +199,10 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 			HeatRecord heatRecord = new HeatRecord();
 			heatRecord.setActiveProductId(activeHelpRecord.getProductId());
 			heatRecord.setHeatValue(BigDecimal.valueOf(heatValue.doubleValue())); //必须克隆对象,防止事务状态下,使用同一个对象地址
+			heatRecord.setVoteCount(activeHelpRecord.getVoteCount());
 			heatRecord.setHeatType(HeatTypeEnum.HEAT_VALUE_SEND);
 			heatRecord.setPhone(userHeat.getPhone());
+			heatRecord.setUserId(activeProductRecord.getUserId());
 			Assert.isTrue(heatRecordService.save(heatRecord), "投票失败");
 			//修改活动热力值
 			activeProductRecord.setHeatValue(heatValue.add(activeProductRecord.getHeatValue()));
@@ -243,11 +244,10 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 	/**
 	 * 更新用户普法积分
 	 * @param activeHelpRecord
-	 * @param phone
 	 * @param activeSetting
 	 */
 	@Override
-	public void userPuFaPointUpdate(ActiveHelpRecord activeHelpRecord, String phone, ActiveSettingDto activeSetting) {
+	public void userPuFaPointUpdate(ActiveHelpRecord activeHelpRecord,ActiveSettingDto activeSetting) {
 		//判断是否普法积分
 		if (ObjectUtils.isNotEmpty(activeSetting.getVoteAndPointRate()) && !activeSetting.getVoteAndPointRate().equals(BigDecimal.ZERO)) {
 			//修改普法积分(票数*积分比例+原有积分)
@@ -259,16 +259,18 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 			pointRecord.setPointType(PointTypeEnum.PUFA_POINT_SEND);
 			pointRecord.setActiveProductId(activeHelpRecord.getProductId());
 			pointRecord.setUserId(activeHelpRecord.getUserId());
+			pointRecord.setPhone(activeHelpRecord.getPhone());
 			Assert.notNull(pointRecordService.save(pointRecord), "投票失败");
 
 			//修改积分
-			UserPufaPoint userPufaPoint = userPufaPointService.getOne(Wrappers.<UserPufaPoint>lambdaQuery().eq(UserPufaPoint::getPhone, phone));
+			UserPufaPoint userPufaPoint = userPufaPointService.getOne(Wrappers.<UserPufaPoint>lambdaQuery().eq(UserPufaPoint::getPhone, activeHelpRecord.getPhone()));
 			if(ObjectUtils.isEmpty(userPufaPoint)){
 				userPufaPoint = new UserPufaPoint();
-				userPufaPoint.setPhone(phone);
-				userPufaPoint.setHeatValue(BigDecimal.ZERO);
+				userPufaPoint.setPhone(activeHelpRecord.getPhone());
+				userPufaPoint.setUserId(activeHelpRecord.getUserId());
+				userPufaPoint.setPufaPoint(BigDecimal.ZERO);
 			}
-			userPufaPoint.setHeatValue(userPufaPoint.getHeatValue().add(puFaPoint));
+			userPufaPoint.setPufaPoint(userPufaPoint.getPufaPoint().add(puFaPoint));
 
 			//保存
 			userPufaPointService.saveOrUpdate(userPufaPoint);

+ 3 - 0
src/main/java/org/springblade/gateway/common_gateway/dto/ActiveSettingDto.java

@@ -39,6 +39,9 @@ public class ActiveSettingDto {
 	@ApiModelProperty("排行显示总数")
 	private Long rankTotal;
 
+	@ApiModelProperty("我的作品图片")
+	private String myProductImage;
+
 	@ApiModelProperty("助力说明")
 	private List<String> helpExplainList;
 }

+ 42 - 0
src/main/java/org/springblade/gateway/common_gateway/dto/PointGoodsSettingDto.java

@@ -0,0 +1,42 @@
+package org.springblade.gateway.common_gateway.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+/**
+ * @Author: Silent
+ * @Description
+ * @Date: Created in 10:16 2021/11/10
+ * @Modified By:
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("积分商场设置")
+public class PointGoodsSettingDto {
+
+	@ApiModelProperty("主页轮播图")
+	private List<ImageItem> indexImageList;
+
+	@ApiModel("轮播图选项")
+	@Data
+	@AllArgsConstructor
+	@NoArgsConstructor
+	public static class ImageItem{
+		@ApiModelProperty("图片地址")
+		private String url;
+
+		@ApiModelProperty("类型")
+		private String type;
+
+		@ApiModelProperty("需要跳转的地址")
+		private String path;
+	}
+}

+ 19 - 3
src/main/java/org/springblade/gateway/common_gateway/enums/PlatformSettingEnum.java

@@ -2,6 +2,9 @@ package org.springblade.gateway.common_gateway.enums;
 
 import lombok.AllArgsConstructor;
 import lombok.Getter;
+import org.springblade.gateway.common_gateway.dto.ActiveSettingDto;
+import org.springblade.gateway.common_gateway.dto.PageSettingDto;
+import org.springblade.gateway.common_gateway.dto.PointGoodsSettingDto;
 
 /**
  * @Author: Silent
@@ -9,14 +12,27 @@ import lombok.Getter;
  * @Date: Created in 15:19 2021/11/9
  * @Modified By:
  */
-@Getter
 @AllArgsConstructor
 public enum PlatformSettingEnum {
-	PAGE_INTERFACE_SHOW("平台页面展示"),
-	ACTIVE_SETTING("活动设置");
+	PAGE_INTERFACE_SHOW("平台页面展示", PageSettingDto.class),
+	ACTIVE_SETTING("活动设置", ActiveSettingDto.class),
+	POINT_GOODS_SETTING("积分商场设置", PointGoodsSettingDto.class);
 
 	/**
 	 * 描述
 	 */
 	private String describe;
+
+	/**
+	 * 类型
+	 */
+	private Class type;
+
+	public String getDescribe() {
+		return describe;
+	}
+
+	public <T> Class<T> getType() {
+		return type;
+	}
 }

+ 27 - 2
src/main/java/org/springblade/gateway/common_gateway/util/PlatformSettingUtil.java

@@ -9,6 +9,7 @@ import org.springblade.core.redis.cache.BladeRedis;
 import org.springblade.gateway.common_gateway.constant.PlatformSettingConstant;
 import org.springblade.gateway.common_gateway.dto.ActiveSettingDto;
 import org.springblade.gateway.common_gateway.dto.PageSettingDto;
+import org.springblade.gateway.common_gateway.dto.PointGoodsSettingDto;
 import org.springblade.gateway.common_gateway.enums.PlatformSettingEnum;
 import org.springblade.sing.desk.entity.PlatformSetting;
 import org.springblade.sing.desk.service.IPlatformSettingService;
@@ -37,7 +38,7 @@ public class PlatformSettingUtil {
 	 * @return
 	 */
 	public PageSettingDto getPageSetting(){
-		return getPlatformSettingByCache(PlatformSettingEnum.PAGE_INTERFACE_SHOW.name(),PageSettingDto.class);
+		return getPlatformSettingByCache(PlatformSettingEnum.PAGE_INTERFACE_SHOW);
 	}
 
 	/**
@@ -45,7 +46,31 @@ public class PlatformSettingUtil {
 	 * @return
 	 */
 	public ActiveSettingDto getActiveSetting(){
-		return getPlatformSettingByCache(PlatformSettingEnum.ACTIVE_SETTING.name(),ActiveSettingDto.class);
+		return getPlatformSettingByCache(PlatformSettingEnum.ACTIVE_SETTING);
+	}
+
+	/**
+	 * 获取积分商场设置
+	 * @return
+	 */
+	public PointGoodsSettingDto getPointGoodsSetting(){
+		return getPlatformSettingByCache(PlatformSettingEnum.POINT_GOODS_SETTING);
+	}
+
+	/**
+	 * 获取平台设置
+	 * @return
+	 */
+	public <T> T getPlatformSettingByCache(PlatformSettingEnum platformSettingEnum){
+		String platformSettingByCache = getPlatformSettingByCache(platformSettingEnum.name());
+		if(StringUtils.isNotEmpty(platformSettingByCache)){
+			try {
+				return JSON.parseObject(platformSettingByCache,platformSettingEnum.getType());
+			} catch (Exception e) {
+				log.error(e.getMessage());
+			}
+		}
+		return null;
 	}
 
 	/**

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

@@ -92,7 +92,8 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 		activeHelpRecord.setHelpGoodsId(helpGoods.getId());
 		activeHelpRecord.setIp(IPUtils.getRealIp(request));
 		activeHelpRecord.setVoteCount(helpGoods.getVotePointRate().longValue());
-		appActiveProductService.activeHelp(activeHelpRecord,ObjectUtils.getIfNull(cmccPointRecord.getPhone(),loginUser::getPhone));
+		activeHelpRecord.setPhone(ObjectUtils.getIfNull(cmccPointRecord.getPhone(),loginUser::getPhone));
+		appActiveProductService.activeHelp(activeHelpRecord);
 
 		//助力之后判断是否需要移动积分兑换(防止先兑换之后,助力不成功问题)
 		cmccPointExchange(cmccPointRecord, cmccDectOrderRequest, helpGoods, loginUser);
@@ -112,7 +113,7 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 			Long count = userHelpGoodsExchangeCount(loginUser.getId(), helpGoods.getId());
 			//购买次数>=允许购买的次数
 			if((cmccPointRecord.getNum().longValue() + count)> helpGoods.getTotal()){
-				throw new HelpGoodsException("您购买次数超过上限");
+				throw new HelpGoodsException("您兑换次数超过上限");
 			}
 		}
 		//添加道具兑换记录
@@ -143,12 +144,12 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
 
 			//判断是否是同一个道具
 			if(ObjectUtils.notEqual(helpGoods.getId(),oldCmccPointRecord.getHelpGoodsId())){
-				throw new HelpGoodsException("您购买的道具和您的订单不相同");
+				throw new HelpGoodsException("您兑换的道具和您的订单不相同");
 			}
 
 			//判断数量是否相同
 			if(ObjectUtils.notEqual(cmccPointRecord.getNum(),oldCmccPointRecord.getNum())){
-				throw new HelpGoodsException("您购买的道具和您的订单数量不相同");
+				throw new HelpGoodsException("您兑换的道具和您的订单数量不相同");
 			}
 
 			//添加移动积分兑换记录

+ 72 - 3
src/main/java/org/springblade/gateway/login_gateway/controller/LoginController.java

@@ -1,19 +1,31 @@
 package org.springblade.gateway.login_gateway.controller;
 
+import cn.hutool.core.map.MapUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.AllArgsConstructor;
+import org.springblade.common.utils.BeanPropertyUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.tool.api.R;
 import org.springblade.gateway.login_gateway.service.LoginService;
+import org.springblade.sing.active.entity.ActiveProductRecord;
+import org.springblade.sing.active.service.IActiveProductRecordService;
+import org.springblade.sing.heat.entity.UserHeat;
+import org.springblade.sing.heat.service.IUserHeatService;
+import org.springblade.sing.point.entity.UserPufaPoint;
+import org.springblade.sing.point.service.IUserPufaPointService;
 import org.springblade.sing.user.entity.LoginUser;
 import org.springblade.sing.user.service.ILoginUserService;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
 
 
 /**
@@ -25,8 +37,11 @@ import javax.validation.Valid;
 @AllArgsConstructor
 public class LoginController {
 
-	private LoginService loginService;
-	private ILoginUserService loginUserService;
+	private final LoginService loginService;
+	private final ILoginUserService loginUserService;
+	private final IUserPufaPointService userPufaPointService;
+	private final IUserHeatService userHeatService;
+	private final IActiveProductRecordService activeProductRecordService;
 
 	/**
 	 * 登陆校验
@@ -55,4 +70,58 @@ public class LoginController {
 		}
 		return R.data(user);
 	}
+
+	/**
+	 * 查询用户积分
+	 */
+	@PostMapping("/userPufaPoint")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "查询用户普法积分")
+	public R<UserPufaPoint> userPufaPoint(@ApiParam(value = "用户手机号码",required = true) @RequestParam String phone) {
+		return R.data(userPufaPointService.getOne(
+			Wrappers.<UserPufaPoint>lambdaQuery()
+				.eq(UserPufaPoint::getPhone,phone)));
+	}
+
+	/**
+	 * 查询用户热力值
+	 */
+	@PostMapping("/userHeatValue")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "查询用户热力值")
+	public R<UserHeat> userHeatValue(@ApiParam(value = "用户手机号码",required = true) @RequestParam String phone) {
+		return R.data(userHeatService.getOne(
+			Wrappers.<UserHeat>lambdaQuery()
+				.eq(UserHeat::getPhone,phone)));
+	}
+
+	/**
+	 * 查询参赛用户票数
+	 */
+	@PostMapping("/userVoteCount")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "查询参赛用户票数")
+	public R<Long> userVoteCount(@ApiParam(value = "用户手机号码",required = true) @RequestParam String phone) {
+		Map<String, Object> map = activeProductRecordService.getMap(Wrappers.<ActiveProductRecord>query().select(new StringBuilder("ifnull(sum(")
+				.append(BeanPropertyUtil.getFieldNameToUnder(ActiveProductRecord::getVoteCount))
+				.append("),0) as count")
+				.toString())
+			.lambda()
+			.eq(ActiveProductRecord::getPhone, phone));
+		return R.data(MapUtil.getLong(map,"count"));
+	}
+
+	/**
+	 * 查询用户热力值和普法积分
+	 */
+	@GetMapping("/userHeatValueAndPufaPoint")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "查询用户热力值和普法积分")
+	public R<Map<String,?>> userHeatValueAndPufaPoint(@ApiParam(value = "用户手机号码",required = true) @RequestParam String phone) {
+		Map<String, Object> hashMap = new HashMap<>();
+		hashMap.put("userHeatValue", Optional.ofNullable(userHeatValue(phone).getData()).map(UserHeat::getHeatValue).orElse(BigDecimal.ZERO));
+		hashMap.put("userPufaPoint", Optional.ofNullable(userPufaPoint(phone).getData()).map(UserPufaPoint::getPufaPoint).orElse(BigDecimal.ZERO));
+		hashMap.put("userVoteCount",Optional.ofNullable(userVoteCount(phone).getData()).orElse(0L));
+		return R.data(hashMap);
+	}
 }

+ 3 - 2
src/main/java/org/springblade/gateway/point_gateway/controller/PointExchangeController.java

@@ -23,10 +23,11 @@ public class PointExchangeController {
 	//积分兑换商品
 	@PostMapping("/exchange")
 	@ApiOperation("积分兑换")
-	public R<Boolean> exchange(@ApiParam(value = "手机号",required = true) @RequestParam String phone,
+	public R<Boolean> exchange(@ApiParam(value = "兑换类型",required = true) @RequestParam Integer type,
+							   @ApiParam(value = "手机号",required = true) @RequestParam String phone,
 						   @ApiParam(value = "商品ID",required = true) @RequestParam Long goodsId,
 						   @ApiParam(value = "收获地址ID",required = false) @RequestParam Long addressId){
-		return R.status(pointExchangeService.exchange(phone,goodsId,addressId));
+		return R.status(pointExchangeService.exchange(type,phone,goodsId,addressId));
 
 	}
 }

+ 1 - 1
src/main/java/org/springblade/gateway/point_gateway/service/PointExchangeService.java

@@ -8,6 +8,6 @@ public interface PointExchangeService {
 	 * @param addressId 收货地址id
 	 * @return
 	 */
-	boolean exchange(String phone, Long goodsId, Long addressId);
+	boolean exchange(Integer type,String phone, Long goodsId, Long addressId);
 }
 

+ 1 - 1
src/main/java/org/springblade/gateway/point_gateway/service/impl/PointExchangeServiceImpl.java

@@ -34,7 +34,7 @@ public class PointExchangeServiceImpl implements PointExchangeService {
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	public boolean exchange(String phone, Long goodsId, Long addressId) {
+	public boolean exchange(Integer type,String phone, Long goodsId, Long addressId) {
 
 		LoginUser user = loginUserService.getOne(new LambdaQueryWrapper<LoginUser>().eq(LoginUser::getPhone,phone));
 		Assert.notNull(user,"用户不存在");

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

@@ -0,0 +1,129 @@
+/*
+ *      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.ActiveHelp;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import org.springblade.sing.active.wrapper.ActiveHelpWrapper;
+import org.springblade.sing.active.service.IActiveHelpService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 活动记录 控制器
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("sing_active/activehelp")
+@Api(value = "我要代言", tags = "我要代言接口")
+public class ActiveHelpController extends BladeController {
+
+	private final IActiveHelpService activeHelpService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入activeHelp")
+	public R<ActiveHelpVO> detail(ActiveHelp activeHelp) {
+		ActiveHelp detail = activeHelpService.getOne(Condition.getQueryWrapper(activeHelp));
+		return R.data(ActiveHelpWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页 活动记录
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入activeHelp")
+	public R<IPage<ActiveHelpVO>> list(ActiveHelp activeHelp, Query query) {
+		IPage<ActiveHelp> pages = activeHelpService.page(Condition.getPage(query), Condition.getQueryWrapper(activeHelp));
+		return R.data(ActiveHelpWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页 活动记录
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入activeHelp")
+	public R<IPage<ActiveHelpVO>> page(ActiveHelpVO activeHelp, Query query) {
+		IPage<ActiveHelpVO> pages = activeHelpService.selectActiveHelpPage(Condition.getPage(query), activeHelp);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 活动记录
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入activeHelp")
+	public R save(@Valid @RequestBody ActiveHelp activeHelp) {
+		return R.status(activeHelpService.save(activeHelp));
+	}
+
+	/**
+	 * 修改 活动记录
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入activeHelp")
+	public R update(@Valid @RequestBody ActiveHelp activeHelp) {
+		return R.status(activeHelpService.updateById(activeHelp));
+	}
+
+	/**
+	 * 新增或修改 活动记录
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入activeHelp")
+	public R submit(@Valid @RequestBody ActiveHelp activeHelp) {
+		return R.status(activeHelpService.saveOrUpdate(activeHelp));
+	}
+
+
+	/**
+	 * 删除 活动记录
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(activeHelpService.deleteLogic(Func.toLongList(ids)));
+	}
+
+
+}

+ 2 - 1
src/main/java/org/springblade/sing/active/controller/ActiveProductRecordController.java

@@ -98,7 +98,8 @@ public class ActiveProductRecordController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入activeProductRecord")
 	public R<IPage<ActiveProductRecordVO>> list(ActiveProductRecord activeProductRecord, Query query) {
-		IPage<ActiveProductRecord> pages = activeProductRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(activeProductRecord).lambda().orderByDesc(ActiveProductRecord::getHeatValue));
+		IPage<ActiveProductRecord> pages = activeProductRecordService.page(Condition.getPage(query),
+			Condition.getQueryWrapper(activeProductRecord).lambda().orderByAsc(ActiveProductRecord::getProductNo));
 		return R.data(ActiveProductRecordWrapper.build(bladeRedis).pageVO(pages));
 	}
 

+ 1 - 0
src/main/java/org/springblade/sing/active/controller/ActiveRecordController.java

@@ -31,6 +31,7 @@ import org.springblade.sing.active.entity.ActiveRecord;
 import org.springblade.sing.active.service.IActiveRecordService;
 import org.springblade.sing.active.vo.ActiveRecordVO;
 import org.springblade.sing.active.wrapper.ActiveRecordWrapper;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;

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

@@ -0,0 +1,34 @@
+/*
+ *      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.ActiveHelp;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 活动记录数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ActiveHelpDTO extends ActiveHelp {
+	private static final long serialVersionUID = 1L;
+
+}

+ 58 - 0
src/main/java/org/springblade/sing/active/entity/ActiveHelp.java

@@ -0,0 +1,58 @@
+/*
+ *      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.TableField;
+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-22
+ */
+@Data
+@TableName("sing_active_help")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ActiveHelp对象", description = "活动记录")
+public class ActiveHelp extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 活动ID
+	*/
+		@ApiModelProperty(value = "活动ID")
+		private Long activeId;
+	/**
+	* 手机号码
+	*/
+		@ApiModelProperty(value = "手机号码")
+		private String phone;
+
+	/**
+	 * 排位
+	 */
+		@ApiModelProperty(value = "排位")
+		@TableField(value = "`index`")
+		private Long index;
+}

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

@@ -45,6 +45,11 @@ public class ActiveHelpRecord extends BaseEntity {
 	@ApiModelProperty(value = "用户ID",required = true)
 	@NotNull
 	private Long userId;
+	/**
+	 * 手机号码
+	 */
+	@ApiModelProperty(value = "手机号码",required = true)
+	private String phone;
 	/**
 	 * 作品ID
 	 */

+ 44 - 0
src/main/java/org/springblade/sing/active/mapper/ActiveHelpMapper.java

@@ -0,0 +1,44 @@
+/*
+ *      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.ActiveHelp;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 活动记录 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+public interface ActiveHelpMapper extends BaseMapper<ActiveHelp> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param activeHelp
+	 * @return
+	 */
+	List<ActiveHelpVO> selectActiveHelpPage(IPage page, ActiveHelpVO activeHelp);
+
+	Long selectIndexMax();
+
+}

+ 28 - 0
src/main/java/org/springblade/sing/active/mapper/ActiveHelpMapper.xml

@@ -0,0 +1,28 @@
+<?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.ActiveHelpMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="activeHelpResultMap" type="org.springblade.sing.active.entity.ActiveHelp">
+        <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="active_id" property="activeId"/>
+        <result column="phone" property="phone"/>
+    </resultMap>
+
+
+    <select id="selectActiveHelpPage" resultMap="activeHelpResultMap">
+        select * from sing_active_help where is_deleted = 0
+    </select>
+
+    <select id="selectIndexMax" resultType="Long">
+        select MAX(`index`) from sing_active_help
+    </select>
+
+</mapper>

+ 47 - 0
src/main/java/org/springblade/sing/active/service/IActiveHelpService.java

@@ -0,0 +1,47 @@
+/*
+ *      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.ActiveHelp;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 活动记录 服务类
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+public interface IActiveHelpService extends BaseService<ActiveHelp> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param activeHelp
+	 * @return
+	 */
+	IPage<ActiveHelpVO> selectActiveHelpPage(IPage<ActiveHelpVO> page, ActiveHelpVO activeHelp);
+
+	/**
+	 * 我的代言排位
+	 * @param activeHelpVO
+	 * @return
+	 */
+	ActiveHelp queryIndex(ActiveHelpVO activeHelpVO);
+}

+ 68 - 0
src/main/java/org/springblade/sing/active/service/impl/ActiveHelpServiceImpl.java

@@ -0,0 +1,68 @@
+/*
+ *      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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import io.jsonwebtoken.lang.Assert;
+import org.springblade.sing.active.entity.ActiveHelp;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import org.springblade.sing.active.mapper.ActiveHelpMapper;
+import org.springblade.sing.active.service.IActiveHelpService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 活动记录 服务实现类
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+@Service
+public class ActiveHelpServiceImpl extends BaseServiceImpl<ActiveHelpMapper, ActiveHelp> implements IActiveHelpService {
+
+	@Override
+	public IPage<ActiveHelpVO> selectActiveHelpPage(IPage<ActiveHelpVO> page, ActiveHelpVO activeHelp) {
+		return page.setRecords(baseMapper.selectActiveHelpPage(page, activeHelp));
+	}
+
+    @Override
+	@Transactional
+    public ActiveHelp queryIndex(ActiveHelpVO activeHelpVO) {
+
+		Assert.notNull(activeHelpVO.getPhone(), "请添加手机号");
+		Assert.notNull(activeHelpVO.getActiveId(), "非法操作");
+
+		ActiveHelp activeHelp = baseMapper.selectOne(new LambdaQueryWrapper<ActiveHelp>().eq(ActiveHelp::getPhone,
+			activeHelpVO.getPhone()).eq(ActiveHelp::getActiveId,activeHelpVO.getActiveId()));
+
+		if (activeHelp == null){
+			Long maxIndex = baseMapper.selectIndexMax();
+
+			if (maxIndex != null){
+				activeHelpVO.setIndex(maxIndex + 1L);
+			}else {
+				activeHelpVO.setIndex(1L);
+			}
+			baseMapper.insert(activeHelpVO);
+		}
+		return baseMapper.selectOne(new LambdaQueryWrapper<ActiveHelp>().eq(ActiveHelp::getPhone,activeHelpVO.getPhone()));
+	}
+
+}

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

@@ -0,0 +1,36 @@
+/*
+ *      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.ActiveHelp;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 活动记录视图实体类
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "ActiveHelpVO对象", description = "活动记录")
+public class ActiveHelpVO extends ActiveHelp {
+	private static final long serialVersionUID = 1L;
+
+}

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

@@ -0,0 +1,49 @@
+/*
+ *      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.ActiveHelp;
+import org.springblade.sing.active.vo.ActiveHelpVO;
+import java.util.Objects;
+
+/**
+ * 活动记录包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2021-11-22
+ */
+public class ActiveHelpWrapper extends BaseEntityWrapper<ActiveHelp, ActiveHelpVO>  {
+
+	public static ActiveHelpWrapper build() {
+		return new ActiveHelpWrapper();
+ 	}
+
+	@Override
+	public ActiveHelpVO entityVO(ActiveHelp activeHelp) {
+		ActiveHelpVO activeHelpVO = Objects.requireNonNull(BeanUtil.copy(activeHelp, ActiveHelpVO.class));
+
+		//User createUser = UserCache.getUser(activeHelp.getCreateUser());
+		//User updateUser = UserCache.getUser(activeHelp.getUpdateUser());
+		//activeHelpVO.setCreateUserName(createUser.getName());
+		//activeHelpVO.setUpdateUserName(updateUser.getName());
+
+		return activeHelpVO;
+	}
+
+}

+ 5 - 0
src/main/java/org/springblade/sing/heat/entity/HeatRecord.java

@@ -60,6 +60,11 @@ public class HeatRecord extends BaseEntity {
 	 */
 	@ApiModelProperty(value = "活动作品id(热力值赠送)")
 	private Long activeProductId;
+	/**
+	 * 票数
+	 */
+	@ApiModelProperty(value = "票数")
+	private Long voteCount;
 	/**
 	 * 热力值
 	 */

+ 16 - 8
src/main/java/org/springblade/sing/heat/entity/UserHeat.java

@@ -17,6 +17,7 @@
 package org.springblade.sing.heat.entity;
 
 import java.math.BigDecimal;
+
 import com.baomidou.mybatisplus.annotation.TableName;
 import org.springblade.core.mp.base.BaseEntity;
 import lombok.Data;
@@ -39,15 +40,22 @@ public class UserHeat extends BaseEntity {
 	private static final long serialVersionUID = 1L;
 
 	/**
-	* 手机号码
-	*/
-		@ApiModelProperty(value = "手机号码")
-		private String phone;
+	 * 用户ID
+	 */
+	@ApiModelProperty(value = "用户ID")
+	private Long userId;
+
+	/**
+	 * 手机号码
+	 */
+	@ApiModelProperty(value = "手机号码")
+	private String phone;
+
 	/**
-	* 热力值
-	*/
-		@ApiModelProperty(value = "热力值")
-		private BigDecimal heatValue;
+	 * 热力值
+	 */
+	@ApiModelProperty(value = "热力值")
+	private BigDecimal heatValue;
 
 
 }

+ 6 - 0
src/main/java/org/springblade/sing/point/entity/PointRecord.java

@@ -46,6 +46,12 @@ public class PointRecord extends BaseEntity {
 	@ApiModelProperty(value = "用户id")
 	private Long userId;
 
+	/**
+	 * 手机号码
+	 */
+	@ApiModelProperty(value = "手机号码",required = true)
+	private String phone;
+
 	/**
 	 * 活动作品id(积分赠送)
 	 */

+ 16 - 8
src/main/java/org/springblade/sing/point/entity/UserPufaPoint.java

@@ -17,6 +17,7 @@
 package org.springblade.sing.point.entity;
 
 import java.math.BigDecimal;
+
 import com.baomidou.mybatisplus.annotation.TableName;
 import org.springblade.core.mp.base.BaseEntity;
 import lombok.Data;
@@ -39,15 +40,22 @@ public class UserPufaPoint extends BaseEntity {
 	private static final long serialVersionUID = 1L;
 
 	/**
-	* 手机号码
-	*/
-		@ApiModelProperty(value = "手机号码")
-		private String phone;
+	 * 用户ID
+	 */
+	@ApiModelProperty(value = "用户ID")
+	private Long userId;
+
+	/**
+	 * 手机号码
+	 */
+	@ApiModelProperty(value = "手机号码")
+	private String phone;
+
 	/**
-	* 热力值
-	*/
-		@ApiModelProperty(value = "热力值")
-		private BigDecimal heatValue;
+	 * 用户普法积分
+	 */
+	@ApiModelProperty(value = "用户普法积分")
+	private BigDecimal pufaPoint;
 
 
 }

+ 88 - 3
src/main/java/org/springblade/sing/user/controller/UserAddressController.java

@@ -16,6 +16,11 @@
  */
 package org.springblade.sing.user.controller;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -23,6 +28,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 import javax.validation.Valid;
 
+import org.springblade.core.launch.constant.AppConstant;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
@@ -36,6 +42,10 @@ import org.springblade.sing.user.wrapper.UserAddressWrapper;
 import org.springblade.sing.user.service.IUserAddressService;
 import org.springblade.core.boot.ctrl.BladeController;
 
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
 /**
  * 用户收获地址表 控制器
  *
@@ -49,6 +59,8 @@ import org.springblade.core.boot.ctrl.BladeController;
 public class UserAddressController extends BladeController {
 
 	private final IUserAddressService userAddressService;
+	private final String MAP_URL = "https://apis.map.qq.com/ws/geocoder/v1/?location=";
+	private final String MAP_KEY = "WAGBZ-EFIKU-2W2VF-4UX5F-ATB3F-HKBFU";
 
 	/**
 	 * 详情
@@ -68,7 +80,7 @@ public class UserAddressController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入userAddress")
 	public R<IPage<UserAddressVO>> list(UserAddress userAddress, Query query) {
-		IPage<UserAddress> pages = userAddressService.page(Condition.getPage(query), Condition.getQueryWrapper(userAddress));
+		IPage<UserAddress> pages = userAddressService.page(Condition.getPage(query), Condition.getQueryWrapper(userAddress).lambda().orderByDesc(UserAddress::getIsDefault));
 		return R.data(UserAddressWrapper.build().pageVO(pages));
 	}
 
@@ -114,7 +126,7 @@ public class UserAddressController extends BladeController {
 		return R.status(userAddressService.saveOrUpdate(userAddress));
 	}
 
-	
+
 	/**
 	 * 删除 用户收获地址表
 	 */
@@ -125,5 +137,78 @@ public class UserAddressController extends BladeController {
 		return R.status(userAddressService.deleteLogic(Func.toLongList(ids)));
 	}
 
-	
+	@GetMapping("/getLocation")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "", notes = "传入rule")
+	public R getLocationData(String latitude,String longitude) {
+		String request_url = MAP_URL +latitude+","+longitude + "&key=" + MAP_KEY;
+		String s = HttpUtil.get(request_url);
+		JSONObject jsonObject = JSONUtil.parseObj(s);
+		return R.data(jsonObject);
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submitAddress")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入userAddress")
+	public R submitAddress(@Valid @RequestBody UserAddress userAddress) {
+		Assert.notNull(userAddress.getUserId(), "用户id不能为空");
+		List<UserAddress> addressList = userAddressService.list(Condition.getQueryWrapper(new UserAddress()).lambda()
+			.eq(UserAddress::getUserId, userAddress.getUserId()));
+
+		if (Objects.isNull(userAddress.getId())) {
+			return  R.status(this.saveAddress(userAddress, addressList));
+		}
+		return R.status(this.updateAddress(userAddress,addressList));
+	}
+
+	/**
+	 * 修改地址
+	 * @param userAddress
+	 * @param addressList
+	 * @return
+	 */
+	private boolean updateAddress(UserAddress userAddress, List<UserAddress> addressList) {
+		if (!userAddress.getIsDefault()) {
+			return userAddressService.updateById(userAddress);
+		}
+		//修改成默认地址
+		List<UserAddress> defaultAddresses = addressList.stream().filter(item -> item.getIsDefault() && !item.getId().equals(userAddress.getId())).collect(Collectors.toList());
+		if (CollUtil.isEmpty(defaultAddresses)) {
+			return userAddressService.updateById(userAddress);
+		}
+		defaultAddresses.forEach(item -> item.setIsDefault(false));
+		userAddressService.updateBatchById(defaultAddresses);
+		return userAddressService.updateById(userAddress);
+	}
+
+	/**
+	 * 新增地址
+	 * @param userAddress
+	 * @param addressList
+	 * @return
+	 */
+	private boolean saveAddress(UserAddress userAddress,List<UserAddress> addressList) {
+		//如果数据库中没有该用户的地址,将该新增的地址置为默认
+		if (CollUtil.isEmpty(addressList)) {
+			userAddress.setIsDefault(true);
+			return userAddressService.save(userAddress);
+		}
+		//如果数据库中有用户的地址,且不是设置默认地址
+		if (!userAddress.getIsDefault()) {
+			return userAddressService.save(userAddress);
+		}
+		//设置默认地址,将旧的默认地址置为不默认
+		List<UserAddress> defaultAddresses = addressList.stream().filter(UserAddress::getIsDefault).collect(Collectors.toList());
+		if (CollUtil.isEmpty(defaultAddresses)) {
+			return userAddressService.save(userAddress);
+		}
+		defaultAddresses.forEach(item -> item.setIsDefault(false));
+		userAddressService.updateBatchById(defaultAddresses);
+		return  userAddressService.save(userAddress);
+	}
+
+
 }

+ 21 - 0
src/main/java/org/springblade/sing/user/entity/UserAddress.java

@@ -58,5 +58,26 @@ public class UserAddress extends BaseEntity {
 		@ApiModelProperty(value = "收货电话")
 		private String phone;
 
+	/**
+	 * 是否默认
+	 */
+	@ApiModelProperty(value = "是否默认")
+	private Boolean isDefault;
+	/**
+	 * 省
+	 */
+	@ApiModelProperty(value = "省")
+	private String provinceName;
+	/**
+	 * 市
+	 */
+	@ApiModelProperty(value = "市")
+	private String cityName;
+	/**
+	 * 区
+	 */
+	@ApiModelProperty(value = "区")
+	private String areaName;
+
 
 }

+ 4 - 0
src/main/java/org/springblade/sing/user/mapper/UserAddressMapper.xml

@@ -14,6 +14,10 @@
         <result column="is_deleted" property="isDeleted"/>
         <result column="user_id" property="userId"/>
         <result column="consignee" property="consignee"/>
+        <result column="is_default" property="isDefault"/>
+        <result column="province_name" property="provinceName"/>
+        <result column="city_name" property="cityName"/>
+        <result column="area_name" property="areaName"/>
         <result column="address" property="address"/>
         <result column="phone" property="phone"/>
     </resultMap>

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

@@ -52,16 +52,16 @@ blade:
 cmcc:
   pay:
     # 地址
-    url: http://api-test.kunbiaowangluo.com/
+    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
+    callbackUrl: https://vote.guosen-fumao.cn/auth.html

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

@@ -65,5 +65,6 @@ cmcc:
     # 签名key
     signKey: f0463e4f8823
     # 回调地址
-    callbackUrl: https://vote.guosen-fumao.cn/auth.html
+    callbackUrl: https://vote.guosen-fumao.cn/h5/#/pages/webview/auth_result
+#    callbackUrl: https://vote.guosen-fumao.cn/auth.html
 

+ 1 - 1
src/main/resources/wxConfig.properties

@@ -1,4 +1,4 @@
-#爱效科技
+#音乐之声
 wx.client.appId = wx432ac69188f554a9
 wx.client.appSecret = 25fbbd170a3c551f0d3498c16259bc36
 

+ 72 - 0
src/test/resources/static/test.html

@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+    <script src="https://static.tongdun.net/monitor/monitor.js" async crossorigin="anonymous"></script>
+    <script src="https://j.changyoyo.com/static/js/common/tfd.js" type="application/javascript"></script>
+    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
+    <script type="text/javascript">
+        (function () {
+            window._fmOpt = {
+                partner: 'changyou',
+                appName: 'changyou_web',
+                token: 'changyou' + "-" + new Date().getTime() + "-" +
+                    Math.random().toString(16).substr(2),
+                fmb: true,
+                success: function (data) {
+                    // //	 在成功完成采集后,success 回调中可以获取到 blackbox,在获取到
+                    // blackbox
+                    // 后传输过程中请进行
+                    // url
+                    // 编码
+                    console.log('blackbox:	', data)
+                },
+                fpHost: "https://fp.tongdun.net"
+            };
+            var cimg = new Image(1, 1);
+            cimg.onload = function () {
+                _fmOpt.imgLoaded = true;
+            };
+            cimg.src =
+                "https://fp.tongdun.net/fp/clear.png?partnerCode=changyou&appName=changyou_web&tokenId="
+                + _fmOpt.token;
+            var fm = document.createElement('script');
+            fm.type = 'text/javascript';
+            fm.async = true;
+            fm.src = ('https:' == document.location.protocol ? 'https://' : 'http://') +
+                'static.tongdun.net/v3/fm.js?ver=0.1&t=' + (new Date().getTime() / 3600000).toFixed(0);
+            var s = document.getElementsByTagName('script')[0];
+            s.parentNode.insertBefore(fm,
+                s);
+        })();
+    </script>
+</head>
+<body>
+<div>sessionId & fingerprint Demo</div>
+<script>
+    (function () {
+        var url, ts, sessionId, appId, appkey;
+        if (document.domain === 'm.changyoyo.com') {
+            url = "tfd.changyoyo.com";
+        } else {
+            url = "101.132.237.10";
+        }
+        appId = "5308e20b";
+        appkey = "3daf27ea2fe840ada6af8e1ec0d7b760";
+        ts = new Date().getTime();
+        sessionId = "changyo-pc-" + ts + "-" + Math.random().toString(16).substr(2);
+        window.sessionId = sessionId;
+        with (document) {
+            [getElementsByTagName('script')[0].parentNode.appendChild(createElement('script')).src = "http://"
+                + url + "/did/js/dp.js?appId=" + appId + "&appkey=" + appkey + "&sessionId=" + sessionId + "&ts=" +
+                ts][0];
+        }
+    })()
+    window.onload = function(){
+        console.log("sessionId:"+window.sessionId);
+        console.log("fingerprint:"+_fmOpt.getinfo());
+    }
+</script>
+</body>
+</html>