Commit e732cabf by 墨竹

活码修改

parent 0b5ba891
......@@ -140,5 +140,17 @@ public interface TabHaobanHmClerkRelationMapper {
* @date 2022-07-21 16:32:43
*/
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 {
*/
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 {
public int updateStatusById(Integer status, Long 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 {
if (CollectionUtils.isEmpty(clerkIdList)) {
return null;
}
String enterpriseId = hmQrcodeQDTO.getEnterpriseId();
//单人活码
String clerkId = clerkIdList.get(0);
if (hmType == 2) {
//多人活码
insertHmClerkRelation(hmQrcodeQDTO, wxEnterpriseId, hmId, clerkIdList, addFlag);
insertHmClerkRelation(enterpriseId, wxEnterpriseId, hmId, clerkIdList, addFlag);
} else if (hmType == 1) {
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (addFlag && hmQrcodeBO != null) {
......@@ -467,17 +468,27 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
/**
* 多人活码关联关系
*
* @param hmQrcodeQDTO
* @param enterpriseId
* @param wxEnterpriseId
* @param hmId
* @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();
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) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (addFlag && hmClerkRelationBO != null) {
if (hmClerkRelationBO != null) {
logger.error("该导购已经在该多人活码中,clerkId:{}", clerkId);
continue;
}
......@@ -488,7 +499,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setHmId(hmId);
hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId());
hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId);
hmClerkRelationQDTO.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId());
hmClerkRelationQDTO.setEnterpriseId(enterpriseId);
hmClerkRelationQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) {
......
......@@ -190,5 +190,15 @@
where relation_id = #{relationId}
</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>
......@@ -165,10 +165,10 @@ public class HmQrcodeController {
hmQrcodeListQO.getInFields().setHmId(stringBuffer.toString());
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
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)) {
for (HmQrcodeListDTO hmQrcodeListDTO : data) {
List<HmStoreDTO> storeDTOList = new ArrayList<>();
List<HmClerkDTO> clerkDTOList = new ArrayList<>();
Long hmId = hmQrcodeListDTO.getHmId();
Integer hmType = hmQrcodeListDTO.getHmType();
if (hmType == 1) {
......@@ -177,6 +177,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmQrcodeListDTO.getClerkId());
clerkDTO.setClerkCode(hmQrcodeListDTO.getClerkCode());
clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmQrcodeListDTO.getStoreId());
storeDTO.setStoreName(hmQrcodeListDTO.getStoreName());
......@@ -195,6 +196,7 @@ public class HmQrcodeController {
clerkDTO.setClerkId(hmClerkRelationDTO.getClerkId());
clerkDTO.setClerkCode(hmClerkRelationDTO.getClerkCode());
clerkDTOList.add(clerkDTO);
HmStoreDTO storeDTO = new HmStoreDTO();
storeDTO.setStoreId(hmClerkRelationDTO.getStoreId());
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