Commit 9fc255ca by songyinghui

Merge remote-tracking branch 'origin/feature-0808' into feature-0808

parents d14ededf f06cf027
......@@ -99,7 +99,7 @@ public class HmQrcodeQDTO implements Serializable {
private String staffId;
private String staffName;
/**
* 调用类型来源 0:不记录,1:来源为后台操作 其他查看枚举 HbBindEnum
* 调用类型来源 0:不记录,1:来源为后台操作 其他查看枚举 ChannelCodeEnum
*/
private Integer invokingType = 0;
/**
......
package com.gic.haoban.manage.api.service;
import java.util.List;
import java.util.Set;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
......@@ -10,6 +7,9 @@ import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import java.util.List;
import java.util.Set;
public interface StaffClerkRelationApiService {
/**
* 绑定日志
......@@ -39,7 +39,12 @@ public interface StaffClerkRelationApiService {
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
/**
* 审核绑定
* @param staffClerkRelation
* @param optStaffId
* @param chanelCode
*/
void delAndInsert(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int chanelCode);
/**
......
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
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 cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
......@@ -22,11 +8,7 @@ import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
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.dto.*;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.enterprise.api.service.StoreWidgetService;
......@@ -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.UuidUtil;
import com.gic.haoban.communicate.api.service.SyncHaobanToGicServiceApi;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditStaffDTO;
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.dto.*;
import com.gic.haoban.manage.api.enums.*;
import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
......@@ -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.TabHaobanStaff;
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.
......@@ -141,9 +122,8 @@ public class AuditApiServiceImpl implements AuditApiService {
content = "[" + content + "]" + "修改审核通过";
TabHaobanAudit tab2 = auditMapper.selectByPrimaryKey(auditId);
String staffId = tab2.getCommitStaffId();
// this.sendMessageByStaffId(staffId, storeId, title, content);
//插入log
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
}
this.sendMessageByStaffId(staffId, storeId, false, content, "");
......@@ -159,19 +139,18 @@ public class AuditApiServiceImpl implements AuditApiService {
tab.setAuditStatus(5);
tab.setAuditReason("该成员在该门店下已经绑定过一个导购了");
auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
}
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true);
return "该成员在该门店下已经绑定过一个导购了";
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(obj.getClerkId());
if (clerkDTO == null) {
tab.setAuditStatus(5);
tab.setAuditReason("gic已删除该导购");
auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
}
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), tab.getAuditReason(), true);
......@@ -189,14 +168,11 @@ public class AuditApiServiceImpl implements AuditApiService {
staffClerkRelation.setStaffId(obj.getStaffId());
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);
}
//同意绑定
staffDepartmentRelatedApiService.sendBindAuditMessage(auditId, obj.getStaffId(), obj.getClerkId(), "", false);
// staffDepartmentRelatedApiService.sendClerkBind(obj.getStaffId(), obj.getClerkCode(),storeId, 1, "");
} else if (auditType == AuditType.CLERK_ADD.getCode()) {
//门店导购新增
String oldValue = tab.getOldValue();
......@@ -207,13 +183,13 @@ public class AuditApiServiceImpl implements AuditApiService {
tab.setAuditStatus(5);
tab.setAuditReason(flag);
auditMapper.updateByPrimaryKeySelective(tab);
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.fail.getCode(), tab);
}
return flag;
} else {
//成功
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, 1, tab);
}
staffDepartmentRelatedApiService.sendClerkAdd(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, "");
......@@ -224,7 +200,7 @@ public class AuditApiServiceImpl implements AuditApiService {
String oldValue = tab.getOldValue();
AuditStaffDTO obj = JSONObject.parseObject(oldValue, AuditStaffDTO.class);
syncHaobanToGicServiceApi.delGicClerk(obj.getClerkId());
if (org.apache.commons.lang.StringUtils.isNotBlank(batchId)) {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
}
//解绑日志
......
......@@ -295,10 +295,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(oldStaffClerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, staffClerkRelation.getStaffClerkRelationId());
clerkMainStoreRelatedService.delMainStore(oldStaffClerkRelation.getStaffId(), oldStaffClerkRelation.getStoreId(), oldStaffClerkRelation.getWxEnterpriseId());
}
String relationId = staffClerkRelationService.insert(staffClerkRelation);
staffClerkBindLogService.pushToMq(staffClerkRelation.getStaffId(), optStaffId, BindTypeEnum.BIND.getVal(), chanelCode, relationId);
//设置主门店
clerkMainStoreRelatedService.getMainStoreByStaffId(staffClerkRelation.getStaffId(), staffClerkRelation.getWxEnterpriseId());
staffClerkRelationService.bind(staffClerkRelation,optStaffId,chanelCode);
}
@Override
......
......@@ -11,6 +11,7 @@ import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
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.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
......@@ -55,6 +56,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Autowired
private StaffApiService staffApiService;
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@Override
public List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId) {
......@@ -250,7 +253,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
//导购绑定,,审核记录,,消息发送
@Override
public void sendClerkBind(String staffId, String clerkCode, String storeId, int auditStatus, String auditReason) {
//TODO huang 发送申请人,我的记录页
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO == null) {
logger.info("staff不存在,发送消息失败{}", staffId);
......@@ -269,12 +271,8 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
//导购新增,,审核记录,,消息发送
@Override
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.put("storeId", storeId);
// String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if(gicClerk == null){
logger.info("店长不存在,发送消息失败{}",storeId);
......@@ -285,9 +283,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长未绑定clerkId={}",gicClerk.getClerkId());
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>();
params.put("clerkName", clerkName);
params.put("clerkCode", clerkCode);
......@@ -309,7 +304,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
// String messageContent = "删除导购:" + clerkName + "(" + clerkCode + ")";
JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", storeId);
// String data = jsonObject.toJSONString();
ClerkDTO gicClerk = clerkService.getClerkLeaderByStoreId(storeId);
if (gicClerk == null) {
logger.info("店长不存在,发送消息失败{}", storeId);
......@@ -515,6 +509,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
if (clerkDTO == null) {
return;
}
String enterpriseId = clerkDTO.getEnterpriseId();
//字段
Map<String, String> params = new HashMap<String, String>();
params.put("staffName", clerkDTO.getClerkName());
......@@ -525,10 +520,11 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
jsonObject.put("storeId", clerkDTO.getStoreId());
//发送消息
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 {
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);
}
}
@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