Commit da65a23c by 徐高华

Merge branch 'developer' of http://git.gicdev.com/haoban3.0/haoban-manage3.0.git into developer

parents 202ea1e4 8466f382
......@@ -122,6 +122,15 @@ public interface HmQrcodeApiService {
*/
void checkStaffOpenContact(String param);
/**
* 检查员工开启联系我
*
* @param wxEnterpriseId wx企业标识
* @author mozhu
* @date 2022-07-19 15:53:37
*/
void checkStaffOpenContactByWxEnterpriseId(String wxEnterpriseId);
/**
* 活码门店ids
......
......@@ -60,7 +60,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
......@@ -600,9 +599,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
//查询出所有正常的导购
String wxEnterpriseId = tabHaobanWxEnterpris.getWxEnterpriseId();
//企微已经开启联系我
String wxUserIds = qywxUserApiService.listCorpExternalUser(tabHaobanWxEnterpris.getCorpid(), config.getWxSuiteid());
String[] split = wxUserIds.split(",");
List<String> wxUserIdsList = Arrays.asList(split);
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(tabHaobanWxEnterpris.getCorpid(), config.getWxSuiteid());
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
logger.error("无导购关联数据");
......@@ -643,6 +640,49 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
@Override
public void checkStaffOpenContactByWxEnterpriseId(String wxEnterpriseId) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
//查询出所有正常的导购
//企微已经开启联系我
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid());
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
logger.error("无导购关联数据");
return;
}
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
//具有联系我功能的导购创建活码
staffClerkRelationService.updateOpenConcatFlagById(1, staffClerkRelationDTO.getStaffClerkRelationId());
//创建活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmType(1);
hmQrcodeQDTO.setWxEnterpriseId(wxEnterpriseId);
hmQrcodeQDTO.setEnterpriseId(staffClerkRelationDTO.getEnterpriseId());
hmQrcodeQDTO.setName(staffClerkRelationDTO.getStaffName());
hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId(staffClerkRelationDTO.getStoreId());
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(staffClerkRelationDTO.getClerkId()));
add(hmQrcodeQDTO);
}
List<StaffClerkRelationDTO> relationDTOS = staffClerkRelationService.listIdsByNotInWxOpenUserIds(wxUserIdsList, wxEnterpriseId);
if (CollectionUtils.isEmpty(relationDTOS)) {
logger.error("无导购不包含关联数据");
return;
}
for (StaffClerkRelationDTO relationDTO : relationDTOS) {
//有活码,但是企微联系我功能 被关闭
String clerkId = relationDTO.getClerkId();
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, relationDTO.getWxEnterpriseId());
if (hmQrcodeBO == null) {
logger.info("导购无活码,无需处理:clerkId:{}", clerkId);
continue;
}
hmQrcodeService.updateStatusById(hmQrcodeBO.getHmId(), 3);
}
}
@Override
public List<HmQrcodeStoreDTO> getHmStoreByEnterpriseId(String enterpriseId) {
String key = "HM:STORE:" + enterpriseId;
Object cache = RedisUtil.getCache(key);
......
......@@ -38,19 +38,19 @@
<!--新增所有列-->
<insert id="insert" keyProperty="relationId" useGeneratedKeys="true">
insert into tab_haoban_hm_clerk_relation(hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
insert into tab_haoban_hm_clerk_relation(relation_id,hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
store_name, store_code, clerk_id, clerk_name, clerk_code, status,
create_time, update_time, over_flag, add_num,staff_id,staff_name)
values (#{hmId}, #{wxUserId}, #{wxEnterpriseId}, #{enterpriseId}, #{storeId}, #{storeName}, #{storeCode},
values (#{relationId},#{hmId}, #{wxUserId}, #{wxEnterpriseId}, #{enterpriseId}, #{storeId}, #{storeName}, #{storeCode},
#{clerkId}, #{clerkName}, #{clerkCode}, #{status}, #{createTime}, #{updateTime}, #{overFlag}, #{addNum},#{staffId},#{staffName})
</insert>
<insert id="insertBatch" keyProperty="relationId" useGeneratedKeys="true">
insert into tab_haoban_hm_clerk_relation(hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
insert into tab_haoban_hm_clerk_relation(relation_id,hm_id, wx_user_id, wx_enterprise_id, enterprise_id, store_id,
store_name, store_code, clerk_id, clerk_name, clerk_code, status, create_time, update_time, over_flag,add_num,staff_id,staff_name)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.hmId}, #{entity.wxUserId}, #{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.storeId},
(#{entity.relationId},#{entity.hmId}, #{entity.wxUserId}, #{entity.wxEnterpriseId}, #{entity.enterpriseId}, #{entity.storeId},
#{entity.storeName}, #{entity.storeCode}, #{entity.clerkId}, #{entity.clerkName}, #{entity.clerkCode},
#{entity.status}, #{entity.createTime}, #{entity.updateTime}, #{entity.overFlag},#{entity.addNum},
#{entity.staffId},#{entity.staffName})
......
......@@ -51,4 +51,9 @@ public class ServiceTest {
}
@Test
public void test2() {
hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId("5bd929fd3b2c49deaa1184bcb0d669b3");
}
}
......@@ -7,6 +7,7 @@ import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo;
......@@ -61,17 +62,12 @@ public class TestController extends WebBaseController {
private TestApiService testApiService;
@Autowired
private DepartmentApiService departmentApiService;
@Autowired
private MaidianLogApiService maidianLogApiService;
@Autowired
private WxEnterpriseRelatedApiService wxEnterpriseRelatedApiService;
@Autowired
private ExternalClerkRelatedApiService externalClerkRelatedApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
......@@ -81,6 +77,8 @@ public class TestController extends WebBaseController {
private WxApplicationApiService wxApplicationApiService;
@Autowired
private Config config;
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
......@@ -321,4 +319,11 @@ public class TestController extends WebBaseController {
List<QywxNewUseridDTO> list = qywxUserApiService.getSelfUseridToOpenuserid(corpid, secret, Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, list);
}
@RequestMapping("/checkStaffOpenContactByWxEnterpriseId")
public HaobanResponse checkStaffOpenContact(String wxEnterpriseId) {
hmQrcodeApiService.checkStaffOpenContactByWxEnterpriseId(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
}
......@@ -9,6 +9,9 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.gic.haoban.manage.web.qo.hm.data.HmLinkChartQO;
import com.gic.haoban.manage.web.qo.hm.data.HmLinkClerkListQO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
......@@ -597,12 +600,12 @@ public class HmLinkController {
// 链接统计
@RequestMapping("statistics/total")
public RestResponse<Object> statistics(Long linkId) {
public RestResponse<Object> statistics(@RequestBody HmLinkChartQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
JSONObject jsonObject = new JSONObject();
jsonObject.put("enterpriseId", loginUser.getEnterpriseId());
jsonObject.put("linkId", linkId);
jsonObject.put("linkId", qo.getLinkId());
JSONObject param = DataStatisticsParamUtils.getParamNoPage(jsonObject);
// HmLinkStatisticsVO vo = new HmLinkStatisticsVO();
return DataStatisticsParamUtils
......@@ -611,9 +614,12 @@ public class HmLinkController {
// 统计图表
@RequestMapping("statistics/chart")
public RestResponse<Object> statisticsChart(Long linkId, Date startTime, Date endTime) {
public RestResponse<Object> statisticsChart(@RequestBody HmLinkChartQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
Long linkId = qo.getLinkId();
Date startTime = qo.getStartTime();
Date endTime = qo.getEndTime();
JSONObject jsonObject = new JSONObject();
jsonObject.put("enterpriseId", loginUser.getEnterpriseId());
jsonObject.put("linkId", linkId);
......@@ -675,36 +681,17 @@ public class HmLinkController {
// 导购统计
@RequestMapping("statistics/clerk")
public RestResponse<Object> statisticsClerk(Long linkId, String storeSearchParams, String clerkSearchParams,
Date startTime, Date endTime, BasePageInfo basePageInfo, String sortColumn, String sortType) {
public RestResponse<Object> statisticsClerk(@RequestBody HmLinkClerkListQO qo) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
JSONObject jsonObject = new JSONObject();
jsonObject.put("enterpriseId", loginUser.getEnterpriseId());
jsonObject.put("linkId", linkId);
if (startTime != null) {
jsonObject.put("startTime", DateUtil.getStartTimeOfDay(startTime));
qo.getInFields().setEnterpriseId(loginUser.getEnterpriseId());
if (qo.getInFields().getStartTime() != null) {
qo.getInFields().setStartTime(DateUtil.getStartTimeOfDay(qo.getInFields().getStartTime()));
}
if (endTime != null) {
jsonObject.put("endTime", DateUtil.getEndTimeOfDay(endTime));
if (qo.getInFields().getEndTime() != null) {
qo.getInFields().setEndTime(DateUtil.getEndTimeOfDay(qo.getInFields().getEndTime()));
}
if (StringUtils.isNotBlank(storeSearchParams)) {
jsonObject.put("linkSelect1", storeSearchParams);
}
if (StringUtils.isNotBlank(clerkSearchParams)) {
jsonObject.put("linkSelect2", clerkSearchParams);
}
if (StringUtils.isBlank(sortColumn)) {
// 今日新增人数
sortColumn = "addNum";
}
if (StringUtils.isBlank(sortType)) {
sortType = "desc";
}
jsonObject.put("orderByField", sortColumn + " " + sortType);
JSONObject param = DataStatisticsParamUtils.getParam(basePageInfo, jsonObject);
return DataStatisticsParamUtils
.responsePage(DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_link_detail, param));
.responsePage(DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_link_detail, qo));
}
/**
......
......@@ -126,8 +126,11 @@ public class HmQrcodeController {
if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()),HaoBanErrCode.ERR_100007.getMsg());
}
if (!storeList.contains("-1")) {
hmQrcodeListQO.getInFields().setStoreId(storeList);
StringBuffer stringBuffer = new StringBuffer();
storeList.forEach(c-> stringBuffer.append(c).append(","));
hmQrcodeListQO.getInFields().setStoreId(stringBuffer.toString());
}
StatisticsDTO statisticsDTO = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_list, hmQrcodeListQO);
......
package com.gic.haoban.manage.web.qo.hm.data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author guojx
* @Date 2022/7/19 16:35
*/
public class HmLinkChartQO implements Serializable {
private Long linkId;
private Date startTime;
private Date endTime;
public Long getLinkId() {
return linkId;
}
public HmLinkChartQO setLinkId(Long linkId) {
this.linkId = linkId;
return this;
}
public Date getStartTime() {
return startTime;
}
public HmLinkChartQO setStartTime(Date startTime) {
this.startTime = startTime;
return this;
}
public Date getEndTime() {
return endTime;
}
public HmLinkChartQO setEndTime(Date endTime) {
this.endTime = endTime;
return this;
}
}
package com.gic.haoban.manage.web.qo.hm.data;
import java.io.Serializable;
import java.util.Date;
public class HmLinkClerkListQO implements Serializable {
private InFields inFields;
private Integer pageNo;
private Integer pageSize;
public InFields getInFields() {
return inFields;
}
public void setInFields(InFields inFields) {
this.inFields = inFields;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public static class InFields {
private String enterpriseId;
private Long linkId;
private Date startTime;
private Date endTime;
private String orderByField;
/**
* 门店名/code
*/
private String linkSelect1;
/**
* 导购code/名称
*/
private String linkSelect2;
public String getEnterpriseId() {
return enterpriseId;
}
public InFields setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
return this;
}
public Long getLinkId() {
return linkId;
}
public InFields setLinkId(Long linkId) {
this.linkId = linkId;
return this;
}
public Date getStartTime() {
return startTime;
}
public InFields setStartTime(Date startTime) {
this.startTime = startTime;
return this;
}
public Date getEndTime() {
return endTime;
}
public InFields setEndTime(Date endTime) {
this.endTime = endTime;
return this;
}
public String getOrderByField() {
return orderByField;
}
public InFields setOrderByField(String orderByField) {
this.orderByField = orderByField;
return this;
}
public String getLinkSelect1() {
return linkSelect1;
}
public InFields setLinkSelect1(String linkSelect1) {
this.linkSelect1 = linkSelect1;
return this;
}
public String getLinkSelect2() {
return linkSelect2;
}
public InFields setLinkSelect2(String linkSelect2) {
this.linkSelect2 = linkSelect2;
return this;
}
}
}
......@@ -2,7 +2,6 @@ package com.gic.haoban.manage.web.qo.hm.data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 活码(TabHaobanHmQrcode)实体类
......@@ -76,7 +75,7 @@ public class HmQrcodeListQO implements Serializable {
*/
private Long hmGroupId;
private List<String> storeId;
private String storeId;
public Long getHmId() {
return hmId;
......@@ -174,11 +173,11 @@ public class HmQrcodeListQO implements Serializable {
this.hmGroupId = hmGroupId;
}
public List<String> getStoreId() {
public String getStoreId() {
return storeId;
}
public void setStoreId(List<String> storeId) {
public void setStoreId(String storeId) {
this.storeId = storeId;
}
}
......
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