Commit 34e27c50 by 墨竹

fix:区经,我的相关接口改为门店列表

parent 3a7301b4
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO; import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
import java.util.List;
/** /**
* Created by tgs on 2020/2/9. * Created by tgs on 2020/2/9.
...@@ -31,7 +31,7 @@ public interface AuditApiService { ...@@ -31,7 +31,7 @@ public interface AuditApiService {
Page<AuditDTO> listByStaffId(String staffId,Integer auditType,Integer auditStatus, BasePageInfo pageInfo); Page<AuditDTO> listByStaffId(String staffId,Integer auditType,Integer auditStatus, BasePageInfo pageInfo);
Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus); Page<AuditDTO> pageStoreListByParams(List<String> storeIds, BasePageInfo pageInfo, Integer auditType, Integer auditStatus);
AuditDTO findById(String auditId); AuditDTO findById(String auditId);
......
...@@ -80,10 +80,12 @@ public interface StaffClerkRelationApiService { ...@@ -80,10 +80,12 @@ public interface StaffClerkRelationApiService {
*/ */
List<StaffClerkRelationDTO> listByStoreId(String storeId); List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds);
/** /**
* 查询导购信息 * 查询导购信息
* * @param storeId
* @param clerkId * @param staffId
* @return * @return
*/ */
StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId, String staffId); StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId, String staffId);
......
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanAudit; import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TabHaobanAuditMapper { public interface TabHaobanAuditMapper {
...@@ -23,7 +22,7 @@ public interface TabHaobanAuditMapper { ...@@ -23,7 +22,7 @@ public interface TabHaobanAuditMapper {
com.github.pagehelper.Page listByStaffId(@Param("staffId")String staffId,@Param("auditType")Integer auditType,@Param("auditStatus")Integer auditStatus); com.github.pagehelper.Page listByStaffId(@Param("staffId")String staffId,@Param("auditType")Integer auditType,@Param("auditStatus")Integer auditStatus);
com.github.pagehelper.Page pageStoreListByParams(@Param("storeId")String storeId, @Param("auditType")Integer auditType, @Param("auditStatus")Integer auditStatus); com.github.pagehelper.Page pageStoreListByParams(@Param("storeIds")List<String> storeIds, @Param("auditType")Integer auditType, @Param("auditStatus")Integer auditStatus);
TabHaobanAudit findByBindRelatedIdAndAuditType(@Param("relatedId")String relatedId,@Param("auditType")int auditType); TabHaobanAudit findByBindRelatedIdAndAuditType(@Param("relatedId")String relatedId,@Param("auditType")int auditType);
......
...@@ -267,4 +267,7 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -267,4 +267,7 @@ public interface TabHaobanStaffClerkRelationMapper {
int getBindByStaffIdAndEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId); int getBindByStaffIdAndEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId);
List<TabHaobanStaffClerkRelation> listManageBindByStaffId(@Param("staffId") String staffId); List<TabHaobanStaffClerkRelation> listManageBindByStaffId(@Param("staffId") String staffId);
List<TabHaobanStaffClerkRelation> listByStoreIds(@Param("storeIds") List<String> storeIds);
} }
\ No newline at end of file
...@@ -153,8 +153,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -153,8 +153,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
String wxEnterpriseId = dto.getWxEnterpriseId(); String wxEnterpriseId = dto.getWxEnterpriseId();
clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId); clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId);
//推入日志 //推入日志
staffClerkBindLogService.pushToMq(staffId, optStaffId, BindTypeEnum.BIND.getVal(), channelCode, dto.getStaffClerkRelationId()); staffClerkBindLogService.pushToMq(staffId, optStaffId, BindTypeEnum.BIND.getVal(), channelCode, staffClerkRelationId);
Integer manageFlag = dto.getManageFlag();
if (manageFlag != null && manageFlag == 1) {
return staffClerkRelationId;
}
// 绑定自动创建活码 // 绑定自动创建活码
HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO(); HmQrcodeQDTO hmQrcodeQDTO = new HmQrcodeQDTO();
hmQrcodeQDTO.setHmType(1); hmQrcodeQDTO.setHmType(1);
......
...@@ -401,10 +401,10 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -401,10 +401,10 @@ public class AuditApiServiceImpl implements AuditApiService {
} }
@Override @Override
public Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType, public Page<AuditDTO> pageStoreListByParams(List<String> storeIds, BasePageInfo pageInfo, Integer auditType,
Integer auditStatus) { Integer auditStatus) {
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize()); PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
return PageUtil.changePageHelperToCurrentPage(auditMapper.pageStoreListByParams(storeId, auditType, auditStatus), AuditDTO.class); return PageUtil.changePageHelperToCurrentPage(auditMapper.pageStoreListByParams(storeIds, auditType, auditStatus), AuditDTO.class);
} }
public void insertBatchLog(String batchId, int auditResult, TabHaobanAudit tab) { public void insertBatchLog(String batchId, int auditResult, TabHaobanAudit tab) {
......
...@@ -165,22 +165,22 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -165,22 +165,22 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO)); logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO));
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId()); StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId());
if (null != relationDTO) { if (null != relationDTO) {
return ServiceResponse.failure("2","已经被绑定,不能绑定"); return ServiceResponse.failure("2", "已经被绑定,不能绑定");
} }
AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(staffClerkRelationDTO.getClerkId(), AuditType.CLERK_BIND.getCode()); AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(staffClerkRelationDTO.getClerkId(), AuditType.CLERK_BIND.getCode());
if (null != auditDTO) { if (null != auditDTO) {
return ServiceResponse.failure("4","该导购已经被被申请绑定,请审核处理后再绑定"); return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定");
} }
List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId()); List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet()); Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet());
if (staffIds.contains(staffClerkRelationDTO.getStaffId())) { if (staffIds.contains(staffClerkRelationDTO.getStaffId())) {
return ServiceResponse.failure("5","该成员已经已经在该门店下申请了绑定,请审核处理后再绑定"); return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
} }
} }
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffClerkRelationDTO.getStaffId(), staffClerkRelationDTO.getStoreId()); StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffClerkRelationDTO.getStaffId(), staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) { if (storeHasBind != null) {
return ServiceResponse.failure("3","该导购已在该门店下有其它成员绑定"); return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
} }
Integer manageFlag = staffClerkRelationDTO.getManageFlag(); Integer manageFlag = staffClerkRelationDTO.getManageFlag();
if (manageFlag != null && manageFlag == 1) { if (manageFlag != null && manageFlag == 1) {
...@@ -226,6 +226,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -226,6 +226,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreIds(storeIds);
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, list);
}
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode) { public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode); return staffClerkRelationService.delBind(clerkId, staffId, channelCode);
} }
...@@ -261,7 +267,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -261,7 +267,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public ServiceResponse wxBindStaffClerk(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int channelCode) { public ServiceResponse wxBindStaffClerk(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int channelCode) {
Integer manageFlag = staffClerkRelation.getManageFlag(); Integer manageFlag = staffClerkRelation.getManageFlag();
if (manageFlag != null && manageFlag ==1) { if (manageFlag != null && manageFlag == 1) {
ServiceResponse serviceResponse = getManageFlagBind(staffClerkRelation); ServiceResponse serviceResponse = getManageFlagBind(staffClerkRelation);
if (!serviceResponse.isSuccess()) { if (!serviceResponse.isSuccess()) {
return serviceResponse; return serviceResponse;
...@@ -282,7 +288,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -282,7 +288,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
private ServiceResponse getManageFlagBind(StaffClerkRelationDTO staffClerkRelation) { private ServiceResponse getManageFlagBind(StaffClerkRelationDTO staffClerkRelation) {
boolean bindFlag = staffClerkRelationService.getBindByStaffIdAndEnterpriseId(staffClerkRelation.getWxEnterpriseId(), staffClerkRelation.getStaffId()); boolean bindFlag = staffClerkRelationService.getBindByStaffIdAndEnterpriseId(staffClerkRelation.getWxEnterpriseId(), staffClerkRelation.getStaffId());
if (bindFlag) { if (bindFlag) {
return ServiceResponse.failure("3","该员工已经绑定,不允许绑定区经/督导"); return ServiceResponse.failure("3", "该员工已经绑定,不允许绑定区经/督导");
} }
return ServiceResponse.success(); return ServiceResponse.success();
} }
......
...@@ -259,9 +259,9 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -259,9 +259,9 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
boolean delClerkFlag = false; boolean delClerkFlag = false;
for (TabHaobanWxEnterpriseRelated enterpriseRelated : enterpriseRelateds) { for (TabHaobanWxEnterpriseRelated enterpriseRelated : enterpriseRelateds) {
ClerkEditInfoDTO clerkEditInfoDTO = ClerkEditInfoDTO.info(enterpriseRelated.getClerkEditFlag()); ClerkEditInfoDTO clerkEditInfoDTO = ClerkEditInfoDTO.info(enterpriseRelated.getClerkEditFlag());
addClerkFlag = clerkEditInfoDTO.getAddClerkFlag() == 1 ? true : false; addClerkFlag = clerkEditInfoDTO.getAddClerkFlag() == 1;
editClerkFlag = clerkEditInfoDTO.getEditClerkFlag() == 1 ? true : false; editClerkFlag = clerkEditInfoDTO.getEditClerkFlag() == 1;
delClerkFlag = clerkEditInfoDTO.getDelClerkFlag() == 1 ? true : false; delClerkFlag = clerkEditInfoDTO.getDelClerkFlag() == 1;
boolean searchFlagEnterpriseId = manageSettingApiService.getEnterpriseIdByFlag(enterpriseRelated.getEnterpriseId(), 1, null); boolean searchFlagEnterpriseId = manageSettingApiService.getEnterpriseIdByFlag(enterpriseRelated.getEnterpriseId(), 1, null);
if (searchFlagEnterpriseId) { if (searchFlagEnterpriseId) {
searchFlag = true; searchFlag = true;
...@@ -294,7 +294,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService { ...@@ -294,7 +294,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
menuCodes.add("userCenter_addClerk"); menuCodes.add("userCenter_addClerk");
} }
if (editClerkFlag) { if (editClerkFlag) {
menuCodes.add("userCenter_editClerk"); menuCodes.add("storeClerkList_edit");
} }
if (delClerkFlag) { if (delClerkFlag) {
menuCodes.add("userCenter_delClerk"); menuCodes.add("userCenter_delClerk");
......
...@@ -565,4 +565,15 @@ ...@@ -565,4 +565,15 @@
where status_flag=1 and manage_flag = 1 and staff_id = #{staffId} where status_flag=1 and manage_flag = 1 and staff_id = #{staffId}
</select> </select>
<select id="listByStoreIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where status_flag=1
and store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<foreach collection="menuCodes" open="(" close=")" separator="," item="item"> <foreach collection="menuCodes" open="(" close=")" separator="," item="item">
#{item} #{item}
</foreach> </foreach>
and menu_code not in ('customerList_allSearch','customerList_allSearch','userCenter_addClerk','userCenter_delClerk','userCenter_editClerk'); and menu_code not in ('customerList_allSearch','customerList_allSearch','userCenter_addClerk','userCenter_delClerk','storeClerkList_edit');
</select> </select>
<select id="getHaobanMenuListByCode" resultMap="TabHaobanMenuMap"> <select id="getHaobanMenuListByCode" resultMap="TabHaobanMenuMap">
......
...@@ -26,6 +26,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode; ...@@ -26,6 +26,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.AuditVO; import com.gic.haoban.manage.web.vo.AuditVO;
import com.gic.haoban.manage.web.vo.StaffClerkBindLogDetailVO; import com.gic.haoban.manage.web.vo.StaffClerkBindLogDetailVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -129,12 +130,23 @@ public class AuditController extends WebBaseController { ...@@ -129,12 +130,23 @@ public class AuditController extends WebBaseController {
//门店记录列表 //门店记录列表
@RequestMapping("store-apply-list") @RequestMapping("store-apply-list")
public HaobanResponse storeApplyList(String storeId, String wxEnterpriseId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus) { public HaobanResponse storeApplyList(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus,Integer manageFlag,String clerkId) {
if (StringUtils.isAnyBlank(storeId, wxEnterpriseId)) { WellDoneLoginDTO loginUser = this.getLoginUser();
return resultResponse(HaoBanErrCode.ERR_2); String wxEnterpriseId = loginUser.getWxEnterpriseId();
List<String> storeIds = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) {
List<String> roleStoreIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
storeIds.addAll(roleStoreIds);
} else {
storeIds.add(storeId);
} }
if (CollectionUtils.isEmpty(storeIds)) {
Page<AuditDTO> page = auditApiService.pageStoreListByParams(storeId, pageInfo, auditType, auditStatus); return resultResponse(HaoBanErrCode.ERR_10009);
}
if (storeIds.contains("-1")) {
storeIds = null;
}
Page<AuditDTO> page = auditApiService.pageStoreListByParams(storeIds, pageInfo, auditType, auditStatus);
List<AuditDTO> list = page.getResult(); List<AuditDTO> list = page.getResult();
List<AuditVO> voList = new ArrayList<AuditVO>(); List<AuditVO> voList = new ArrayList<AuditVO>();
for (AuditDTO auditDTO : list) { for (AuditDTO auditDTO : list) {
......
...@@ -103,11 +103,23 @@ public class ClerkController extends WebBaseController { ...@@ -103,11 +103,23 @@ public class ClerkController extends WebBaseController {
//选择成员列表 //选择成员列表
@RequestMapping("/staff-list") @RequestMapping("/staff-list")
public HaobanResponse staffList(String storeId) { public HaobanResponse staffList(String storeId, Integer manageFlag, String clerkId) {
if (StringUtils.isAnyBlank(storeId)) { WellDoneLoginDTO loginUser = this.getLoginUser();
return resultResponse(HaoBanErrCode.ERR_2); String wxEnterpriseId = loginUser.getWxEnterpriseId();
List<String> storeIds = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) {
List<String> roleStoreIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
storeIds.addAll(roleStoreIds);
} else {
storeIds.add(storeId);
}
if (CollectionUtils.isEmpty(storeIds)) {
return resultResponse(HaoBanErrCode.ERR_10009);
} }
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId); if (storeIds.contains("-1")) {
storeIds = null;
}
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreIds(storeIds);
List<String> staffIds = list.stream().map(StaffClerkRelationDTO::getStaffId).collect(Collectors.toList()); List<String> staffIds = list.stream().map(StaffClerkRelationDTO::getStaffId).collect(Collectors.toList());
List<StaffDTO> resultlist = staffApiService.listByIds(staffIds); List<StaffDTO> resultlist = staffApiService.listByIds(staffIds);
Map<String, StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId"); Map<String, StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId");
...@@ -134,20 +146,28 @@ public class ClerkController extends WebBaseController { ...@@ -134,20 +146,28 @@ public class ClerkController extends WebBaseController {
//门店成员列表 //门店成员列表
@RequestMapping("/store-clerks") @RequestMapping("/store-clerks")
public HaobanResponse storeClerks(String wxEnterpriseId, String storeId, String version) { public HaobanResponse storeClerks(String clerkId, String enterpriseId, String storeId, Integer manageFlag) {
if (StringUtils.isAnyBlank(storeId)) { WellDoneLoginDTO loginUser = this.getLoginUser();
return resultResponse(HaoBanErrCode.ERR_2); String wxEnterpriseId = loginUser.getWxEnterpriseId();
List<String> storeIds = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) {
List<String> roleStoreIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
storeIds.addAll(roleStoreIds);
} else {
storeIds.add(storeId);
} }
StoreDTO storeDTO = storeService.getStore(storeId); if (CollectionUtils.isEmpty(storeIds)) {
if (storeDTO == null) {
return resultResponse(HaoBanErrCode.ERR_10009); return resultResponse(HaoBanErrCode.ERR_10009);
} }
List<ClerkListDTO> list = clerkService.getClerkByStoreId(storeDTO.getEnterpriseId(), storeId); if (storeIds.contains("-1")) {
Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet()); storeIds = null;
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(storeDTO.getEnterpriseId(), clerkCodeList); }
List<ClerkDTO> clerkDTOS = clerkService.listClerkByNameOrCode(enterpriseId, null, storeIds);
Set<String> clerkCodeList = clerkDTOS.stream().map(ClerkDTO::getClerkCode).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(enterpriseId, clerkCodeList);
Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkCode, s -> s)); Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkCode, s -> s));
List<StoreClerkVO> resultList = new ArrayList<>(); List<StoreClerkVO> resultList = new ArrayList<>();
for (ClerkListDTO dto : list) { for (ClerkDTO dto : clerkDTOS) {
String clerkCode = dto.getClerkCode(); String clerkCode = dto.getClerkCode();
StoreClerkVO vo = new StoreClerkVO(); StoreClerkVO vo = new StoreClerkVO();
vo.setClerkCode(clerkCode); vo.setClerkCode(clerkCode);
...@@ -164,17 +184,9 @@ public class ClerkController extends WebBaseController { ...@@ -164,17 +184,9 @@ public class ClerkController extends WebBaseController {
} }
resultList.add(vo); resultList.add(vo);
} }
if (StringUtils.isBlank(version)) { Map<String, Object> ret = new HashMap<>();
return resultResponse(HaoBanErrCode.ERR_1, resultList); ret.put("clerkList", resultList);
} else { return resultResponse(HaoBanErrCode.ERR_1, ret);
WxEnterpriseRelationDetailDTO enterpriseBindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, storeDTO.getEnterpriseId());
Map<String, Object> ret = new HashMap<>();
// 待删除
ret.put("clerkEditFlag", ClerkEditInfoVO.info(enterpriseBindInfo.getClerkEditFlag()).getEditClerkFlag());
ret.put("clerkList", resultList);
return resultResponse(HaoBanErrCode.ERR_1, ret);
}
} }
//门店成员列表 //门店成员列表
...@@ -645,6 +657,9 @@ public class ClerkController extends WebBaseController { ...@@ -645,6 +657,9 @@ public class ClerkController extends WebBaseController {
if (StringUtils.isAnyBlank(staffId, wxEnterpriseId, keyword)) { if (StringUtils.isAnyBlank(staffId, wxEnterpriseId, keyword)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
if (manageFlag == null) {
return resultResponse(HaoBanErrCode.ERR_2);
}
if ("-1".equals(staffId)) { if ("-1".equals(staffId)) {
return resultResponse(HaoBanErrCode.ERR_400022); return resultResponse(HaoBanErrCode.ERR_400022);
} }
...@@ -662,10 +677,13 @@ public class ClerkController extends WebBaseController { ...@@ -662,10 +677,13 @@ public class ClerkController extends WebBaseController {
} }
logger.info("查询到企微门店数={},{}", storeIds.size(), storeIds); logger.info("查询到企微门店数={},{}", storeIds.size(), storeIds);
List<ClerkDTO> clerkList = new ArrayList<>(); List<ClerkDTO> clerkList = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) { if (manageFlag == -1) {
clerkList = clerkService.listClerkEnableHaoban(enterpriseIdList, keyword); clerkList.addAll(clerkService.listClerkEnableHaoban(enterpriseIdList, keyword));
clerkList.addAll(clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword));
} else if (manageFlag == 1) {
clerkList.addAll(clerkService.listClerkEnableHaoban(enterpriseIdList, keyword));
} else { } else {
clerkList = clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword); clerkList.addAll(clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword));
} }
List<ClerkStoreVO> clerkStoreList = buildClerkRelation(clerkList, enterpriseIdList); List<ClerkStoreVO> clerkStoreList = buildClerkRelation(clerkList, enterpriseIdList);
return resultResponse(HaoBanErrCode.ERR_1, clerkStoreList); return resultResponse(HaoBanErrCode.ERR_1, clerkStoreList);
...@@ -944,28 +962,36 @@ public class ClerkController extends WebBaseController { ...@@ -944,28 +962,36 @@ public class ClerkController extends WebBaseController {
//门店导购列表 //门店导购列表
@RequestMapping("store-clerk-list") @RequestMapping("store-clerk-list")
public HaobanResponse storeClerkList(String storeId, String wxEnterpriseId) { public HaobanResponse storeClerkList(String storeId, String enterpriseId, Integer manageFlag, String clerkId) {
if (StringUtils.isAnyBlank(storeId, wxEnterpriseId)) { WellDoneLoginDTO loginUser = this.getLoginUser();
return resultResponse(HaoBanErrCode.ERR_2); String wxEnterpriseId = loginUser.getWxEnterpriseId();
List<String> storeIds = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) {
List<String> roleStoreIds = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
storeIds.addAll(roleStoreIds);
} else {
storeIds.add(storeId);
} }
StoreDTO store = storeService.getStore(storeId); if (CollectionUtils.isEmpty(storeIds)) {
if (store == null) {
return resultResponse(HaoBanErrCode.ERR_10009); return resultResponse(HaoBanErrCode.ERR_10009);
} }
List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId); if (storeIds.contains("-1")) {
Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet()); storeIds = null;
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(store.getEnterpriseId(), clerkCodeList); }
List<ClerkDTO> list = clerkService.listClerkByNameOrCode(enterpriseId, null, storeIds);
Set<String> clerkCodeList = list.stream().map(ClerkDTO::getClerkCode).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(enterpriseId, clerkCodeList);
Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkCode, s -> s)); Map<String, StaffClerkRelationDTO> bindCodeMap = bindRelationList.stream().collect(Collectors.toMap(StaffClerkRelationDTO::getClerkCode, s -> s));
List<BindClerkVO> bindList = new ArrayList<>(); List<BindClerkVO> bindList = new ArrayList<>();
List<BindClerkVO> unBindList = new ArrayList<>(); List<BindClerkVO> unBindList = new ArrayList<>();
for (ClerkListDTO clerkListDTO : list) { for (ClerkDTO dto : list) {
BindClerkVO vo = EntityUtil.changeEntityByJSON(BindClerkVO.class, clerkListDTO); BindClerkVO vo = EntityUtil.changeEntityByJSON(BindClerkVO.class, dto);
if (bindCodeMap.containsKey(clerkListDTO.getClerkCode())) { if (bindCodeMap.containsKey(dto.getClerkCode())) {
String staffId = bindCodeMap.get(clerkListDTO.getClerkCode()).getStaffId(); String staffId = bindCodeMap.get(dto.getClerkCode()).getStaffId();
StaffDTO staffDTO = staffApiService.selectById(staffId); StaffDTO staffDTO = staffApiService.selectById(staffId);
vo.setStaffId(staffId); vo.setStaffId(staffId);
vo.setNationCode(clerkListDTO.getNationcode()); vo.setNationCode(dto.getNationcode());
vo.setPhoneNumber(clerkListDTO.getPhoneNumber()); vo.setPhoneNumber(dto.getPhoneNumber());
vo.setStaffName(staffDTO == null ? "" : staffDTO.getStaffName()); vo.setStaffName(staffDTO == null ? "" : staffDTO.getStaffName());
bindList.add(vo); bindList.add(vo);
} else { } else {
......
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