feat:handleDecorationTeam
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
package com.cool.store.enums.Decoration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/11/3 9:40
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
public enum DecorationDescStatus {
|
||||||
|
|
||||||
|
TO_BE_ASSIGNED(0, "待分配"),
|
||||||
|
ASSIGNED(1, "已分配"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
private String descStatus;
|
||||||
|
|
||||||
|
DecorationDescStatus(Integer code, String descStatus) {
|
||||||
|
this.code = code;
|
||||||
|
this.descStatus = descStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescStatus() {
|
||||||
|
return descStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,5 +21,12 @@ public enum DecorationUseSystemEnum {
|
|||||||
this.userSystemName = userSystemName;
|
this.userSystemName = userSystemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserSystemName() {
|
||||||
|
return userSystemName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,9 +310,12 @@ public enum ErrorCodeEnum {
|
|||||||
MESSAGE_NOT_HANDLED(1610008,"当前消息无需处理,请确认消息处理类型!",null),
|
MESSAGE_NOT_HANDLED(1610008,"当前消息无需处理,请确认消息处理类型!",null),
|
||||||
MESSAGE_PUBLISH(1610009,"您选择通知任务正在发布中,请稍后重试!",null),
|
MESSAGE_PUBLISH(1610009,"您选择通知任务正在发布中,请稍后重试!",null),
|
||||||
|
|
||||||
NOT_FLAGSHIP_STORE(16100005,"非直营店,无法跳过缴费阶段!",null),
|
NOT_FLAGSHIP_STORE(1611005,"非直营店,无法跳过缴费阶段!",null),
|
||||||
NOT_FLAGSHIP_STORE_NOT_EXIST(16100006,"当前阶段加盟类型不能变更!",null),
|
NOT_FLAGSHIP_STORE_NOT_EXIST(1611006,"当前阶段加盟类型不能变更!",null),
|
||||||
JOIN_MODE_NOT_ALLOW_OPERATE(16100007,"加盟部人员只能新建加盟店或联营店,请确认!",null),
|
JOIN_MODE_NOT_ALLOW_OPERATE(1611007,"加盟部人员只能新建加盟店或联营店,请确认!",null),
|
||||||
|
|
||||||
|
//装修
|
||||||
|
TEAM_USED(1612001,"该装修团队有门店使用,无法删除,请确认!",null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ public enum RocketMqGroupEnum {
|
|||||||
FEI_SHU_EVENT_LISTENER("fei_shu_event_listener", new ArrayList<>(Arrays.asList(RocketMqTagEnum.USER_EVENT, RocketMqTagEnum.AUTH_SCOPE_CHANGE, RocketMqTagEnum.DEPT_EVENT))),
|
FEI_SHU_EVENT_LISTENER("fei_shu_event_listener", new ArrayList<>(Arrays.asList(RocketMqTagEnum.USER_EVENT, RocketMqTagEnum.AUTH_SCOPE_CHANGE, RocketMqTagEnum.DEPT_EVENT))),
|
||||||
|
|
||||||
|
|
||||||
STORE_USER_UPDATE("store_user_update", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_USER_UPDATE)))
|
STORE_USER_UPDATE("store_user_update", new ArrayList<>(Arrays.asList(RocketMqTagEnum.STORE_USER_UPDATE))),
|
||||||
|
SHOP_DECORATION_ASSIGN("shop_decoration_assign", new ArrayList<>(Arrays.asList(RocketMqTagEnum.DELAY_SHOP_DECORATION_ASSIGN)))
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ public enum RocketMqTagEnum {
|
|||||||
ZXJP_CREATE_STORE("zxjp_create_store", "正新鸡排招商创建门店"),
|
ZXJP_CREATE_STORE("zxjp_create_store", "正新鸡排招商创建门店"),
|
||||||
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步"),
|
PARTNER_LICENSE_SYNC_QUEUE("partner_license_sync_queue", "招商证照信息同步"),
|
||||||
BUSINESS_SYNC("business_sync", "工商食安信息同步"),
|
BUSINESS_SYNC("business_sync", "工商食安信息同步"),
|
||||||
STORE_USER_UPDATE("store_user_update", "门店信息人员变更同步菜品");
|
STORE_USER_UPDATE("store_user_update", "门店信息人员变更同步菜品"),
|
||||||
|
DELAY_SHOP_DECORATION_ASSIGN("shop_decoration_assign","门店装修分配");
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package com.cool.store.dao.decoration;
|
package com.cool.store.dao.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.dao.HyOpenAreaInfoDAO;
|
||||||
|
import com.cool.store.dto.decoration.DecorationListDTO;
|
||||||
|
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||||
|
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
||||||
import com.cool.store.mapper.decoration.ShopDecorationAssignMapper;
|
import com.cool.store.mapper.decoration.ShopDecorationAssignMapper;
|
||||||
|
import com.cool.store.request.decoration.DecorationListRequest;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author suzhuhong
|
* @Author suzhuhong
|
||||||
@@ -15,7 +22,50 @@ public class ShopDecorationAssignDAO {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ShopDecorationAssignMapper shopDecorationAssignMapper;
|
private ShopDecorationAssignMapper shopDecorationAssignMapper;
|
||||||
|
@Resource
|
||||||
|
HyOpenAreaInfoDAO hyOpenAreaInfoDAO;
|
||||||
|
|
||||||
|
|
||||||
|
public Integer insert(ShopDecorationAssignDO shopDecorationAssignDO) {
|
||||||
|
if (shopDecorationAssignDO == null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return shopDecorationAssignMapper.insert(shopDecorationAssignDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShopDecorationAssignDO getById(Long id) {
|
||||||
|
if (id == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return shopDecorationAssignMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer update(ShopDecorationAssignDO shopDecorationAssignDO) {
|
||||||
|
if (shopDecorationAssignDO == null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return shopDecorationAssignMapper.updateByPrimaryKey(shopDecorationAssignDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer countByTeamId(Long teamId) {
|
||||||
|
if (teamId == null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return shopDecorationAssignMapper.countByTeamId(teamId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DecorationListDTO> listByCondition(DecorationListRequest request) {
|
||||||
|
if (request == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (request.getWantShopAreaId()!=null){
|
||||||
|
HyOpenAreaInfoDO hyOpenAreaInfoDO = hyOpenAreaInfoDAO.selectById(request.getWantShopAreaId());
|
||||||
|
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOList = hyOpenAreaInfoDAO.queryByKeyword(hyOpenAreaInfoDO.getAreaPath(), null, null, false);
|
||||||
|
List<Long> wantShopAreaIds = hyOpenAreaInfoDOList.stream().map(HyOpenAreaInfoDO::getId).collect(Collectors.toList());
|
||||||
|
request.setWantShopAreaIds(wantShopAreaIds);
|
||||||
|
}
|
||||||
|
return shopDecorationAssignMapper.listByCondition(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,30 @@
|
|||||||
package com.cool.store.mapper.decoration;
|
package com.cool.store.mapper.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.dto.decoration.DecorationListDTO;
|
||||||
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
||||||
|
import com.cool.store.request.decoration.DecorationListRequest;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import tk.mybatis.mapper.common.Mapper;
|
import tk.mybatis.mapper.common.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ShopDecorationAssignMapper extends Mapper<ShopDecorationAssignDO> {
|
public interface ShopDecorationAssignMapper extends Mapper<ShopDecorationAssignDO> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询团队被门店使用次数
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer countByTeamId(Long teamId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分配装修团队列表
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<DecorationListDTO> listByCondition(@Param("request") DecorationListRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,4 +12,64 @@
|
|||||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
||||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="countByTeamId" resultType="java.lang.Integer">
|
||||||
|
select count(1) from shop_decoration_assign where decoration_team_id = #{teamId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="listByCondition" resultType="com.cool.store.dto.decoration.DecorationListDTO">
|
||||||
|
SELECT
|
||||||
|
zsda.shop_id AS shopId,
|
||||||
|
zsda.decoration_desc_status as decorationDescStatus,
|
||||||
|
xsi.shop_name AS shopName,
|
||||||
|
xsi.shop_code AS shopCode,
|
||||||
|
xsi.region_id AS regionId,
|
||||||
|
xsi.province AS province,
|
||||||
|
xsi.city AS city,
|
||||||
|
xsi.district AS district,
|
||||||
|
xsi.detail_address AS detailAddress,
|
||||||
|
xsi.store_type AS storeType,
|
||||||
|
xsf.sign_type AS signType
|
||||||
|
FROM zxjp_shop_decoration_assign zsda
|
||||||
|
LEFT JOIN xfsg_shop_info xsi ON zsda.shop_id = xsi.id
|
||||||
|
LEFT JOIN xfsg_sign_franchise xsf ON zsda.shop_id = xsf.shop_id
|
||||||
|
<where>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND (xsi.shop_name LIKE CONCAT('%', #{keyword}, '%') OR xsi.shop_code LIKE CONCAT('%', #{keyword}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="storeType != null">
|
||||||
|
AND xsi.store_type = #{storeType}
|
||||||
|
</if>
|
||||||
|
<if test="signType != null">
|
||||||
|
AND xsf.sign_type = #{signType}
|
||||||
|
</if>
|
||||||
|
<if test="regionId != null">
|
||||||
|
AND xsi.region_id = #{regionId}
|
||||||
|
</if>
|
||||||
|
<if test="province != null and province != ''">
|
||||||
|
AND xsi.province = #{province}
|
||||||
|
</if>
|
||||||
|
<if test="city != null and city != ''">
|
||||||
|
AND xsi.city = #{city}
|
||||||
|
</if>
|
||||||
|
<if test="district != null and district != ''">
|
||||||
|
AND xsi.district = #{district}
|
||||||
|
</if>
|
||||||
|
<if test="decorationDescStatus != null">
|
||||||
|
AND zsda.decoration_desc_status = #{decorationDescStatus}
|
||||||
|
</if>
|
||||||
|
<if test="wantShopAreaIds != null and wantShopAreaIds.size() > 0">
|
||||||
|
and b.want_shop_area_id in
|
||||||
|
<foreach collection="wantShopAreaIds" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.cool.store.dto.decoration;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/11/3 11:23
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DecorationListDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("门店ID")
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店名称")
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店编号")
|
||||||
|
private String shopCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店区域ID")
|
||||||
|
private String regionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店区域名称")
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店省")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店县")
|
||||||
|
private String district;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店详细地址")
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店类型")
|
||||||
|
private Integer storeType;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店签约类型")
|
||||||
|
private Integer signType;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店装修分配状态")
|
||||||
|
private Integer decorationDescStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ public class ShopDecorationAssignDO {
|
|||||||
* 分配状态(0-待分配,1-已分配)
|
* 分配状态(0-待分配,1-已分配)
|
||||||
*/
|
*/
|
||||||
@Column(name = "decoration_desc_status")
|
@Column(name = "decoration_desc_status")
|
||||||
private Byte decorationDescStatus;
|
private Integer decorationDescStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装修团队id
|
* 装修团队id
|
||||||
@@ -76,7 +76,7 @@ public class ShopDecorationAssignDO {
|
|||||||
*
|
*
|
||||||
* @return decoration_desc_status - 分配状态(0-待分配,1-已分配)
|
* @return decoration_desc_status - 分配状态(0-待分配,1-已分配)
|
||||||
*/
|
*/
|
||||||
public Byte getDecorationDescStatus() {
|
public Integer getDecorationDescStatus() {
|
||||||
return decorationDescStatus;
|
return decorationDescStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ public class ShopDecorationAssignDO {
|
|||||||
*
|
*
|
||||||
* @param decorationDescStatus 分配状态(0-待分配,1-已分配)
|
* @param decorationDescStatus 分配状态(0-待分配,1-已分配)
|
||||||
*/
|
*/
|
||||||
public void setDecorationDescStatus(Byte decorationDescStatus) {
|
public void setDecorationDescStatus(Integer decorationDescStatus) {
|
||||||
this.decorationDescStatus = decorationDescStatus;
|
this.decorationDescStatus = decorationDescStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cool.store.request.decoration;
|
||||||
|
|
||||||
|
import com.cool.store.common.PageBasicInfo;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/11/3 13:31
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DecorationListRequest extends PageBasicInfo {
|
||||||
|
|
||||||
|
@ApiModelProperty("关键字 门店名称/门店编码")
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店类型")
|
||||||
|
private Integer storeType;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店签约类型")
|
||||||
|
private Integer signType;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店区域ID")
|
||||||
|
private Integer regionId;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店意向开店区域")
|
||||||
|
private Long wantShopAreaId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "门店意向开店区域IDs",hidden = true)
|
||||||
|
private List<Long> wantShopAreaIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("门店装修分配状态")
|
||||||
|
private Integer decorationDescStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.aliyun.openservices.ons.api.bean.Subscription;
|
|||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.enums.RocketMqGroupEnum;
|
import com.cool.store.enums.RocketMqGroupEnum;
|
||||||
import com.cool.store.mq.RocketMqConfig;
|
import com.cool.store.mq.RocketMqConfig;
|
||||||
|
import com.cool.store.mq.consumer.listener.ShopDecorationAssignListener;
|
||||||
import com.cool.store.mq.consumer.listener.StoreUserUpdateListener;
|
import com.cool.store.mq.consumer.listener.StoreUserUpdateListener;
|
||||||
import com.cool.store.mq.consumer.listener.XfsgTrainingPersonSyncListener;
|
import com.cool.store.mq.consumer.listener.XfsgTrainingPersonSyncListener;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
@@ -35,6 +36,8 @@ public class ConsumerClient {
|
|||||||
private XfsgTrainingPersonSyncListener xfsgTrainingPersonSyncListener;
|
private XfsgTrainingPersonSyncListener xfsgTrainingPersonSyncListener;
|
||||||
@Resource
|
@Resource
|
||||||
private StoreUserUpdateListener storeUserUpdateListener;
|
private StoreUserUpdateListener storeUserUpdateListener;
|
||||||
|
@Resource
|
||||||
|
private ShopDecorationAssignListener shopDecorationAssignListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通用配置
|
* 获取通用配置
|
||||||
@@ -101,4 +104,17 @@ public class ConsumerClient {
|
|||||||
return consumerBean;
|
return consumerBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean(initMethod = "start", destroyMethod = "shutdown")
|
||||||
|
public ConsumerBean shopDecorationAssign() {
|
||||||
|
RocketMqGroupEnum groupEnum = RocketMqGroupEnum.SHOP_DECORATION_ASSIGN;
|
||||||
|
ConsumerBean consumerBean = new ConsumerBean();
|
||||||
|
//配置文件
|
||||||
|
Properties properties = getCommonProperties(groupEnum);
|
||||||
|
consumerBean.setProperties(properties);
|
||||||
|
Map<Subscription, MessageListener> commonSubscriptionTable = getCommonSubscriptionTable(groupEnum, shopDecorationAssignListener);
|
||||||
|
//订阅多个topic如上面设置
|
||||||
|
consumerBean.setSubscriptionTable(commonSubscriptionTable);
|
||||||
|
return consumerBean;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.cool.store.mq.consumer.listener;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.openservices.ons.api.Action;
|
||||||
|
import com.aliyun.openservices.ons.api.ConsumeContext;
|
||||||
|
import com.aliyun.openservices.ons.api.Message;
|
||||||
|
import com.aliyun.openservices.ons.api.MessageListener;
|
||||||
|
import com.cool.store.constants.CommonConstants;
|
||||||
|
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||||
|
import com.cool.store.dto.store.StoreUserUpdateDTO;
|
||||||
|
import com.cool.store.service.DecorationHandleService;
|
||||||
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author suzhuhong
|
||||||
|
* @Date 2025/11/3 10:13
|
||||||
|
* @Version 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ShopDecorationAssignListener implements MessageListener {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public RedisUtilPool redisUtilPool;
|
||||||
|
@Resource
|
||||||
|
DecorationHandleService decorationHandleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Action consume(Message message, ConsumeContext context) {
|
||||||
|
String text = new String(message.getBody());
|
||||||
|
if(StringUtils.isBlank(text)){
|
||||||
|
log.info("消息体为空,tag:{},messageId:{}",message.getTag(),message.getMsgID());
|
||||||
|
return Action.CommitMessage;
|
||||||
|
}
|
||||||
|
String lockKey = "ShopDecorationAssignListener:" + message.getMsgID();
|
||||||
|
boolean lock = redisUtilPool.setNxExpire(lockKey, message.getMsgID(), CommonConstants.NORMAL_LOCK_TIMES);
|
||||||
|
if(lock){
|
||||||
|
try {
|
||||||
|
decorationHandleService.handleDecorationTeam(Long.valueOf(text));
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("ShopDecorationAssignListener consume error",e);
|
||||||
|
return Action.ReconsumeLater;
|
||||||
|
}finally {
|
||||||
|
redisUtilPool.delKey(lockKey);
|
||||||
|
}
|
||||||
|
log.info("消费成功,tag:{},messageId:{},reqBody={}",message.getTag(),message.getMsgID(),text);
|
||||||
|
return Action.CommitMessage;
|
||||||
|
}
|
||||||
|
return Action.ReconsumeLater;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.cool.store.service;
|
package com.cool.store.service;
|
||||||
|
|
||||||
import com.cool.store.common.PageBasicInfo;
|
import com.cool.store.common.PageBasicInfo;
|
||||||
|
import com.cool.store.dto.decoration.DecorationListDTO;
|
||||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||||
import com.cool.store.request.decoration.AddTeamRequest;
|
import com.cool.store.request.decoration.AddTeamRequest;
|
||||||
|
import com.cool.store.request.decoration.DecorationListRequest;
|
||||||
import com.cool.store.request.decoration.UpdateTeamRequest;
|
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
@@ -51,6 +53,20 @@ public interface DecorationHandleService {
|
|||||||
*/
|
*/
|
||||||
Long getDecorationTeamIdByCityId(Long openCityId);
|
Long getDecorationTeamIdByCityId(Long openCityId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理团队
|
||||||
|
* @param teamId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean handleDecorationTeam(Long decorationAssignId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageInfo<DecorationListDTO> listByCondition(DecorationListRequest request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.cool.store.context.LoginUserInfo;
|
|||||||
import com.cool.store.request.AddSignFranchiseRequest;
|
import com.cool.store.request.AddSignFranchiseRequest;
|
||||||
import com.cool.store.request.AuditApproveRequest;
|
import com.cool.store.request.AuditApproveRequest;
|
||||||
import com.cool.store.request.AuditResultRequest;
|
import com.cool.store.request.AuditResultRequest;
|
||||||
|
import com.cool.store.request.HqtBuildRequest;
|
||||||
import com.cool.store.response.AddSignFranchiseResponse;
|
import com.cool.store.response.AddSignFranchiseResponse;
|
||||||
import com.cool.store.response.ResponseResult;
|
import com.cool.store.response.ResponseResult;
|
||||||
|
|
||||||
@@ -42,4 +43,6 @@ public interface SignFranchiseService {
|
|||||||
Boolean rePay(Long shopId);
|
Boolean rePay(Long shopId);
|
||||||
|
|
||||||
Integer dateHandle();
|
Integer dateHandle();
|
||||||
|
|
||||||
|
HqtBuildRequest getHqtBuildRequest(Long shopId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,43 @@
|
|||||||
package com.cool.store.service.impl;
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
import com.cool.store.common.PageBasicInfo;
|
import com.cool.store.common.PageBasicInfo;
|
||||||
|
import com.cool.store.dao.RegionDao;
|
||||||
|
import com.cool.store.dao.ShopInfoDAO;
|
||||||
|
import com.cool.store.dao.ShopStageInfoDAO;
|
||||||
import com.cool.store.dao.decoration.DecorationTeamConfigDAO;
|
import com.cool.store.dao.decoration.DecorationTeamConfigDAO;
|
||||||
|
import com.cool.store.dao.decoration.ShopDecorationAssignDAO;
|
||||||
import com.cool.store.dao.decoration.TeamAreaMappingDAO;
|
import com.cool.store.dao.decoration.TeamAreaMappingDAO;
|
||||||
|
import com.cool.store.dto.decoration.DecorationListDTO;
|
||||||
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
import com.cool.store.dto.decoration.DecorationTeamDTO;
|
||||||
import com.cool.store.dto.decoration.TeamAreaMappingDTO;
|
import com.cool.store.dto.decoration.TeamAreaMappingDTO;
|
||||||
|
import com.cool.store.entity.RegionDO;
|
||||||
|
import com.cool.store.entity.ShopInfoDO;
|
||||||
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||||
|
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
||||||
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
||||||
|
import com.cool.store.enums.Decoration.DecorationDescStatus;
|
||||||
import com.cool.store.enums.Decoration.DecorationUseSystemEnum;
|
import com.cool.store.enums.Decoration.DecorationUseSystemEnum;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.enums.JoinModeEnum;
|
||||||
|
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.request.decoration.AddTeamRequest;
|
import com.cool.store.request.decoration.AddTeamRequest;
|
||||||
|
import com.cool.store.request.decoration.DecorationListRequest;
|
||||||
import com.cool.store.request.decoration.UpdateTeamRequest;
|
import com.cool.store.request.decoration.UpdateTeamRequest;
|
||||||
import com.cool.store.service.DecorationHandleService;
|
import com.cool.store.service.DecorationHandleService;
|
||||||
|
import com.cool.store.service.HqtAPIService;
|
||||||
|
import com.cool.store.service.SignFranchiseService;
|
||||||
import com.cool.store.utils.RedisUtilPool;
|
import com.cool.store.utils.RedisUtilPool;
|
||||||
import com.cool.store.utils.StringUtil;
|
import com.cool.store.utils.StringUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import springfox.documentation.service.ApiListing;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +46,7 @@ import java.util.stream.Collectors;
|
|||||||
* @Version 1.0
|
* @Version 1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class DecorationHandleServiceImpl implements DecorationHandleService {
|
public class DecorationHandleServiceImpl implements DecorationHandleService {
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +55,19 @@ public class DecorationHandleServiceImpl implements DecorationHandleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TeamAreaMappingDAO teamAreaMappingDAO;
|
private TeamAreaMappingDAO teamAreaMappingDAO;
|
||||||
@Resource
|
@Resource
|
||||||
|
ShopDecorationAssignDAO shopDecorationAssignDAO;
|
||||||
|
@Resource
|
||||||
RedisUtilPool redisUtilPool;
|
RedisUtilPool redisUtilPool;
|
||||||
|
@Resource
|
||||||
|
private HqtAPIService hqtAPIService;
|
||||||
|
@Resource
|
||||||
|
ShopStageInfoDAO shopStageInfoDAO;
|
||||||
|
@Resource
|
||||||
|
ShopInfoDAO shopInfoDAO;
|
||||||
|
@Resource
|
||||||
|
SignFranchiseService signFranchiseService;
|
||||||
|
@Resource
|
||||||
|
RegionDao regionDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean addTeam(AddTeamRequest request) {
|
public Boolean addTeam(AddTeamRequest request) {
|
||||||
@@ -85,6 +112,11 @@ public class DecorationHandleServiceImpl implements DecorationHandleService {
|
|||||||
if (teamConfigDO==null){
|
if (teamConfigDO==null){
|
||||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||||
}
|
}
|
||||||
|
//查询当前团队是否有门店使用 有的话 不能删除
|
||||||
|
Integer count = shopDecorationAssignDAO.countByTeamId(teamId);
|
||||||
|
if (count != null && count > 0){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.TEAM_USED);
|
||||||
|
}
|
||||||
teamConfigDO.setDeleted(1);
|
teamConfigDO.setDeleted(1);
|
||||||
teamAreaMappingDAO.deletedByTeamId(teamId);
|
teamAreaMappingDAO.deletedByTeamId(teamId);
|
||||||
decorationTeamConfigDAO.updateTeam(teamConfigDO);
|
decorationTeamConfigDAO.updateTeam(teamConfigDO);
|
||||||
@@ -120,6 +152,54 @@ public class DecorationHandleServiceImpl implements DecorationHandleService {
|
|||||||
return teamInfo.getId();
|
return teamInfo.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean handleDecorationTeam(Long decorationAssignId) {
|
||||||
|
//先查询
|
||||||
|
ShopDecorationAssignDO shopDecorationAssign = shopDecorationAssignDAO.getById(decorationAssignId);
|
||||||
|
if (shopDecorationAssign == null){
|
||||||
|
log.info("handleDecorationTeam_error data not exist");
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
//如果门店是已经分配状态 则不能再次分配
|
||||||
|
if (DecorationDescStatus.ASSIGNED.getCode().equals(shopDecorationAssign.getDecorationDescStatus())){
|
||||||
|
log.info("handleDecorationTeam id:{},门店已分配",decorationAssignId);
|
||||||
|
}
|
||||||
|
//没有分配的门店 开始分配
|
||||||
|
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(shopDecorationAssign.getShopId());
|
||||||
|
//查询装修团队
|
||||||
|
DecorationTeamConfigDO teamInfo = decorationTeamConfigDAO.getById(shopDecorationAssign.getDecorationTeamId());
|
||||||
|
if (teamInfo == null){
|
||||||
|
log.info("handleDecorationTeam_error team not exist");
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
//配置的系统是红圈通 且不是加盟公司自有店 则推送数据 也就是配置了crm或者是加盟公司自有店 走crm流程
|
||||||
|
if (teamInfo.getUseSystem().equals(DecorationUseSystemEnum.HQT.getCode())&&!shopInfoDO.getJoinMode().equals(JoinModeEnum.OWN_STORE.getCode())){
|
||||||
|
hqtAPIService.pushHqtBuild(signFranchiseService.getHqtBuildRequest(shopInfoDO.getId()));
|
||||||
|
}
|
||||||
|
shopDecorationAssign.setDecorationDescStatus(DecorationDescStatus.ASSIGNED.getCode());
|
||||||
|
shopDecorationAssignDAO.update(shopDecorationAssign);
|
||||||
|
//阶段
|
||||||
|
shopStageInfoDAO.updateShopStageInfo(shopInfoDO.getId(), ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_861);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageInfo<DecorationListDTO> listByCondition(DecorationListRequest request) {
|
||||||
|
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||||
|
List<DecorationListDTO> decorationListDTOS = shopDecorationAssignDAO.listByCondition(request);
|
||||||
|
if (CollectionUtils.isEmpty(decorationListDTOS)){
|
||||||
|
return new PageInfo<>();
|
||||||
|
}
|
||||||
|
Set<String> regionIds = decorationListDTOS.stream().map(DecorationListDTO::getRegionId).collect(Collectors.toSet());
|
||||||
|
List<RegionDO> regionList = regionDao.getRegionByRegionIds(new ArrayList<>(regionIds));
|
||||||
|
//转为map
|
||||||
|
Map<String, String> regionMap = regionList.stream().collect(Collectors.toMap(RegionDO::getRegionId, RegionDO::getName));
|
||||||
|
decorationListDTOS.forEach(x->{
|
||||||
|
x.setRegionName(regionMap.get(x.getRegionId()));
|
||||||
|
});
|
||||||
|
return new PageInfo<>(decorationListDTOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getNextNumber() {
|
public String getNextNumber() {
|
||||||
Long current = redisUtilPool.incrby("counter_key", 1);
|
Long current = redisUtilPool.incrby("counter_key", 1);
|
||||||
|
|||||||
@@ -5,13 +5,21 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.cool.store.constants.CommonConstants;
|
import com.cool.store.constants.CommonConstants;
|
||||||
import com.cool.store.context.LoginUserInfo;
|
import com.cool.store.context.LoginUserInfo;
|
||||||
import com.cool.store.dao.*;
|
import com.cool.store.dao.*;
|
||||||
|
import com.cool.store.dao.decoration.DecorationTeamConfigDAO;
|
||||||
|
import com.cool.store.dao.decoration.ShopDecorationAssignDAO;
|
||||||
|
import com.cool.store.dao.decoration.TeamAreaMappingDAO;
|
||||||
import com.cool.store.dto.PartnerBankInfoDTO;
|
import com.cool.store.dto.PartnerBankInfoDTO;
|
||||||
import com.cool.store.entity.*;
|
import com.cool.store.entity.*;
|
||||||
|
import com.cool.store.entity.decoration.DecorationTeamConfigDO;
|
||||||
|
import com.cool.store.entity.decoration.ShopDecorationAssignDO;
|
||||||
|
import com.cool.store.entity.decoration.TeamAreaMappingDO;
|
||||||
import com.cool.store.enums.*;
|
import com.cool.store.enums.*;
|
||||||
|
import com.cool.store.enums.Decoration.DecorationDescStatus;
|
||||||
import com.cool.store.enums.point.ShopSubStageEnum;
|
import com.cool.store.enums.point.ShopSubStageEnum;
|
||||||
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
||||||
import com.cool.store.exception.ServiceException;
|
import com.cool.store.exception.ServiceException;
|
||||||
import com.cool.store.mapper.*;
|
import com.cool.store.mapper.*;
|
||||||
|
import com.cool.store.mq.producer.SimpleMessageService;
|
||||||
import com.cool.store.request.*;
|
import com.cool.store.request.*;
|
||||||
import com.cool.store.response.AddSignFranchiseResponse;
|
import com.cool.store.response.AddSignFranchiseResponse;
|
||||||
import com.cool.store.response.ResponseResult;
|
import com.cool.store.response.ResponseResult;
|
||||||
@@ -27,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import sun.font.Decoration;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -119,6 +128,14 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
|||||||
OperationLogService operationLogService;
|
OperationLogService operationLogService;
|
||||||
@Resource
|
@Resource
|
||||||
OperationLogDAO operationLogDAO;
|
OperationLogDAO operationLogDAO;
|
||||||
|
@Resource
|
||||||
|
TeamAreaMappingDAO teamAreaMappingDAO;
|
||||||
|
@Resource
|
||||||
|
DecorationTeamConfigDAO decorationTeamConfigDAO;
|
||||||
|
@Resource
|
||||||
|
ShopDecorationAssignDAO shopDecorationAssignDAO;
|
||||||
|
@Resource
|
||||||
|
private SimpleMessageService simpleMessageService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -390,10 +407,26 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
|||||||
));
|
));
|
||||||
}else{
|
}else{
|
||||||
//,加盟公司自有店->加盟公司建店 不推送数据 再crm中完成
|
//,加盟公司自有店->加盟公司建店 不推送数据 再crm中完成
|
||||||
if ( !shopInfoDO.getJoinMode().equals(JoinModeEnum.OWN_STORE.getCode())){
|
//v2.0.0 先确认装修团队
|
||||||
hqtAPIService.pushHqtBuild(getHqtBuildRequest(request.getShopId()));
|
TeamAreaMappingDO city = teamAreaMappingDAO.getByCityId(shopInfoDO.getWantShopAreaId());
|
||||||
|
//默认团队
|
||||||
|
Long teamId = 1L;
|
||||||
|
if (Objects.nonNull(city)) {
|
||||||
|
//v2.0.0 确认团队
|
||||||
|
DecorationTeamConfigDO decorationTeamConfigDO = decorationTeamConfigDAO.getById(city.getTeamId());
|
||||||
|
if (Objects.nonNull(decorationTeamConfigDO)) {
|
||||||
|
//v2.0.0 确认团队
|
||||||
|
teamId = decorationTeamConfigDO.getId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
shopStageInfoDAO.updateShopStageInfo(shopId, ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_861);
|
ShopDecorationAssignDO shopDecorationAssignDO = new ShopDecorationAssignDO();
|
||||||
|
shopDecorationAssignDO.setDecorationDescStatus(DecorationDescStatus.TO_BE_ASSIGNED.getCode());
|
||||||
|
shopDecorationAssignDO.setDecorationTeamId(teamId);
|
||||||
|
shopDecorationAssignDO.setShopId(shopId);
|
||||||
|
shopDecorationAssignDAO.insert(shopDecorationAssignDO);
|
||||||
|
//新增一个延迟队列 四个小时之后确定是否手动分配 没有手动分配 直接自动分配 红圈通推送和下一个流程开始改为分配团队之后 触发
|
||||||
|
simpleMessageService.send(String.valueOf(shopDecorationAssignDO.getId()), RocketMqTagEnum.DELAY_SHOP_DECORATION_ASSIGN,System.currentTimeMillis() + 4*60 * 1000);
|
||||||
}
|
}
|
||||||
shopAuditInfoDO.setResultType(Constants.ZERO_INTEGER);
|
shopAuditInfoDO.setResultType(Constants.ZERO_INTEGER);
|
||||||
shopAuditInfoDO.setPassReason(request.getCause());
|
shopAuditInfoDO.setPassReason(request.getCause());
|
||||||
@@ -449,6 +482,7 @@ public class SignFranchiseServiceImpl implements SignFranchiseService, AuditResu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HqtBuildRequest getHqtBuildRequest(Long shopId) {
|
public HqtBuildRequest getHqtBuildRequest(Long shopId) {
|
||||||
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
|
||||||
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId());
|
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(shopInfo.getLineId());
|
||||||
|
|||||||
Reference in New Issue
Block a user