Commit c9d21277 by 徐高华

导购转移门店

parent bc7870c6
......@@ -183,5 +183,19 @@ public interface TabHaobanHmClerkRelationMapper {
@Param("storeId") String storeId,
@Param("storeName") String storeName,
@Param("storeCode") String storeCode);
/**
*
* @Title: updateByClerkChangeStore
* @Description: 导购转移门店,更新多人码门店和导购信息
* @author xugh
* @param tabHaobanHmClerkRelation
* @return
* @throws
*/
int updateByClerkChangeStore(@Param("enterpriseId")String enterpriseId,
@Param("clerkId")String clerkId, @Param("clerkCode")String clerkCode, @Param("clerkName")String clerkName,
@Param("storeId")String storeId, @Param("storeCode")String storeCode, @Param("storeName")String storeName,
@Param("oldClerkId") String oldClerkId) ;
}
......@@ -169,5 +169,16 @@ public interface HmClerkRelationService {
* @date 2022-07-26 15:38:33
*/
List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds);
/**
*
* @Title: updateByClerkChangeStore
* @Description: 导购转移门店更新多人活码
* @author xugh
* @param bo
* @param oldClerkId
* @throws
*/
void updateByClerkChangeStore(String enterpriseId,String oldClerkId,String newClerkId) ;
}
package com.gic.haoban.manage.service.service.hm.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.qdto.hm.HmClerkRelationQDTO;
......@@ -11,11 +21,6 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmClerkRelationBO;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 多人活码(TabHaobanHmClerkRelation)表服务实现类
......@@ -28,6 +33,10 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService {
@Autowired
private TabHaobanHmClerkRelationMapper tabHaobanHmClerkRelationMapper;
@Autowired
private ClerkService clerkService ;
@Autowired
private StoreService storeService ;
/**
* 通过ID查询单条数据
......@@ -116,4 +125,16 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService {
public List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds) {
return EntityUtil.changeEntityListByOrika(HmClerkRelationBO.class,tabHaobanHmClerkRelationMapper.queryByHmIdNotInClerkIds(hmId,clerkIds));
}
@Override
public void updateByClerkChangeStore(String enterpriseId,String oldClerkId,String newClerkId) {
ClerkDTO newClerk = this.clerkService.getclerkById(newClerkId) ;
String clerkCode = newClerk.getClerkCode();
String clerkName = newClerk.getClerkName() ;
String storeId = newClerk.getStoreId();
StoreDTO newStore = this.storeService.getStore(storeId) ;
String storeCode = newStore.getStoreCode();
String storeName = newStore.getStoreName() ;
this.tabHaobanHmClerkRelationMapper.updateByClerkChangeStore(enterpriseId,newClerkId,clerkCode,clerkName,storeId, storeCode,storeName, oldClerkId) ;
}
}
......@@ -14,6 +14,7 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -33,7 +34,6 @@ public class HmClerkRelationApiServiceImpl implements HmClerkRelationApiService
@Autowired
private HmClerkRelationService hmClerkRelationService;
@Override
public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId, Integer invokingType) {
return this.delByClerkId(clerkId, enterpriseId, wxEnterpriseId, invokingType, null) ;
......@@ -47,28 +47,30 @@ public class HmClerkRelationApiServiceImpl implements HmClerkRelationApiService
if (hmQrcodeBO != null) {
hmQrcodeApiService.delById(hmQrcodeBO.getHmId(), invokingType, null);
}
// 多人活码逻辑
List<HmClerkRelationBO> hmClerkRelationBOS = hmClerkRelationService.queryByClerkId(clerkId, enterpriseId);
if (CollectionUtils.isEmpty(hmClerkRelationBOS)) {
logger.info("无多人活码");
return ServiceResponse.success();
}
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
Long hmId = hmClerkRelationBO.getHmId();
List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId);
hmClerkRelationService.updateStatusById(0, hmClerkRelationBO.getRelationId());
clerkIds.remove(clerkId);
if (CollectionUtils.isNotEmpty(clerkIds)) {
// 更新活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmId(hmId);
hmQrcodeQDTO.setClerkIdList(clerkIds);
hmQrcodeQDTO.setWxEnterpriseId(wxEnterpriseId);
hmQrcodeApiService.update(hmQrcodeQDTO);
} else {
hmQrcodeApiService.delById(hmId, invokingType, null);
if(StringUtils.isNotBlank(newClerkId)) {
this.hmClerkRelationService.updateByClerkChangeStore(enterpriseId, clerkId ,newClerkId);
}else {
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
Long hmId = hmClerkRelationBO.getHmId();
List<String> clerkIds = hmClerkRelationService.getClerkIdByHmId(hmId);
hmClerkRelationService.updateStatusById(0, hmClerkRelationBO.getRelationId());
clerkIds.remove(clerkId);
if (CollectionUtils.isNotEmpty(clerkIds)) {
// 更新活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmId(hmId);
hmQrcodeQDTO.setClerkIdList(clerkIds);
hmQrcodeQDTO.setWxEnterpriseId(wxEnterpriseId);
hmQrcodeApiService.update(hmQrcodeQDTO);
} else {
hmQrcodeApiService.delById(hmId, invokingType, null);
}
}
}
return ServiceResponse.success();
......
......@@ -211,6 +211,12 @@
</set>
where store_id = #{storeId} and enterprise_id = #{enterpriseId}
</update>
<update id="updateByClerkChangeStore">
update tab_haoban_hm_clerk_relation set
clerk_id = #{clerkId} , clerk_code=#{clerkCode} , clerk_name=#{clerkName} , store_id=#{storeId} , store_name = #{storeName}, store_code = #{storeCode} , update_time = now()
where clerk_id = #{oldClerkId} and enterprise_id = #{enterpriseId} and `status` = 1
</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