From 055b75bc30aaceb1c73bcb823e8c5ef682891fde Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 15 七月 2024 17:14:14 +0800
Subject: [PATCH] 提交

---
 server/service/src/main/java/com/doumee/service/business/impl/CustomerUserServiceImpl.java |   22 +++--
 server/service/src/main/java/com/doumee/biz/zbom/model/crm/CrmCustomerInfoRequest.java     |    2 
 server/service/src/main/java/com/doumee/biz/zbom/ZbomZhongTaiService.java                  |    3 
 server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java              |   16 ++-
 server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java         |   75 ++++++++++++++----
 server/web/src/main/java/com/doumee/api/web/CatalogApi.java                                |   56 ++------------
 server/service/src/main/java/com/doumee/dao/web/response/ZSZXCatalogResponse.java          |   31 +++++++
 7 files changed, 121 insertions(+), 84 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/biz/zbom/ZbomZhongTaiService.java b/server/service/src/main/java/com/doumee/biz/zbom/ZbomZhongTaiService.java
index 7bd5f98..03ec1a6 100644
--- a/server/service/src/main/java/com/doumee/biz/zbom/ZbomZhongTaiService.java
+++ b/server/service/src/main/java/com/doumee/biz/zbom/ZbomZhongTaiService.java
@@ -3,6 +3,7 @@
 import com.doumee.biz.zbom.model.zhongtai.*;
 import com.doumee.biz.zbom.model.zhongtai.response.*;
 import com.doumee.dao.business.MemberMapper;
+import com.doumee.dao.web.response.ZSZXCatalogResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,5 +34,5 @@
     List<ZTAreaInfoResponse> getAreaList(ZTAreaListRequest param);
 
 
-
+    ZSZXCatalogResponse getZSZXCatalogs();
 }
diff --git a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java
index 89a91a3..cc65fde 100644
--- a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomCRMServiceImpl.java
@@ -77,7 +77,7 @@
             entity.setSource(CRMConstants.CRM_SOURCE.SOURCE_MP02);
             entity.setChannel(CRMConstants.CRM_SOURCE.SOURCE_MP02+"00");
         }
-        entity.setOpenId(customerLog.getOpenid());
+        entity.setOpenid(customerLog.getOpenid());
         entity.setDate(DateUtil.dateToString(customerLog.getCreateDate(),"yyyy/MM/dd HH:mm"));
         CrmCustomerPostRequest obj = new CrmCustomerPostRequest();
         obj.setCusInfo(new ArrayList<>());
@@ -110,7 +110,10 @@
         int status ;
         String crmInfo;
         String param = JSONObject.toJSONString(entity);
-        CRMBaseResponse<List<CRMDaogouBindListResponse>> result = sendHttpRequest(CRMConstants.IntegerUrl.DAOGOU_BIND_LIST_URL,CRMConstants.IntegerName.DAOGOU_BIND_LIST_NAME,param);
+        CRMBaseResponse<List<CRMDaogouBindListResponse>> result = sendHttpRequest(CRMConstants.IntegerUrl.DAOGOU_BIND_LIST_URL,
+                CRMConstants.IntegerName.DAOGOU_BIND_LIST_NAME,
+                param,
+                new TypeReference<CRMBaseResponse<List<CRMDaogouBindListResponse>>>(){});
         return result;// 榛樿澶辫触
     }
 
@@ -124,7 +127,10 @@
         int status ;
         String crmInfo;
         String param = JSONObject.toJSONString(entity);
-        CRMBaseResponse<List<CRMCustomerListResponse>> result = sendHttpRequest(CRMConstants.IntegerUrl.CUS_BEFORE_PAGE_LIST_URL,CRMConstants.IntegerName.CUS_BEFORE_PAGE_LIST_NAME,param);
+        CRMBaseResponse<List<CRMCustomerListResponse>> result = sendHttpRequest(CRMConstants.IntegerUrl.CUS_BEFORE_PAGE_LIST_URL
+                ,CRMConstants.IntegerName.CUS_BEFORE_PAGE_LIST_NAME
+                ,param
+                ,new TypeReference<CRMBaseResponse<List<CRMCustomerListResponse>>>(){});
         return result;// 榛樿澶辫触
     }
 
@@ -158,7 +164,7 @@
         }
         return  null;
     }
-    public   <T> CRMBaseResponse<T> sendHttpRequest(String interfaceUrl,  String name,  String param){
+    public   <T> CRMBaseResponse<T> sendHttpRequest(String interfaceUrl,  String name,  String param,TypeReference<CRMBaseResponse<T>> typeReference){
         log.info("銆�"+name+"銆�================寮�濮�===="+ JSONObject.toJSONString(param));
         String appKey = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_CRM_API_KEY);
         String url = redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_CRM_API_URL) + interfaceUrl ;
@@ -170,8 +176,6 @@
                 url += "?timestamp=" + _t + "&sign=" + DigestUtils.md5Hex( _t + appKey);
                 Map<String,String> headers = new HashMap<>();
                 res = HttpsUtil.postJson(url,param);
-                TypeReference typeReference =
-                        new TypeReference<CRMBaseResponse<T>>(){};
                 CRMBaseResponse<T>  result = JSONObject.parseObject(res, typeReference.getType());
                 logResult(result,name);
                 if(StringUtils.equals(result.getCode(),CRMConstants.CODE_SUCCESS)){
diff --git a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java
index 12f9fc8..d1b6eaa 100644
--- a/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/biz/zbom/impl/ZbomZhongTaiServiceImpl.java
@@ -16,6 +16,7 @@
 import com.doumee.dao.business.MemberMapper;
 import com.doumee.dao.business.model.CrmInterfaceLog;
 import com.doumee.dao.business.model.InterfaceLog;
+import com.doumee.dao.web.response.ZSZXCatalogResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -52,11 +53,37 @@
                ZTConstants.IntegerName.USER_GET_TOKEN_NAME,
                param.getToken(),
                param.getUserType(),
-               JSONObject.toJSONString(param ));
+               JSONObject.toJSONString(param ),
+               new TypeReference<ZTBaseResponse<ZTUserGetTokenResponse>>(){});
        if(result!=null){
            return result.getData();
        }
        return null;
+   }
+    /**
+     * 鑾峰彇鐢ㄦ埛鐧婚檰token
+     * @return
+     */
+   @Override
+   public ZSZXCatalogResponse getZSZXCatalogs(){
+       ZSZXCatalogResponse response = new ZSZXCatalogResponse();
+       ZTCatalogListRequest param = new ZTCatalogListRequest();
+       param.setCatalogCode(ZTConstants.CatalogCode.ZHISHUO_ZHUANGXIU);
+       List<ZTCatalogInfoResponse> cataList = getCatalogList(param);
+        if(cataList!=null ){
+            for(ZTCatalogInfoResponse data : cataList){
+                if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.JIADE_ID)){
+                    response.setJdId(data);
+                }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.CHUFANGSHEJI)){
+                    response.setCfsj(data);
+                }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.QW_SHEJI)){
+                    response.setQwsj(data);
+                }else if(StringUtils.equals(data.getCode(), ZTConstants.CatalogCode.SHOUNASHEJI)){
+                    response.setSnsj(data);
+                }
+            }
+        }
+       return response;
    }
     /**
      * 鐢ㄦ埛淇℃伅鍚屾
@@ -70,7 +97,8 @@
                 ZTConstants.IntegerName.USER_UPDATE_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<ZTUserGetTokenResponse>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -88,7 +116,8 @@
                 ZTConstants.IntegerName.USER_LOGOUT_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<Object>>(){});
         if(result!=null ){
             return true;
         }
@@ -102,12 +131,14 @@
      */
     @Override
     public  List<ZTCatalogInfoResponse> getCatalogList(ZTCatalogListRequest param){
-        ZTBaseResponse<List<ZTCatalogInfoResponse>> result = sendHttpRequest(
+
+       ZTBaseResponse<List<ZTCatalogInfoResponse>> result = sendHttpRequest(
                 ZTConstants.IntegerUrl.CATALOG_LIST_URL,
                 ZTConstants.IntegerName.CATALOG_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+        new TypeReference<ZTBaseResponse<List<ZTCatalogInfoResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -125,7 +156,8 @@
                 ZTConstants.IntegerName.TAG_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<List<ZTTagInfoResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -144,7 +176,8 @@
                 ZTConstants.IntegerName.CONTENT_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTContentListResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -162,7 +195,8 @@
                 ZTConstants.IntegerName.CONTENT_INFO_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<ZTContentInfoResponse>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -180,7 +214,8 @@
                 ZTConstants.IntegerName.COLLECT_DO_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<Object>>(){});
         if(result!=null ){
             return true;
         }
@@ -198,7 +233,8 @@
                 ZTConstants.IntegerName.LIKE_DO_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<Object>>(){});
         if(result!=null ){
             return true;
         }
@@ -216,7 +252,8 @@
                 ZTConstants.IntegerName.SHARE_DO_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<Object>>(){});
         if(result!=null ){
             return true;
         }
@@ -234,7 +271,8 @@
                 ZTConstants.IntegerName.VIEW_DO_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<Object>>(){});
         if(result!=null ){
             return true;
         }
@@ -252,7 +290,8 @@
                 ZTConstants.IntegerName.COLLECT_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTContentListResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -271,7 +310,8 @@
                 ZTConstants.IntegerName.LIKE_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<ZTBasePageResponse<ZTContentListResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -293,7 +333,8 @@
                 ZTConstants.IntegerName.AREA_LIST_NAME,
                 param.getToken(),
                 param.getUserType(),
-                JSONObject.toJSONString(param ));
+                JSONObject.toJSONString(param ),
+                new TypeReference<ZTBaseResponse<List<ZTAreaInfoResponse>>>(){});
         if(result!=null){
             return result.getData();
         }
@@ -301,7 +342,7 @@
     }
 
 
-    public   <T> ZTBaseResponse<T> sendHttpRequest(String url,String name,String token,String userType,String param){
+    public   <T>   ZTBaseResponse<T> sendHttpRequest(String url,String name,String token,String userType,String param,TypeReference<ZTBaseResponse<T>> typeReference){
         log.info("銆�"+name+"銆�================寮�濮�===="+ JSONObject.toJSONString(param));
         String res = null;
         int success = 0;
@@ -312,8 +353,6 @@
             headers.put(ZTConstants.HEADER_USERTYPE,userType);
             String index = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.ZBOM_ZHONGTAI_API_URL);
             res = HttpsUtil.postJsonWithHeaders(index+url,param,headers);
-            TypeReference typeReference =
-                    new TypeReference<ZTBaseResponse<T>>(){};
             ZTBaseResponse<T>  result = JSONObject.parseObject(res, typeReference.getType());
             logResult(result,name);
             if(Constants.equalsInteger(result.getCode(),ZTConstants.CODE_SUCCESS)){
diff --git a/server/service/src/main/java/com/doumee/biz/zbom/model/crm/CrmCustomerInfoRequest.java b/server/service/src/main/java/com/doumee/biz/zbom/model/crm/CrmCustomerInfoRequest.java
index 3411ed2..0de506d 100644
--- a/server/service/src/main/java/com/doumee/biz/zbom/model/crm/CrmCustomerInfoRequest.java
+++ b/server/service/src/main/java/com/doumee/biz/zbom/model/crm/CrmCustomerInfoRequest.java
@@ -39,6 +39,4 @@
     private String openid;
     @ApiModelProperty(value = "缁堢淇℃伅")
     private String terminal;
-    @ApiModelProperty(value = "灏忕▼搴忕敤鎴穙pneid)")
-    private String openId;
 }
\ No newline at end of file
diff --git a/server/service/src/main/java/com/doumee/dao/web/response/ZSZXCatalogResponse.java b/server/service/src/main/java/com/doumee/dao/web/response/ZSZXCatalogResponse.java
new file mode 100644
index 0000000..86311b3
--- /dev/null
+++ b/server/service/src/main/java/com/doumee/dao/web/response/ZSZXCatalogResponse.java
@@ -0,0 +1,31 @@
+package com.doumee.dao.web.response;
+
+import com.doumee.biz.zbom.model.zhongtai.response.ZTCatalogInfoResponse;
+import com.doumee.dao.business.model.Member;
+import com.doumee.dao.business.model.Users;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2023/3/23 9:25
+ */
+@Data
+@ApiModel("蹇楄瑁呬慨棣栭〉鍥涗釜妯″潡瀵硅薄")
+public class ZSZXCatalogResponse implements Serializable {
+
+    @ApiModelProperty(value = "瀹剁殑ID")
+    private ZTCatalogInfoResponse jdId;
+    @ApiModelProperty(value = "鏀剁撼璁捐")
+    private ZTCatalogInfoResponse snsj;
+    @ApiModelProperty(value = "鍘ㄦ埧璁捐")
+    private ZTCatalogInfoResponse cfsj;
+    @ApiModelProperty(value = "鍏ㄥ眿璁捐")
+    private ZTCatalogInfoResponse qwsj;
+
+}
diff --git a/server/service/src/main/java/com/doumee/service/business/impl/CustomerUserServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/CustomerUserServiceImpl.java
index e4288db..a753f89 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/CustomerUserServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/CustomerUserServiceImpl.java
@@ -208,6 +208,7 @@
 
     private void dealSyncDataBiz(Date date,List<CRMDaogouBindListResponse> list) {
         List<CustomerUser> addList = new ArrayList<>();
+        List<String> phoneList = new ArrayList<>();
         for(CRMDaogouBindListResponse data : list){
             if(StringUtils.isBlank(data.getCustomerPhone())){
                 continue;
@@ -222,15 +223,8 @@
             if(member == null){
                 continue;
             }
-            /**
-             * 鍒犻櫎鑰佸緱鏁版嵁
-             */
-            customerUserMapper.update(null,new UpdateWrapper<CustomerUser>().lambda()
-                    .eq(CustomerUser::getPhone,data.getDgPhone() )
-                    .eq(CustomerUser::getUsername,data.getUseName() )
-                    .eq(CustomerUser::getIsdeleted,Constants.ZERO)
-                    .set(CustomerUser::getIsdeleted,Constants.ONE)
-            );
+            phoneList.add(data.getCustomerPhone());
+
             CustomerUser model = new CustomerUser();
             model.setCreateDate(date);
             model.setIsdeleted(Constants.ZERO);
@@ -246,6 +240,16 @@
             model.setCreationDate(data.getCreationDate());
             addList.add(model);
         }
+        if(phoneList.size()>0){
+            /**
+             * 鍒犻櫎鑰佸緱鏁版嵁
+             */
+            customerUserMapper.update(null,new UpdateWrapper<CustomerUser>().lambda()
+                    .in(CustomerUser::getPhone,phoneList)
+                    .eq(CustomerUser::getIsdeleted,Constants.ZERO)
+                    .set(CustomerUser::getIsdeleted,Constants.ONE)
+            );
+        }
         if(addList .size() >0){
             int temp = 0;
             while(temp < addList.size()){
diff --git a/server/web/src/main/java/com/doumee/api/web/CatalogApi.java b/server/web/src/main/java/com/doumee/api/web/CatalogApi.java
index 6401f59..c620d4b 100644
--- a/server/web/src/main/java/com/doumee/api/web/CatalogApi.java
+++ b/server/web/src/main/java/com/doumee/api/web/CatalogApi.java
@@ -1,10 +1,12 @@
 package com.doumee.api.web;
 
+import com.doumee.biz.zbom.ZbomZhongTaiService;
 import com.doumee.config.annotation.UserLoginRequired;
 import com.doumee.core.annotation.trace.Trace;
 import com.doumee.core.model.ApiResponse;
 import com.doumee.dao.business.model.SmsEmail;
 import com.doumee.dao.web.response.AccountResponse;
+import com.doumee.dao.web.response.ZSZXCatalogResponse;
 import com.doumee.service.business.SmsEmailService;
 import com.doumee.service.business.UsersService;
 import io.swagger.annotations.Api;
@@ -13,10 +15,7 @@
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * Created by IntelliJ IDEA.
@@ -32,55 +31,16 @@
 public class CatalogApi extends ApiController{
 
     @Autowired
-    public UsersService usersService;
+    public ZbomZhongTaiService zbomZhongTaiService;
 
     @Autowired
     public SmsEmailService smsEmailService;
 
 
-    @ApiOperation(value = "灏忕▼搴忕櫥闄�", notes = "鍛樺伐绔皬绋嬪簭")
-    @GetMapping("/loginByWx")
-    @ApiImplicitParams({
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "寰俊code", required = true),
-    })
-    public ApiResponse<AccountResponse> loginByWx(@RequestParam String code) {
-        return  ApiResponse.success(usersService.wxLogin(code));
-    }
-
-    @ApiOperation(value = "鍙戦�佺煭淇¢獙璇佺爜", notes = "鍛樺伐绔皬绋嬪簭")
-    @GetMapping("/sendSms")
-    @ApiImplicitParams({
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "鎵嬫満鍙�", required = true),
-    })
-    public ApiResponse sendSms(@RequestParam String phone) {
-        SmsEmail smsEmail = new SmsEmail();
-        smsEmail.setPhone(phone);
-        smsEmailService.sendSms(smsEmail);
-        return  ApiResponse.success("鍙戦�佹垚鍔�");
-    }
-
-
-
-    @ApiOperation(value = "鎵嬫満鍙烽獙璇佺爜鐧婚檰", notes = "鍛樺伐绔皬绋嬪簭")
-    @GetMapping("/loginByPhone")
-    @ApiImplicitParams({
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "鎵嬫満鍙�", required = true),
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "鐭俊楠岃瘉鐮�", required = true),
-    })
-    public ApiResponse<AccountResponse> loginByPhone(@RequestParam String phone,@RequestParam String code) {
-        return  ApiResponse.success(usersService.phoneLogin(phone,code));
-    }
-
-
-    @UserLoginRequired
-    @ApiOperation(value = "缁戝畾openid", notes = "鍛樺伐绔皬绋嬪簭")
-    @GetMapping("/bindingOpenid")
-    @ApiImplicitParams({
-            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "寰俊code", required = true),
-    })
-    public ApiResponse bindingOpenid(@RequestParam String code) {
-        usersService.bindingOpenid(code,getMemberId());
-        return  ApiResponse.success("鎿嶄綔鎴愬姛");
+    @ApiOperation(value = "C绔皬绋嬪簭-鑾峰彇棣栭〉蹇楄瑁呬慨鍥涗釜妯″潡绫荤洰鏁版嵁", notes = "鑾峰彇棣栭〉蹇楄瑁呬慨鍥涗釜妯″潡绫荤洰鏁版嵁")
+    @PostMapping("/getZSZXCatalogs")
+    public ApiResponse<ZSZXCatalogResponse> getZSZXCatalogs() {
+        return  ApiResponse.success(zbomZhongTaiService.getZSZXCatalogs());
     }
 
 }

--
Gitblit v1.9.3