Commit 5cea527f by songyinghui

feat: 活码分权

parent 34d0a8cc
......@@ -46,7 +46,7 @@ public interface HmGroupApiService {
* @param wxEnterpriseId
* @return
*/
ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId);
ServiceResponse<Integer> queryGroupTotalReferCount(String clerkId, String enterpriseId, String wxEnterpriseId);
/**
* 查询单个分组信息
......
......@@ -178,7 +178,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu
* @date 2022-07-12 15:10:09
*/
int getTotalByEnterpriseId(@Param("enterpriseId") String enterpriseId);
int getTotalByEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("hmIds") List<String> hmIds);
/**
* 批量修改 活码所属分组
......
......@@ -167,7 +167,7 @@ public interface HmQrcodeService {
* @author mozhu
* @date 2022-07-12 15:08:35
*/
int getTotalByEnterpriseId(String enterpriseId);
int getTotalByEnterpriseId(String enterpriseId, List<String> hmIds);
/**
* 批量修改活码分组
......
......@@ -128,8 +128,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
}
@Override
public int getTotalByEnterpriseId(String enterpriseId) {
return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId);
public int getTotalByEnterpriseId(String enterpriseId, List<String> hmIds) {
return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId, hmIds);
}
@Override
......
......@@ -183,8 +183,20 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
* @return
*/
@Override
public ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId) {
int totalReferCount = qrcodeService.getTotalByEnterpriseId(enterpriseId);
public ServiceResponse<Integer> queryGroupTotalReferCount(String clerkId, String enterpriseId, String wxEnterpriseId) {
List<String> storeList = staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
log.info("导购拥有的门店权限 clerkId:{}, storeIds:{}", clerkId, JSON.toJSONString(storeList));
List<String> hmIds = null;
if (!CollectionUtils.isEmpty(storeList)) {
if (!storeList.contains("-1")) {
HmQrcodeListQDTO hmQrcodeListQDTO = new HmQrcodeListQDTO();
hmQrcodeListQDTO.setEnterpriseId(enterpriseId);
hmQrcodeListQDTO.setStoreId(storeList);
hmIds = qrcodeService.listHmIdForIndex(hmQrcodeListQDTO);
log.info("导购拥有的活码权限列表:{}", JSON.toJSONString(hmIds));
}
}
int totalReferCount = qrcodeService.getTotalByEnterpriseId(enterpriseId, hmIds);
return ServiceResponse.success(totalReferCount);
}
......
......@@ -391,6 +391,12 @@
from tab_haoban_hm_qrcode
where status_flag != 0
and enterprise_id = #{enterpriseId}
<if test="hmIds != null and hmIds.size > 0">
and hm_id in
<foreach collection="hmIds" open="(" close=")" separator="," item="hmId">
#{hmId}
</foreach>
</if>
</select>
......
......@@ -132,7 +132,7 @@ public class HmGroupController extends WebBaseController {
@RequestMapping(path = "/refer/count")
public RestResponse<?> queryGroupTotalReferCount(){
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
ServiceResponse<Integer> serviceResponse = groupApiService.queryGroupTotalReferCount(loginUser.getEnterpriseId(), loginUser.getWxEnterpriseId());
ServiceResponse<Integer> serviceResponse = groupApiService.queryGroupTotalReferCount(loginUser.getClerkId(), loginUser.getEnterpriseId(), loginUser.getWxEnterpriseId());
return RestResponse.successResult(serviceResponse.getResult());
}
......
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