Commit 7810d426 by 墨竹

feat:门店查询修改

parent 9257d464
......@@ -88,4 +88,20 @@ public interface TabHaobanStoreRelationMapper {
* @return
*/
public int updateStoreName(@Param("enterpriseId") String enterpriseId, @Param("storeId") String storeId, @Param("storeName") String storeName);
/**
* 门店查询列表
*
* @param storeId 存储id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-05-30 16:00:47
*/
List<String> listStoreIdByStoreIdWxEnterpriseId(@Param("storeId") String storeId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId);
}
\ No newline at end of file
......@@ -105,4 +105,17 @@ public interface StoreRangeService {
*/
public void updatwStoreName(String enterpriseId, String storeId, String storeName);
/**
* 该门店是否存在
*
* @param storeId 存储id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return boolean
* @author mozhu
* @date 2022-05-30 15:58:50
*/
boolean isFlagByStoreId(String storeId, String wxEnterpriseId, String enterpriseId);
}
......@@ -7,7 +7,6 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StoreOrGroupInfoDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRangeMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRelationMapper;
import com.gic.haoban.manage.service.entity.TabStoreRange;
......@@ -267,4 +266,10 @@ public class StoreRangeServiceImpl implements StoreRangeService {
public void updatwStoreName(String enterpriseId, String storeId, String storeName) {
tabHaobanStoreRelationMapper.updateStoreName(enterpriseId, storeId, storeName);
}
@Override
public boolean isFlagByStoreId(String storeId, String wxEnterpriseId, String enterpriseId) {
List<String> storeIds = tabHaobanStoreRelationMapper.listStoreIdByStoreIdWxEnterpriseId(storeId, wxEnterpriseId, enterpriseId);
return CollectionUtils.isNotEmpty(storeIds);
}
}
......@@ -1346,11 +1346,7 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public boolean isFlagByStoreIdAndEnterpriseId(String storeId, String enterpriseId, String wxEnterpriseId) {
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(enterpriseIdStoreIds)) {
return false;
}
return enterpriseIdStoreIds.contains(storeId);
return storeRangeService.isFlagByStoreId(storeId, wxEnterpriseId, enterpriseId);
}
@Override
......@@ -1384,7 +1380,7 @@ public class StaffApiServiceImpl implements StaffApiService {
}
Integer superAdmin = clerkDTO.getSuperAdmin();
if (superAdmin != null && superAdmin == 1) {
logger.info("gic超管,clerkId:{}",clerkId);
logger.info("gic超管,clerkId:{}", clerkId);
//gic超管
return Collections.singletonList("-1");
}
......@@ -1405,7 +1401,7 @@ public class StaffApiServiceImpl implements StaffApiService {
Integer selectType = storeWidgetDTO.getSelectType();
if (selectType != null && selectType == 0) {
//gic超管
logger.info("gic超管,clerkId:{}",clerkId);
logger.info("gic超管,clerkId:{}", clerkId);
return Collections.singletonList("-1");
}
return getStoreWidgetIdStoreIds(storeWidgetId, enterpriseId);
......
......@@ -13,9 +13,9 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
store_relation_id, wx_enterprise_id, store_id, store_group_id, enterprise_id, status_flag, store_name,
store_relation_id, wx_enterprise_id, store_id, store_group_id, enterprise_id, status_flag, store_name,
create_time, update_time
</sql>
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
......@@ -23,19 +23,18 @@
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_store_relation
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</delete>
delete
from tab_haoban_store_relation
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
insert into tab_haoban_store_relation (store_relation_id, wx_enterprise_id,
store_id, store_group_id, enterprise_id,
status_flag, create_time, update_time
)
values (#{storeRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{storeId,jdbcType=VARCHAR}, #{storeGroupId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
insert into tab_haoban_store_relation (store_relation_id, wx_enterprise_id,
store_id, store_group_id, enterprise_id,
status_flag, create_time, update_time)
values (#{storeRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{storeId,jdbcType=VARCHAR}, #{storeGroupId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
insert into tab_haoban_store_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -134,26 +133,25 @@
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
update tab_haoban_store_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
store_group_id = #{storeGroupId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</update>
update tab_haoban_store_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
store_group_id = #{storeGroupId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</update>
<update id="deleteStoreRalation">
update tab_haoban_store_relation
set
status_flag = 0,
update_time = now()
where store_id = #{storeId,jdbcType=VARCHAR}
and enterprise_id=#{enterpriseId}
and status_flag=1
</update>
update tab_haoban_store_relation
set status_flag = 0,
update_time = now()
where store_id = #{storeId,jdbcType=VARCHAR}
and enterprise_id = #{enterpriseId}
and status_flag = 1
</update>
<select id="searchStoreRange" resultMap="BaseResultMap">
select
......@@ -189,11 +187,10 @@
<update id="deleteAllStoreRalation">
update tab_haoban_store_relation
set
status_flag = 0,
update_time = now()
where enterprise_id=#{enterpriseId}
and status_flag=1
set status_flag = 0,
update_time = now()
where enterprise_id = #{enterpriseId}
and status_flag = 1
</update>
<update id="deleteStoreRalationByStoreIds">
......@@ -211,11 +208,19 @@
<update id="updateStoreName">
update tab_haoban_store_relation
set
store_name = #{storeName},
update_time = now()
where enterprise_id=#{enterpriseId}
and store_id=#{storeId}
and status_flag=1
set store_name = #{storeName},
update_time = now()
where enterprise_id = #{enterpriseId}
and store_id = #{storeId}
and status_flag = 1
</update>
<select id="listStoreIdByStoreIdWxEnterpriseId" resultType="String">
select store_id
from tab_haoban_store_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and store_id = #{storeId}
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
......@@ -6,10 +6,14 @@ import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -19,37 +23,42 @@ import java.util.List;
@RestController
@RequestMapping("/store")
public class StoreController extends WebBaseController{
private static final Logger logger = LoggerFactory.getLogger(StoreController.class);
@Autowired
private StoreService storeService;
@Autowired
private StaffApiService staffApiService;
//门店列表
@RequestMapping("/find-simple-page")
public HaobanResponse storeList(Integer storeType,String enterpriseId,BasePageInfo basePageInfo) {
boolean superAdmin = staffApiService.isSuperAdmin(AuthWebRequestUtil.getLoginUser().getClerkId());
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
String clerkId = loginUser.getClerkId();
Page page = new Page<>();
page.setCurrentPage(basePageInfo.getPageNum());
page.setPageSize(basePageInfo.getPageSize());
int pageNum = basePageInfo.getPageNum();
int pageSize = basePageInfo.getPageSize();
page.setCurrentPage(pageNum);
page.setPageSize(pageSize);
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStatus("2");
if (!superAdmin) {
storeSearchDTO.setUserId(AuthWebRequestUtil.getLoginUser().getClerkId());
}
storeSearchDTO.setStoreType(storeType);
Page<StoreDTO> resultPage = storeService.storeListPage(page, storeSearchDTO);
List<StoreDTO> storeDTOList = resultPage.getResult();
List<String> storeRolesByClerkId = staffApiService.getHaoBanStoreRolesByClerkId(clerkId, loginUser.getWxEnterpriseId());
PageResult<StoreDTO> pageVo = new PageResult<>();
pageVo.setList(storeDTOList);
pageVo.setPageNum(page.getCurrentPage());
pageVo.setPages(resultPage.getPages());
pageVo.setPageSize(page.getPageSize());
pageVo.setTotal(page.getTotalCount());
return resultResponse(HaoBanErrCode.ERR_1,pageVo);
pageVo.setPageNum(pageNum);
pageVo.setPageSize(pageSize);
if (CollectionUtils.isEmpty(storeRolesByClerkId)) {
logger.info("导购无门店权限");
return resultResponse(HaoBanErrCode.ERR_1,pageVo);
}
storeSearchDTO.setStoreIdList(storeRolesByClerkId);
Page<StoreDTO> pageResult = storeService.storeListPage(page, storeSearchDTO);
pageVo.setList(pageResult.getResult());
pageVo.setTotal(pageResult.getTotalCount());
return resultResponse(HaoBanErrCode.ERR_1, pageVo);
}
}
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