Commit 7f96451a by guojx

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

parents 44bb1cb3 77a6b75f
......@@ -22,7 +22,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-05 10:59:08
*/
int add(HmQrcodeQDTO hmQrcodeQDTO);
ServiceResponse add(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 更新
......@@ -32,7 +32,7 @@ public interface HmQrcodeApiService {
* @author mozhu
* @date 2022-07-05 10:59:06
*/
int update(HmQrcodeQDTO hmQrcodeQDTO);
ServiceResponse update(HmQrcodeQDTO hmQrcodeQDTO);
/**
* 查询详情
......
package com.gic.haoban.manage.service.dao.mapper.hm;
import java.util.List;
import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp;
/**
*
* @ClassName: TabHaobanHmQrcodeTempMapper
* @Description: TODO
* @Author 徐高华
* @Date 2022年07月14日 12:24:43
* @Modify
* @CopyRight
*/
public interface HmQrcodeTempMapper {
/**
* 新增
* @Title: insert
* @Description: TODO
* @Param @param TabHaobanHmQrcodeTemp
*/
public int insert(TabHmQrcodeTemp entity);
public int deleteByPrimaryKey(Long id);
public int deleteByRelationId(String id);
TabHmQrcodeTemp selectByRelationId(String relationId);
/**
* 通过条件查询
* @Title: listAll
* @Description: TODO
* @Param @param TabHaobanHmQrcodeTemp
* @Param @return
* @Return List
* @Throws
*/
public List<TabHmQrcodeTemp> listAll();
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ 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.WxUserAddLogSearchQDTO;
import com.gic.haoban.manage.service.entity.hm.TabWxUserAddLog;
......@@ -45,7 +47,7 @@ public interface WxUserAddLogMapper {
* @return
* @throws
*/
public TabWxUserAddLog selectNewLog(String externalUserid, String wxUserId);
public TabWxUserAddLog selectNewLog(@Param("externalUserid")String externalUserid, @Param("wxUserId")String wxUserId);
/**
......
package com.gic.haoban.manage.service.entity.hm;
import java.io.Serializable;
/**
*
* @ClassName: TabHaobanHmQrcodeTemp
* @Description: TODO
* @Author 徐高华
* @Date 2022年07月14日 12:24:43
* @Modify
* @CopyRight
*/
public class TabHmQrcodeTemp implements Serializable {
private static final long serialVersionUID = 759835662265000L;
private Long id;
private String wxConfigId;
private String wxQrcode;
private String wxEnterpriseId;
private java.util.Date createTime;
private java.util.Date updateTime;
/**1有效 0已删除*/
private Integer statusFlag;
private String relationId ;
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setWxConfigId(String wxConfigId) {
this.wxConfigId = wxConfigId;
}
public String getWxConfigId() {
return wxConfigId;
}
public void setWxQrcode(String wxQrcode) {
this.wxQrcode = wxQrcode;
}
public String getWxQrcode() {
return wxQrcode;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
public java.util.Date getCreateTime() {
return createTime;
}
public void setUpdateTime(java.util.Date updateTime) {
this.updateTime = updateTime;
}
public java.util.Date getUpdateTime() {
return updateTime;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ public class HmQrcodeGroupNumBO implements Serializable {
private static final long serialVersionUID = -7006820026168431701L;
private Integer num;
private Integer hmGroupId;
private Long hmGroupId;
private String hmGroupName;
public Integer getNum() {
......@@ -17,11 +17,11 @@ public class HmQrcodeGroupNumBO implements Serializable {
this.num = num;
}
public Integer getHmGroupId() {
public Long getHmGroupId() {
return hmGroupId;
}
public void setHmGroupId(Integer hmGroupId) {
public void setHmGroupId(Long hmGroupId) {
this.hmGroupId = hmGroupId;
}
......
package com.gic.haoban.manage.service.pojo.bo.welcome;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2022/7/14 3:26 PM
* @Description
* @Version
**/
public class WelcomeReferBO implements Serializable {
private static final long serialVersionUID = 6490051043315353967L;
/**
* @see com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType
*/
private Integer type;
private String referId;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getReferId() {
return referId;
}
public void setReferId(String referId) {
this.referId = referId;
}
}
package com.gic.haoban.manage.service.pojo.qo;
import java.io.Serializable;
/**
*
* @ClassName: TabHaobanHmQrcodeTemp
* @Description: TODO
* @Author 徐高华
* @Date 2022年07月14日 12:24:43
* @Modify
* @CopyRight
*/
public class HmQrcodeTempQO implements Serializable {
private static final long serialVersionUID = 759835662265000L;
private Long id;
private String wxConfigId;
private String wxQrcode;
private String wxEnterpriseId;
private java.util.Date createTime;
private java.util.Date updateTime;
/**1有效 0已删除*/
private Integer statusFlag;
private String relationId ;
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setWxConfigId(String wxConfigId) {
this.wxConfigId = wxConfigId;
}
public String getWxConfigId() {
return wxConfigId;
}
public void setWxQrcode(String wxQrcode) {
this.wxQrcode = wxQrcode;
}
public String getWxQrcode() {
return wxQrcode;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
public java.util.Date getCreateTime() {
return createTime;
}
public void setUpdateTime(java.util.Date updateTime) {
this.updateTime = updateTime;
}
public java.util.Date getUpdateTime() {
return updateTime;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
}
\ No newline at end of file
......@@ -135,7 +135,7 @@ public interface WelcomeService {
* @param referId 活码 / 链接id
* @return
*/
WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, String referId);
WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, WelcomeReferBO welcomeReferBo);
/**
* 删除欢迎语
......
package com.gic.haoban.manage.service.service.hm;
import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
/**
*
* @ClassName: TabHaobanHmQrcodeTemp
* @Description: TODO
* @Author 徐高华
* @Date 2022年07月14日 12:24:43
* @Modify
* @CopyRight
*/
public interface HmQrcodeTempService {
/**
*
* @Title: save
* @Description: 保存临时活码
* @author xugh
* @param qo
* @throws
*/
public void save(HmQrcodeTempQO qo);
// 删除临时活码
public void deleteQrcode(String relationId);
public void deleteQrcodeById(Long id);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.hm;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import java.util.List;
......@@ -16,12 +17,10 @@ import java.util.List;
public interface WelcomeRelationService {
/**
* 查询欢迎语关联关系
* @param referId
* @param status
* 查询关联的欢迎语
* @return
*/
HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status);
String queryWelcomeRelation(WelcomeReferBO welcomeReferBo);
/**
* 条件查询 欢迎语引用列表
......
package com.gic.haoban.manage.service.service.hm.impl;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper;
import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp;
import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
@Service
public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
@Autowired
private HmQrcodeTempMapper hmQrcodeTempMapper;
@Override
public void save(HmQrcodeTempQO qo) {
TabHmQrcodeTemp entity = EntityUtil.changeEntityByJSON(TabHmQrcodeTemp.class, qo);
entity.setCreateTime(new Date());
entity.setUpdateTime(new Date());
entity.setStatusFlag(1);
entity.setId(UniqueIdUtils.uniqueLong());
this.hmQrcodeTempMapper.insert(entity);
}
@Override
public void deleteQrcode(String relationId) {
this.hmQrcodeTempMapper.deleteByRelationId(relationId);
}
@Override
public void deleteQrcodeById(Long id) {
this.hmQrcodeTempMapper.deleteByPrimaryKey(id);
}
}
......@@ -3,13 +3,13 @@ package com.gic.haoban.manage.service.service.hm.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.enums.WelcomeRelationStatusEnum;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
......@@ -27,7 +27,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
......@@ -46,7 +45,6 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
@Autowired
private WelcomeService welcomeService;
private static final String WELCOME_RELATION_KEY = "HM:welcome:relation:";
private static final Long WELCOME_RELATION_CACHE_TIME = 5 * 60L;
......@@ -54,24 +52,12 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
/**
* 查询欢迎语关联关系
*
* @param referId
* @param status
* @return
* @retur
*/
@Override
public HmWelcomeRelationBO queryWelcomeRelation(String referId, Integer status) {
String welcomeRelationCacheKey = WELCOME_RELATION_KEY + referId;
HmWelcomeRelationBO cache = RedisUtil.getCache(welcomeRelationCacheKey, HmWelcomeRelationBO.class);
if (cache != null) {
return cache;
}
List<TabHaobanWelcomeTemplateRelation> welcomeTemplateRelations = welcomeTemplateRelationMapper.queryWelTemplateRelation(null, referId, status);
if (CollectionUtils.isEmpty(welcomeTemplateRelations)) {
return null;
}
HmWelcomeRelationBO welcomeRelationBO = EntityUtil.changeEntityByOrika(HmWelcomeRelationBO.class, welcomeTemplateRelations.get(0));
RedisUtil.setCache(welcomeRelationCacheKey, welcomeRelationBO, WELCOME_RELATION_CACHE_TIME, TimeUnit.SECONDS);
return welcomeRelationBO;
public String queryWelcomeRelation(WelcomeReferBO welcomeReferBo) {
return null;
}
/**
......
......@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogSearchQDTO;
import com.gic.haoban.manage.service.dao.mapper.hm.WxUserAddLogMapper;
......@@ -53,6 +54,7 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService {
String externalUserid = qdto.getExternalUserid();
String wxUserId = qdto.getWxUserId();
TabWxUserAddLog entity = new TabWxUserAddLog();
entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setWxEnterpriseId(qdto.getWxEnterpriseId());
entity.setEnterpriseId(qdto.getEnterpriseId());
entity.setExternalUserid(externalUserid);
......@@ -61,9 +63,11 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService {
entity.setWxUserId(qdto.getWxUserId());
entity.setStaffId(qdto.getStaffId());
entity.setStaffName(qdto.getStaffName());
entity.setAllDelFlag(0);
if (qdto.isDelFlag()) {
TabWxUserAddLog log = this.wxUserAddLogMapper.selectNewLog(externalUserid, wxUserId);
entity = log;
entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setStatusFlag(2);
// 是否所有好友删除 1是0否
entity.setAllDelFlag(this.isAllDel(externalUserid));
......
......@@ -306,6 +306,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public List<String> listWxUserIdByClerkIds(List<String> clerkList, String wxEnterpriseId) {
if (CollectionUtils.isEmpty(clerkList)) {
return null;
}
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId);
}
......
package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.service.LinkService;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveCheckDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
......@@ -23,6 +25,8 @@ import com.gic.haoban.manage.service.entity.TabHaobanWelcomeMedia;
import com.gic.haoban.manage.service.entity.TabHaobanWelcomeSuitRang;
import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.entity.TabWelcome;
import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.FriendSettingDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.SaveFriendSettingBO;
......@@ -31,6 +35,7 @@ import com.gic.haoban.manage.service.pojo.bo.welcome.SaveWelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeListBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeSuitDepartmentBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeSuitStaffBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeInfoQO;
......@@ -38,6 +43,8 @@ import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.KeyDataService;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.WelcomeSuitRangService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
......@@ -85,7 +92,10 @@ public class WelcomeServiceImpl implements WelcomeService {
private WelcomeRelationService welcomeRelationService;
@Autowired
private KeyDataService keyDataService;
@Autowired
private HmLinkService linkService;
@Autowired
private HmQrcodeService qrcodeService;
private static final int WELCOME_LIMIT = 50;
private static final int DEPARTMENT_NUM_LIMIT = 10000;
private static final int STAFF_NUM_LIMIT = 2000;
......@@ -661,19 +671,36 @@ public class WelcomeServiceImpl implements WelcomeService {
}
@Override
public WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, String referId) {
logger.info("[getMatchWelcomeWithReferId] staffId:{}, wxEnterpriseId:{}, referId:{}",
staffId, wxEnterpriseId, referId);
public WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, WelcomeReferBO welcomeReferBo) {
logger.info("[getMatchWelcomeWithReferId] staffId:{}, wxEnterpriseId:{}, welcomeReferBo:{}",
staffId, wxEnterpriseId, JSON.toJSONString(welcomeReferBo));
if (StringUtils.isBlank(referId)){
if (welcomeReferBo == null || welcomeReferBo.getType() == null || StringUtils.isBlank(welcomeReferBo.getReferId())) {
return null;
}
HmWelcomeRelationBO welcomeRelationBO = welcomeRelationService.queryWelcomeRelation(referId, WelcomeRelationStatusEnum.ENABLE.getCode());
if (welcomeRelationBO == null){
// 不存在
String welcomeId = "";
try {
if (HmWelcomeReferType.LINK.getCode().equals(welcomeReferBo.getType())) {
HmLinkBO linkBo = linkService.getByLinkIdFormCache(null, null, Long.parseLong(welcomeReferBo.getReferId()));
if (linkBo == null || StringUtils.isBlank(linkBo.getWelcomeId())){
return null;
}
welcomeId = linkBo.getWelcomeId();
} else if (HmWelcomeReferType.HM.getCode().equals(welcomeReferBo.getType())) {
HmQrcodeBO qrcodeBo = qrcodeService.queryById(Long.parseLong(welcomeReferBo.getReferId()));
if (qrcodeBo == null || StringUtils.isBlank(qrcodeBo.getWelcomeId())){
return null;
}
welcomeId = qrcodeBo.getWelcomeId();
}
} catch (Exception ex) {
logger.error("[getMatchWelcomeWithReferId] err", ex);
}
logger.info("[getMatchWelcomeWithReferId] 获取欢迎语Id:{}, params:{}", welcomeId, JSON.toJSONString(welcomeReferBo));
if (StringUtils.isBlank(welcomeId)){
return null;
}
TabWelcome tabWelcome = welcomeMapper.selectByPrimaryKey(welcomeRelationBO.getWelcomeId());
TabWelcome tabWelcome = welcomeMapper.selectByPrimaryKey(welcomeId);
return convertWelcomeToBo(tabWelcome);
}
......
......@@ -35,6 +35,7 @@ import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.qdto.hm.WxUserAddLogQDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.WelcomeMediaTypeEnum;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.CheckQywxSettingApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.MaterialApiService;
......@@ -52,6 +53,7 @@ import com.gic.haoban.manage.service.pojo.QywxTagSyncInfoPojo;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeMediaBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.WelcomeReferBO;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
import com.gic.haoban.manage.service.util.CommonUtil;
......@@ -364,12 +366,14 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
refId = dataForHmLink.getLinkId();
unionid = dataForHmLink.getUnionid();
wxUserAddLogQDTO.setLinkId(refId);
wxUserAddLogQDTO.setHmId(dataForHmLink.getHmId());
}
}
String memberId = "";
if (StringUtils.isNotBlank(unionid)) {
log.info("有unionid处理:wxEnterpriseId:{},unionid:{}", wxEnterpriseId,unionid);
dto.setUnionid(unionid);
memberId = addExternalClerkRelated(dto, staffId, staffClerkRelationDTO, wxEnterpriseRelated);
} else {
log.info("发送欢迎语逻辑:wxEnterpriseId:{}", wxEnterpriseId);
......@@ -377,6 +381,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
if (StringUtils.isNotBlank(memberId)) {
log.info("插入加好友日志");
wxUserAddLogQDTO.setWxEnterpriseId(wxEnterpriseId);
wxUserAddLogQDTO.setEnterpriseId(enterpriseId);
wxUserAddLogQDTO.setMemberId(memberId);
......@@ -574,8 +579,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (StringUtils.isNotBlank(state)) {
//"HM+id" "DT+key"
log.info("特殊欢迎语 state:{}", state);
String refId = getRefId(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, refId);
WelcomeReferBO welcomeReferBo = getWelcomeReferBo(state);
welcomeDetailBO = welcomeService.getMatchWelcomeWithReferId(staffId, wxEnterpriseId, welcomeReferBo);
} else {
welcomeDetailBO = welcomeService.getMatchWelcome(staffId, wxEnterpriseId);
}
......@@ -627,6 +632,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
qywxWelcomeMsgDTO.setAttachments(attachments);
}
qywxWelcomeMsgDTO.setWelcomeCode(welcomeCode);
log.info("[sendWelcome] 发送欢迎语 params:{}", JSON.toJSONString(qywxWelcomeMsgDTO));
if (dto.getSuiteid().equals(SELF_APP)) {
//好办助手和代开发
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(dto.getWxEnterpriseId(), SecretTypeEnum.HAOBAN_HELP.getVal());
......@@ -641,16 +647,20 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
* @param state
* @return
*/
private String getRefId(String state) {
String substring = state.substring(2);
String refId = "";
private WelcomeReferBO getWelcomeReferBo(String state){
WelcomeReferBO welcomeReferBo = new WelcomeReferBO();
String id = state.substring(2);
if (state.contains("HM")) {
refId = substring;
welcomeReferBo.setType(HmWelcomeReferType.HM.getCode());
welcomeReferBo.setReferId(id);
} else if (state.contains("DT")) {
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(refId);
refId = Convert.toStr(dataForHmLink.getLinkId());
KeyDataLinkBO dataForHmLink = keyDataService.getDataForHmLink(id);
if (dataForHmLink != null) {
welcomeReferBo.setType(HmWelcomeReferType.LINK.getCode());
welcomeReferBo.setReferId(Convert.toStr(dataForHmLink.getLinkId()));
}
}
return refId;
return welcomeReferBo;
}
private void attachmentAddImage(List<QywxExternalMessageBaseDTO> attachments, WelcomeMediaBO media, WxEnterpriseDTO wxEnterpriseDTO) {
......
......@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
......@@ -114,13 +115,16 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
}
result.addAll(groupDtoPage.getResult());
List<Long> groupIds = result.stream().map(HmGroupDTO::getGroupId).collect(Collectors.toList());
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getEnterpriseId(),groupIds);
Map<Integer, Integer> qrcodeGroupNumMap = qrcodeGroupNumBoList.stream()
.collect(Collectors.toMap(HmQrcodeGroupNumBO::getHmGroupId, HmQrcodeGroupNumBO::getNum, (v1, v2) -> v1));
List<HmQrcodeGroupNumBO> qrcodeGroupNumBoList = qrcodeService.getGroupIdNumByEnterpriseId(groupQueryDTO.getEnterpriseId(), groupIds);
Map<Long, Integer> qrcodeGroupNumMap = Collections.emptyMap();
if (CollectionUtils.isNotEmpty(qrcodeGroupNumBoList)) {
qrcodeGroupNumMap = qrcodeGroupNumBoList.stream()
.collect(Collectors.toMap(HmQrcodeGroupNumBO::getHmGroupId, HmQrcodeGroupNumBO::getNum, (v1, v2) -> v1));
}
for (HmGroupDTO groupDTO : result) {
Integer referNum = Optional.ofNullable(qrcodeGroupNumMap.get(groupDTO.getGroupId().intValue())).orElse(0);
Integer referNum = Optional.ofNullable(qrcodeGroupNumMap.get(groupDTO.getGroupId())).orElse(0);
groupDTO.setReferNum(referNum);
if (!DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())){
if (!DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())) {
groupDTO.setDefaultFlag(0);
}
}
......@@ -148,10 +152,10 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
}
HmGroupSettingBO groupSettingBo = groupService.queryGroupSettingDetail(groupDTO.getGroupId());
if (groupSettingBo == null
|| !HmGroupStatus.ENABLE.getCode().equals(groupSettingBo.getStatus())){
|| !HmGroupStatus.ENABLE.getCode().equals(groupSettingBo.getStatus())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
}
if (groupSettingBo.getReferNum() != null && groupSettingBo.getReferNum() > 0){
if (groupSettingBo.getReferNum() != null && groupSettingBo.getReferNum() > 0) {
return ServiceResponse.failure(HaoBanErrCode.ERR_100033.getCode(), HaoBanErrCode.ERR_100033.getMsg());
}
groupService.deleteGroupSetting(groupDTO);
......
......@@ -23,6 +23,7 @@ import com.gic.haoban.manage.service.pojo.bo.hm.HmLinkBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataLinkBO;
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;
......@@ -30,6 +31,7 @@ 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.member.api.dto.es.MemberDataDTO;
import com.gic.member.api.dto.es.MemberStoreClerkDataDTO;
import com.gic.member.api.service.MemberService;
......@@ -75,6 +77,8 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
private WxEnterpriseService wxEnterpriseService;
@Autowired
private HmPageService hmPageService;
@Autowired
private HmQrcodeTempService hmQrcodeTempService;
@Override
public ServiceResponse<String> getHmLinkUrl() {
......@@ -294,7 +298,11 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
bo.setHmId(hm.getHmId());
String dthmKey = this.keyDataService.saveDataForLink(enterpriseId, bo);
if (null != dthmKey) {
this.addQrcode(hm, dthmKey, wxEnterpriseDTO.getCorpid(), retDTO);
ServiceResponse<Void> addResp = this.addQrcode(hm, dthmKey, wxEnterpriseDTO.getCorpid(), retDTO);
if (!addResp.isSuccess()) {
// 创建动态活码失败
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), addResp.getMessage());
}
}
// 查询页面
HmPageBO page = this.hmPageService.queryHmPageDetail(link.getPageId());
......@@ -307,26 +315,31 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
return ServiceResponse.success(retDTO);
}
private void addQrcode(HmQrcodeBO hm, String key, String corpid, HmLinkWxaDTO retDTO) {
// 创建活码
private ServiceResponse<Void> addQrcode(HmQrcodeBO hm, String key, String corpid, HmLinkWxaDTO retDTO) {
QywxExternalcontactDTO paramsDTO = new QywxExternalcontactDTO();
// 联系方式类型,1-单人, 2-多人
// 联系方式类型,1-单人, 2-多人 场景,1-在小程序中联系,2-通过二维码联系
paramsDTO.setType(1);
// 场景,1-在小程序中联系,2-通过二维码联系
paramsDTO.setScene(2);
paramsDTO.setRemark(hm.getName());
paramsDTO.setSkipVerify(hm.getPassFlag() == 1);
paramsDTO.setState("DT" + key);
// paramsDTO.setTemp(true);
// 过期时间一小时
paramsDTO.setExpiresIn(60L * 60);
paramsDTO.setChatExpiresIn(60L);
paramsDTO.setUser(Arrays.asList("wo59NLDQAAOVOU_FKL7DJg6NNq2-lgDQ"));
// paramsDTO.setTemp(true);
paramsDTO.setUser(Arrays.asList(hm.getWxUserId()));
QywxExternalcontactResultDTO dto = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), paramsDTO);
log.info("创建动态活码参数corpid:{}{},param={},返回={}", corpid, config.getWxSuiteid(), JSON.toJSONString(paramsDTO),
JSON.toJSONString(dto));
if (null != dto && "0".equals(dto.getErrcode())) {
retDTO.setHmQrcode(retDTO.getHmQrcode());
retDTO.setHmQrcode(dto.getQr_code());
HmQrcodeTempQO qo = new HmQrcodeTempQO();
qo.setWxEnterpriseId(hm.getWxEnterpriseId());
qo.setWxConfigId(dto.getConfig_id());
qo.setWxQrcode(dto.getQr_code());
qo.setRelationId(key);
this.hmQrcodeTempService.save(qo);
return ServiceResponse.success();
}
return ServiceResponse.failure(HaoBanErrCode.ERR_OTHER.getCode(), "企微错误:" + dto.getErrmsg());
}
private HmQrcodeBO getHmFromClerk(String clerkId, String wxEnterpriseId) {
......
package com.gic.haoban.manage.service.service.out.impl.hm;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
......@@ -88,8 +89,6 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
@Autowired
private StaffService staffService;
@Autowired
private HmGroupService groupService;
@Autowired
private WelcomeRelationService welcomeRelationService;
@Autowired
private HmGroupService hmGroupService;
......@@ -106,12 +105,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class)
@Override
@Transactional(rollbackFor = Exception.class)
public int add(HmQrcodeQDTO hmQrcodeQDTO) {
public ServiceResponse add(HmQrcodeQDTO hmQrcodeQDTO) {
String wxEnterpriseId = hmQrcodeQDTO.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.error("未查询到微信企业");
return HaoBanErrCodeCommon.ERR_8.getCode();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"微信企业不存在");
}
hmQrcodeQDTO.setHmId(UniqueIdUtils.uniqueLong());
......@@ -124,7 +123,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"该导购已经生成过活码或未关联过好办");
}
//生成活码
QywxExternalcontactDTO qywxExternalcontactDTO = new QywxExternalcontactDTO();
qywxExternalcontactDTO.setType(hmQrcodeQDTO.getHmType());
......@@ -133,6 +134,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId);
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
......@@ -147,7 +151,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getCreatorId(), hmQrcodeQDTO.getCreatorName());
GicLogRecordEvaluationContext.putAttribute("logContent", "【" + hmId + "-" + hmQrcodeQDTO.getName() + "】");
return saveResult;
return ServiceResponse.success();
}
/**
......@@ -189,18 +193,20 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
afterFunc = LogRecordAfterServiceImpl.class)
@Override
@Transactional(rollbackFor = Exception.class)
public int update(HmQrcodeQDTO hmQrcodeQDTO) {
public ServiceResponse update(HmQrcodeQDTO hmQrcodeQDTO) {
String wxEnterpriseId = hmQrcodeQDTO.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
if (wxEnterpriseDTO == null) {
logger.error("未查询到微信企业");
return 0;
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"微信企业不存在");
}
Long hmId = hmQrcodeQDTO.getHmId();
Integer hmType = hmQrcodeQDTO.getHmType();
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"该导购已经生成过活码或未关联过好办");
}
//更新活码
QywxExternalcontactDTO qywxExternalcontactDTO = new QywxExternalcontactDTO();
qywxExternalcontactDTO.setType(hmQrcodeQDTO.getHmType());
......@@ -209,11 +215,14 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId);
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()),"导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
boolean flag = qywxUserApiService.updateContactWay(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
if (!flag) {
logger.error("更新企微活码失败");
return 0;
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()),"更新企微活码失败");
}
int updateResult = hmQrcodeService.update(hmQrcodeQDTO);
......@@ -225,7 +234,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
setLoggerContext(hmQrcodeQDTO.getEnterpriseId(), wxEnterpriseId, hmQrcodeQDTO.getModifierId(), hmQrcodeQDTO.getModifierName());
updateSystemLog(hmQrcodeQDTO, hmId);
return updateResult;
return ServiceResponse.success();
}
/**
......@@ -325,12 +334,6 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
*/
private List<String> setStoreClerk(HmQrcodeQDTO hmQrcodeQDTO, String wxEnterpriseId, Long hmId, Integer hmType) {
List<String> clerkIdList = hmQrcodeQDTO.getClerkIdList();
String storeId = hmQrcodeQDTO.getStoreId();
StoreDTO storeDTO = storeService.getStore(storeId);
if (storeDTO != null) {
storeDTO.setStoreCode(storeDTO.getStoreCode());
storeDTO.setStoreName(storeDTO.getStoreName());
}
if (hmType == 2) {
//多人活码
......@@ -348,6 +351,13 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
if (clerkDTO != null) {
hmQrcodeQDTO.setClerkName(clerkDTO.getClerkName());
hmQrcodeQDTO.setClerkCode(clerkDTO.getClerkCode());
String storeId = clerkDTO.getStoreId();
hmQrcodeQDTO.setStoreId(storeId);
StoreDTO storeDTO = storeService.getStore(storeId);
if (storeDTO != null) {
hmQrcodeQDTO.setStoreCode(storeDTO.getStoreCode());
hmQrcodeQDTO.setStoreName(storeDTO.getStoreName());
}
}
StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getByClerkId(clerkId);
if (staffClerkRelationDTO != null) {
......@@ -380,12 +390,16 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
hmClerkRelationQDTO.setWxUserId(clerkRelationDTO.getWxUserId());
hmClerkRelationQDTO.setWxEnterpriseId(wxEnterpriseId);
hmClerkRelationQDTO.setEnterpriseId(hmQrcodeQDTO.getEnterpriseId());
hmClerkRelationQDTO.setStoreId(hmQrcodeQDTO.getStoreId());
hmClerkRelationQDTO.setStoreName(hmQrcodeQDTO.getStoreName());
hmClerkRelationQDTO.setStoreCode(hmQrcodeQDTO.getStoreCode());
hmClerkRelationQDTO.setClerkId(clerkId);
ClerkDTO clerkDTO = clerkService.getclerkById(clerkId);
if (clerkDTO != null) {
String storeId = clerkDTO.getStoreId();
hmClerkRelationQDTO.setStoreId(storeId);
StoreDTO storeDTO = storeService.getStore(storeId);
if (storeDTO != null) {
hmClerkRelationQDTO.setStoreCode(storeDTO.getStoreCode());
hmClerkRelationQDTO.setStoreName(storeDTO.getStoreName());
}
hmClerkRelationQDTO.setClerkName(clerkDTO.getClerkName());
hmClerkRelationQDTO.setClerkCode(clerkDTO.getClerkCode());
}
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper">
<resultMap type="com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp"
id="result-map-tabHaobanHmQrcodeTemp">
<result column="id" property="id" />
<result column="wx_config_id" property="wxConfigId" />
<result column="wx_qrcode" property="wxQrcode" />
<result column="wx_enterprise_id" property="wxEnterpriseId" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="status_flag" property="statusFlag" />
<result column="relation_id" property="relationId" />
</resultMap>
<sql id="Base_Column_List">
wx_config_id,
wx_qrcode,
wx_enterprise_id,
create_time,
update_time,
status_flag , relation_id
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp">
<![CDATA[
INSERT INTO tab_haoban_hm_qrcode_temp(
id,
wx_config_id,
wx_qrcode,
wx_enterprise_id,
create_time,
update_time,
status_flag , relation_id
)VALUES(
#{id} ,
#{wxConfigId,jdbcType=VARCHAR},
#{wxQrcode,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=CHAR},
#{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},
#{statusFlag,jdbcType=INTEGER} , #{relationId}
)
]]>
</insert>
<!-- =====================删除==================== -->
<update id="deleteByPrimaryKey" parameterType="long">
UPDATE tab_haoban_hm_qrcode_temp SET status_flag = 0 , update_time=now() WHERE id = #{id} and status_flag=1
</update>
<update id="deleteByRelationId" parameterType="long">
UPDATE tab_haoban_hm_qrcode_temp SET status_flag = 0 , update_time=now() WHERE relation_id = #{relationId} and status_flag=1
</update>
<!-- ============ 查询============= -->
<select id="selectByRelationId" parameterType="String"
resultMap="result-map-tabHaobanHmQrcodeTemp">
SELECT * FROM tab_haoban_hm_qrcode_temp WHERE relation_id = #{relationId}
</select>
<select id="listAll" resultMap="result-map-tabHaobanHmQrcodeTemp">
select * from tab_haoban_hm_qrcode_temp
</select>
</mapper>
\ No newline at end of file
......@@ -324,8 +324,8 @@
</select>
<select id="getGroupIdNumByEnterpriseId" resultType="com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeGroupNumBO">
select hm_group_id,
COUNT(hm_id)
select hm_group_id as hmGroupId,
COUNT(hm_id) as num
from tab_haoban_hm_qrcode
where status_flag != 0
and enterprise_id = #{enterpriseId}
......
......@@ -32,7 +32,11 @@ public class HmLinkTest {
@Autowired
private HmLinkStoreService hmLinkStoreService;
@Test
public void getLinkHmFromWxa(){
this.hmLinkApiService.getLinkHmFromWxa("ff8080815dacd3a2015dacd3ef5c0000", null, null, null, "fKzecO", "3b9167b1a", "orXl9t6P-XBJQyaNCaJj38GLyYd0",null) ;
}
@Test
public void saveLinkStore() {
HmLinkStoreDTO dto = new HmLinkStoreDTO();
......
......@@ -71,7 +71,8 @@ public class HmPageServiceTest {
@Test
public void groupList(){
HmGroupQueryDTO groupQueryDTO = new HmGroupQueryDTO();
groupQueryDTO.setGroupName("默认");
//groupQueryDTO.setGroupName("默认");
groupQueryDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
ServiceResponse<Page<HmGroupDTO>> pageServiceResponse = groupService.queryHmGroupSettingList(groupQueryDTO);
System.out.println(JSON.toJSONString(pageServiceResponse));
}
......
......@@ -45,7 +45,7 @@ public class ServiceTest {
hmQrcodeQDTO.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
hmQrcodeQDTO.setName("徐高华");
hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId("ff1307040a7748699cf3109615fb24d7");
hmQrcodeQDTO.setStoreId("ff8080816ad96137016ad97c87580000");
hmQrcodeQDTO.setClerkIdList(Collections.singletonList("ff1307040a7748699cf3109615fb24d7"));
hmQrcodeApiService.add(hmQrcodeQDTO);
}
......
......@@ -57,37 +57,41 @@ public class HmQrcodeController {
/**
* 新增
* @param HmQrcodeQDTO
* @param hmQrcodeQDTO
* @return
*/
@RequestMapping(value = "add", method = RequestMethod.POST)
public RestResponse add(@RequestBody HmQrcodeQDTO HmQrcodeQDTO) {
public RestResponse add(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
HmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
HmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
HmQrcodeQDTO.setModifierId(loginUser.getClerkId());
HmQrcodeQDTO.setModifierName(loginUser.getClerkName());
HmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
HmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.add(HmQrcodeQDTO);
hmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
hmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
ServiceResponse serviceResponse = this.hmQrcodeApiService.add(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_0.getCode()),serviceResponse.getMessage());
}
return RestResponse.successResult();
}
/**
* 修改
* @param HmQrcodeQDTO
* @param hmQrcodeQDTO
* @return
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
public RestResponse update(@RequestBody HmQrcodeQDTO HmQrcodeQDTO) {
public RestResponse update(@RequestBody HmQrcodeQDTO hmQrcodeQDTO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
HmQrcodeQDTO.setCreatorId(loginUser.getClerkId());
HmQrcodeQDTO.setCreatorName(loginUser.getClerkName());
HmQrcodeQDTO.setModifierId(loginUser.getClerkId());
HmQrcodeQDTO.setModifierName(loginUser.getClerkName());
HmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
HmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
this.hmQrcodeApiService.update(HmQrcodeQDTO);
hmQrcodeQDTO.setModifierId(loginUser.getClerkId());
hmQrcodeQDTO.setModifierName(loginUser.getClerkName());
hmQrcodeQDTO.setWxEnterpriseId(loginUser.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(loginUser.getEnterpriseId());
ServiceResponse serviceResponse = this.hmQrcodeApiService.update(hmQrcodeQDTO);
if (!"0000".equals(serviceResponse.getCode())) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_0.getCode()),serviceResponse.getMessage());
}
return RestResponse.successResult();
}
......@@ -100,7 +104,6 @@ public class HmQrcodeController {
public RestResponse<StatisticsDTO> list(@RequestBody HmQrcodeListQO hmQrcodeListQO) {
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
hmQrcodeListQO.getInFields().setEnterpriseId(loginUser.getEnterpriseId());
hmQrcodeListQO.setPageNo(hmQrcodeListQO.getPageNo());
List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(loginUser.getClerkId(), loginUser.getWxEnterpriseId());
if (CollectionUtils.isEmpty(storeList)) {
return RestResponse.failure(Convert.toStr(HaoBanErrCode.ERR_100007.getCode()),HaoBanErrCode.ERR_100007.getMsg());
......@@ -157,7 +160,9 @@ public class HmQrcodeController {
StatisticsDTO dto = DataHttpUtil.post(StatisticsApolloKeyConstant.data_haoban_hm_trend_m, hmTrendQO);
list= JSON.parseArray(JSON.toJSONString(dto.getData()), Map.class);
}
hmTrendVO.setDateList(list);
if (hmTrendVO != null) {
hmTrendVO.setDateList(list);
}
return RestResponse.successResult(hmTrendVO);
}
......@@ -193,7 +198,6 @@ public class HmQrcodeController {
@RequestMapping(value = "detail-clerk-list-page", method = RequestMethod.POST)
public RestResponse detailClerkListPage(@RequestBody HmDetailClerkListQO hmDetailClerkListQO) {
hmDetailClerkListQO.getInFields().setEnterpriseId(AuthWebRequestUtil.getLoginUser().getEnterpriseId());
hmDetailClerkListQO.setPageNo(hmDetailClerkListQO.getPageNum());
Long hmId = hmDetailClerkListQO.getInFields().getHmId();
HmQrcodeDTO hmQrcodeDTO = hmQrcodeApiService.queryById(hmId);
if (hmQrcodeDTO == null) {
......
package com.gic.haoban.manage.web.qo.hm.data;
import com.gic.haoban.base.api.common.BasePageInfo;
import java.io.Serializable;
public class HmDetailClerkListQO extends BasePageInfo implements Serializable {
public class HmDetailClerkListQO implements Serializable {
private static final long serialVersionUID = -5504797924745631906L;
private InFields inFields;
private Integer pageNo;
private Integer pageSize;
public InFields getInFields() {
return inFields;
......@@ -25,6 +24,14 @@ public class HmDetailClerkListQO extends BasePageInfo implements Serializable {
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 hmId;
......
package com.gic.haoban.manage.web.qo.hm.data;
import com.gic.haoban.base.api.common.BasePageInfo;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
......@@ -12,14 +10,23 @@ import java.util.List;
* @author mozhu
* @since 2022-07-04 15:42:20
*/
public class HmQrcodeListQO extends BasePageInfo implements Serializable {
public class HmQrcodeListQO implements Serializable {
private static final long serialVersionUID = 887910678030827375L;
private Integer pageNo;
private Integer pageSize;
private InFields inFields;
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getPageNo() {
return pageNo;
}
......
......@@ -4,6 +4,7 @@ import java.io.Serializable;
public class HmTrendQO implements Serializable {
private static final long serialVersionUID = 5002448176485217071L;
private InFields inFields;
public InFields getInFields() {
......
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