Commit c699df7d by 墨竹

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

parent be932e1f
...@@ -152,5 +152,36 @@ public interface TabHaobanHmClerkRelationMapper { ...@@ -152,5 +152,36 @@ public interface TabHaobanHmClerkRelationMapper {
*/ */
List<TabHaobanHmClerkRelation> queryByHmIdNotInClerkIds(@Param("hmId") Long hmId, List<TabHaobanHmClerkRelation> queryByHmIdNotInClerkIds(@Param("hmId") Long hmId,
@Param("clerkIds") List<String> clerkIds); @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);
} }
...@@ -146,8 +146,8 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -146,8 +146,8 @@ public interface TabHaobanHmQrcodeMapper {
* @date 2022-07-07 17:26:34 * @date 2022-07-07 17:26:34
*/ */
TabHaobanHmQrcode queryByClerkIdAndOverFlag(@Param("clerkId") String clerkId, TabHaobanHmQrcode queryByClerkIdAndOverFlag(@Param("clerkId") String clerkId,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
@Param("overFlag") Integer overFlag, @Param("overFlag") Integer overFlag,
@Param("hmType") Integer hmType); @Param("hmType") Integer hmType);
/** /**
...@@ -158,7 +158,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -158,7 +158,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-08 15:10:57 * @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获取活码数量 * 根据分组id获取活码数量
...@@ -169,7 +169,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -169,7 +169,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-12 17:39:12 * @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,41 +183,72 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -183,41 +183,72 @@ public interface TabHaobanHmQrcodeMapper {
/** /**
* 批量修改 活码所属分组 * 批量修改 活码所属分组
*
* @param ids * @param ids
* @param groupId * @param groupId
* @return * @return
*/ */
int batchUpdateQrCodeGroup(@Param("ids") List<Long> ids, @Param("groupId") Long groupId); int batchUpdateQrCodeGroup(@Param("ids") List<Long> ids, @Param("groupId") Long groupId);
/** /**
* * @param wxEnterpriseId
* @Title: getCanAddCount * @param enterprsieId
* @Description: 获取能创建活码的导购列表 * @param storeIdList
* @author xugh * @return
* @param wxEnterpriseId * @throws
* @param enterprsieId * @Title: getCanAddCount
* @param storeIdList * @Description: 获取能创建活码的导购列表
* @return * @author xugh
* @throws
*/ */
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<String> getHmStoreForWxa(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("enterpriseId") String enterpriseId); 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> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
/** /**
* * @param enterpriseId
* @Title: listHasQrcodeClerk * @param clerkId
* @Description: 返回已有单人活码的clerkId * @return
* @author xugh * @throws
* @param enterpriseId * @Title: listHasQrcodeClerk
* @param clerkId * @Description: 返回已有单人活码的clerkId
* @return * @author xugh
* @throws */
*/ 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 { ...@@ -191,4 +191,29 @@ public interface HmQrcodeService {
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto); List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList); 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; ...@@ -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.HmQrcodeListQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.service.StaffApiService; 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.dao.mapper.hm.TabHaobanHmQrcodeMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmQrcode; import com.gic.haoban.manage.service.entity.hm.TabHaobanHmQrcode;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
...@@ -36,6 +37,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -36,6 +37,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
private TabHaobanHmQrcodeMapper tabHaobanHmQrcodeMapper; private TabHaobanHmQrcodeMapper tabHaobanHmQrcodeMapper;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private TabHaobanHmClerkRelationMapper tabHaobanHmClerkRelationMapper;
@Override @Override
public HmQrcodeBO queryById(Long hmId) { public HmQrcodeBO queryById(Long hmId) {
...@@ -84,9 +87,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -84,9 +87,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @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, return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag,hmType)); tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag, hmType));
} }
@Override @Override
...@@ -106,9 +109,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -106,9 +109,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @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, return EntityUtil.changeEntity(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag,hmType)); tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag, hmType));
} }
@Override @Override
...@@ -117,9 +120,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -117,9 +120,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @Override
public List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId,String enterpriseId) { public List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId) {
return EntityUtil.changeEntityListNew(HmQrcodeBO.class, return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(wxEnterpriseId ,enterpriseId)); tabHaobanHmQrcodeMapper.getHmStoreByEnterpriseId(wxEnterpriseId, enterpriseId));
} }
@Override @Override
...@@ -169,20 +172,31 @@ public class HmQrcodeServiceImpl implements HmQrcodeService { ...@@ -169,20 +172,31 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
authStoreIdList); authStoreIdList);
return list; return list;
} }
@Override @Override
public List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId) { public List<String> getHmStoreForWxa(String wxEnterpriseId, String enterpriseId) {
return tabHaobanHmQrcodeMapper.getHmStoreForWxa(wxEnterpriseId , enterpriseId) ; return tabHaobanHmQrcodeMapper.getHmStoreForWxa(wxEnterpriseId, enterpriseId);
} }
@Override @Override
public List<String> listHmIdForIndex(HmQrcodeListQDTO qdto) { public List<String> listHmIdForIndex(HmQrcodeListQDTO qdto) {
return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto) ; return tabHaobanHmQrcodeMapper.listHmIdForIndex(qdto);
} }
@Override @Override
public List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) { public List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList) {
return this.tabHaobanHmQrcodeMapper.listHasQrcodeClerk(enterpriseId, clerkIdList); 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 ...@@ -485,6 +485,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
ClerkSyncQDTO clerkSyncQDTO = JSON.parseObject(param, ClerkSyncQDTO.class); ClerkSyncQDTO clerkSyncQDTO = JSON.parseObject(param, ClerkSyncQDTO.class);
Integer type = clerkSyncQDTO.getType(); Integer type = clerkSyncQDTO.getType();
String clerkId = clerkSyncQDTO.getClerkId(); String clerkId = clerkSyncQDTO.getClerkId();
String enterpriseId = clerkSyncQDTO.getEnterpriseId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1);
if (clerkDTO == null) { if (clerkDTO == null) {
logger.error("导购为空"); logger.error("导购为空");
...@@ -519,8 +520,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -519,8 +520,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.error("任务重新分配问题发送消息队列出错",e); logger.error("任务重新分配问题发送消息队列出错",e);
} }
} }
hmQrcodeService.updateClerkNameByClerkId(enterpriseId,clerkId,clerkDTO.getClerkName(),clerkDTO.getClerkCode());
} }
} }
......
...@@ -20,6 +20,7 @@ import com.gic.haoban.manage.service.pojo.GroupSyncPojo; ...@@ -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.pojo.StoreSyncPojo;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StoreRangeService; 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.commons.lang3.time.DateUtils;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -59,6 +60,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -59,6 +60,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired @Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService; private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private HmQrcodeService hmQrcodeService;
@Override @Override
public void onMessage(ConsumerRecord<String, GicRecord> record) { public void onMessage(ConsumerRecord<String, GicRecord> record) {
...@@ -205,6 +208,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -205,6 +208,7 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
&& (!syncPojo.getStoreName().equals(syncPojo.getOldStoreName()))) { && (!syncPojo.getStoreName().equals(syncPojo.getOldStoreName()))) {
logger.info("门店名称变更:{}", JSONObject.toJSONString(syncPojo)); logger.info("门店名称变更:{}", JSONObject.toJSONString(syncPojo));
storeRangeService.updatwStoreName(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName()); storeRangeService.updatwStoreName(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName());
hmQrcodeService.updateStoreNameByStoreId(syncPojo.getEnterpriseId(), syncPojo.getStoreId(), syncPojo.getStoreName(),syncPojo.getStoreCode());
} }
//门店状态变更 包括删除 //门店状态变更 包括删除
......
...@@ -200,5 +200,21 @@ ...@@ -200,5 +200,21 @@
</foreach> </foreach>
</select> </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> </mapper>
...@@ -461,7 +461,7 @@ ...@@ -461,7 +461,7 @@
and b.hm_id is null and b.hm_id is null
</sql> </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} select clerk_id from tab_haoban_hm_qrcode where enterprise_id=#{enterpriseId}
and clerk_id in and clerk_id in
<foreach collection="clerkIdList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="clerkIdList" item="id" index="index" open="(" close=")" separator=",">
...@@ -469,6 +469,23 @@ ...@@ -469,6 +469,23 @@
</foreach> </foreach>
and hm_type = 1 and status_flag in (1,3) and hm_type = 1 and status_flag in (1,3)
</select> </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> </mapper>
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