叶君翔 3 rokov pred
rodič
commit
94c676848b

+ 1 - 1
lb-module/src/main/java/com/ydd/module/mapper/ProfitsAgentMapper.java

@@ -22,7 +22,7 @@ public interface ProfitsAgentMapper extends BaseMapper<ProfitsAgent> {
 
     void insertProfitsAgentList(@Param("list") List<ProfitsAgent> list);
 
-    BigDecimal selectDeliveryAmountsByMonth(@Param("year") Long year,@Param("month") Long month,@Param("agentId")Integer agentId);
+    BigDecimal selectDeliveryAmountsByMonth(@Param("year") Long year,@Param("month") Long month,@Param("agentIds") List<Long> agentIds);
 
     List<ProfitsAgent> selectTopTen(@Param("date")String date);
 

+ 1 - 1
lb-module/src/main/java/com/ydd/module/service/IProfitsAgentService.java

@@ -53,7 +53,7 @@ public interface IProfitsAgentService extends IService<ProfitsAgent> {
 
     void agentProfitSettlement();
 
-    List<EChartsDto> getProfitTrend(Integer agentId);
+    List<EChartsDto> getProfitTrend(List<Long> agentIds);
 
     List<EChartsDto> topTen();
 

+ 2 - 2
lb-module/src/main/java/com/ydd/module/service/impl/ProfitsAgentServiceImpl.java

@@ -743,7 +743,7 @@ public class ProfitsAgentServiceImpl extends ServiceImpl<ProfitsAgentMapper, Pro
 
 
     @Override
-    public List<EChartsDto> getProfitTrend(Integer agentId){
+    public List<EChartsDto> getProfitTrend(List<Long> agentIds){
         List<EChartsDto> list = initEChartsDtoList();
         SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM");
         String day = sdf.format(new Date());
@@ -755,7 +755,7 @@ public class ProfitsAgentServiceImpl extends ServiceImpl<ProfitsAgentMapper, Pro
                 String date = dto.getxValue();
                 Long year = Integer.valueOf(date.split("-")[0]).longValue();
                 Long month = Integer.valueOf(date.split("-")[1]).longValue();
-                BigDecimal profit = baseMapper.selectDeliveryAmountsByMonth(year,month,agentId);
+                BigDecimal profit = baseMapper.selectDeliveryAmountsByMonth(year,month, agentIds);
                 dto.setyVlue(profit.toString());
 //            }
         }

+ 7 - 2
lb-module/src/main/resources/mapper/module/ProfitsAgentMapper.xml

@@ -39,9 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectDeliveryAmountsByMonth" resultType="java.math.BigDecimal">
         SELECT COALESCE(SUM(delivery_commission) + SUM(huolala_delivery_commission),0) FROM lb_profits_agent
-        WHERE agent_id = #{agentId}
-        AND `year` = #{year}
+        WHERE `year` = #{year}
         AND `month` = #{month}
+        <if test="agentIds != null and agentIds.size() > 0">
+            AND agent_id in
+            <foreach collection="agentIds" index="index" item="agentId" open="(" separator="," close=")">
+                #{agentId}
+            </foreach>
+        </if>
     </select>
 
     <select id="selectTopTen" resultType="com.ydd.module.domain.ProfitsAgent">

+ 20 - 2
lb-web/src/main/java/com/ydd/web/controller/HomeController.java

@@ -196,13 +196,31 @@ public class HomeController extends BaseController {
         return Result.success(list);
     }
 
+    @BindAgent
     @GetMapping("/profit/trend")
     @Log(title = "收益趋势", businessType = BusinessType.EXPORT)
     public Result trend() {
         SysUser user = getSysUser();
         List<EChartsDto> list;
-        if (user.getType().equals(UserTypeEnums.AGENT.getCode())) {
-            list = iProfitsAgentService.getProfitTrend(user.getAgentId().intValue());
+        if (user.getType().equals(UserTypeEnums.AGENT.getCode())
+                || user.getType().equals(UserTypeEnums.DSP_CUSTOMER.getCode())
+                || user.getType().equals(UserTypeEnums.DSP_MARKET.getCode())) {
+            // 允许查看的代理商数据
+            List<Long> agentIds = new ArrayList<>();
+            if (user.getType().equals(UserTypeEnums.AGENT.getCode())) {
+                agentIds = iAgentService.listAgent(user.getAgentId());
+            } else {
+                HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
+                Object obj = request.getAttribute(Constants.SYS_USER_BIND_AGENT);
+                if (obj instanceof List) {
+                    agentIds = (List) obj;
+                }
+            }
+            if (CollectionUtils.isNotEmpty(agentIds)) {
+                list = iProfitsAgentService.getProfitTrend(agentIds);
+            } else {
+                list = Lists.newArrayList();
+            }
         } else {
             list = iProfitsDspService.getProfitTrend(user.getDspId());
         }

+ 7 - 7
web-ui/src/views/index.vue

@@ -93,19 +93,19 @@
               <div class="chart-title">常用功能</div>
               <div class="link-top"/>
               <div class="function-box">
-                <div class="item" @click="toInfo('/dataInfo/dataInfo/merchant/summaryStatistics')">
+                <div class="item" @click="toInfo('/dataInfo/dataInfo/merchant/summaryStatistics')"  v-hasPermi="['module:message:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/shop-statistics.png">
                   </div>
                   <div class="label">商户统计</div>
                 </div>
-                <div class="item" @click="toInfo('/merchant/merchant')">
+                <div class="item" @click="toInfo('/merchant/merchant')"  v-hasPermi="['module:merchant:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/shop.png">
                   </div>
                   <div class="label">商户管理</div>
                 </div>
-                <div class="item" @click="toInfo('/agent/agent')" v-if="this.type == 0 || this.type == 1">
+                <div class="item" @click="toInfo('/agent/agent')" v-hasPermi="['module:merchant:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/creat-agent.png">
                   </div>
@@ -117,19 +117,19 @@
                   </div>
                   <div class="label">创建代理商</div>
                 </div>
-                <div class="item" @click="toInfo('/order/order')">
+                <div class="item" @click="toInfo('/order/order')" v-hasPermi="['module:order:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/order.png">
                   </div>
                   <div class="label">订单管理</div>
                 </div>
-                <div class="item" @click="toInfo('/device/shopDevice')">
+                <div class="item" @click="toInfo('/device/shopDevice')" v-hasPermi="['module:shopDevice:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/device.png">
                   </div>
                   <div class="label">设备管理</div>
                 </div>
-                <div class="item" @click="toInfo('/withdrawal/agentWithdrawal')">
+                <div class="item" @click="toInfo('/withdrawal/agentWithdrawal')" v-hasPermi="['module:agentWithdrawal:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/shop.png">
                   </div>
@@ -147,7 +147,7 @@
                   </div>
                   <div class="label">代理商</div>
                 </div>
-                <div class="item" @click="toInfo(commissionUrl)">
+                <div class="item" @click="toInfo(commissionUrl)" v-hasPermi="['module:message:list']">
                   <div class="img-bg">
                     <img class="icon" src="../assets/images/commission.png">
                   </div>