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");
......
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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" > <mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanAudit" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanAudit">
<id column="audit_id" property="auditId" jdbcType="VARCHAR" /> <id column="audit_id" property="auditId" jdbcType="VARCHAR"/>
<result column="audit_type" property="auditType" jdbcType="INTEGER" /> <result column="audit_type" property="auditType" jdbcType="INTEGER"/>
<result column="commit_name" property="commitName" jdbcType="VARCHAR" /> <result column="commit_name" property="commitName" jdbcType="VARCHAR"/>
<result column="commit_staff_id" property="commitStaffId" jdbcType="VARCHAR" /> <result column="commit_staff_id" property="commitStaffId" jdbcType="VARCHAR"/>
<result column="commit_staff_name" property="commitStaffName" jdbcType="VARCHAR" /> <result column="commit_staff_name" property="commitStaffName" jdbcType="VARCHAR"/>
<result column="commit_staff_img" property="commitStaffImg" jdbcType="VARCHAR" /> <result column="commit_staff_img" property="commitStaffImg" jdbcType="VARCHAR"/>
<result column="commit_store_id" property="commitStoreId" jdbcType="VARCHAR" /> <result column="commit_store_id" property="commitStoreId" jdbcType="VARCHAR"/>
<result column="change_field" property="changeField" jdbcType="VARCHAR" /> <result column="change_field" property="changeField" jdbcType="VARCHAR"/>
<result column="old_value" property="oldValue" jdbcType="VARCHAR" /> <result column="old_value" property="oldValue" jdbcType="VARCHAR"/>
<result column="new_value" property="newValue" jdbcType="VARCHAR" /> <result column="new_value" property="newValue" jdbcType="VARCHAR"/>
<result column="commit_time" property="commitTime" jdbcType="TIMESTAMP" /> <result column="commit_time" property="commitTime" jdbcType="TIMESTAMP"/>
<result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" /> <result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR"/>
<result column="audit_name" property="auditName" jdbcType="VARCHAR" /> <result column="audit_name" property="auditName" jdbcType="VARCHAR"/>
<result column="audit_status" property="auditStatus" jdbcType="INTEGER" /> <result column="audit_status" property="auditStatus" jdbcType="INTEGER"/>
<result column="audit_reason" property="auditReason" jdbcType="VARCHAR" /> <result column="audit_reason" property="auditReason" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
<result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" /> <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR"/>
<result column="related_id" property="relatedId" jdbcType="VARCHAR" /> <result column="related_id" property="relatedId" jdbcType="VARCHAR"/>
<result column="audit_staff_id" property="auditStaffId" jdbcType="VARCHAR" /> <result column="audit_staff_id" property="auditStaffId" jdbcType="VARCHAR"/>
<result column="commit_store_name" property="commitStoreName"/> <result column="commit_store_name" property="commitStoreName"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List">
audit_id, audit_type, commit_name, commit_staff_id, commit_staff_name, commit_staff_img, 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, 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 audit_name, audit_status, audit_reason, create_time, update_time, status_flag, wx_enterprise_id,related_id,audit_staff_id , commit_store_name
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from tab_haoban_audit from tab_haoban_audit
where audit_id = #{auditId,jdbcType=VARCHAR} where audit_id = #{auditId,jdbcType=VARCHAR}
</select> </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, insert into tab_haoban_audit (audit_id, audit_type, commit_name,
commit_staff_id, commit_staff_name, commit_staff_img, commit_staff_id, commit_staff_name, commit_staff_img,
commit_store_id, change_field, old_value, commit_store_id, change_field, old_value,
new_value, commit_time, enterprise_id, new_value, commit_time, enterprise_id,
audit_name, audit_status, audit_reason, audit_name, audit_status, audit_reason,
create_time, update_time, status_flag, 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}, 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},
#{commitStoreId,jdbcType=VARCHAR}, #{changeField,jdbcType=VARCHAR}, #{oldValue,jdbcType=VARCHAR}, #{commitStaffImg,jdbcType=VARCHAR},
#{newValue,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=VARCHAR}, #{commitStoreId,jdbcType=VARCHAR}, #{changeField,jdbcType=VARCHAR}, #{oldValue,jdbcType=VARCHAR},
#{auditName,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{auditReason,jdbcType=VARCHAR}, #{newValue,jdbcType=VARCHAR}, #{commitTime,jdbcType=TIMESTAMP}, #{enterpriseId,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER}, #{auditName,jdbcType=VARCHAR}, #{auditStatus,jdbcType=INTEGER}, #{auditReason,jdbcType=VARCHAR},
#{wxEnterpriseId,jdbcType=VARCHAR},#{relatedId,jdbcType=VARCHAR},#{auditStaffId,jdbcType=VARCHAR} , #{commitStoreName} ) #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{statusFlag,jdbcType=INTEGER},
</insert> #{wxEnterpriseId,jdbcType=VARCHAR}, #{relatedId,jdbcType=VARCHAR}, #{auditStaffId,jdbcType=VARCHAR},
#{commitStoreName})
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit" > </insert>
update tab_haoban_audit
<set > <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanAudit">
<if test="auditType != null" > update tab_haoban_audit
audit_type = #{auditType,jdbcType=INTEGER}, <set>
</if> <if test="auditType != null">
<if test="commitName != null" > audit_type = #{auditType,jdbcType=INTEGER},
commit_name = #{commitName,jdbcType=VARCHAR}, </if>
</if> <if test="commitName != null">
<if test="commitStaffId != null" > commit_name = #{commitName,jdbcType=VARCHAR},
commit_staff_id = #{commitStaffId,jdbcType=VARCHAR}, </if>
</if> <if test="commitStaffId != null">
<if test="commitStaffName != null" > commit_staff_id = #{commitStaffId,jdbcType=VARCHAR},
commit_staff_name = #{commitStaffName,jdbcType=VARCHAR}, </if>
</if> <if test="commitStaffName != null">
<if test="commitStaffImg != null" > commit_staff_name = #{commitStaffName,jdbcType=VARCHAR},
commit_staff_img = #{commitStaffImg,jdbcType=VARCHAR}, </if>
</if> <if test="commitStaffImg != null">
<if test="commitStoreId != null" > commit_staff_img = #{commitStaffImg,jdbcType=VARCHAR},
commit_store_id = #{commitStoreId,jdbcType=VARCHAR}, </if>
</if> <if test="commitStoreId != null">
<if test="changeField != null" > commit_store_id = #{commitStoreId,jdbcType=VARCHAR},
change_field = #{changeField,jdbcType=VARCHAR}, </if>
</if> <if test="changeField != null">
<if test="oldValue != null" > change_field = #{changeField,jdbcType=VARCHAR},
old_value = #{oldValue,jdbcType=VARCHAR}, </if>
</if> <if test="oldValue != null">
<if test="newValue != null" > old_value = #{oldValue,jdbcType=VARCHAR},
new_value = #{newValue,jdbcType=VARCHAR}, </if>
</if> <if test="newValue != null">
<if test="commitTime != null" > new_value = #{newValue,jdbcType=VARCHAR},
commit_time = #{commitTime,jdbcType=TIMESTAMP}, </if>
</if> <if test="commitTime != null">
<if test="enterpriseId != null" > commit_time = #{commitTime,jdbcType=TIMESTAMP},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}, </if>
</if> <if test="enterpriseId != null">
<if test="auditName != null" > enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
audit_name = #{auditName,jdbcType=VARCHAR},
</if>
<if test="auditStatus != null" >
audit_status = #{auditStatus,jdbcType=INTEGER},
</if>
<if test="auditReason != null" >
audit_reason = #{auditReason,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="statusFlag != null" >
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="relatedId != null" >
related_id = #{relatedId,jdbcType=VARCHAR},
</if>
<if test="auditStaffId != null" >
audit_staff_id = #{auditStaffId,jdbcType=VARCHAR},
</if>
</set>
where audit_id = #{auditId,jdbcType=VARCHAR}
</update>
<sql id="storeSql">
<if test="null != storeIds and storeIds.size gt 0">
and commit_store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<sql id="staffSql">
<if test="null != staffIds and staffIds.size gt 0">
and commit_staff_id in
<foreach collection="staffIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<select id="page" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
<if test = "auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER}
</if>
<if test = "auditFlag != null and auditFlag == 0">
and audit_status = 0
</if>
<if test = "auditFlag != null and auditFlag != 0">
and audit_status in (1,2,4,5)
</if>
<if test = "auditStatus != null">
and audit_status = #{auditStatus,jdbcType=INTEGER}
</if>
<if test=" null != searchParams and '' !=searchParams ">
and (commit_staff_name like '%${searchParams}%' or commit_store_name like '%${searchParams}%')
</if>
<include refid="storeSql"/>
order by commit_time desc
</select>
<select id="listByStoreId" resultMap="BaseResultMap" >
select
<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
<include refid="Base_Column_List" />
from tab_haoban_audit
where 1=1
and commit_store_id = #{storeId,jdbcType=VARCHAR}
and audit_status = 0
and change_field = #{changeField,jdbcType=VARCHAR}
</select>
<select id="listByStaffId" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where 1=1
and commit_staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
<if test="auditType == null">
and audit_type in (2,3,4,5)
</if>
<if test="auditType != null">
and audit_type = #{auditType}
</if>
<if test="auditStatus != null">
and audit_status = #{auditStatus}
</if>
order by create_time desc
</select>
<select id="pageStoreListByParams" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where
commit_store_id = #{storeId,jdbcType=VARCHAR}
and status_flag = 1
<if test="auditType == null || auditType == -1">
and audit_type in (2,3,4,5)
</if>
<if test="auditType != null and auditType != -1">
and audit_type = #{auditType}
</if>
<if test="auditStatus != null and auditStatus != -1">
and audit_status = #{auditStatus}
</if>
order by update_time desc
</select>
<select id="findByBindRelatedIdAndAuditType" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where
status_flag = 1
and related_Id = #{relatedId}
and audit_type = #{auditType}
and audit_status = 0
</select>
<select id="judgeHavePhoneNumberOrCode" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from tab_haoban_audit
where
status_flag = 1
and audit_type = 3
and audit_status = 0
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and (related_Id = #{clerkCode}
<if test="phoneNumber != null and phoneNumber != ''">
or old_value like concat ('%',#{phoneNumber},'%')
</if> </if>
) <if test="auditName != null">
</select> audit_name = #{auditName,jdbcType=VARCHAR},
</if>
<select id="getAuditCount" resultType="int"> <if test="auditStatus != null">
select count(*) from tab_haoban_audit where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id=#{enterpriseId} audit_status = #{auditStatus,jdbcType=INTEGER},
<if test="null != storeIds"> </if>
and <if test="auditReason != null">
( commit_store_id in audit_reason = #{auditReason,jdbcType=VARCHAR},
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")"> </if>
#{item} <if test="createTime != null">
</foreach> create_time = #{createTime,jdbcType=TIMESTAMP},
) </if>
</if> <if test="updateTime != null">
and audit_status = 0 update_time = #{updateTime,jdbcType=TIMESTAMP},
</select> </if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="relatedId != null">
related_id = #{relatedId,jdbcType=VARCHAR},
</if>
<if test="auditStaffId != null">
audit_staff_id = #{auditStaffId,jdbcType=VARCHAR},
</if>
</set>
where audit_id = #{auditId,jdbcType=VARCHAR}
</update>
<sql id="storeSql">
<if test="null != storeIds and storeIds.size gt 0">
and commit_store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<sql id="staffSql">
<if test="null != staffIds and staffIds.size gt 0">
and commit_staff_id in
<foreach collection="staffIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<select id="page" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_audit
where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
<if test="auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER}
</if>
<if test="auditFlag != null and auditFlag == 0">
and audit_status = 0
</if>
<if test="auditFlag != null and auditFlag != 0">
and audit_status in (1,2,4,5)
</if>
<if test="auditStatus != null">
and audit_status = #{auditStatus,jdbcType=INTEGER}
</if>
<if test=" null != searchParams and '' !=searchParams ">
and (commit_staff_name like '%${searchParams}%' or commit_store_name like '%${searchParams}%')
</if>
<include refid="storeSql"/>
order by commit_time desc
</select>
<select id="listByStoreId" resultMap="BaseResultMap">
select
<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
<include refid="Base_Column_List"/>
from tab_haoban_audit
where 1=1
and commit_store_id = #{storeId,jdbcType=VARCHAR}
and audit_status = 0
and change_field = #{changeField,jdbcType=VARCHAR}
</select>
<select id="listByStaffId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_audit
where 1=1
and commit_staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
<if test="auditType == null">
and audit_type in (2,3,4,5)
</if>
<if test="auditType != null">
and audit_type = #{auditType}
</if>
<if test="auditStatus != null">
and audit_status = #{auditStatus}
</if>
order by create_time desc
</select>
<select id="pageStoreListByParams" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
status_flag = 1
<if test="auditType == null || auditType == -1">
and audit_type in (2,3,4,5)
</if>
<if test="auditType != null and auditType != -1">
and audit_type = #{auditType}
</if>
<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
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
status_flag = 1
and related_Id = #{relatedId}
and audit_type = #{auditType}
and audit_status = 0
</select>
<select id="judgeHavePhoneNumberOrCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_audit
where
status_flag = 1
and audit_type = 3
and audit_status = 0
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and (related_Id = #{clerkCode}
<if test="phoneNumber != null and phoneNumber != ''">
or old_value like concat ('%',#{phoneNumber},'%')
</if>
)
</select>
<select id="getAuditCount" resultType="int">
select count(*) from tab_haoban_audit where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id=#{enterpriseId}
<if test="null != storeIds">
and
( commit_store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
and audit_status = 0
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -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