Commit 5e4fdbf5 by 墨竹

fix:绑定后台审核自动创建活码

parent 253fbd90
...@@ -99,7 +99,7 @@ public class HmQrcodeQDTO implements Serializable { ...@@ -99,7 +99,7 @@ public class HmQrcodeQDTO implements Serializable {
private String staffId; private String staffId;
private String staffName; private String staffName;
/** /**
* 调用类型来源 0:不记录,1:来源为后台操作 其他查看枚举 HbBindEnum * 调用类型来源 0:不记录,1:来源为后台操作 其他查看枚举 ChannelCodeEnum
*/ */
private Integer invokingType = 0; private Integer invokingType = 0;
/** /**
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList; import cn.hutool.core.collection.CollectionUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -22,11 +8,7 @@ import com.gic.clerk.api.dto.ClerkDTO; ...@@ -22,11 +8,7 @@ import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService; import com.gic.clerk.api.service.PowerService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.*;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreDetailDTO;
import com.gic.enterprise.api.dto.StoreWidgetDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.enterprise.api.service.StoreWidgetService; import com.gic.enterprise.api.service.StoreWidgetService;
...@@ -34,17 +16,8 @@ import com.gic.haoban.base.api.common.BasePageInfo; ...@@ -34,17 +16,8 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi; import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.AuditStaffDTO; import com.gic.haoban.manage.api.enums.*;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StoreAddressDTO;
import com.gic.haoban.manage.api.enums.AuditRsultType;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
import com.gic.haoban.manage.api.service.AuditApiService; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
...@@ -56,8 +29,16 @@ import com.gic.haoban.manage.service.entity.TabHaobanAudit; ...@@ -56,8 +29,16 @@ import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog; import com.gic.haoban.manage.service.entity.TabHaobanBatchAuditLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.collection.CollectionUtil; import java.util.*;
import java.util.stream.Collectors;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
...@@ -141,9 +122,8 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -141,9 +122,8 @@ public class AuditApiServiceImpl implements AuditApiService {
content = "[" + content + "]" + "修改审核通过"; content = "[" + content + "]" + "修改审核通过";
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId); TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
String staffId = tab2.getCommitStaffId(); String staffId = tab2.getCommitStaffId();
// this.sendMessageByStaffId(staffId, storeId, title, content);
//插入log //插入log
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab); insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
} }
this.sendMessageByStaffId(staffId, storeId, false, content, ""); this.sendMessageByStaffId(staffId, storeId, false, content, "");
...@@ -159,19 +139,18 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -159,19 +139,18 @@ public class AuditApiServiceImpl implements AuditApiService {
tab.setAuditStatus(5); tab.setAuditStatus(5);
tab.setAuditReason("该成员在该门店下已经绑定过一个导购了"); tab.setAuditReason("该成员在该门店下已经绑定过一个导购了");
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab); insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
} }
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true); staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true);
return "该成员在该门店下已经绑定过一个导购了"; return "该成员在该门店下已经绑定过一个导购了";
} }
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(obj.getClerkId()); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(obj.getClerkId());
if (clerkDTO == null) { if (clerkDTO == null) {
tab.setAuditStatus(5); tab.setAuditStatus(5);
tab.setAuditReason("gic已删除该导购"); tab.setAuditReason("gic已删除该导购");
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab); insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
} }
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true); staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true);
...@@ -189,14 +168,11 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -189,14 +168,11 @@ public class AuditApiServiceImpl implements AuditApiService {
staffClerkRelation.setStaffId(obj.getStaffId()); staffClerkRelation.setStaffId(obj.getStaffId());
staffClerkRelationApiService.delAndInsert(staffClerkRelation, optStaffId, ChannelCodeEnum.AUDIT_BIND.getCode()); staffClerkRelationApiService.delAndInsert(staffClerkRelation, optStaffId, ChannelCodeEnum.AUDIT_BIND.getCode());
} }
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab); insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
} }
//同意绑定 //同意绑定
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), "", false); staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), "", false);
// staffDepartmentRelatedApiService.sendClerkBind(obj.getStaffId(), obj.getClerkCode(),storeId, 1, "");
} else if (auditType == AuditType.CLERK_ADD.getCode()) { } else if (auditType == AuditType.CLERK_ADD.getCode()) {
//门店导购新增 //门店导购新增
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
...@@ -207,13 +183,13 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -207,13 +183,13 @@ public class AuditApiServiceImpl implements AuditApiService {
tab.setAuditStatus(5); tab.setAuditStatus(5);
tab.setAuditReason(flag); tab.setAuditReason(flag);
auditMapper.updateByPrimaryKeySelective(tab); auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab); insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
} }
return flag; return flag;
} else { } else {
//成功 //成功
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, 1, tab); insertBatchLog(batchId, 1, tab);
} }
staffDepartmentRelatedApiService.sendClerkAdd(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, ""); staffDepartmentRelatedApiService.sendClerkAdd(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, "");
...@@ -224,7 +200,7 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -224,7 +200,7 @@ public class AuditApiServiceImpl implements AuditApiService {
String oldValue = tab.getOldValue(); String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue, AuditStaffDTO.class); AuditStaffDTO obj = JSONObject.parseObject(oldValue, AuditStaffDTO.class);
syncHaobanToGicServiceApi.delGicClerk(obj.getClerkId()); syncHaobanToGicServiceApi.delGicClerk(obj.getClerkId());
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab); insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
} }
//解绑日志 //解绑日志
......
...@@ -7,10 +7,13 @@ import com.gic.clerk.api.service.ClerkService; ...@@ -7,10 +7,13 @@ import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.enums.AppPageType; import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService; import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil; import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
...@@ -55,6 +58,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -55,6 +58,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper; private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@Override @Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId) { public List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId) {
...@@ -250,7 +255,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -250,7 +255,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
//导购绑定,,审核记录,,消息发送 //导购绑定,,审核记录,,消息发送
@Override @Override
public void sendClerkBind(String staffId, String clerkCode, String storeId, int auditStatus, String auditReason) { public void sendClerkBind(String staffId, String clerkCode, String storeId, int auditStatus, String auditReason) {
//TODO huang 发送申请人,我的记录页
StaffDTO staffDTO = staffApiService.selectById(staffId); StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO == null) { if (staffDTO == null) {
logger.info("staff不存在,发送消息失败{}", staffId); logger.info("staff不存在,发送消息失败{}", staffId);
...@@ -269,12 +273,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -269,12 +273,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
//导购新增,,审核记录,,消息发送 //导购新增,,审核记录,,消息发送
@Override @Override
public void sendClerkAdd(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason) { public void sendClerkAdd(String clerkName, String clerkCode, String storeId, int auditStatus, String auditReason) {
//TODO huang 发送店长,门店关联记录列表
// String messageTitle = "门店导购变更";
// String messageContent ="新增导购:"+ clerkName+"("+clerkCode+")";
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", storeId); jsonObject.put("storeId", storeId);
// String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId); ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if(gicClerk == null){ if(gicClerk == null){
logger.info("店长不存在,发送消息失败{}",storeId); logger.info("店长不存在,发送消息失败{}",storeId);
...@@ -285,9 +285,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -285,9 +285,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长未绑定clerkId={}",gicClerk.getClerkId()); logger.info("店长未绑定clerkId={}",gicClerk.getClerkId());
return ; return ;
} }
// String pageUrl = this.getPageUrl(AppPageType.STORE_RELATED_RECORD.getCode(), data);
// this.sendAuditMessage(tab.getStaffId(), messageTitle, messageContent, pageUrl, auditStatus, auditReason);
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("clerkName", clerkName); params.put("clerkName", clerkName);
params.put("clerkCode", clerkCode); params.put("clerkCode", clerkCode);
...@@ -309,7 +306,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -309,7 +306,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
// String messageContent = "删除导购:" + clerkName + "(" + clerkCode + ")"; // String messageContent = "删除导购:" + clerkName + "(" + clerkCode + ")";
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", storeId); jsonObject.put("storeId", storeId);
// String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId); ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if (gicClerk == null) { if (gicClerk == null) {
logger.info("店长不存在,发送消息失败{}", storeId); logger.info("店长不存在,发送消息失败{}", storeId);
...@@ -515,6 +511,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -515,6 +511,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
if (clerkDTO == null) { if (clerkDTO == null) {
return; return;
} }
String enterpriseId = clerkDTO.getEnterpriseId();
//字段 //字段
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("staffName", clerkDTO.getClerkName()); params.put("staffName", clerkDTO.getClerkName());
...@@ -525,10 +522,25 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -525,10 +522,25 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
jsonObject.put("storeId", clerkDTO.getStoreId()); jsonObject.put("storeId", clerkDTO.getStoreId());
//发送消息 //发送消息
if (isRefuse) { if (isRefuse) {
NoticeMessageUtil.sendNoticeMessageByStaff(clerkDTO.getEnterpriseId(), staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_REFUSE.getType(), auditId, params, jsonObject); NoticeMessageUtil.sendNoticeMessageByStaff(enterpriseId, staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_REFUSE.getType(), auditId, params, jsonObject);
} else { } else {
NoticeMessageUtil.sendNoticeMessageByStaff(clerkDTO.getEnterpriseId(), staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_AGREE.getType(), auditId, params, jsonObject); NoticeMessageUtil.sendNoticeMessageByStaff(enterpriseId, staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_AGREE.getType(), auditId, params, jsonObject);
StaffDTO staffDTO = staffApiService.selectById(staffId);
logger.info("绑定自动创建活码,staffId:{}",staffId);
// 绑定自动创建活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmType(1);
hmQrcodeQDTO.setWxEnterpriseId(staffDTO.getWxEnterpriseId());
hmQrcodeQDTO.setEnterpriseId(enterpriseId);
hmQrcodeQDTO.setName(staffDTO.getStaffName());
hmQrcodeQDTO.setPassFlag(1);
hmQrcodeQDTO.setStoreId(clerkDTO.getStoreId());
hmQrcodeQDTO.setClerkIdList(Collections.singletonList(clerkDTO.getClerkId()));
hmQrcodeQDTO.setInvokingType(ChannelCodeEnum.AUDIT_BIND.getCode());
hmQrcodeApiService.add(hmQrcodeQDTO);
} }
} }
@Override @Override
......
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