Commit e732cabf by 墨竹

活码修改

parent 0b5ba891
...@@ -140,5 +140,17 @@ public interface TabHaobanHmClerkRelationMapper { ...@@ -140,5 +140,17 @@ public interface TabHaobanHmClerkRelationMapper {
* @date 2022-07-21 16:32:43 * @date 2022-07-21 16:32:43
*/ */
int updateStatusById(@Param("status") Integer status, @Param("relationId") Long relationId); int updateStatusById(@Param("status") Integer status, @Param("relationId") Long relationId);
/**
* 查询需要删除的数据
*
* @param hmId hm id
* @param clerkIds 职员id
* @return {@link List }<{@link TabHaobanHmClerkRelation }>
* @author mozhu
* @date 2022-07-26 15:42:07
*/
List<TabHaobanHmClerkRelation> queryByHmIdNotInClerkIds(@Param("hmId") Long hmId,
@Param("clerkIds") List<String> clerkIds);
} }
...@@ -159,4 +159,15 @@ public interface HmClerkRelationService { ...@@ -159,4 +159,15 @@ public interface HmClerkRelationService {
*/ */
int updateStatusById(Integer status, Long relationId); int updateStatusById(Integer status, Long relationId);
/**
* 查询需要删除的数据
*
* @param hmId hm id
* @param clerkIds 职员id
* @return {@link List }<{@link HmClerkRelationBO }>
* @author mozhu
* @date 2022-07-26 15:38:33
*/
List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds);
} }
...@@ -111,4 +111,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService { ...@@ -111,4 +111,9 @@ public class HmClerkRelationServiceImpl implements HmClerkRelationService {
public int updateStatusById(Integer status, Long relationId) { public int updateStatusById(Integer status, Long relationId) {
return tabHaobanHmClerkRelationMapper.updateStatusById(status,relationId); return tabHaobanHmClerkRelationMapper.updateStatusById(status,relationId);
} }
@Override
public List<HmClerkRelationBO> queryByHmIdNotInClerkIds(Long hmId, List<String> clerkIds) {
return EntityUtil.changeEntityListByOrika(HmClerkRelationBO.class,tabHaobanHmClerkRelationMapper.queryByHmIdNotInClerkIds(hmId,clerkIds));
}
} }
...@@ -422,11 +422,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -422,11 +422,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
if (CollectionUtils.isEmpty(clerkIdList)) { if (CollectionUtils.isEmpty(clerkIdList)) {
return null; return null;
} }
String enterpriseId = hmQrcodeQDTO.getEnterpriseId();
//单人活码 //单人活码
String clerkId = clerkIdList.get(0); String clerkId = clerkIdList.get(0);
if (hmType == 2) { if (hmType == 2) {
//多人活码 //多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList, addFlag); insertHmClerkRelation(enterpriseId, wxEnterpriseId, hmId, clerkIdList, addFlag);
} else if (hmType == 1) { } else if (hmType == 1) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (addFlag && hmQrcodeBO != null) { if (addFlag && hmQrcodeBO != null) {
...@@ -467,17 +468,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -467,17 +468,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
/** /**
* 多人活码关联关系 * 多人活码关联关系
* * @param enterpriseId
* @param hmQrcodeQDTO
* @param wxEnterpriseId * @param wxEnterpriseId
* @param hmId * @param hmId
* @param clerkIdList * @param clerkIdList
* @param addFlag
*/ */
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) { private void insertHmClerkRelation(String enterpriseId,String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) {
Date now = new Date(); Date now = new Date();
if (!addFlag) {
//修改,删除其余无效导购
List<HmClerkRelationBO> hmClerkRelationBOS = hmClerkRelationService.queryByHmIdNotInClerkIds(hmId, clerkIdList);
if (CollectionUtils.isNotEmpty(hmClerkRelationBOS)) {
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
hmClerkRelationService.updateStatusById(0,hmClerkRelationBO.getRelationId());
}
}
}
for (String clerkId : clerkIdList) { for (String clerkId : clerkIdList) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId); HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (addFlag && hmClerkRelationBO != null) { if (hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId); logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId);
continue; continue;
} }
...@@ -488,7 +499,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService { ...@@ -488,7 +499,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setHmId(hmId); hmClerkRelationQDTO.setHmId(hmId);
hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId()); hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId());
hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId); hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId);
hmClerkRelationQDTO.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId()); hmClerkRelationQDTO.setEnterpriseId(enterpriseId);
hmClerkRelationQDTO.setClerkId(clerkId); hmClerkRelationQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId); ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) { if (clerkDTO != null) {
......
...@@ -190,5 +190,15 @@ ...@@ -190,5 +190,15 @@
where relation_id = #{relationId} where relation_id = #{relationId}
</update> </update>
<select id="queryByHmIdNotInClerkIds" resultMap="TabHaobanHmClerkRelationMap">
select <include refid="Base_Column_List"></include>
from tab_haoban_hm_clerk_relation
where hm_id = #{hmId}
and clerk_id not in
<foreach item="id" index="index" collection="clerkIds" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper> </mapper>
...@@ -165,10 +165,10 @@ public class HmQrcodeController { ...@@ -165,10 +165,10 @@ public class HmQrcodeController {
hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString()); hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString());
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO); StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class); List<HmQrcodeListDTO> data = JSON.parseArray(JSON.toJSONString(statisticsDTO.getData()), HmQrcodeListDTO.class);
List<HmStoreDTO> storeDTOList = new ArrayList<>();
List<HmClerkDTO> clerkDTOList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(data)) { if (CollectionUtils.isNotEmpty(data)) {
for (HmQrcodeListDTO hmQrcodeListDTO : data) { for (HmQrcodeListDTO hmQrcodeListDTO : data) {
List<HmStoreDTO> storeDTOList = new ArrayList<>();
List<HmClerkDTO> clerkDTOList = new ArrayList<>();
Long hmId = hmQrcodeListDTO.getHmId(); Long hmId = hmQrcodeListDTO.getHmId();
Integer hmType = hmQrcodeListDTO.getHmType(); Integer hmType = hmQrcodeListDTO.getHmType();
if (hmType == 1) { if (hmType == 1) {
...@@ -177,6 +177,7 @@ public class HmQrcodeController { ...@@ -177,6 +177,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId()); clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId());
clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode()); clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode());
clerkDTOList.add(clerkDTO); clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO(); HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmQrcodeListDTO.getStoreId()); storeDTO.setStoreId(hmQrcodeListDTO.getStoreId());
storeDTO.setStoreName(hmQrcodeListDTO.getStoreName()); storeDTO.setStoreName(hmQrcodeListDTO.getStoreName());
...@@ -195,6 +196,7 @@ public class HmQrcodeController { ...@@ -195,6 +196,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId()); clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId());
clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode()); clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode());
clerkDTOList.add(clerkDTO); clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO(); HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmClerkRelationDTO.getStoreId()); storeDTO.setStoreId(hmClerkRelationDTO.getStoreId());
storeDTO.setStoreName(hmClerkRelationDTO.getStoreName()); storeDTO.setStoreName(hmClerkRelationDTO.getStoreName());
......
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