| | |
| | | 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; |
| | | |
| | |
| | | List<ZTAreaInfoResponse> getAreaList(ZTAreaListRequest param); |
| | | |
| | | |
| | | |
| | | ZSZXCatalogResponse getZSZXCatalogs(); |
| | | } |
| | |
| | | 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<>()); |
| | |
| | | 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;// é»è®¤å¤±è´¥ |
| | | } |
| | | |
| | |
| | | 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;// é»è®¤å¤±è´¥ |
| | | } |
| | | |
| | |
| | | } |
| | | 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 ; |
| | |
| | | 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)){ |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯åæ¥ |
| | |
| | | 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(); |
| | | } |
| | |
| | | ZTConstants.IntegerName.USER_LOGOUT_NAME, |
| | | param.getToken(), |
| | | param.getUserType(), |
| | | JSONObject.toJSONString(param )); |
| | | JSONObject.toJSONString(param ), |
| | | new TypeReference<ZTBaseResponse<Object>>(){}); |
| | | if(result!=null ){ |
| | | return true; |
| | | } |
| | |
| | | */ |
| | | @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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | ZTConstants.IntegerName.COLLECT_DO_NAME, |
| | | param.getToken(), |
| | | param.getUserType(), |
| | | JSONObject.toJSONString(param )); |
| | | JSONObject.toJSONString(param ), |
| | | new TypeReference<ZTBaseResponse<Object>>(){}); |
| | | if(result!=null ){ |
| | | return true; |
| | | } |
| | |
| | | ZTConstants.IntegerName.LIKE_DO_NAME, |
| | | param.getToken(), |
| | | param.getUserType(), |
| | | JSONObject.toJSONString(param )); |
| | | JSONObject.toJSONString(param ), |
| | | new TypeReference<ZTBaseResponse<Object>>(){}); |
| | | if(result!=null ){ |
| | | return true; |
| | | } |
| | |
| | | ZTConstants.IntegerName.SHARE_DO_NAME, |
| | | param.getToken(), |
| | | param.getUserType(), |
| | | JSONObject.toJSONString(param )); |
| | | JSONObject.toJSONString(param ), |
| | | new TypeReference<ZTBaseResponse<Object>>(){}); |
| | | if(result!=null ){ |
| | | return true; |
| | | } |
| | |
| | | ZTConstants.IntegerName.VIEW_DO_NAME, |
| | | param.getToken(), |
| | | param.getUserType(), |
| | | JSONObject.toJSONString(param )); |
| | | JSONObject.toJSONString(param ), |
| | | new TypeReference<ZTBaseResponse<Object>>(){}); |
| | | if(result!=null ){ |
| | | return true; |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | 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; |
| | |
| | | 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)){ |
| | |
| | | private String openid; |
| | | @ApiModelProperty(value = "ç»ç«¯ä¿¡æ¯") |
| | | private String terminal; |
| | | @ApiModelProperty(value = "å°ç¨åºç¨æ·opneid)") |
| | | private String openId; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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()){ |
| | |
| | | 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; |
| | |
| | | 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. |
| | |
| | | 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()); |
| | | } |
| | | |
| | | } |