From bf6b379d3ead5e7cb92379d7c7e66517fb288fa0 Mon Sep 17 00:00:00 2001 From: Lihx Date: Mon, 23 Sep 2024 18:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=AE=A2=E6=9C=8D=E7=94=B5=E8=AF=9D=E5=8F=B7=E7=A0=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/CustomerMainController.java | 31 +++++++++++++++++++ .../custom/vo/CustomerMainSaveReqVO.java | 4 +++ .../controller/UniShopConfigController.java | 22 +++++++++++++ .../app/mapper/UniShopConfigMapper.java | 11 +++++++ .../app/service/UniShopConfigService.java | 6 ++++ .../impl/UniShopConfigServiceImpl.java | 18 +++++++++++ .../mapper/app/UniShopConfigMapper.xml | 9 ++++++ 7 files changed, 101 insertions(+) create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java create mode 100644 dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java create mode 100644 dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java index 1e53ee26..9cfdc8b9 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java @@ -1,5 +1,10 @@ package cn.iocoder.yudao.module.custom.controller.admin; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.service.CustomerMainService; @@ -17,8 +22,11 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.net.ssl.HttpsURLConnection; import javax.validation.Valid; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.List; import static cn.iocoder.yudao.common.BaseConstants.*; @@ -171,4 +179,27 @@ public class CustomerMainController { busiLabelService.saveBusiLable(saveReqVO.getId(), TABLE_BASE_CUSTOMER_MAIN, saveReqVO.getLabelList()); return success(true); } + + /** + * 小程序客户注册 + * cusName,phoneNumber,birthday,sex,inviter + */ + @PostMapping("/addUniUser") + public CommonResult addUniUser(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) { + if(!saveReqVO.getCode().isEmpty()){ + String code = saveReqVO.getCode(); + JSONObject jsonObj = new JSONObject(); + String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=" + +code+"&grant_type=authorization_code"; + String response = HttpRequest.get(url).execute().body(); + JSONObject json = JSONUtil.parseObj(response); + if (json.containsKey("access_token") && json.containsKey("openid")) { + String accessToken = json.getStr("access_token"); + String openid = json.getStr("openid"); + } + + } + return null; + } + } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java index 1989cd30..007e71b3 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CustomerMainSaveReqVO.java @@ -19,4 +19,8 @@ public class CustomerMainSaveReqVO extends CustomerMain { /**标签信息*/ List labelList; + /** + * Code + */ + private String Code; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java new file mode 100644 index 00000000..26799651 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/controller/UniShopConfigController.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.app.controller; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.app.service.UniShopConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/userClient/uniShopConfig") +public class UniShopConfigController { + + @Autowired + UniShopConfigService uniShopConfigService; + + @GetMapping("/getRepairTel") + public CommonResult getRepairTel() { + return CommonResult.success(uniShopConfigService.getRepairTel()); + } + +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java new file mode 100644 index 00000000..5092a40a --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/mapper/UniShopConfigMapper.java @@ -0,0 +1,11 @@ +package cn.iocoder.yudao.module.app.mapper; + +import cn.iocoder.yudao.module.project.entity.RepairProject; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UniShopConfigMapper { + + public String getRepairTel(); +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java new file mode 100644 index 00000000..588b379e --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/UniShopConfigService.java @@ -0,0 +1,6 @@ +package cn.iocoder.yudao.module.app.service; + +public interface UniShopConfigService { + + public String getRepairTel(); +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java new file mode 100644 index 00000000..a267d5fd --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/service/impl/UniShopConfigServiceImpl.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.app.service.impl; + +import cn.iocoder.yudao.module.app.mapper.UniShopConfigMapper; +import cn.iocoder.yudao.module.app.service.UniShopConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UniShopConfigServiceImpl implements UniShopConfigService { + + + @Autowired + UniShopConfigMapper uniShopConfigMapper; + @Override + public String getRepairTel() { + return uniShopConfigMapper.getRepairTel(); + } +} diff --git a/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml b/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml new file mode 100644 index 00000000..301b3f84 --- /dev/null +++ b/dl-module-repair/src/main/resources/mapper/app/UniShopConfigMapper.xml @@ -0,0 +1,9 @@ + + + + + + +