Commit 2051c88c by guojx

Merge remote-tracking branch 'origin/developer' into developer

parents 3005aef1 2eb48fa4
......@@ -101,6 +101,8 @@ public class HmQrcodeQDTO implements Serializable {
*/
private Integer invokingType = 0;
private String addStaffName;
public Long getHmId() {
return hmId;
......@@ -365,5 +367,13 @@ public class HmQrcodeQDTO implements Serializable {
public void setInvokingType(Integer invokingType) {
this.invokingType = invokingType;
}
public String getAddStaffName() {
return addStaffName;
}
public void setAddStaffName(String addStaffName) {
this.addStaffName = addStaffName;
}
}
package com.gic.haoban.manage.service.dao.mapper.hm;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeListQDTO;
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.HmQrcodeClerkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 活码(TabHaobanHmQrcode)表数据库访问层
......@@ -103,7 +102,8 @@ public interface TabHaobanHmQrcodeMapper {
List<TabHaobanHmQrcode> listByStoreId(
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("storeId") String storeId,
@Param("overFlag") Integer overFlag);
@Param("overFlag") Integer overFlag,
@Param("hmType") Integer hmType);
/**
* 通过id添加num
......@@ -147,7 +147,8 @@ public interface TabHaobanHmQrcodeMapper {
*/
TabHaobanHmQrcode queryByClerkIdAndOverFlag(@Param("clerkId") String clerkId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("overFlag") Integer overFlag);
@Param("overFlag") Integer overFlag,
@Param("hmType") Integer hmType);
/**
* 活码门店ids
......
......@@ -9,8 +9,6 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* 活码(TabHaobanHmQrcode)表服务接口
......@@ -82,7 +80,7 @@ public interface HmQrcodeService {
* @author mozhu
* @date 2022-07-07 17:19:08
*/
List<HmQrcodeBO> listByStoreId(String wxEnterpriseId,String storeId, Integer overFlag);
List<HmQrcodeBO> listByStoreId(String wxEnterpriseId, String storeId, Integer overFlag,Integer hmType);
/**
* 通过id添加num
......@@ -112,7 +110,7 @@ public interface HmQrcodeService {
* @author mozhu
* @date 2022-07-07 17:19:02
*/
HmQrcodeBO queryByClerkId(String clerkId,String wxEnterpriseId);
HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId);
/**
* 查询职员id 有效
......@@ -120,11 +118,12 @@ public interface HmQrcodeService {
* @param clerkId 职员id
* @param wxEnterpriseId wx企业标识
* @param overFlag 在国旗
* @param hmType hm型
* @return {@link HmQrcodeBO }
* @author mozhu
* @date 2022-07-07 17:24:57
* @date 2022-07-27 14:52:40
*/
HmQrcodeBO queryByClerkId(String clerkId,String wxEnterpriseId,Integer overFlag);
HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer overFlag,Integer hmType);
/**
......@@ -136,27 +135,30 @@ public interface HmQrcodeService {
* @author mozhu
* @date 2022-07-07 16:18:13
*/
int updateStatusById(Long hmId,Integer statusFlag);
int updateStatusById(Long hmId, Integer statusFlag);
/**
* 活码门店ids
*
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link HmQrcodeBO }>
* @author mozhu
* @date 2022-07-08 15:09:50
* @date 2022-07-27 14:52:03
*/
List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId , String enterpriseId);
List<HmQrcodeBO> getHmStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId);
/**
* 根据分组id获取活码数量
*
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @param groupIds 组id
* @param hmIds hm id
* @return {@link List }<{@link HmQrcodeGroupNumBO }>
* @author mozhu
* @date 2022-07-12 17:38:43
* @date 2022-07-27 14:52:10
*/
List<HmQrcodeGroupNumBO> getGroupIdNumByEnterpriseId(String wxEnterpriseId, String enterpriseId, List<Long> groupIds, List<String> hmIds);
......@@ -172,20 +174,21 @@ public interface HmQrcodeService {
/**
* 批量修改活码分组
*
* @param hmIds
* @param groupId
* @return
*/
int batchUpdateQrcodeGroup(List<Long> hmIds, Long groupId);
int getCanAddCount(String wxEnterpriseId , String enterpriseId , String clerkId) ;
int getCanAddCount(String wxEnterpriseId, String enterpriseId, String clerkId);
List<HmQrcodeClerkBO> listCanAddClerk(String wxEnterpriseId , String enterpriseId , String clerkId) ;
List<HmQrcodeClerkBO> listCanAddClerk(String wxEnterpriseId, String enterpriseId, String clerkId);
List<String> getHmStoreForWxa(String wxEnterpriseId ,String enterpriseId);
List<String> getHmStoreForWxa(String wxEnterpriseId, String enterpriseId);
List<String> listHmIdForIndex(HmQrcodeListQDTO qdto);
List<String> listHasQrcodeClerk(String enterpriseId , List<String> clerkIdList) ;
List<String> listHasQrcodeClerk(String enterpriseId, List<String> clerkIdList);
}
......@@ -84,9 +84,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public List<HmQrcodeBO> listByStoreId(String wxEnterpriseId, String storeId, Integer overFlag) {
public List<HmQrcodeBO> listByStoreId(String wxEnterpriseId, String storeId, Integer overFlag,Integer hmType) {
return EntityUtil.changeEntityListNew(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag));
tabHaobanHmQrcodeMapper.listByStoreId(wxEnterpriseId, storeId, overFlag,hmType));
}
@Override
......@@ -106,9 +106,9 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer overFlag) {
public HmQrcodeBO queryByClerkId(String clerkId, String wxEnterpriseId, Integer overFlag,Integer hmType) {
return EntityUtil.changeEntity(HmQrcodeBO.class,
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag));
tabHaobanHmQrcodeMapper.queryByClerkIdAndOverFlag(clerkId, wxEnterpriseId, overFlag,hmType));
}
@Override
......
......@@ -519,6 +519,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.error("任务重新分配问题发送消息队列出错",e);
}
}
}
}
......
package com.gic.haoban.manage.service.service.out.impl.hm;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
......@@ -30,11 +13,7 @@ import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreSettingDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkWxaDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.hm.*;
import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO;
import com.gic.haoban.manage.api.service.hm.HmLinkApiService;
import com.gic.haoban.manage.service.config.Config;
......@@ -49,11 +28,7 @@ import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
import com.gic.haoban.manage.service.service.KeyDataService;
import com.gic.haoban.manage.service.service.MemberQueryService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.HmLinkStoreService;
import com.gic.haoban.manage.service.service.hm.HmPageService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.haoban.manage.service.service.hm.*;
import com.gic.member.api.dto.MemberClerkDTO;
import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.member.api.dto.es.MemberStoreClerkDataDTO;
......@@ -63,6 +38,17 @@ import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactResultDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service("hmLinkApiService")
public class HmLinkApiServiceImpl implements HmLinkApiService {
......@@ -494,7 +480,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if (StringUtils.isBlank(clerkId) || "-1".equals(clerkId)) {
return null;
}
HmQrcodeBO hm = this.hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId, 0);
HmQrcodeBO hm = this.hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId, 0,1);
return hm;
}
......@@ -519,7 +505,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
// 店员需要过滤主导购、店长
log.info("过滤的导购={}",clerkIdList);
if (null == hm && dy == 1) {
List<HmQrcodeBO> list = this.hmQrcodeService.listByStoreId(wxEnterpriseId, inStoreId, 0);
List<HmQrcodeBO> list = this.hmQrcodeService.listByStoreId(wxEnterpriseId, inStoreId, 0,1);
if (CollectionUtils.isNotEmpty(list)) {
log.info("查询门店下有活码的导购数={}",list.size());
list = list.stream().filter(dto -> !clerkIdList.contains(dto.getClerkId())).collect(Collectors.toList());
......
......@@ -293,6 +293,8 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getModifierId(), hmQrcodeQDTO.getModifierName());
//操作日志
updateSystemLog(hmQrcodeQDTO, hmId);
int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
......@@ -329,11 +331,22 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
logContent.append("活码分组「").append(hmGroupSettingBOOld.getGroupName()).append("」").append("变更为「").append(hmGroupSettingBO.getGroupName()).append("」");
}
//员工变更
String staffId = hmQrcodeQDTO.getStaffId();
String staffIdOld = hmOld.getStaffId();
if (!staffId.equals(staffIdOld)) {
logContent.append("新增使用成员「").append(hmQrcodeQDTO.getStaffName()).append("」").append("删除使用成员「").append(hmOld.getStaffName()).append("」");
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
List<HmClerkRelationBO> hmClerkRelationBOS = hmClerkRelationService.queryByHmIdNotInClerkIds(hmId, clerkIdList);
if (CollectionUtils.isNotEmpty(hmClerkRelationBOS)) {
//删除员工
StringBuffer staffNameBuffer = new StringBuffer();
for (HmClerkRelationBO hmClerkRelationBO : hmClerkRelationBOS) {
staffNameBuffer.append(hmClerkRelationBO.getStaffName()).append(" ");
}
logContent.append("删除使用成员「").append(staffNameBuffer.toString()).append("」");
}
//新增员工
String addStaffName = hmQrcodeQDTO.getAddStaffName();
if (StringUtils.isNotBlank(addStaffName)) {
logContent.append("新增使用成员「").append(addStaffName).append("」");
}
Integer passFlag = hmQrcodeQDTO.getPassFlag();
Integer passFlagOld = hmOld.getPassFlag();
if (!passFlag.equals(passFlagOld)) {
......@@ -423,28 +436,30 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return null;
}
String enterpriseId = hmQrcodeQDTO.getEnterpriseId();
//单人活码
String clerkId = clerkIdList.get(0);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) {
String name = hmQrcodeQDTO.getName();
if (StringUtils.isBlank(name)) {
hmQrcodeQDTO.setName(clerkDTO.getClerkName());
}
}
if (hmType == 2) {
//多人活码
insertHmClerkRelation(enterpriseId, wxEnterpriseId, hmId, clerkIdList, addFlag);
insertHmClerkRelation(hmQrcodeQDTO,enterpriseId, wxEnterpriseId, hmId, clerkIdList, addFlag);
} else if (hmType == 1) {
//单人活码
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (addFlag && hmQrcodeBO != null) {
logger.error("已经生成过活码,clerkId:{}", clerkId);
return null;
}
}
hmQrcodeQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) {
String name = hmQrcodeQDTO.getName();
String clerkName = clerkDTO.getClerkName();
if (StringUtils.isBlank(name)) {
hmQrcodeQDTO.setName(clerkName);
}
hmQrcodeQDTO.setClerkName(clerkName);
hmQrcodeQDTO.setClerkName(clerkDTO.getClerkName());
hmQrcodeQDTO.setClerkCode(clerkDTO.getClerkCode());
String storeId = clerkDTO.getStoreId();
hmQrcodeQDTO.setStoreId(storeId);
......@@ -454,6 +469,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setStoreName(storeDTO.getStoreName());
}
}
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
if (staffClerkRelationDTO != null) {
hmQrcodeQDTO.setStaffId(staffClerkRelationDTO.getStaffId());
......@@ -463,6 +479,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmQrcodeQDTO.setWxUserId(tabHaobanStaff.getWxUserId());
}
}
}
return clerkIdList;
}
......@@ -474,7 +491,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
* @param clerkIdList
* @param addFlag
*/
private void insertHmClerkRelation(String enterpriseId,String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) {
private void insertHmClerkRelation(HmQrcodeQDTO hmQrcodeQDTO,String enterpriseId,String wxEnterpriseId, Long hmId, List<String> clerkIdList, Boolean addFlag) {
Date now = new Date();
if (!addFlag) {
//修改,删除其余无效导购
......@@ -485,7 +502,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
}
}
StringBuffer addStaffName = new StringBuffer();
for (String clerkId : clerkIdList) {
HmClerkRelationBO hmClerkRelationBO = hmClerkRelationService.queryByHmIdAndClerkId(hmId, clerkId);
if (hmClerkRelationBO != null) {
......@@ -520,6 +537,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
TabHaobanStaff tabHaobanStaff = staffService.selectById(staffClerkRelationDTO.getStaffId());
if (tabHaobanStaff != null) {
hmClerkRelationQDTO.setStaffName(tabHaobanStaff.getStaffName());
addStaffName.append(tabHaobanStaff.getStaffName()).append(" ");
}
}
hmClerkRelationQDTO.setStatus(1);
......@@ -529,6 +547,10 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setAddNum(0);
hmClerkRelationService.insert(hmClerkRelationQDTO);
}
if (addStaffName != null && addStaffName.length() > 0){
hmQrcodeQDTO.setAddStaffName(addStaffName.toString());
}
}
......
......@@ -272,6 +272,9 @@
<if test="overFlag != null">
and over_flag = #{overFlag}
</if>
<if test="hmType != null">
and hm_type = #{hmType}
</if>
</select>
<update id="updateAddNumById">
......@@ -307,7 +310,12 @@
<include refid="Base_Column_List"></include>
from tab_haoban_hm_qrcode
where clerk_id = #{clerkId} and status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and over_flag = #{overFlag} limit 1
and wx_enterprise_id = #{wxEnterpriseId}
and over_flag = #{overFlag}
<if test="hmType != null">
and hm_type = #{hmType}
</if>
limit 1
</select>
......
package com.gic.haoban.manage.web.controller.hm;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.gic.haoban.manage.web.utils.statistics.DateUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.BasePageInfo;
......@@ -43,9 +28,12 @@ import com.gic.haoban.manage.web.qo.hm.HmQrcodeUpdateQO;
import com.gic.haoban.manage.web.qo.hm.data.HmDetailClerkListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmQrcodeListQO;
import com.gic.haoban.manage.web.qo.hm.data.HmTrendQO;
import com.gic.haoban.manage.web.utils.statistics.DataStatisticsParamUtils;
import com.gic.haoban.manage.web.utils.statistics.DateUtils;
import com.gic.haoban.manage.web.vo.hm.HmDetailClerkListVO;
import com.gic.haoban.manage.web.vo.hm.HmTrendVO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -53,9 +41,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
/**
* 活码(TabHaobanHmQrcode)表控制层
......@@ -226,11 +214,11 @@ public class HmQrcodeController {
if (hmGroupDTO != null) {
hmQrcodeListDTO.setHmGroupName(hmGroupDTO.getGroupName());
}
//if (CollectionUtils.isNotEmpty(storeDTOList)) {
// //门店id去重
// storeDTOList = storeDTOList.stream()
// .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(HmStoreDTO::getStoreId))), ArrayList::new));
//}
if (CollectionUtils.isNotEmpty(storeDTOList)) {
//门店id去重
storeDTOList = storeDTOList.stream().filter(c-> StringUtils.isNotBlank(c.getStoreId()))
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(HmStoreDTO::getStoreId))), ArrayList::new));
}
hmQrcodeListDTO.setClerkList(clerkDTOList);
hmQrcodeListDTO.setStoreList(storeDTOList);
}
......@@ -370,7 +358,7 @@ public class HmQrcodeController {
} else if (hmType == 2) {
statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_many_detail, hmDetailClerkListQO);
}
return RestResponse.successResult(statisticsDTO);
return DataStatisticsParamUtils.responsePage(statisticsDTO);
}
......
......@@ -5,6 +5,7 @@ import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.manage.api.dto.statistics.StatisticsDTO;
import com.gic.haoban.manage.api.dto.statistics.StatisticsPage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -74,10 +75,13 @@ public class DataStatisticsParamUtils {
}
Page page = new Page();
page.setResult(statisticsDTO.getData());
page.setPageSize(statisticsDTO.getPage().getPageSize());
page.setCurrentPage(statisticsDTO.getPage().getCurrentPage());
page.setTotalPage(statisticsDTO.getPage().getTotalPage());
page.setTotalCount(statisticsDTO.getPage().getTotalCount());
StatisticsPage statisticsPage = statisticsDTO.getPage();
if (statisticsPage != null) {
page.setPageSize(statisticsPage.getPageSize());
page.setCurrentPage(statisticsPage.getCurrentPage());
page.setTotalPage(statisticsPage.getTotalPage());
page.setTotalCount(statisticsPage.getTotalCount());
}
return RestResponse.successResult(page);
}
......
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