Commit d546a816 by 徐高华

解绑日志

parent de68a6c0
......@@ -3,7 +3,6 @@ package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import retrofit2.http.PATCH;
import java.util.List;
......@@ -12,34 +11,14 @@ public interface StaffClerkBindLogMapper {
/**
*
*/
int deleteByPrimaryKey(Integer logId);
/**
*
*/
int insert(TabHaobanStaffClerkBindLog record);
/**
*
*/
int insertSelective(TabHaobanStaffClerkBindLog record);
/**
*
*/
TabHaobanStaffClerkBindLog selectByPrimaryKey(Integer logId);
/**
*
*/
int updateByPrimaryKeySelective(TabHaobanStaffClerkBindLog record);
/**
*
*/
int updateByPrimaryKey(TabHaobanStaffClerkBindLog record);
/**
* 列表
*
* @param clerkIds
......@@ -49,7 +28,7 @@ public interface StaffClerkBindLogMapper {
* @return
*/
public List<TabHaobanStaffClerkBindLog> listStaffClerkBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkIds") List<String> clerkIds
, @Param("staffIds") List<String> staffIds, @Param("enterpriseIds") List<String> enterpriseIds, @Param("optType") int optType, @Param("search") String search);
, @Param("staffIds") List<String> staffIds, @Param("enterpriseId") String enterpriseId, @Param("optType") int optType, @Param("search") String search);
public List<TabHaobanStaffClerkBindLog> staffClerkUnBindLog(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("clerkId") String clerkIds
, @Param("enterpriseId") String enterpriseIds, @Param("optType") int optType);
......
......@@ -87,6 +87,26 @@ public class TabHaobanStaffClerkBindLog implements Serializable {
*
*/
private Date updateTime;
private String operName ;
private String clerkName ;
public String getOperName() {
return operName;
}
public String getClerkName() {
return clerkName;
}
public void setOperName(String operName) {
this.operName = operName;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
/**
*/
......
......@@ -44,7 +44,7 @@ public interface StaffClerkBindLogService {
/**
* @return
*/
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId, List<String> clerkIds, List<String> staffIds, List<String> enterpriseIds, int optType, String search, BasePageInfo pageInfo);
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId, List<String> clerkIds, List<String> staffIds, String enterpriseId, int optType, String search, BasePageInfo pageInfo);
public Page<StaffClerkBindLogDetailDTO> pageUnBindLog(String wxEnterpriseId, String clerkId, String enterpriseId, int optType, BasePageInfo pageInfo);
}
......@@ -40,7 +40,7 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
@Override
public void insert(TabHaobanStaffClerkBindLog bindLog) {
bindLog.setCreateTime(new Date());
staffClerkBindLogMapper.insertSelective(bindLog);
staffClerkBindLogMapper.insert(bindLog);
}
@Override
......@@ -85,9 +85,9 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
}
@Override
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId, List<String> clerkIds, List<String> staffIds, List<String> enterpriseIds, int optType, String search, BasePageInfo pageInfo) {
public Page<StaffClerkBindLogDetailDTO> pageBindLog(String wxEnterpriseId, List<String> clerkIds, List<String> staffIds, String enterpriseId, int optType, String search, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.listStaffClerkBindLog(wxEnterpriseId, clerkIds, staffIds, enterpriseIds, optType, search);
List<TabHaobanStaffClerkBindLog> clerkBindLogList = staffClerkBindLogMapper.listStaffClerkBindLog(wxEnterpriseId, clerkIds, staffIds, enterpriseId, optType, search);
Page<StaffClerkBindLogDetailDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindLogList), StaffClerkBindLogDetailDTO.class);
return retPage;
}
......
......@@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanTemplateApplicationRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanTemplateApplicationRelated;
import com.gic.haoban.manage.service.service.TemplateApplicationRelatedService;
......
......@@ -41,42 +41,28 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired
private StaffClerkRelationService staffClerkRelatinService;
@Autowired
private EnterpriseService enterpriseService;
@Autowired
private ClerkService clerkService;
@Autowired
private StoreService storeService;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
@Autowired
private AuditApiService auditApiService;
@Autowired
private ClerkMainStoreRelatedService clerkMainStoreRelatedService;
@Autowired
private StaffClerkBindLogService staffClerkBindLogService;
@Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private StaffService staffService;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private SecretSettingService secretSettingService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
......@@ -95,26 +81,34 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String phoneNumber = "";
String clerkName = null;
if (null != clerkDTO) {
phoneNumber = clerkDTO.getPhoneNumber();
clerkName = clerkDTO.getClerkName() ;
}
TabHaobanStaffClerkBindLog staffClerkRelation = new TabHaobanStaffClerkBindLog();
staffClerkRelation.setClerkId(clerkRelation.getClerkId());
staffClerkRelation.setChannelCode(infoDTO.getChannelCode());
staffClerkRelation.setClerkCode(clerkRelation.getClerkCode());
staffClerkRelation.setCreateTime(new Date());
staffClerkRelation.setEnterpriseId(clerkRelation.getEnterpriseId());
staffClerkRelation.setOptStaffId(infoDTO.getOptStaffId());
staffClerkRelation.setOptType(infoDTO.getOptType());
staffClerkRelation.setStatusFlag(1);
staffClerkRelation.setStaffId(clerkRelation.getStaffId());
staffClerkRelation.setWxEnterpriseId(clerkRelation.getWxEnterpriseId());
staffClerkRelation.setRelationId(infoDTO.getRelationId());
staffClerkRelation.setClerkPhone(phoneNumber);
staffClerkRelation.setUpdateTime(new Date());
staffClerkBindLogService.insert(staffClerkRelation);
String operClerkId = infoDTO.getOptStaffId() ;
clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String operName = null ;
if (null != clerkDTO) {
operName = clerkDTO.getClerkName() ;
}
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
enity.setClerkId(clerkRelation.getClerkId());
enity.setChannelCode(infoDTO.getChannelCode());
enity.setClerkCode(clerkRelation.getClerkCode());
enity.setCreateTime(new Date());
enity.setEnterpriseId(clerkRelation.getEnterpriseId());
enity.setOptStaffId(operClerkId);
enity.setOperName(operName);
enity.setOptType(infoDTO.getOptType());
enity.setStatusFlag(1);
enity.setStaffId(clerkRelation.getStaffId());
enity.setWxEnterpriseId(clerkRelation.getWxEnterpriseId());
enity.setRelationId(infoDTO.getRelationId());
enity.setClerkPhone(phoneNumber);
enity.setUpdateTime(new Date());
enity.setClerkName(clerkName);
staffClerkBindLogService.insert(enity);
}
@Override
......@@ -307,25 +301,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo) {
List<TabHaobanWxEnterpriseRelated> wxEnterpriseRelateds = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isEmpty(wxEnterpriseRelateds)) {
logger.info("没有关联企业");
return null;
}
List<String> enterpriseList = wxEnterpriseRelateds.stream().map(TabHaobanWxEnterpriseRelated::getEnterpriseId)
.filter(eid -> {
if (StringUtils.isBlank(enterpriseId)) {
return true;
} else {
return enterpriseId.equals(eid);
}
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(enterpriseList)) {
logger.info("没有有效的企业");
return null;
}
List<String> clerkIds = null;
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageBindLog(wxEnterpriseId, clerkIds, null, enterpriseList, optType, search, pageInfo);
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageBindLog(wxEnterpriseId, null, null, enterpriseId, optType, search, pageInfo);
if (CollectionUtils.isNotEmpty(retList.getResult())) {
retList.getResult().forEach(staffClerkBindLogDetailDTO -> {
TabHaobanStaff haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getStaffId());
......@@ -364,30 +340,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageUnBindLog(wxEnterpriseId, clerkId, enterpriseId, optType, pageInfo);
if (CollectionUtils.isNotEmpty(retList.getResult())) {
retList.getResult().forEach(staffClerkBindLogDetailDTO -> {
TabHaobanStaff haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getStaffId());
if (null != haobanStaff) {
staffClerkBindLogDetailDTO.setStaffName(haobanStaff.getStaffName());
staffClerkBindLogDetailDTO.setWxUserId(haobanStaff.getWxUserId());
} else {
staffClerkBindLogDetailDTO.setStaffName("未知成员");
retList.getResult().forEach(item -> {
if ("-1".equals(item.getOptStaffId())) {
item.setOptStaffName("系统");
}
if ("-1".equals(staffClerkBindLogDetailDTO.getOptStaffId())) {
staffClerkBindLogDetailDTO.setOptStaffName("系统");
} else {
haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getOptStaffId());
if (null != haobanStaff) {
staffClerkBindLogDetailDTO.setOptStaffName(haobanStaff.getStaffName());
} else {
staffClerkBindLogDetailDTO.setOptStaffName("未知成员");
}
if(StringUtils.isBlank(item.getOptStaffName())) {
item.setOptStaffName("未知成员");
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(staffClerkBindLogDetailDTO.getClerkId());
if (null != clerkDTO) {
staffClerkBindLogDetailDTO.setClerkName(clerkDTO.getClerkName());
}
staffClerkBindLogDetailDTO.setClerkPhoneNumber(staffClerkBindLogDetailDTO.getClerkPhone());
item.setClerkPhoneNumber(item.getClerkPhone());
});
}
return retList;
......@@ -398,19 +358,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId);
}
private void setMainStore(StaffClerkRelationDTO staffClerkRelation) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = staffClerkRelatinService.listByStaffId(wxEnterpriseId, staffId);
if (list != null && list.size() == 1) {
clerkMainStoreRelatedService.setMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
}
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
......
......@@ -46,7 +46,6 @@ import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.ApplicationVO;
import com.gic.haoban.manage.web.vo.ClerkEditInfoVO;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -96,28 +95,24 @@ public class ApplicationController extends WebBaseController {
}
Map<String, Object> map = new HashMap<>();
List<ApplicationDTO> list = applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId);
Object o = RedisUtil.getCache("haobanWxEnterpriseIdAppOpen");
String wxEnterpriseIds = o == null ? "" : o.toString();
if (!wxEnterpriseIds.contains(wxEnterpriseId)) {
Iterator<ApplicationDTO> it = list.iterator();
// 判断模板
List<String> tempIdList = null ;
List<ApplicationDTO> tempList = this.applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId) ;
if(CollectionUtils.isNotEmpty(tempList)) {
tempIdList = tempList.stream().map(dto->dto.getApplicationId()).collect(Collectors.toList()) ;
Iterator<ApplicationDTO> it = list.iterator();
// 判断模板
List<String> tempIdList = null ;
List<ApplicationDTO> tempList = this.applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId) ;
if(CollectionUtils.isNotEmpty(tempList)) {
tempIdList = tempList.stream().map(dto->dto.getApplicationId()).collect(Collectors.toList()) ;
}
while (it.hasNext()) {
ApplicationDTO s = it.next();
// 我的客户、营销任务、看数据、云日报、月指标、商品中心、订单评价、扫码核销、E袋洗、佣金结算
if(Arrays.asList("11111","11114","11121","11122").contains(s.getApplicationId())) {
it.remove();
}
while (it.hasNext()) {
ApplicationDTO s = it.next();
// 我的客户、营销任务、看数据、云日报、月指标、商品中心、订单评价、扫码核销、E袋洗、佣金结算
if(Arrays.asList("11111","11114","11121","11122").contains(s.getApplicationId())) {
it.remove();
}
// 11123E袋洗 11124佣金结算
if(CollectionUtils.isNotEmpty(tempIdList)) {
if(Arrays.asList("11123","11124").contains(s.getApplicationId())) {
if(!tempIdList.contains(s.getApplicationId())) {
it.remove();
}
// 11123E袋洗 11124佣金结算
if(CollectionUtils.isNotEmpty(tempIdList)) {
if(Arrays.asList("11123","11124").contains(s.getApplicationId())) {
if(!tempIdList.contains(s.getApplicationId())) {
it.remove();
}
}
}
......
......@@ -339,12 +339,9 @@ public class StaffController extends WebBaseController {
* @return
*/
@RequestMapping("del-clerk-relation")
public HaobanResponse delStaffClerkList(String staffId, String clerkId) {
StaffDTO staff = staffApiService.selectById(staffId);
if (staff == null) {
return resultResponse(HaoBanErrCode.ERR_10007);
}
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId);
public HaobanResponse delStaffClerkList(String clerkId) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(login.getClerkId(), clerkId);
return resultResponse(HaoBanErrCode.ERR_1, b);
}
......@@ -433,7 +430,7 @@ public class StaffController extends WebBaseController {
relationDTO.setWxUserId(staffDTO.getWxUserId());
ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO, login.getStaffId(), ChannelCodeEnum.ADMIN_BIND.getCode());
ServiceResponse response = staffClerkRelationApiService.bindStaffClerk(relationDTO, login.getClerkId(), ChannelCodeEnum.ADMIN_BIND.getCode());
logger.info("返回信息:{}", JSONObject.toJSONString(response));
if (response.getCode() == 1) {
return resultResponse(HaoBanErrCode.ERR_1);
......
......@@ -947,7 +947,7 @@ public class ClerkController extends WebBaseController {
staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode);
//加入日志
staffClerkRelationApiService.pushToBindLog(staffClerkRelation.getStaffId(), staffId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(), staffClerkRelation.getStaffClerkRelationId());
staffClerkRelationApiService.pushToBindLog(staffClerkRelation.getStaffId(), clerkId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(), staffClerkRelation.getStaffClerkRelationId());
return resultResponse(HaoBanErrCode.ERR_1);
}
......
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