红圈通接口改造hqtShopId
This commit is contained in:
@@ -348,4 +348,11 @@ public class ShopInfoDAO {
|
||||
example.createCriteria().andEqualTo("shopCode", shopCode);
|
||||
return shopInfoMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public Integer updateHqtShopId (Long shopId,String hqtShopId){
|
||||
if (shopId==null || StringUtils.isBlank(hqtShopId)){
|
||||
return 0;
|
||||
}
|
||||
return shopInfoMapper.updateHqtShopId(shopId, hqtShopId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.response.PlatformBuildListResponse;
|
||||
import com.cool.store.vo.shop.StageShopCountVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
@@ -147,4 +148,6 @@ public interface ShopInfoMapper extends Mapper<ShopInfoDO> {
|
||||
List<IsCreateStoreDTO> selectIsCreateStore();
|
||||
Integer updateManagerRegionId(@Param("list") List<ShopInfoDO> shopList);
|
||||
Integer getNumByShopCode(@Param("shopCode") String shopCode);
|
||||
|
||||
Integer updateHqtShopId(@Param("shopId") Long shopId,@Param("hqtShopId") String hqtShopId);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<result column="district_code" jdbcType="INTEGER" property="districtCode"/>
|
||||
<result column="manager_region_id" jdbcType="BIGINT" property="managerRegionId"/>
|
||||
<result column="shop_decoration_attributes" jdbcType="INTEGER" property="shopDecorationAttributes"/>
|
||||
<result column="hqt_shop_id" jdbcType="VARCHAR" property="hqtShopId"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="allColumn">
|
||||
@@ -45,7 +46,7 @@
|
||||
shop_code, store_num, shop_manager_user_id, supervisor_user_id,
|
||||
plan_open_time, cur_progress, shop_type, shop_stage, deleted, create_time, update_time,
|
||||
join_mode,detail_address,franchise_brand,development_manager,want_shop_area_id,investment_manager,shop_status,create_user_id,update_user_id,store_type
|
||||
, province,province_code,city,city_code,district,district_code,manager_region_id,shop_decoration_attributes
|
||||
, province,province_code,city,city_code,district,district_code,manager_region_id,shop_decoration_attributes,hqt_shop_id
|
||||
</sql>
|
||||
|
||||
<insert id="batchAddShop" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
@@ -590,4 +591,7 @@
|
||||
update xfsg_shop_info set manager_region_id = #{item.managerRegionId} where id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateHqtShopId">
|
||||
update xfsg_shop_info set hqt_shop_id = #{hqtShopId} where id = #{shopId}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -9,7 +9,6 @@ import lombok.Data;
|
||||
* @注释:
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class HqtTokenDTO {
|
||||
//访问令牌
|
||||
private String access_token;
|
||||
|
||||
@@ -155,4 +155,7 @@ public class ShopInfoDO {
|
||||
// 门店装修属性
|
||||
@Column(name = "shop_decoration_attributes")
|
||||
private Integer shopDecorationAttributes;
|
||||
//红圈通门店id
|
||||
@Column(name = "hqt_shop_id")
|
||||
private String hqtShopId;
|
||||
}
|
||||
@@ -14,13 +14,13 @@ import java.util.Objects;
|
||||
*/
|
||||
@Data
|
||||
public class ConfirmQuotationRequest {
|
||||
private String shopCode;
|
||||
private String hqtShopId;
|
||||
private String quotationSheetId;
|
||||
@ApiModelProperty("0:拒绝,1:通过")
|
||||
private Integer status;
|
||||
|
||||
public Boolean check(){
|
||||
if (StringUtils.isAnyBlank(shopCode,quotationSheetId)){
|
||||
if (StringUtils.isAnyBlank(hqtShopId,quotationSheetId)){
|
||||
return false;
|
||||
}
|
||||
if (Objects.isNull(status)){
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@Data
|
||||
public class HqtBuildRequest {
|
||||
private Long shopId;
|
||||
//门店编码
|
||||
private String shopCode;
|
||||
//门店名称
|
||||
|
||||
@@ -14,14 +14,14 @@ import java.util.Objects;
|
||||
@Data
|
||||
public class HqtPartnerAcceptanceRequest {
|
||||
|
||||
private String shopCode;
|
||||
private String hqtShopId;
|
||||
//加盟商满意度 3-差,4-一般,5-好,6-非常好 对应红圈通 回访结果分类
|
||||
private Integer satisfaction;
|
||||
//加盟商评语
|
||||
private String comment;
|
||||
|
||||
public Boolean check() {
|
||||
if (StringUtils.isAnyBlank(shopCode)){
|
||||
if (StringUtils.isAnyBlank(hqtShopId)){
|
||||
return false;
|
||||
}
|
||||
if (Objects.isNull(satisfaction)){
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.cool.store.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -10,7 +9,6 @@ import lombok.Data;
|
||||
* @注释:
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class HqtAPIResponse {
|
||||
|
||||
/**
|
||||
|
||||
@@ -376,7 +376,7 @@ public class DecorationServiceImpl implements DecorationService {
|
||||
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
shopStageInfoDAO.updateShopStageInfo(request.getShopId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_122);
|
||||
HqtPartnerAcceptanceRequest hqtPartnerAcceptanceRequest = new HqtPartnerAcceptanceRequest();
|
||||
hqtPartnerAcceptanceRequest.setShopCode(shopInfoDO.getShopCode());
|
||||
hqtPartnerAcceptanceRequest.setHqtShopId(shopInfoDO.getHqtShopId());
|
||||
hqtPartnerAcceptanceRequest.setSatisfaction(request.getSatisfaction());
|
||||
hqtPartnerAcceptanceRequest.setComment(request.getPartnerAcceptance().getRemark());
|
||||
hqtAPIService.hqtPartnerAcceptance(hqtPartnerAcceptanceRequest);
|
||||
@@ -761,7 +761,7 @@ public class DecorationServiceImpl implements DecorationService {
|
||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
|
||||
//推送给HQT
|
||||
ConfirmQuotationRequest confirmQuotationRequest = new ConfirmQuotationRequest();
|
||||
confirmQuotationRequest.setShopCode(shopInfo.getShopCode());
|
||||
confirmQuotationRequest.setHqtShopId(shopInfo.getHqtShopId());
|
||||
confirmQuotationRequest.setQuotationSheetId(decoration.getQuotationSheetId());
|
||||
confirmQuotationRequest.setStatus(CommonConstants.ONE);
|
||||
hqtAPIService.confirmQuotation(confirmQuotationRequest);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dao.BigRegionDAO;
|
||||
import com.cool.store.dao.ShopInfoDAO;
|
||||
import com.cool.store.dto.HqtTokenDTO;
|
||||
import com.cool.store.entity.BigRegionDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
@@ -57,8 +58,7 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
@Resource
|
||||
OkHttpClient okHttpClient;
|
||||
@Resource
|
||||
ObjectMapper objectMapper;
|
||||
|
||||
private ShopInfoDAO shopInfoDAO;
|
||||
@Resource
|
||||
private BigRegionDAO bigRegionDAO;
|
||||
|
||||
@@ -85,7 +85,8 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
//资源服务URL
|
||||
String url = hqtToken.getEndPoint();
|
||||
String requestUrl = url + "/v1/data/objects/project3X";
|
||||
sendPostRequest(JSONObject.toJSONString(hqtBuildAPIRequest), requestUrl, hqtToken);
|
||||
HqtAPIResponse hqtAPIResponse = sendPostRequest(JSONObject.toJSONString(hqtBuildAPIRequest), requestUrl, hqtToken);
|
||||
shopInfoDAO.updateHqtShopId(request.getShopId(), hqtAPIResponse.getData());
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +101,7 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
}
|
||||
//构建CRM系统门店编码(红圈通门店id)
|
||||
HqtQuotationSheetAPIRequest.Field1__c field1__c = new HqtQuotationSheetAPIRequest.Field1__c();
|
||||
field1__c.setCode(request.getShopCode());
|
||||
field1__c.setCode(request.getHqtShopId());
|
||||
|
||||
HqtTokenDTO hqtToken = this.getHqtToken();
|
||||
String requestUrl = hqtToken.getEndPoint() + "/v1/data/objects/CustomObject77__c";
|
||||
@@ -140,9 +141,9 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
field1__c.setLabel(satisfactionEnum.getName());
|
||||
field1__c.setName(satisfactionEnum.getHqtCode());
|
||||
}
|
||||
//门店编码
|
||||
//红圈通门店id
|
||||
HqtPartnerAcceptanceAPIRequest.Field13__c field13__c = new HqtPartnerAcceptanceAPIRequest.Field13__c();
|
||||
field13__c.setCode(request.getShopCode());
|
||||
field13__c.setCode(request.getHqtShopId());
|
||||
|
||||
apiRequest.setField1__c(field1__c);
|
||||
apiRequest.setField13__c(field13__c);
|
||||
@@ -183,7 +184,7 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
}
|
||||
String responseBody = response.body().string();
|
||||
log.info("请求成功responseBody:{}",JSONObject.toJSONString(responseBody));
|
||||
HqtAPIResponse hqtAPIResponse = objectMapper.readValue(responseBody, HqtAPIResponse.class);
|
||||
HqtAPIResponse hqtAPIResponse = JSONObject.parseObject(responseBody, HqtAPIResponse.class);
|
||||
return hqtAPIResponse;
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
@@ -276,7 +277,7 @@ public class HqtAPIServiceImpl implements HqtAPIService {
|
||||
"HTTP请求失败,状态码: " + response.code());
|
||||
}
|
||||
String responseBody = response.body().string();
|
||||
HqtTokenDTO hqtTokenDTO = objectMapper.readValue(responseBody, HqtTokenDTO.class);
|
||||
HqtTokenDTO hqtTokenDTO = JSONObject.parseObject(responseBody, HqtTokenDTO.class);
|
||||
return hqtTokenDTO;
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
|
||||
@@ -303,6 +303,7 @@ public class OrderSysInfoServiceImpl implements OrderSysInfoService {
|
||||
bigRegionDO = hqtAPIService.pushHqtRegion(bigRegionDO);
|
||||
}
|
||||
HqtBuildRequest request = new HqtBuildRequest();
|
||||
request.setShopId(shopId);
|
||||
request.setShopCode(shopInfo.getShopCode());
|
||||
request.setShopName(shopInfo.getShopName());
|
||||
request.setShopDecorationAttributes(shopInfo.getShopDecorationAttributes());
|
||||
|
||||
Reference in New Issue
Block a user