From 82d00f1c5b616ee6d083aab649b1cfcf6281195a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=8D=9A?= Date: Mon, 18 Nov 2024 15:24:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E6=85=A7=E6=A0=A1=E5=9B=AD=E8=AF=9D?= =?UTF-8?q?=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/annotation/Snowflake.java | 11 +++ .../common/aspect/SnowflakeAspect.java | 30 ++++++++ .../modules/fegin/OpFeignClient.java | 54 +------------- .../modules/fegin/WxFeignClient.java | 72 +++++++++++++++++++ .../modules/ten/entity/TenPersonEntity.java | 3 +- .../service/impl/TenPersonServiceImpl.java | 4 ++ 6 files changed, 122 insertions(+), 52 deletions(-) create mode 100644 shapelight-admin/src/main/java/net/shapelight/common/annotation/Snowflake.java create mode 100644 shapelight-admin/src/main/java/net/shapelight/common/aspect/SnowflakeAspect.java create mode 100644 shapelight-admin/src/main/java/net/shapelight/modules/fegin/WxFeignClient.java diff --git a/shapelight-admin/src/main/java/net/shapelight/common/annotation/Snowflake.java b/shapelight-admin/src/main/java/net/shapelight/common/annotation/Snowflake.java new file mode 100644 index 0000000..1307002 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/common/annotation/Snowflake.java @@ -0,0 +1,11 @@ +package net.shapelight.common.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Snowflake { +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/common/aspect/SnowflakeAspect.java b/shapelight-admin/src/main/java/net/shapelight/common/aspect/SnowflakeAspect.java new file mode 100644 index 0000000..b76eb22 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/common/aspect/SnowflakeAspect.java @@ -0,0 +1,30 @@ +package net.shapelight.common.aspect; + +import net.shapelight.common.utils.SnowflakeIdWorker; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +@Aspect +public class SnowflakeAspect { + + @Around("@annotation(net.shapelight.common.annotation.Snowflake)") + public Object generateSnowflakeId(ProceedingJoinPoint joinPoint) throws Throwable { + // 生成Snowflake ID + SnowflakeIdWorker snowflakeIdWorker = new SnowflakeIdWorker(); + long snowflakeId = snowflakeIdWorker.nextId(); + + // 修改方法参数或者返回值来设置Snowflake ID + Object[] args = joinPoint.getArgs(); + if (args != null && args.length > 0) { + // 假设第一个参数是传递Snowflake ID的参数 + args[0] = snowflakeId; + } + + // 继续执行原方法,并且可以返回修改后的结果 + return joinPoint.proceed(args); + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/fegin/OpFeignClient.java b/shapelight-admin/src/main/java/net/shapelight/modules/fegin/OpFeignClient.java index 4d2efd2..c74e645 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/fegin/OpFeignClient.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/fegin/OpFeignClient.java @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSONObject; import net.shapelight.modules.fegin.config.OpFeignConfig; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.PostConstruct; import java.util.Map; @@ -17,7 +15,7 @@ import java.util.Map; * path 指定调用接口所在Controller的@RequestMapping对应路径,没有则不填 * 青桔话务平台 */ -@FeignClient(name = "operator-service", url = "${global.wx.url}",configuration = OpFeignConfig.class) +@FeignClient(name = "operator-service", url = "${global.qingju.url}",configuration = OpFeignConfig.class) @Component public interface OpFeignClient { @@ -32,53 +30,7 @@ public interface OpFeignClient { @PostMapping("/submitData") JSONObject submitData(@RequestBody Map params); - /* - 获取token - */ - @GetMapping("cgi-bin/token") - JSONObject getToken(@RequestParam Map params); - - /* - 创建设备组 - */ - @PostMapping("wxa/business/group/createid") - JSONObject createIotGroupId(@RequestBody Map params); - - /* - 删除设备组设备 - */ - @PostMapping("wxa/business/group/removedevice") - JSONObject removeIotGroupDevice(@RequestBody Map params); - - /* - 新增设备组设备 - */ - @PostMapping("wxa/business/group/adddevice") - JSONObject addIotGroupDevice(@RequestBody Map params); - - /* - 获取设备组信息 - */ - @PostMapping("wxa/business/group/getinfo") - JSONObject getIotGroupInfo(@RequestBody Map params); - - /* - 激活licence - */ - @PostMapping("wxa/business/license/activedevice") - JSONObject activeLicenseDevice(@RequestBody Map params); - - /* - 查询license资源包列表 - */ - @PostMapping("wxa/business/license/getdeviceinfo") - JSONObject getLicenseDeviceInfo(@RequestBody Map params); - - - @PostMapping("v3/pay/transactions/jsapi") - JSONObject createOrder(@RequestBody Map params); - - - + @PostMapping("/getData") + JSONObject getData(@RequestBody Map params); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/fegin/WxFeignClient.java b/shapelight-admin/src/main/java/net/shapelight/modules/fegin/WxFeignClient.java new file mode 100644 index 0000000..6c68867 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/fegin/WxFeignClient.java @@ -0,0 +1,72 @@ +package net.shapelight.modules.fegin; + +import com.alibaba.fastjson.JSONObject; +import net.shapelight.modules.fegin.config.OpFeignConfig; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.annotation.PostConstruct; +import java.util.Map; + +/* + * name 指定调用rest接口对应服务名 + * path 指定调用接口所在Controller的@RequestMapping对应路径,没有则不填 + * 青桔话务平台 + */ +@FeignClient(name = "operator-service", url = "${global.wx.url}",configuration = OpFeignConfig.class) +@Component +public interface WxFeignClient { + /* + 获取token + */ + @GetMapping("cgi-bin/token") + JSONObject getToken(@RequestParam Map params); + + /* + 创建设备组 + */ + @PostMapping("wxa/business/group/createid") + JSONObject createIotGroupId(@RequestBody Map params); + + /* + 删除设备组设备 + */ + @PostMapping("wxa/business/group/removedevice") + JSONObject removeIotGroupDevice(@RequestBody Map params); + + /* + 新增设备组设备 + */ + @PostMapping("wxa/business/group/adddevice") + JSONObject addIotGroupDevice(@RequestBody Map params); + + /* + 获取设备组信息 + */ + @PostMapping("wxa/business/group/getinfo") + JSONObject getIotGroupInfo(@RequestBody Map params); + + /* + 激活licence + */ + @PostMapping("wxa/business/license/activedevice") + JSONObject activeLicenseDevice(@RequestBody Map params); + + /* + 查询license资源包列表 + */ + @PostMapping("wxa/business/license/getdeviceinfo") + JSONObject getLicenseDeviceInfo(@RequestBody Map params); + + + @PostMapping("v3/pay/transactions/jsapi") + JSONObject createOrder(@RequestBody Map params); + + + + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java index a95c4da..2ae7cb8 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java @@ -16,6 +16,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import net.shapelight.common.base.BaseEntity; +import net.shapelight.modules.mobile.entity.MobileContact; /** * 人员表 @@ -369,6 +370,6 @@ public class TenPersonEntity extends BaseEntity implements Serializable { private Integer featureType; @TableField(exist = false) - private TenRelation tenRelation; + private List mobileContactList; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java index c54a080..f2d6ac5 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java @@ -25,6 +25,8 @@ import net.shapelight.modules.excel.listener.PersonExcelListener; import net.shapelight.modules.excel.model.PersonModel; import net.shapelight.modules.face.dto.FaceRecognitionResDTO; import net.shapelight.modules.face.service.FaceEngineService; +import net.shapelight.modules.mobile.entity.MobileContact; +import net.shapelight.modules.mobile.service.MobileContactService; import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.sys.entity.SysDictEntity; import net.shapelight.modules.sys.service.impl.SysDictServiceImpl; @@ -106,6 +108,8 @@ public class TenPersonServiceImpl implements TenPersonService { private FaceEngineService faceEngineService; @Autowired private TenRelationMapper tenRelationMapper; + @Autowired + private MobileContactService mobileContactService; @Override