Commit 34e27c50 by 墨竹

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

parent 3a7301b4
package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.BatchAuditLogDTO;
import java.util.List;
/**
* Created by tgs on 2020/2/9.
......@@ -31,7 +31,7 @@ public interface AuditApiService {
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);
......
......@@ -80,10 +80,12 @@ public interface StaffClerkRelationApiService {
*/
List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds);
/**
* 查询导购信息
*
* @param clerkId
* @param storeId
* @param staffId
* @return
*/
StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId, String staffId);
......
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.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
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 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);
......
......@@ -267,4 +267,7 @@ public interface TabHaobanStaffClerkRelationMapper {
int getBindByStaffIdAndEnterpriseId(@Param("enterpriseId") String enterpriseId, @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
String wxEnterpriseId = dto.getWxEnterpriseId();
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.setHmType(1);
......
......@@ -401,10 +401,10 @@ public class AuditApiServiceImpl implements AuditApiService {
}
@Override
public Page<AuditDTO> pageStoreListByParams(String storeId, BasePageInfo pageInfo, Integer auditType,
public Page<AuditDTO> pageStoreListByParams(List<String> storeIds, BasePageInfo pageInfo, Integer auditType,
Integer auditStatus) {
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) {
......
......@@ -165,22 +165,22 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO));
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId());
if (null != relationDTO) {
return ServiceResponse.failure("2","已经被绑定,不能绑定");
return ServiceResponse.failure("2", "已经被绑定,不能绑定");
}
AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(staffClerkRelationDTO.getClerkId(), AuditType.CLERK_BIND.getCode());
if (null != auditDTO) {
return ServiceResponse.failure("4","该导购已经被被申请绑定,请审核处理后再绑定");
return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定");
}
List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId());
if (CollectionUtils.isNotEmpty(list)) {
Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet());
if (staffIds.contains(staffClerkRelationDTO.getStaffId())) {
return ServiceResponse.failure("5","该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
}
}
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffClerkRelationDTO.getStaffId(), staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) {
return ServiceResponse.failure("3","该导购已在该门店下有其它成员绑定");
return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
}
Integer manageFlag = staffClerkRelationDTO.getManageFlag();
if (manageFlag != null && manageFlag == 1) {
......@@ -226,6 +226,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@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) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode);
}
......@@ -261,7 +267,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public ServiceResponse wxBindStaffClerk(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int channelCode) {
Integer manageFlag = staffClerkRelation.getManageFlag();
if (manageFlag != null && manageFlag ==1) {
if (manageFlag != null && manageFlag == 1) {
ServiceResponse serviceResponse = getManageFlagBind(staffClerkRelation);
if (!serviceResponse.isSuccess()) {
return serviceResponse;
......@@ -282,7 +288,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
private ServiceResponse getManageFlagBind(StaffClerkRelationDTO staffClerkRelation) {
boolean bindFlag = staffClerkRelationService.getBindByStaffIdAndEnterpriseId(staffClerkRelation.getWxEnterpriseId(), staffClerkRelation.getStaffId());
if (bindFlag) {
return ServiceResponse.failure("3","该员工已经绑定,不允许绑定区经/督导");
return ServiceResponse.failure("3", "该员工已经绑定,不允许绑定区经/督导");
}
return ServiceResponse.success();
}
......
......@@ -259,9 +259,9 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
boolean delClerkFlag = false;
for (TabHaobanWxEnterpriseRelated enterpriseRelated : enterpriseRelateds) {
ClerkEditInfoDTO clerkEditInfoDTO = ClerkEditInfoDTO.info(enterpriseRelated.getClerkEditFlag());
addClerkFlag = clerkEditInfoDTO.getAddClerkFlag() == 1 ? true : false;
editClerkFlag = clerkEditInfoDTO.getEditClerkFlag() == 1 ? true : false;
delClerkFlag = clerkEditInfoDTO.getDelClerkFlag() == 1 ? true : false;
addClerkFlag = clerkEditInfoDTO.getAddClerkFlag() == 1;
editClerkFlag = clerkEditInfoDTO.getEditClerkFlag() == 1;
delClerkFlag = clerkEditInfoDTO.getDelClerkFlag() == 1;
boolean searchFlagEnterpriseId = manageSettingApiService.getEnterpriseIdByFlag(enterpriseRelated.getEnterpriseId(), 1, null);
if (searchFlagEnterpriseId) {
searchFlag = true;
......@@ -294,7 +294,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
menuCodes.add("userCenter_addClerk");
}
if (editClerkFlag) {
menuCodes.add("userCenter_editClerk");
menuCodes.add("storeClerkList_edit");
}
if (delClerkFlag) {
menuCodes.add("userCenter_delClerk");
......
<?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.TabHaobanAuditMapper" >
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanAudit" >
<id column="audit_id" property="auditId" jdbcType="VARCHAR" />
<result column="audit_type" property="auditType" jdbcType="INTEGER" />
<result column="commit_name" property="commitName" jdbcType="VARCHAR" />
<result column="commit_staff_id" property="commitStaffId" jdbcType="VARCHAR" />
<result column="commit_staff_name" property="commitStaffName" jdbcType="VARCHAR" />
<result column="commit_staff_img" property="commitStaffImg" jdbcType="VARCHAR" />
<result column="commit_store_id" property="commitStoreId" jdbcType="VARCHAR" />
<result column="change_field" property="changeField" jdbcType="VARCHAR" />
<result column="old_value" property="oldValue" jdbcType="VARCHAR" />
<result column="new_value" property="newValue" jdbcType="VARCHAR" />
<result column="commit_time" property="commitTime" jdbcType="TIMESTAMP" />
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" />
<result column="audit_name" property="auditName" jdbcType="VARCHAR" />
<result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
<result column="audit_reason" property="auditReason" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
<result column="related_id" property="relatedId" jdbcType="VARCHAR" />
<result column="audit_staff_id" property="auditStaffId" jdbcType="VARCHAR" />
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanAudit">
<id column="audit_id" property="auditId" jdbcType="VARCHAR"/>
<result column="audit_type" property="auditType" jdbcType="INTEGER"/>
<result column="commit_name" property="commitName" jdbcType="VARCHAR"/>
<result column="commit_staff_id" property="commitStaffId" jdbcType="VARCHAR"/>
<result column="commit_staff_name" property="commitStaffName" jdbcType="VARCHAR"/>
<result column="commit_staff_img" property="commitStaffImg" jdbcType="VARCHAR"/>
<result column="commit_store_id" property="commitStoreId" jdbcType="VARCHAR"/>
<result column="change_field" property="changeField" jdbcType="VARCHAR"/>
<result column="old_value" property="oldValue" jdbcType="VARCHAR"/>
<result column="new_value" property="newValue" jdbcType="VARCHAR"/>
<result column="commit_time" property="commitTime" jdbcType="TIMESTAMP"/>
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR"/>
<result column="audit_name" property="auditName" jdbcType="VARCHAR"/>
<result column="audit_status" property="auditStatus" jdbcType="INTEGER"/>
<result column="audit_reason" property="auditReason" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="related_id" property="relatedId" jdbcType="VARCHAR"/>
<result column="audit_staff_id" property="auditStaffId" jdbcType="VARCHAR"/>
<result column="commit_store_name" property="commitStoreName"/>
</resultMap>
<sql id="Base_Column_List" >
audit_id, audit_type, commit_name, commit_staff_id, commit_staff_name, commit_staff_img,
<sql id="Base_Column_List">
audit_id
, audit_type, commit_name, commit_staff_id, commit_staff_name, commit_staff_img,
commit_store_id, change_field, old_value, new_value, commit_time, enterprise_id,
audit_name, audit_status, audit_reason, create_time, update_time, status_flag, wx_enterprise_id,related_id,audit_staff_id , commit_store_name
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where audit_id = #{auditId,jdbcType=VARCHAR}
</select>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" >
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit">
insert into tab_haoban_audit (audit_id, audit_type, commit_name,
commit_staff_id, commit_staff_name, commit_staff_img,
commit_store_id, change_field, old_value,
new_value, commit_time, enterprise_id,
audit_name, audit_status, audit_reason,
create_time, update_time, status_flag,
wx_enterprise_id,related_id,audit_staff_id , commit_store_name)
wx_enterprise_id, related_id, audit_staff_id, commit_store_name)
values (#{auditId,jdbcType=VARCHAR}, #{auditType,jdbcType=INTEGER}, #{commitName,jdbcType=VARCHAR},
#{commitStaffId,jdbcType=VARCHAR}, #{commitStaffName,jdbcType=VARCHAR}, #{commitStaffImg,jdbcType=VARCHAR},
#{commitStaffId,jdbcType=VARCHAR}, #{commitStaffName,jdbcType=VARCHAR},
#{commitStaffImg,jdbcType=VARCHAR},
#{commitStoreId,jdbcType=VARCHAR}, #{changeField,jdbcType=VARCHAR}, #{oldValue,jdbcType=VARCHAR},
#{newValue,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=VARCHAR},
#{auditName,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{auditReason,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER},
#{wxEnterpriseId,jdbcType=VARCHAR},#{relatedId,jdbcType=VARCHAR},#{auditStaffId,jdbcType=VARCHAR} , #{commitStoreName} )
#{wxEnterpriseId,jdbcType=VARCHAR}, #{relatedId,jdbcType=VARCHAR}, #{auditStaffId,jdbcType=VARCHAR},
#{commitStoreName})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" >
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit">
update tab_haoban_audit
<set >
<if test="auditType != null" >
<set>
<if test="auditType != null">
audit_type = #{auditType,jdbcType=INTEGER},
</if>
<if test="commitName != null" >
<if test="commitName != null">
commit_name = #{commitName,jdbcType=VARCHAR},
</if>
<if test="commitStaffId != null" >
<if test="commitStaffId != null">
commit_staff_id = #{commitStaffId,jdbcType=VARCHAR},
</if>
<if test="commitStaffName != null" >
<if test="commitStaffName != null">
commit_staff_name = #{commitStaffName,jdbcType=VARCHAR},
</if>
<if test="commitStaffImg != null" >
<if test="commitStaffImg != null">
commit_staff_img = #{commitStaffImg,jdbcType=VARCHAR},
</if>
<if test="commitStoreId != null" >
<if test="commitStoreId != null">
commit_store_id = #{commitStoreId,jdbcType=VARCHAR},
</if>
<if test="changeField != null" >
<if test="changeField != null">
change_field = #{changeField,jdbcType=VARCHAR},
</if>
<if test="oldValue != null" >
<if test="oldValue != null">
old_value = #{oldValue,jdbcType=VARCHAR},
</if>
<if test="newValue != null" >
<if test="newValue != null">
new_value = #{newValue,jdbcType=VARCHAR},
</if>
<if test="commitTime != null" >
<if test="commitTime != null">
commit_time = #{commitTime,jdbcType=TIMESTAMP},
</if>
<if test="enterpriseId != null" >
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="auditName != null" >
<if test="auditName != null">
audit_name = #{auditName,jdbcType=VARCHAR},
</if>
<if test="auditStatus != null" >
<if test="auditStatus != null">
audit_status = #{auditStatus,jdbcType=INTEGER},
</if>
<if test="auditReason != null" >
<if test="auditReason != null">
audit_reason = #{auditReason,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="statusFlag != null" >
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="wxEnterpriseId != null" >
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="relatedId != null" >
<if test="relatedId != null">
related_id = #{relatedId,jdbcType=VARCHAR},
</if>
<if test="auditStaffId != null" >
<if test="auditStaffId != null">
audit_staff_id = #{auditStaffId,jdbcType=VARCHAR},
</if>
</set>
......@@ -137,21 +140,21 @@
</foreach>
</if>
</sql>
<select id="page" resultMap="BaseResultMap" >
<select id="page" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
<if test = "auditType != null">
<if test="auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER}
</if>
<if test = "auditFlag != null and auditFlag == 0">
<if test="auditFlag != null and auditFlag == 0">
and audit_status = 0
</if>
<if test = "auditFlag != null and auditFlag != 0">
<if test="auditFlag != null and auditFlag != 0">
and audit_status in (1,2,4,5)
</if>
<if test = "auditStatus != null">
<if test="auditStatus != null">
and audit_status = #{auditStatus,jdbcType=INTEGER}
</if>
<if test=" null != searchParams and '' !=searchParams ">
......@@ -161,18 +164,18 @@
order by commit_time desc
</select>
<select id="listByStoreId" resultMap="BaseResultMap" >
<select id="listByStoreId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where 1=1
and commit_store_id = #{storeId,jdbcType=VARCHAR}
and audit_status = 0
and audit_type = 1
</select>
<select id="findByStoreIdAndChangeField" resultMap="BaseResultMap" >
<select id="findByStoreIdAndChangeField" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where 1=1
and commit_store_id = #{storeId,jdbcType=VARCHAR}
......@@ -180,9 +183,9 @@
and change_field = #{changeField,jdbcType=VARCHAR}
</select>
<select id="listByStaffId" resultMap="BaseResultMap" >
<select id="listByStaffId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where 1=1
and commit_staff_id = #{staffId,jdbcType=VARCHAR}
......@@ -199,13 +202,12 @@
order by create_time desc
</select>
<select id="pageStoreListByParams" resultMap="BaseResultMap" >
<select id="pageStoreListByParams" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
commit_store_id = #{storeId,jdbcType=VARCHAR}
and status_flag = 1
status_flag = 1
<if test="auditType == null || auditType == -1">
and audit_type in (2,3,4,5)
</if>
......@@ -215,13 +217,14 @@
<if test="auditStatus != null and auditStatus != -1">
and audit_status = #{auditStatus}
</if>
<include refid="storeSql"></include>
order by update_time desc
</select>
<select id="findByBindRelatedIdAndAuditType" resultMap="BaseResultMap" >
<select id="findByBindRelatedIdAndAuditType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
status_flag = 1
......@@ -230,9 +233,9 @@
and audit_status = 0
</select>
<select id="judgeHavePhoneNumberOrCode" resultMap="BaseResultMap" >
<select id="judgeHavePhoneNumberOrCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
status_flag = 1
......
......@@ -565,4 +565,15 @@
where status_flag=1 and manage_flag = 1 and staff_id = #{staffId}
</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>
\ No newline at end of file
......@@ -177,7 +177,7 @@
<foreach collection="menuCodes" open="(" close=")" separator="," item="item">
#{item}
</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 id="getHaobanMenuListByCode" resultMap="TabHaobanMenuMap">
......
......@@ -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.StaffClerkBindLogDetailVO;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -129,12 +130,23 @@ public class AuditController extends WebBaseController {
//门店记录列表
@RequestMapping("store-apply-list")
public HaobanResponse storeApplyList(String storeId, String wxEnterpriseId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus) {
if (StringUtils.isAnyBlank(storeId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
public HaobanResponse storeApplyList(String storeId, BasePageInfo pageInfo, Integer auditType, Integer auditStatus,Integer manageFlag,String clerkId) {
WellDoneLoginDTO loginUser = this.getLoginUser();
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);
}
Page<AuditDTO> page = auditApiService.pageStoreListByParams(storeId, pageInfo, auditType, auditStatus);
if (CollectionUtils.isEmpty(storeIds)) {
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<AuditVO> voList = new ArrayList<AuditVO>();
for (AuditDTO auditDTO : list) {
......
......@@ -103,11 +103,23 @@ public class ClerkController extends WebBaseController {
//选择成员列表
@RequestMapping("/staff-list")
public HaobanResponse staffList(String storeId) {
if (StringUtils.isAnyBlank(storeId)) {
return resultResponse(HaoBanErrCode.ERR_2);
public HaobanResponse staffList(String storeId, Integer manageFlag, String clerkId) {
WellDoneLoginDTO loginUser = this.getLoginUser();
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);
}
if (storeIds.contains("-1")) {
storeIds = null;
}
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreId(storeId);
List<StaffClerkRelationDTO> list = staffClerkRelationApiService.listByStoreIds(storeIds);
List<String> staffIds = list.stream().map(StaffClerkRelationDTO::getStaffId).collect(Collectors.toList());
List<StaffDTO> resultlist = staffApiService.listByIds(staffIds);
Map<String, StaffDTO> map = com.gic.commons.util.CollectionUtil.toMap(resultlist, "staffId");
......@@ -134,20 +146,28 @@ public class ClerkController extends WebBaseController {
//门店成员列表
@RequestMapping("/store-clerks")
public HaobanResponse storeClerks(String wxEnterpriseId, String storeId, String version) {
if (StringUtils.isAnyBlank(storeId)) {
return resultResponse(HaoBanErrCode.ERR_2);
public HaobanResponse storeClerks(String clerkId, String enterpriseId, String storeId, Integer manageFlag) {
WellDoneLoginDTO loginUser = this.getLoginUser();
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 (storeDTO == null) {
if (CollectionUtils.isEmpty(storeIds)) {
return resultResponse(HaoBanErrCode.ERR_10009);
}
List<ClerkListDTO> list = clerkService.getClerkByStoreId(storeDTO.getEnterpriseId(), storeId);
Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(storeDTO.getEnterpriseId(), clerkCodeList);
if (storeIds.contains("-1")) {
storeIds = null;
}
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));
List<StoreClerkVO> resultList = new ArrayList<>();
for (ClerkListDTO dto : list) {
for (ClerkDTO dto : clerkDTOS) {
String clerkCode = dto.getClerkCode();
StoreClerkVO vo = new StoreClerkVO();
vo.setClerkCode(clerkCode);
......@@ -164,19 +184,11 @@ public class ClerkController extends WebBaseController {
}
resultList.add(vo);
}
if (StringUtils.isBlank(version)) {
return resultResponse(HaoBanErrCode.ERR_1, resultList);
} else {
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);
}
}
//门店成员列表
@RequestMapping("/clerk-edit-flag")
public HaobanResponse clerkEditFlag(String wxEnterpriseId, String storeId) {
......@@ -645,6 +657,9 @@ public class ClerkController extends WebBaseController {
if (StringUtils.isAnyBlank(staffId, wxEnterpriseId, keyword)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
if (manageFlag == null) {
return resultResponse(HaoBanErrCode.ERR_2);
}
if ("-1".equals(staffId)) {
return resultResponse(HaoBanErrCode.ERR_400022);
}
......@@ -662,10 +677,13 @@ public class ClerkController extends WebBaseController {
}
logger.info("查询到企微门店数={},{}", storeIds.size(), storeIds);
List<ClerkDTO> clerkList = new ArrayList<>();
if (manageFlag != null && manageFlag == 1) {
clerkList = clerkService.listClerkEnableHaoban(enterpriseIdList, keyword);
if (manageFlag == -1) {
clerkList.addAll(clerkService.listClerkEnableHaoban(enterpriseIdList, keyword));
clerkList.addAll(clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword));
} else if (manageFlag == 1) {
clerkList.addAll(clerkService.listClerkEnableHaoban(enterpriseIdList, keyword));
} else {
clerkList = clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword);
clerkList.addAll(clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword));
}
List<ClerkStoreVO> clerkStoreList = buildClerkRelation(clerkList, enterpriseIdList);
return resultResponse(HaoBanErrCode.ERR_1, clerkStoreList);
......@@ -944,28 +962,36 @@ public class ClerkController extends WebBaseController {
//门店导购列表
@RequestMapping("store-clerk-list")
public HaobanResponse storeClerkList(String storeId, String wxEnterpriseId) {
if (StringUtils.isAnyBlank(storeId, wxEnterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
public HaobanResponse storeClerkList(String storeId, String enterpriseId, Integer manageFlag, String clerkId) {
WellDoneLoginDTO loginUser = this.getLoginUser();
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 (store == null) {
if (CollectionUtils.isEmpty(storeIds)) {
return resultResponse(HaoBanErrCode.ERR_10009);
}
List<ClerkListDTO> list = clerkService.getClerkByStoreId(store.getEnterpriseId(), storeId);
Set<String> clerkCodeList = list.stream().map(ClerkListDTO::getClerkCode).collect(Collectors.toSet());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCode(store.getEnterpriseId(), clerkCodeList);
if (storeIds.contains("-1")) {
storeIds = null;
}
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));
List<BindClerkVO> bindList = new ArrayList<>();
List<BindClerkVO> unBindList = new ArrayList<>();
for (ClerkListDTO clerkListDTO : list) {
BindClerkVO vo = EntityUtil.changeEntityByJSON(BindClerkVO.class, clerkListDTO);
if (bindCodeMap.containsKey(clerkListDTO.getClerkCode())) {
String staffId = bindCodeMap.get(clerkListDTO.getClerkCode()).getStaffId();
for (ClerkDTO dto : list) {
BindClerkVO vo = EntityUtil.changeEntityByJSON(BindClerkVO.class, dto);
if (bindCodeMap.containsKey(dto.getClerkCode())) {
String staffId = bindCodeMap.get(dto.getClerkCode()).getStaffId();
StaffDTO staffDTO = staffApiService.selectById(staffId);
vo.setStaffId(staffId);
vo.setNationCode(clerkListDTO.getNationcode());
vo.setPhoneNumber(clerkListDTO.getPhoneNumber());
vo.setNationCode(dto.getNationcode());
vo.setPhoneNumber(dto.getPhoneNumber());
vo.setStaffName(staffDTO == null ? "" : staffDTO.getStaffName());
bindList.add(vo);
} 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