Commit 5cea527f by songyinghui

feat: 活码分权

parent 34d0a8cc
...@@ -46,7 +46,7 @@ public interface HmGroupApiService { ...@@ -46,7 +46,7 @@ public interface HmGroupApiService {
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId); ServiceResponse<Integer> queryGroupTotalReferCount(String clerkId, String enterpriseId, String wxEnterpriseId);
/** /**
* 查询单个分组信息 * 查询单个分组信息
......
...@@ -178,7 +178,7 @@ public interface TabHaobanHmQrcodeMapper { ...@@ -178,7 +178,7 @@ public interface TabHaobanHmQrcodeMapper {
* @author mozhu * @author mozhu
* @date 2022-07-12 15:10:09 * @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 { ...@@ -167,7 +167,7 @@ public interface HmQrcodeService {
* @author mozhu * @author mozhu
* @date 2022-07-12 15:08:35 * @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 { ...@@ -128,8 +128,8 @@ public class HmQrcodeServiceImpl implements HmQrcodeService {
} }
@Override @Override
public int getTotalByEnterpriseId(String enterpriseId) { public int getTotalByEnterpriseId(String enterpriseId, List<String> hmIds) {
return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId); return tabHaobanHmQrcodeMapper.getTotalByEnterpriseId(enterpriseId, hmIds);
} }
@Override @Override
......
...@@ -183,8 +183,20 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -183,8 +183,20 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
* @return * @return
*/ */
@Override @Override
public ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId) { public ServiceResponse<Integer> queryGroupTotalReferCount(String clerkId, String enterpriseId, String wxEnterpriseId) {
int totalReferCount = qrcodeService.getTotalByEnterpriseId(enterpriseId); 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); return ServiceResponse.success(totalReferCount);
} }
......
...@@ -391,6 +391,12 @@ ...@@ -391,6 +391,12 @@
from tab_haoban_hm_qrcode from tab_haoban_hm_qrcode
where status_flag != 0 where status_flag != 0
and enterprise_id = #{enterpriseId} 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> </select>
......
...@@ -132,7 +132,7 @@ public class HmGroupController extends WebBaseController { ...@@ -132,7 +132,7 @@ public class HmGroupController extends WebBaseController {
@RequestMapping(path = "/refer/count") @RequestMapping(path = "/refer/count")
public RestResponse<?> queryGroupTotalReferCount(){ public RestResponse<?> queryGroupTotalReferCount(){
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); 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()); 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