Forráskód Böngészése

修改时报字段异常问题

songyh 3 éve
szülő
commit
362e2d7733

+ 2 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/UserAllocationMapper.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -17,5 +18,5 @@ import java.util.List;
 public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     IPage<UserAllocation> queryListWithPermission(Page<UserAllocation> page, String sql);
 
-    List<JSONObject> getAccountListByProjectList(List list);
+    List<JSONObject> getAccountListByProjectList(@Param(value = "list")List list, @Param(value = "designUserId")String designUserId);
 }

+ 3 - 0
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/UserAllocationMapper.xml

@@ -18,6 +18,9 @@
                  open="(" close=")">
             #{item}
         </foreach>
+        <if test="designUserId!=null">
+            abd t1.user_id = #{designUserId}
+        </if>
         order by t1.create_time desc
     </select>
 </mapper>

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/service/IUserAllocationService.java

@@ -17,5 +17,5 @@ import java.util.Map;
 public interface IUserAllocationService extends IService<UserAllocation> {
     IPage<UserAllocation> queryListWithPermission(Integer pageSize, Integer pageNo);
 
-    Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList);
+    Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList,String designUserId);
 }

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/service/impl/ProjectMemberServiceImpl.java

@@ -135,7 +135,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
             map.put(member.getProjectId(), new ArrayList<>());
         }
 
-        List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list);
+        List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list,null);
         for (int i = 0; i < jsonList.size(); i++) {
             JSONObject jsonObject = jsonList.get(i);
             Long projectId = jsonObject.getLong("projectId");

+ 2 - 2
jeecg-boot-report/src/main/java/cn/com/ctop/common/service/impl/UserAllocationServiceImpl.java

@@ -38,7 +38,7 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     }
 
     @Override
-    public Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList) {
+    public Map<Long, List<JSONObject>> getAccountListByProjectList(List<JSONObject> projectList,String designUserId) {
         Map<Long, List<JSONObject>> map = new HashMap<>();
         List list = new ArrayList();
         for (int i = 0; i < projectList.size(); i++) {
@@ -48,7 +48,7 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
                 map.put(jsonObject.getLong("projectId"), new ArrayList<>());
             }
         }
-        List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list);
+        List<JSONObject> jsonList = userAllocationMapper.getAccountListByProjectList(list,designUserId);
         for (int i = 0; i < jsonList.size(); i++) {
             JSONObject jsonObject = jsonList.get(i);
             if (!Check.isNull(jsonObject)) {

+ 8 - 3
jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouMaterialReportDailyDwController.java

@@ -48,9 +48,9 @@ public class KuaishouMaterialReportDailyDwController {
     @PostMapping(value = "/getProjectAccountByUserId")
     public Map<String, Object> getProjectAccount(@RequestBody JSONObject params) {
         Map<String, Object> resultMap = new HashMap<>();
-        String userId = params.getString("userId");
+        String getUserId = params.getString("userId");
         String type = params.getString("type");
-        if (null == userId || "".equals(userId.trim()) || null == type || "".equals(type.trim())) {
+        if (null == getUserId || "".equals(getUserId.trim()) || null == type || "".equals(type.trim())) {
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_PARAM_ERROR);
             return resultMap;
         }
@@ -63,17 +63,22 @@ public class KuaishouMaterialReportDailyDwController {
             mediaIds.add(3);
         }
         //查询用户角色
+        String userId = getUserId;
         String roleCode = sysRoleMapper.getRoleCodeByUserId(userId);
         //角色为 管理员 || 销售 || 媒介 查询全部
         if ("admin".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
             userId = null;
         }
+        String operatorId = null;
+        if ("operator".equals(roleCode) || roleCode.contains("operationAssistant")) {
+            operatorId = getUserId;
+        }
         //查询项目信息以及广告主
         List<JSONObject> projectList = projectMemberService.getProjectByUserIdAndMediaIds(userId, mediaIds);
         List<JSONObject> haveList = new ArrayList<>();
         if (!Check.isNull(projectList)) {
             //项目id 查询账户人员信息
-            Map<Long, List<JSONObject>> accountMap = userAllocationService.getAccountListByProjectList(projectList);
+            Map<Long, List<JSONObject>> accountMap = userAllocationService.getAccountListByProjectList(projectList,operatorId);
             for (int i = 0; i < projectList.size(); i++) {
                 JSONObject project = projectList.get(i);
                 if (!Check.isNull(project)) {

+ 6 - 6
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/AccountAttributionInfoMapper.xml

@@ -74,10 +74,10 @@
         <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum('show') photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
-            max(stat_hour) maxHour
+            max(`hour`) maxHour
             FROM
             kuaishou_account_report_hourly_dw
             WHERE
@@ -99,7 +99,7 @@
             kuaishou_account_report_hourly_dw
             WHERE
             stat_date = #{statDate}
-            AND stat_hour &lt;= #{hour}
+            AND `hour` &lt;= #{hour}
             AND account_id in
             <foreach item="item" index="index" collection="accountIds"
                      open="(" separator="," close=")">
@@ -114,7 +114,7 @@
             sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
-            stat_hour as statHour
+            `hour` as statHour
             FROM
             kuaishou_account_report_hourly_dw
             WHERE
@@ -125,9 +125,9 @@
                 #{item}
             </foreach>
             GROUP BY
-            stat_hour
+            `hour`
             ORDER BY
-            stat_hour ASC
+            `hour` ASC
         </select>