Forráskód Böngészése

添加热力值和普法积分的查询方式

silent 4 éve
szülő
commit
36ad65ba1e

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

@@ -266,9 +266,9 @@ public class AppActiveProductServiceImpl implements AppActiveProductService {
 			if(ObjectUtils.isEmpty(userPufaPoint)){
 				userPufaPoint = new UserPufaPoint();
 				userPufaPoint.setPhone(phone);
-				userPufaPoint.setHeatValue(BigDecimal.ZERO);
+				userPufaPoint.setPufaPoint(BigDecimal.ZERO);
 			}
-			userPufaPoint.setHeatValue(userPufaPoint.getHeatValue().add(puFaPoint));
+			userPufaPoint.setPufaPoint(userPufaPoint.getPufaPoint().add(puFaPoint));
 
 			//保存
 			userPufaPointService.saveOrUpdate(userPufaPoint);

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

@@ -1,5 +1,6 @@
 package org.springblade.gateway.login_gateway.controller;
 
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -8,12 +9,17 @@ import lombok.AllArgsConstructor;
 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.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.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -25,8 +31,10 @@ 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;
 
 	/**
 	 * 登陆校验
@@ -55,4 +63,41 @@ 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("/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",userHeatValue(phone));
+		hashMap.put("userPufaPoint",userPufaPoint(phone));
+		return R.data(hashMap);
+	}
 }

+ 9 - 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,15 @@ public class UserPufaPoint extends BaseEntity {
 	private static final long serialVersionUID = 1L;
 
 	/**
-	* 手机号码
-	*/
-		@ApiModelProperty(value = "手机号码")
-		private String phone;
+	 * 手机号码
+	 */
+	@ApiModelProperty(value = "手机号码")
+	private String phone;
 	/**
-	* 热力值
-	*/
-		@ApiModelProperty(value = "热力值")
-		private BigDecimal heatValue;
+	 * 用户普法积分
+	 */
+	@ApiModelProperty(value = "用户普法积分")
+	private BigDecimal pufaPoint;
 
 
 }

+ 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>