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);
}
......@@ -146,8 +146,8 @@ public interface TabHaobanHmQrcodeMapper {
* @date 2022-07-07 17:26:34
*/
TabHaobanHmQrcode queryByClerkIdAndOverFlag(@Param("clerkId") String clerkId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("overFlag") Integer overFlag,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("overFlag") Integer overFlag,
@Param("hmType") Integer hmType);
/**
......@@ -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,41 +183,72 @@ public interface TabHaobanHmQrcodeMapper {
/**
* 批量修改 活码所属分组
*
* @param ids
* @param groupId
* @return
*/
int batchUpdateQrCodeGroup(@Param("ids") List<Long> ids, @Param("groupId") Long groupId);
/**
*
* @Title: getCanAddCount
* @Description: 获取能创建活码的导购列表
* @author xugh
* @param wxEnterpriseId
* @param enterprsieId
* @param storeIdList
* @return
* @throws
* @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) ;
List<HmQrcodeClerkBO> listCanAddClerk(@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<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);
/**
*
* @Title: listHasQrcodeClerk
* @Description: 返回已有单人活码的clerkId
* @author xugh
* @param enterpriseId
* @param clerkId
* @return
* @throws
*/
List<String> listHasQrcodeClerk(@Param("enterpriseId")String enterpriseId , @Param("clerkIdList")List<String> clerkIdList) ;
/**
* @param enterpriseId
* @param clerkId
* @return
* @throws
* @Title: listHasQrcodeClerk
* @Description: 返回已有单人活码的clerkId
* @author xugh
*/
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
......@@ -169,20 +172,31 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
authStoreIdList);
return list;
}
@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
public List<String> listHasQrcodeClerk(String enterpriseId, List<String> 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
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=",">
......@@ -469,6 +469,23 @@
</foreach>
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>
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