Commit c699df7d by 墨竹

feat:监听导购和门店名称变化

parent be932e1f
......@@ -152,5 +152,36 @@ public interface TabHaobanHmClerkRelationMapper {
*/
List<TabHaobanHmClerkRelation> queryByHmIdNotInClerkIds(@Param("hmId") Long hmId,
@Param("clerkIds") List<String> clerkIds);
/**
* 更新导购名称
*
* @param clerkId 导购id
* @param clerkName 导购名称
* @param clerkCode 职员代码
* @return int
* @author mozhu
* @date 2022-07-28 13:50:30
*/
int updateClerkNameByClerkId(@Param("enterpriseId") String enterpriseId,
@Param("clerkId") String clerkId,
@Param("clerkName") String clerkName,
@Param("clerkCode") String clerkCode);
/**
* 更改门店名称
*
* @param storeId 门店id
* @param storeName 门店名称
* @param storeCode 门店code
* @return int
* @author mozhu
* @date 2022-07-28 13:52:35
*/
int updateStoreNameByStoreId(@Param("enterpriseId") String enterpriseId,
@Param("storeId") String storeId,
@Param("storeName") String storeName,
@Param("storeCode") String storeCode);
}
......@@ -158,7 +158,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu
* @date 2022-07-08 15:10:57
*/
List<TabHaobanHmQrcode> getHmStoreByEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
List<TabHaobanHmQrcode> getHmStoreByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
/**
* 根据分组id获取活码数量
......@@ -169,7 +169,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu
* @date 2022-07-12 17:39:12
*/
List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId,@Param("groupIds") List<Long> groupIds, @Param("hmIds") List<String> hmIds);
List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("groupIds") List<Long> groupIds, @Param("hmIds") List<String> hmIds);
/**
* 获取总数
......@@ -183,6 +183,7 @@ public interface TabHaobanHmQrcodeMapper {
/**
* 批量修改 活码所属分组
*
* @param ids
* @param groupId
* @return
......@@ -190,34 +191,64 @@ public interface TabHaobanHmQrcodeMapper {
int batchUpdateQrCodeGroup(@Param("ids") List<Long> ids, @Param("groupId") Long groupId);
/**
*
* @Title: getCanAddCount
* @Description: 获取能创建活码的导购列表
* @author xugh
* @param wxEnterpriseId
* @param enterprsieId
* @param storeIdList
* @return
* @throws
* @Title: getCanAddCount
* @Description: 获取能创建活码的导购列表
* @author xugh
*/
int getCanAddCount(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId")String enterpriseId , @Param("storeIdList")List<String> storeIdList) ;
int getCanAddCount(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("storeIdList") List<String> storeIdList);
List<HmQrcodeClerkBO> listCanAddClerk(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId")String enterpriseId , @Param("storeIdList")List<String> storeIdList);
List<HmQrcodeClerkBO> listCanAddClerk(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("storeIdList") List<String> storeIdList);
List<String> getHmStoreForWxa(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId") String enterpriseId);
List<String> getHmStoreForWxa(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
/**
*
* @Title: listHasQrcodeClerk
* @Description: 返回已有单人活码的clerkId
* @author xugh
* @param enterpriseId
* @param clerkId
* @return
* @throws
* @Title: listHasQrcodeClerk
* @Description: 返回已有单人活码的clerkId
* @author xugh
*/
List<String> listHasQrcodeClerk(@Param("enterpriseId")String enterpriseId , @Param("clerkIdList")List<String> clerkIdList) ;
List<String> listHasQrcodeClerk(@Param("enterpriseId") String enterpriseId, @Param("clerkIdList") List<String> clerkIdList);
/**
* 更新导购名称
*
* @param enterpriseId 企业标识
* @param clerkId 导购id
* @param clerkName 导购名称
* @param clerkCode 职员代码
* @return int
* @author mozhu
* @date 2022-07-28 14:03:48
*/
int updateClerkNameByClerkId(@Param("enterpriseId") String enterpriseId,
@Param("clerkId") String clerkId,
@Param("clerkName") String clerkName,
@Param("clerkCode") String clerkCode);
/**
* 更改门店名称
*
* @param enterpriseId 企业标识
* @param storeId 门店id
* @param storeName 门店名称
* @param storeCode 门店code
* @return int
* @author mozhu
* @date 2022-07-28 14:03:46
*/
int updateStoreNameByStoreId(@Param("enterpriseId") String enterpriseId,
@Param("storeId") String storeId,
@Param("storeName") String storeName,
@Param("storeCode") String storeCode);
}
......@@ -191,4 +191,29 @@ public interface HmQrcodeService {
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList);
/**
* 更新导购名称
*
* @param clerkId 导购id
* @param clerkName 导购名称
* @param clerkCode 导购代码
* @return int
* @author mozhu
* @date 2022-07-28 13:53:51
*/
void updateClerkNameByClerkId(String enterpriseId, String clerkId,String clerkName,String clerkCode);
/**
* 更改门店名称
*
* @param storeId 存储id
* @param storeName 商店名字
* @param storeCode 存储代码
* @return int
* @author mozhu
* @date 2022-07-28 13:54:49
*/
void updateStoreNameByStoreId(String enterpriseId,String storeId,String storeName, String storeCode);
}
......@@ -6,6 +6,7 @@ import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmQrcodeMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmQrcode;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
......@@ -36,6 +37,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
private TabHaobanHmQrcodeMapper tabHaobanHmQrcodeMapper;
@Autowired
private StaffApiService staffApiService;
@Autowired
private TabHaobanHmClerkRelationMapper tabHaobanHmClerkRelationMapper;
@Override
public HmQrcodeBO queryById(Long hmId) {
......@@ -84,9 +87,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public List<HmQrcodeBO> listByStoreId(String wxEnterpriseId, String storeId, Integer overFlag,Integer hmType) {
public List<HmQrcodeBO> listByStoreId(String wxEnterpriseId, String storeId, Integer overFlag, Integer hmType) {
return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag,hmType));
tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag, hmType));
}
@Override
......@@ -106,9 +109,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer overFlag,Integer hmType) {
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer overFlag, Integer hmType) {
return EntityUtil.changeEntity(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag,hmType));
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag, hmType));
}
@Override
......@@ -117,9 +120,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId,String enterpriseId) {
public List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId) {
return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(wxEnterpriseId ,enterpriseId));
tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(wxEnterpriseId, enterpriseId));
}
@Override
......@@ -171,13 +174,13 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId) {
return tabHaobanHmQrcodeMapper.getHmStoreForWxa(wxEnterpriseId , enterpriseId) ;
public List<String> getHmStoreForWxa(String wxEnterpriseId, String enterpriseId) {
return tabHaobanHmQrcodeMapper.getHmStoreForWxa(wxEnterpriseId, enterpriseId);
}
@Override
public List<String> listHmIdForIndex(HmQrcodeListQDTO qdto) {
return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto) ;
return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto);
}
@Override
......@@ -185,4 +188,15 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
return this.tabHaobanHmQrcodeMapper.listHasQrcodeClerk(enterpriseId, clerkIdList);
}
@Override
public void updateClerkNameByClerkId(String enterpriseId,String clerkId, String clerkName, String clerkCode) {
tabHaobanHmQrcodeMapper.updateClerkNameByClerkId(enterpriseId,clerkId, clerkName, clerkCode);
tabHaobanHmClerkRelationMapper.updateClerkNameByClerkId(enterpriseId,clerkId, clerkName, clerkCode);
}
@Override
public void updateStoreNameByStoreId(String enterpriseId,String storeId, String storeName, String storeCode) {
tabHaobanHmQrcodeMapper.updateStoreNameByStoreId(enterpriseId,storeId, storeName, storeCode);
tabHaobanHmClerkRelationMapper.updateStoreNameByStoreId(enterpriseId,storeId, storeName, storeCode);
}
}
......@@ -485,6 +485,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
ClerkSyncQDTO clerkSyncQDTO = JSON.parseObject(param, ClerkSyncQDTO.class);
Integer type = clerkSyncQDTO.getType();
String clerkId = clerkSyncQDTO.getClerkId();
String enterpriseId = clerkSyncQDTO.getEnterpriseId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1);
if (clerkDTO == null) {
logger.error("导购为空");
......@@ -519,8 +520,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.error("任务重新分配问题发送消息队列出错",e);
}
}
hmQrcodeService.updateClerkNameByClerkId(enterpriseId,clerkId,clerkDTO.getClerkName(),clerkDTO.getClerkCode());
}
}
......
......@@ -20,6 +20,7 @@ import com.gic.haoban.manage.service.pojo.GroupSyncPojo;
import com.gic.haoban.manage.service.pojo.StoreSyncPojo;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
......@@ -59,6 +60,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private HmQrcodeService hmQrcodeService;
@Override
public void onMessage(ConsumerRecord<String, GicRecord> record) {
......@@ -205,6 +208,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
&& (!syncPojo.getStoreName().equals(syncPojo.getOldStoreName()))) {
logger.info("门店名称变更:{}", JSONObject.toJSONString(syncPojo));
storeRangeService.updatwStoreName(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName());
hmQrcodeService.updateStoreNameByStoreId(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName(),syncPojo.getStoreCode());
}
//门店状态变更 包括删除
......
......@@ -200,5 +200,21 @@
</foreach>
</select>
<update id="updateClerkNameByClerkId" parameterType="java.lang.String">
update tab_haoban_hm_clerk_relation
<set>
clerk_name = #{clerkName},clerk_code = #{clerkCode},update_time = now()
</set>
where clerk_id = #{clerkId} and enterprise_id = #{enterpriseId}
</update>
<update id="updateStoreNameByStoreId" parameterType="java.lang.String">
update tab_haoban_hm_clerk_relation
<set>
store_name = #{storeName},store_code = #{storeCode},update_time = now()
</set>
where store_id = #{storeId} and enterprise_id = #{enterpriseId}
</update>
</mapper>
......@@ -461,7 +461,7 @@
and b.hm_id is null
</sql>
<select id="listHasQrcodeClerk" resultType="String">
<select id="listHasQrcodeClerk" resultType="java.lang.String">
select clerk_id from tab_haoban_hm_qrcode where enterprise_id=#{enterpriseId}
and clerk_id in
<foreach collection="clerkIdList" item="id" index="index" open="(" close=")" separator=",">
......@@ -470,5 +470,22 @@
and hm_type = 1 and status_flag in (1,3)
</select>
<update id="updateClerkNameByClerkId" parameterType="java.lang.String">
update tab_haoban_hm_qrcode
<set>
clerk_name = #{clerkName},clerk_code = #{clerkCode},update_time = now()
</set>
where clerk_id = #{clerkId} and enterprise_id = #{enterpriseId}
</update>
<update id="updateStoreNameByStoreId" parameterType="java.lang.String">
update tab_haoban_hm_qrcode
<set>
store_name = #{storeName},store_code = #{storeCode},update_time = now()
</set>
where store_id = #{storeId} and enterprise_id = #{enterpriseId}
</update>
</mapper>
......@@ -3,41 +3,42 @@
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper">
<resultMap type="com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog"
id="result-map-tabHaobanWxUserAddLog">
<result column="log_id" property="logId" />
<result column="wx_enterprise_id" property="wxEnterpriseId" />
<result column="enterprise_id" property="enterpriseId" />
<result column="external_userid" property="externalUserid" />
<result column="staff_id" property="staffId" />
<result column="staff_name" property="staffName" />
<result column="wx_user_id" property="wxUserId" />
<result column="status_flag" property="statusFlag" />
<result column="add_channel" property="addChannel" />
<result column="hm_id" property="hmId" />
<result column="hm_name" property="hmName" />
<result column="link_id" property="linkId" />
<result column="link_name" property="linkName" />
<result column="member_id" property="memberId" />
<result column="member_name" property="memberName" />
<result column="member_nick" property="memberNick" />
<result column="member_image" property="memberImage" />
<result column="member_phone" property="memberPhone" />
<result column="member_grade_id" property="memberGradeId" />
<result column="member_grade_name" property="memberGradeName" />
<result column="member_card_no" property="memberCardNo" />
<result column="clerk_id" property="clerkId" />
<result column="clerk_code" property="clerkCode" />
<result column="clerk_name" property="clerkName" />
<result column="store_id" property="storeId" />
<result column="store_name" property="storeName" />
<result column="store_code" property="storeCode" />
<result column="member_label_id" property="memberLabelId" />
<result column="member_label_name" property="memberLabelName" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="all_del_flag" property="allDelFlag" />
<result column="log_id" property="logId"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="enterprise_id" property="enterpriseId"/>
<result column="external_userid" property="externalUserid"/>
<result column="staff_id" property="staffId"/>
<result column="staff_name" property="staffName"/>
<result column="wx_user_id" property="wxUserId"/>
<result column="status_flag" property="statusFlag"/>
<result column="add_channel" property="addChannel"/>
<result column="hm_id" property="hmId"/>
<result column="hm_name" property="hmName"/>
<result column="link_id" property="linkId"/>
<result column="link_name" property="linkName"/>
<result column="member_id" property="memberId"/>
<result column="member_name" property="memberName"/>
<result column="member_nick" property="memberNick"/>
<result column="member_image" property="memberImage"/>
<result column="member_phone" property="memberPhone"/>
<result column="member_grade_id" property="memberGradeId"/>
<result column="member_grade_name" property="memberGradeName"/>
<result column="member_card_no" property="memberCardNo"/>
<result column="clerk_id" property="clerkId"/>
<result column="clerk_code" property="clerkCode"/>
<result column="clerk_name" property="clerkName"/>
<result column="store_id" property="storeId"/>
<result column="store_name" property="storeName"/>
<result column="store_code" property="storeCode"/>
<result column="member_label_id" property="memberLabelId"/>
<result column="member_label_name" property="memberLabelName"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="all_del_flag" property="allDelFlag"/>
</resultMap>
<sql id="Base_Column_List">
log_id,
log_id
,
wx_enterprise_id,
enterprise_id,
external_userid,
......@@ -74,8 +75,7 @@
<insert id="insert"
parameterType="com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog">
<![CDATA[
INSERT INTO tab_haoban_wx_user_add_log(
log_id,
INSERT INTO tab_haoban_wx_user_add_log(log_id,
wx_enterprise_id,
enterprise_id,
external_userid,
......@@ -106,10 +106,9 @@
member_label_name,
create_time,
update_time,
add_time ,
all_del_flag
)VALUES(
#{logId,jdbcType=BIGINT},
add_time,
all_del_flag)
VALUES (#{logId,jdbcType=BIGINT},
#{wxEnterpriseId,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=CHAR},
#{externalUserid,jdbcType=VARCHAR},
......@@ -141,8 +140,7 @@
now(),
now(),
now(),
#{allDelFlag,jdbcType=INTEGER}
)
#{allDelFlag,jdbcType=INTEGER})
]]>
</insert>
......@@ -161,7 +159,7 @@
create_time = #{createTime} ,
</if>
update_time=now() WHERE
external_userid=#{externalUserid} and staff_id=#{staffId} and membre_id is null
external_userid=#{externalUserid} and staff_id=#{staffId} and member_id is null
</update>
......@@ -169,7 +167,7 @@
parameterType="com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog"
resultMap="result-map-tabHaobanWxUserAddLog">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_wx_user_add_log where
external_userid=#{externalUserid} and status_flag != 0 order by
create_time asc
......@@ -177,15 +175,16 @@
<select id="selectNewLog" resultMap="result-map-tabHaobanWxUserAddLog">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_wx_user_add_log where
external_userid=#{externalUserid} and wx_user_id =#{wxUserId} and
status_flag != 0 order by create_time desc limit 1
</select>
<select id="listForPage" parameterType="com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO" resultMap="result-map-tabHaobanWxUserAddLog">
<select id="listForPage" parameterType="com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO"
resultMap="result-map-tabHaobanWxUserAddLog">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_wx_user_add_log where wx_enterprise_id = #{wxEnterpriseId}
<if test="null != enterpriseId">
and enterprise_id = #{enterpriseId}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment