mitao
2024-04-30 ab4ea7b8f10c9b66aed9c2ea161a08b25c3851a7
meiya-admin/src/main/java/com/sinata/modular/mall/controller/CommissionSettlementController.java
@@ -21,6 +21,9 @@
import com.sinata.modular.mall.service.ICommissionSettlementMonthService;
import com.sinata.modular.member.model.MemUser;
import com.sinata.modular.member.service.IMemUserService;
import com.sinata.modular.system.model.Role;
import com.sinata.modular.system.service.IRoleService;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -53,6 +56,8 @@
    @Autowired
    private ICommissionSettlementMonthService commissionSettlementMonthService;
    @Autowired
    private IRoleService roleService;
    /**
     * 跳转到佣金结算明细首页
@@ -85,13 +90,19 @@
        try {
            // 【城市管理员】数据查询
            ShiroUser shiroUser = ShiroKit.getUser();
            if (shiroUser.getRoleList().contains(EnumCityRole.PROVINCE_ROLE.index)) {
                // 省级城市管理员
                cityCode = shiroUser.getCityCode().substring(0, 2);
            } else if (shiroUser.getRoleList().contains(EnumCityRole.CITY_ROLE.index)) {
            List<Integer> roleList = shiroUser.getRoleList();
            List<Integer> cityRoleList = roleService.selectList(
                            new EntityWrapper<Role>().in("id", roleList)).stream().map(Role::getCityRole)
                    .collect(
                            Collectors.toList());
            if (cityRoleList.contains(EnumCityRole.CITY_ROLE.index)) {
                // 市级城市管理员
                cityCode = shiroUser.getCityCode().substring(0, 4);
            }
            else if (cityRoleList.contains(EnumCityRole.PROVINCE_ROLE.index)) {
                // 省级城市管理员
                cityCode = shiroUser.getCityCode().substring(0, 2);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }