Ver código fonte

Merge remote-tracking branch 'origin/master'

yumeng 1 ano atrás
pai
commit
7c320d7ece

+ 11 - 14
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsPolicyInfoController.java

@@ -158,12 +158,20 @@ public class CwjsPolicyInfoController {
         Integer type = object.getInteger("type");
         String userId = object.getString("userId");
         String approvalContent = object.getString("approvalContent");
-
-
         CwjsPolicyInfo cwjsPolicyInfo = cwjsPolicyInfoService.getById(id);
+
         if (cwjsPolicyInfo == null) {
             return Result.error("政策不存在或已被删除,请重新选择要审核的政策。");
         }
+        //当前政策审核人
+        String approvalUser = cwjsPolicyInfo.getApprovedProgress();
+        //策略审核人不是 法务 和 政审时,必须 登录人和审核人一致
+        if (!Check.isNull(approvalUser) && !"legalAffairs".equals(approvalUser) && !"1747433221403979778".equals(approvalUser)) {
+            if (!Check.isNull(userId) && !userId.equals(approvalUser)) {
+                return Result.error("该政策已被审核,请刷新政策列表");
+            }
+
+        }
         cwjsPolicyInfo.setLoginUserId(userId);
         cwjsPolicyInfo.setApprovalContent(approvalContent);
         //获取 公司主题
@@ -172,10 +180,6 @@ public class CwjsPolicyInfoController {
         CwjsCompanySubject companySubject = cwjsCompanySubjectService.getById(companySubjectId);
         cwjsPolicyInfo.setCompanyId(companySubject.getCompanyId());
 
-
-        //当前政策审核人
-        String approvalUser = cwjsPolicyInfo.getApprovedProgress();
-
         //政策所属销售的部门 和 上级
         JSONObject examineUser = cwjsPolicyInfoMapper.getUserLeaderAndDirectorByRoleName(cwjsPolicyInfo.getCreateUserId(), "分公司总经理");
         String firstAudit = "";//第一次审核人
@@ -263,6 +267,7 @@ public class CwjsPolicyInfoController {
                     reportSettlementService.cwjsPRofit(cwjsPolicyInfo);
                     return Result.successMsg("审核通过", cwjsPolicyInfo);
                 }
+                //丁兆明:b161b7d9793942f980dbfe8c931cd1b0
                 if (examineUser.getString("departName").contains("销售") && !"b161b7d9793942f980dbfe8c931cd1b0".equals(userId)) {
                     //华北 ---> 通过转政审
                     if (cwjsPolicyInfo.getCompanyId().equals("d57fecdcf7a94d009736d9c850731582")) {
@@ -305,7 +310,6 @@ public class CwjsPolicyInfoController {
                         cwjsPolicyInfo.getAdvancePay(), cwjsPolicyInfo.getRebateType(), cwjsPolicyInfo.getRebateRate());
                 if (!Check.isNull(autoConveryList)) {
                     //符合条件,自动转老板
-                    cwjsPolicyInfo.setApprovalContent("审核通过");
                     cwjsPolicyInfoService.automaticConveyBossExamine(cwjsPolicyInfo);
                     cwjsPolicyInfoService.updateById(cwjsPolicyInfo);
                     return Result.successMsg("审核通过", cwjsPolicyInfo);
@@ -355,12 +359,6 @@ public class CwjsPolicyInfoController {
                 text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
                 corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId, text.toString());
             }
-            JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicyInfo.getApprovedProgress());
-            StringBuilder text = new StringBuilder();
-            text.append("您有一条销售政策需要审核,该客户为:");
-            text.append(cwjsPolicyInfo.getCompanyName());
-            text.append(",请及时登录助手平台-销售政策页面进行审核,谢谢!");
-            corpWexinUtils.sendMessageByWeChatId(wChatIdByUserId, text.toString());
             CwjsPolicyApprovalLog policyApprovalLog = new CwjsPolicyApprovalLog();
             policyApprovalLog.setPolicyId(id);
             policyApprovalLog.setCreateUserId(userId);
@@ -380,7 +378,6 @@ public class CwjsPolicyInfoController {
             policyApprovalLog.setCreateTime(new Date());
             policyApprovalLogService.save(policyApprovalLog);
 
-
             JSONObject wChatIdByUserId = mailLogMapper.getWChatIdByUserId(cwjsPolicyInfo.getCreateUserId());
             StringBuilder text = new StringBuilder();
             text.append("您有一条销售政策审核未通过,客户为:");

+ 185 - 200
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/controller/CwjsSaleAssistantInfoController.java

@@ -1,223 +1,208 @@
 package org.jeecg.ctop.finance.policy.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang3.StringUtils;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.system.query.QueryRuleEnum;
-import org.jeecg.common.util.oConvertUtils;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.ctop.finance.policy.entity.CwjsSaleAssistantInfo;
 import org.jeecg.ctop.finance.policy.service.ICwjsSaleAssistantInfoService;
-import org.jeecg.ctop.finance.policy.utils.Check;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.system.service.ISysRoleService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
- /**
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
  * 财务-2021-10-30 17:50
+ *
  * @author jeecg-boot
- * @date   2021-10-18
  * @version V1.0
+ * @date 2021-10-18
  */
 @Slf4j
-@Api(tags="销售与销售助理关系")
+@Api(tags = "销售与销售助理关系")
 @RestController
 @RequestMapping("/cwjsSaleAssistantInfo")
 public class CwjsSaleAssistantInfoController {
-	@Autowired
-	private ICwjsSaleAssistantInfoService cwjsSaleAssistantInfoService;
-
-
-	 @Autowired
-	 private ISysRoleService roleService;
-
-
-
-	 /**
-	  * 分页列表查询
-	 * @param cwjsSaleAssistantInfo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理关系-分页列表查询", notes="销售与销售助理对应关系-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<CwjsSaleAssistantInfo>> queryPageList(CwjsSaleAssistantInfo cwjsSaleAssistantInfo,
-															  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-															  HttpServletRequest req) {
-		Result<IPage<CwjsSaleAssistantInfo>> result = new Result<>();
-		QueryWrapper<CwjsSaleAssistantInfo> queryWrapper = QueryGenerator.initQueryWrapper(cwjsSaleAssistantInfo, req.getParameterMap());
-		queryWrapper.eq("del_flag", 0);
-		queryWrapper.orderByDesc("update_time");
-		Page<CwjsSaleAssistantInfo> page = new Page<CwjsSaleAssistantInfo>(pageNo, pageSize);
-		IPage<CwjsSaleAssistantInfo> pageList = cwjsSaleAssistantInfoService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-
-	/**
-	  *   添加
-	 * @param cwjsSaleAssistantInfo
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理对应关系-添加", notes="销售与销售助理对应关系-添加")
-	@PostMapping(value = "/add")
-	public Result<CwjsSaleAssistantInfo> add(@RequestBody CwjsSaleAssistantInfo cwjsSaleAssistantInfo) {
-		Result<CwjsSaleAssistantInfo> result = new Result<>();
-		try {
-			cwjsSaleAssistantInfo.setCreateTime(new Date());
-			cwjsSaleAssistantInfoService.save(cwjsSaleAssistantInfo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-
-	/**
-	  *  编辑
-	 * @param cwjsSaleAssistantInfo
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理对应关系-编辑", notes="销售与销售助理对应关系-编辑")
-	@PostMapping(value = "/edit")
-	public Result<CwjsSaleAssistantInfo> edit(@RequestBody CwjsSaleAssistantInfo cwjsSaleAssistantInfo) {
-		Result<CwjsSaleAssistantInfo> result = new Result<CwjsSaleAssistantInfo>();
-		CwjsSaleAssistantInfo cwjsSaleAssistantInfoEntity = cwjsSaleAssistantInfoService.getById(cwjsSaleAssistantInfo.getId());
-		if(cwjsSaleAssistantInfoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = cwjsSaleAssistantInfoService.updateById(cwjsSaleAssistantInfo);
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-
-		return result;
-	}
-
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理对应关系-通过id删除", notes="销售与销售助理对应关系-通过id删除")
-	@GetMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id") String id) {
-		try {
-			cwjsSaleAssistantInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-
-	/**
-	 *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理对应关系-批量删除", notes="销售与销售助理对应关系-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<CwjsSaleAssistantInfo> deleteBatch(@RequestParam(name="ids") String ids) {
-		Result<CwjsSaleAssistantInfo> result = new Result<>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.cwjsSaleAssistantInfoService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="销售与销售助理对应关系-通过id查询", notes="销售与销售助理对应关系-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<CwjsSaleAssistantInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<CwjsSaleAssistantInfo> result = new Result<>();
-		CwjsSaleAssistantInfo cwjsSaleAssistantInfo = cwjsSaleAssistantInfoService.getById(id);
-		if(cwjsSaleAssistantInfo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(cwjsSaleAssistantInfo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
-
-
-
-
-	 @ApiOperation(value="销售/销售助理下拉框", notes="销售/销售助理下拉框")
-	 @GetMapping(value = "/getSaleListByUserDepart")
-	 public Result<IPage<CwjsSaleAssistantInfo>> getSaleListByUserDepart(@RequestParam(name="userId") String userId) {
-	 	//查询用户角色
-		 String roleCode = roleService.getRoleCodeByUserId(userId);
-		 //管理员 查询全部
-		 if (StringUtils.equals("admin",roleCode) || StringUtils.equals("finance",roleCode)){
-		 	userId = null;
-		 }
-		return cwjsSaleAssistantInfoService.getSaleListByUserDepart(userId);
-
-	 }
-
-
-	 @ApiOperation(value="政策新增-销售回显下拉框", notes="政策新增-销售回显下拉框")
-	 @GetMapping(value = "/getCwSaleAndAssistantList")
-	 public Result getCwSaleAndAssistantList(@RequestParam(name="userId") String userId) {
-		List<CwjsSaleAssistantInfo> list = cwjsSaleAssistantInfoService.getCwSaleAndAssistantList(userId);
-		return Result.successMsg("查询成功。",list);
-	 }
-
-
-
-
-	 @ApiOperation(value="政策-筛选广告主", notes="政策-筛选广告主")
-	 @GetMapping(value = "/cwjsParticipateList")
-	 public Result cwjsParticipateList(@RequestBody ProjectMember projectMember) {
-		 return  cwjsSaleAssistantInfoService.cwjsParticipateList(projectMember);
-
-	 }
-
-
-
-
+    @Autowired
+    private ICwjsSaleAssistantInfoService cwjsSaleAssistantInfoService;
+
+
+    @Autowired
+    private ISysRoleService roleService;
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param cwjsSaleAssistantInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理关系-分页列表查询", notes = "销售与销售助理对应关系-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<CwjsSaleAssistantInfo>> queryPageList(CwjsSaleAssistantInfo cwjsSaleAssistantInfo,
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
+        Result<IPage<CwjsSaleAssistantInfo>> result = new Result<>();
+        QueryWrapper<CwjsSaleAssistantInfo> queryWrapper = QueryGenerator.initQueryWrapper(cwjsSaleAssistantInfo, req.getParameterMap());
+        queryWrapper.eq("del_flag", 0);
+        queryWrapper.orderByDesc("update_time");
+        Page<CwjsSaleAssistantInfo> page = new Page<CwjsSaleAssistantInfo>(pageNo, pageSize);
+        IPage<CwjsSaleAssistantInfo> pageList = cwjsSaleAssistantInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param cwjsSaleAssistantInfo
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理对应关系-添加", notes = "销售与销售助理对应关系-添加")
+    @PostMapping(value = "/add")
+    public Result<CwjsSaleAssistantInfo> add(@RequestBody CwjsSaleAssistantInfo cwjsSaleAssistantInfo) {
+        Result<CwjsSaleAssistantInfo> result = new Result<>();
+        try {
+            cwjsSaleAssistantInfo.setCreateTime(new Date());
+            cwjsSaleAssistantInfoService.save(cwjsSaleAssistantInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param cwjsSaleAssistantInfo
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理对应关系-编辑", notes = "销售与销售助理对应关系-编辑")
+    @PostMapping(value = "/edit")
+    public Result<CwjsSaleAssistantInfo> edit(@RequestBody CwjsSaleAssistantInfo cwjsSaleAssistantInfo) {
+        Result<CwjsSaleAssistantInfo> result = new Result<CwjsSaleAssistantInfo>();
+        CwjsSaleAssistantInfo cwjsSaleAssistantInfoEntity = cwjsSaleAssistantInfoService.getById(cwjsSaleAssistantInfo.getId());
+        if (cwjsSaleAssistantInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = cwjsSaleAssistantInfoService.updateById(cwjsSaleAssistantInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理对应关系-通过id删除", notes = "销售与销售助理对应关系-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            cwjsSaleAssistantInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理对应关系-批量删除", notes = "销售与销售助理对应关系-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<CwjsSaleAssistantInfo> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<CwjsSaleAssistantInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.cwjsSaleAssistantInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "销售与销售助理对应关系-通过id查询", notes = "销售与销售助理对应关系-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<CwjsSaleAssistantInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<CwjsSaleAssistantInfo> result = new Result<>();
+        CwjsSaleAssistantInfo cwjsSaleAssistantInfo = cwjsSaleAssistantInfoService.getById(id);
+        if (cwjsSaleAssistantInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(cwjsSaleAssistantInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+
+    @ApiOperation(value = "销售/销售助理下拉框", notes = "销售/销售助理下拉框")
+    @GetMapping(value = "/getSaleListByUserDepart")
+    public Result<IPage<CwjsSaleAssistantInfo>> getSaleListByUserDepart(@RequestParam(name = "userId") String userId) {
+        //查询用户角色
+        String roleCode = roleService.getRoleCodeByUserId(userId);
+        //管理员 查询全部
+        if (StringUtils.equals("admin", roleCode) || StringUtils.equals("finance", roleCode) || StringUtils.equals("policyReview", roleCode)) {
+            userId = null;
+        }
+        return cwjsSaleAssistantInfoService.getSaleListByUserDepart(userId);
+
+    }
+
+
+    @ApiOperation(value = "政策新增-销售回显下拉框", notes = "政策新增-销售回显下拉框")
+    @GetMapping(value = "/getCwSaleAndAssistantList")
+    public Result getCwSaleAndAssistantList(@RequestParam(name = "userId") String userId) {
+        List<CwjsSaleAssistantInfo> list = cwjsSaleAssistantInfoService.getCwSaleAndAssistantList(userId);
+        return Result.successMsg("查询成功。", list);
+    }
+
+
+    @ApiOperation(value = "政策-筛选广告主", notes = "政策-筛选广告主")
+    @GetMapping(value = "/cwjsParticipateList")
+    public Result cwjsParticipateList(@RequestBody ProjectMember projectMember) {
+        return cwjsSaleAssistantInfoService.cwjsParticipateList(projectMember);
+
+    }
 
 
 }

+ 10 - 12
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouMaterialStareController.java

@@ -134,25 +134,23 @@ public class KuaiShouMaterialStareController {
      */
     @GetMapping("/getKuaiShouOperateProjectInfo")
     public Result<Object> getKuaiShouOperateProjectInfo(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
-                                                            @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
-                                                            @RequestParam(name = "mediaType", defaultValue = "2") String mediaType,
-                                                            @RequestParam(name = "startTime") String startTime,
-                                                            @RequestParam(name = "endTime") String endTime,
-                                                            @RequestParam(name = "userId") String userId) {
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
+                                                        @RequestParam(name = "mediaType", defaultValue = "2") String mediaType,
+                                                        @RequestParam(name = "startTime") String startTime,
+                                                        @RequestParam(name = "endTime") String endTime,
+                                                        @RequestParam(name = "userId") String userId) {
 
         return materialStareService.getKuaiShouOperateProjectInfo(pageNum, pageSize, mediaType, startTime, endTime, userId);
     }
 
 
-
-
     @GetMapping("/getKuaiShouOperateProjectInfo2")
     public Result<Object> getKuaiShouOperateProjectInfo2(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
-                                                            @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
-                                                            @RequestParam(name = "mediaType", defaultValue = "2") String mediaType,
-                                                            @RequestParam(name = "startTime") String startTime,
-                                                            @RequestParam(name = "endTime") String endTime,
-                                                            @RequestParam(name = "userId") String userId) {
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
+                                                         @RequestParam(name = "mediaType", defaultValue = "2") String mediaType,
+                                                         @RequestParam(name = "startTime") String startTime,
+                                                         @RequestParam(name = "endTime") String endTime,
+                                                         @RequestParam(name = "userId") String userId) {
 
         try {
             List<KuaiShouOperateProjectVo> list = materialStareService.getOperateProjectInfo(pageNum, pageSize, mediaType, startTime, endTime, userId);

+ 2 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/MaterialStareMapper.java

@@ -166,4 +166,6 @@ public interface MaterialStareMapper {
     List<Long> getKuaishouProjectList(Map<String, Object> parameterMap);
 
     List<KuaiShouOperateProjectVo> getKuaiShouOperateProjectInfoNew(Map<String, Object> parameterMap);
+
+    Set<String> getSaleDirctorItsTeamMember(@Param("userId") String userId);
 }

+ 3 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BytedanceAccountReportDailyDwMapper.xml

@@ -180,11 +180,11 @@
         </if>
         GROUP BY t1.project_id
         HAVING sum(cost) > 0
-        ORDER BY ${sortCode} ${order}
         ) t
         <if test="category == 1">
             WHERE rio &lt;= -0.1 AND rio !='-'
         </if>
+        ORDER BY ${sortCode} ${order}
     </select>
 
 
@@ -204,6 +204,7 @@
     </select>
 
     <select id="getProjectMoreDaysReport" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT * FROM (
         SELECT
         t1.project_id as 'projectId',
         t3.project_name AS 'projectName',
@@ -281,6 +282,7 @@
         </if>
         GROUP BY t1.project_id
         HAVING sum(cost) > 0
+        ) t
         ORDER BY ${sortCode} ${order}
     </select>
 

+ 35 - 26
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -641,7 +641,7 @@
         IF(SUM( d.charge ) / SUM( d.activation ) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS
         activationPrice,
         IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM(
-        d.activation ) * 100, 2 ),'%'),0.00)AS leave,
+        d.activation ) * 100, 2 ),'%'),0.00)AS 'leave',
         IFNULL(SUM( d.event_pay ),0) AS eventPay,
         IF(SUM( d.charge ) / SUM( d.event_pay ) > 0.0001,ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS
         eventPayCost,
@@ -837,7 +837,7 @@
         IFNULL(SUM( d.activation ),0) AS activation,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.activation ), 2 ),0) AS activationPrice,
         IF(SUM( d.event_next_day_stay ) / SUM( d.activation ) > 0.0001,CONCAT(ROUND(SUM( d.event_next_day_stay ) / SUM(
-        d.activation ) * 100, 2 ),'%'),0.00) AS leave,
+        d.activation ) * 100, 2 ),'%'),0.00) AS 'leave',
         IFNULL(SUM( d.event_pay ),0) AS eventPay,
         IFNULL(ROUND( SUM( d.charge ) / SUM( d.event_pay ), 2 ),0) AS eventPayCost,
         IF(SUM( d.event_pay ) / ( SUM( d.activation ) + SUM( d.form_count )) > 0.0001,CONCAT(ROUND( SUM( d.event_pay ) /
@@ -1250,7 +1250,7 @@
             SUM( d.event_next_day_stay ) AS eventNextDayStay,
         </if>
         <if test='type == "leave"'>
-            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS 'leave',
         </if>
         d.ad_scene AS adScene
         FROM
@@ -1346,7 +1346,7 @@
             SUM( d.event_next_day_stay ) AS eventNextDayStay,
         </if>
         <if test='type == "leave"'>
-            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS 'leave',
         </if>
         d.age_segment AS ageSegment
         FROM
@@ -1397,7 +1397,7 @@
             SUM( d.event_next_day_stay ) AS eventNextDayStay,
         </if>
         <if test='type == "leave"'>
-            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS leave,
+            IFNULL( ROUND( SUM( d.event_next_day_stay ) / SUM( d.activation ), 2 ), 0 ) AS 'leave',
         </if>
         d.gender AS gender
         FROM
@@ -2020,9 +2020,9 @@
 
     <select id="getBytedanceProjectList" resultType="Long">
         SELECT
-               project_id
+        project_id
         FROM
-        application.bytedance_advertiser_report_daily_dw
+        application.bytedance_advertiser_report_hourly_dw
         WHERE cost > 0
         <if test="startDate != null and startDate != '' ">
             and stat_datetime &gt;= #{startDate}
@@ -2042,7 +2042,7 @@
 
     <select id="getKuaishouProjectList" resultType="Long">
         SELECT
-               project_id
+        project_id
         FROM
         application.kuaishou_account_report_daily_dw d
         WHERE charge > 0
@@ -2063,12 +2063,11 @@
     </select>
 
 
-
-
-    <select id="getKuaiShouOperateProjectInfoNew" resultType="org.jeecg.ctop.material.entity.vo.KuaiShouOperateProjectVo">
+    <select id="getKuaiShouOperateProjectInfoNew"
+            resultType="org.jeecg.ctop.material.entity.vo.KuaiShouOperateProjectVo">
         SELECT
         t1.project_name AS projectName,
-        t1.project_id AS  projectId,
+        t1.project_id AS projectId,
         SUM(t1.charge) AS totalCost,
         COUNT(DISTINCT t1.account_id) AS accountNum,
         COUNT(DISTINCT t1.user_id) AS userNum,
@@ -2188,19 +2187,19 @@
         FROM
         application.today_material_upload_num
         <where>
-        <if test="startDate != null and startDate != '' ">
-            and stat_date &gt;= #{startDate}
-        </if>
-        <if test="endDate != null and endDate != '' ">
-            and stat_date &lt;= #{endDate}
-        </if>
-        <if test='projectIds!=null and projectIds.size()>0'>
-            AND dimension IN
-            <foreach collection="projectIds" item="item" separator=","
-                     open="(" close=")">
-                #{item}
-            </foreach>
-        </if>
+            <if test="startDate != null and startDate != '' ">
+                and stat_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null and endDate != '' ">
+                and stat_date &lt;= #{endDate}
+            </if>
+            <if test='projectIds!=null and projectIds.size()>0'>
+                AND dimension IN
+                <foreach collection="projectIds" item="item" separator=","
+                         open="(" close=")">
+                    #{item}
+                </foreach>
+            </if>
         </where>
         GROUP BY dimension
         )t6 ON t1.project_id = t6.dimension
@@ -2212,7 +2211,7 @@
         json_object('adSceneCost',IFNULL(SUM(charge),0),'adSceneName',ad_scene) as 'adSceneDate'
         FROM
         application.app_kuaishou_account_ad_scene_report_d
-        WHERE  ad_scene!='全部'
+        WHERE ad_scene!='全部'
         <if test="startDate != null and startDate != '' ">
             and stat_date &gt;= #{startDate}
         </if>
@@ -2251,4 +2250,14 @@
         GROUP BY t1.project_id
         ORDER BY SUM(t1.charge) DESC
     </select>
+
+    <select id="getSaleDirctorItsTeamMember" resultType="String">
+        select DISTINCT user_id as 'userId'
+        from `application`.app_user_manage t1
+                 LEFT JOIN sys_user t2 on t1.user_id = t2.id
+        where manage_id = #{userId}
+          and t1.type = 1
+          and t2.status = 1
+    </select>
+
 </mapper>

+ 19 - 17
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/MaterialStareService.java

@@ -1,11 +1,9 @@
 package org.jeecg.ctop.material.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.github.pagehelper.PageInfo;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.ctop.material.entity.vo.KuaiShouOperateAccountVo;
 import org.jeecg.ctop.material.entity.vo.KuaiShouOperateProjectVo;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
@@ -22,42 +20,46 @@ public interface MaterialStareService {
 
     Result kuaiShousumDataPersonal(String mediaType, String startTime, String endTime, String userId);
 
-    Result kuaiShouOperateDateTotal(String mediaType,String startTime, String endTime, String userId);
+    Result kuaiShouOperateDateTotal(String mediaType, String startTime, String endTime, String userId);
 
-    Result kuaiShouOperateDateTotalPersonal(String mediaType,String startTime, String endTime, String userId);
+    Result kuaiShouOperateDateTotalPersonal(String mediaType, String startTime, String endTime, String userId);
 
-    Result getKuaiShouOperateInfo(Integer pageNum,int pageSize,String mediaType,String startTime, String endTime, String userId);
-    Result exportKuaiShouOperateInfo(String startTime, String endTime,String mediaType, String userId, HttpServletResponse response);
+    Result getKuaiShouOperateInfo(Integer pageNum, int pageSize, String mediaType, String startTime, String endTime, String userId);
 
-    Result getKuaiShouOperateProjectInfo(Integer pageNum,int pageSize,String mediaType,String startTime, String endTime, String userId);
-    List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String mediaType,String startTime, String endTime, String userId);
+    Result exportKuaiShouOperateInfo(String startTime, String endTime, String mediaType, String userId, HttpServletResponse response);
+
+    Result getKuaiShouOperateProjectInfo(Integer pageNum, int pageSize, String mediaType, String startTime, String endTime, String userId);
+
+    List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String mediaType, String startTime, String endTime, String userId);
+
+    Result getKuaiShouOperateAccountInfo(Integer pageNum, int pageSize, String startTime, String endTime, String projectId, String userId);
 
-    Result getKuaiShouOperateAccountInfo(Integer pageNum,int pageSize,String startTime, String endTime, String projectId,String userId);
     List<KuaiShouOperateAccountVo> exportKuaiShouOperateAccountInfo(String startTime, String endTime, String projectId, String userId);
 
     Result getKuaiShouAccountInfo(long accountId);
 
-    Result getKuaiShouAccountInfoBrokenLine(long accountId,String startTime, String endTime,String type);
+    Result getKuaiShouAccountInfoBrokenLine(long accountId, String startTime, String endTime, String type);
 
-    Result getKuaiShouAccountMaterialNewAndEffectAndFaddish(long accountId,String searchType,String startTime, String endTime,Integer pageNum,Integer pageSize);
+    Result getKuaiShouAccountMaterialNewAndEffectAndFaddish(long accountId, String searchType, String startTime, String endTime, Integer pageNum, Integer pageSize);
 
-    Result getKuaiShouAccountPieChar(long accountId,String startTime, String endTime,String type);
+    Result getKuaiShouAccountPieChar(long accountId, String startTime, String endTime, String type);
 
 
-    Result kuaiShouRealTimeUnitDateInfo(long accountId,Integer pageNum,Integer pageSize);
+    Result kuaiShouRealTimeUnitDateInfo(long accountId, Integer pageNum, Integer pageSize);
 
 
     Result getCompanyAllSubordinateByUserId(String userId);
 
 
-
     Result<List<JSONObject>> participateListByMediaIdAllSubordinate(JSONObject requestJson);
 
     List<JSONObject> getProjectByUserIdAndMediaIdsSubordinate(Set<String> userIds, List<Integer> mediaIds);
-    Map<Long, List<JSONObject>> getAccountListByProjectListSubordinate(Set<String> userIds,List<JSONObject> projectList);
 
-    Result getOperationGroupData(String userId,String mediaType,String startTime, String endTime, Integer pageNum, Integer pageSize);
-    Result exportOperationGroupData(String userId,String mediaType,String startTime, String endTime,HttpServletResponse response);
+    Map<Long, List<JSONObject>> getAccountListByProjectListSubordinate(Set<String> userIds, List<JSONObject> projectList);
+
+    Result getOperationGroupData(String userId, String mediaType, String startTime, String endTime, Integer pageNum, Integer pageSize);
+
+    Result exportOperationGroupData(String userId, String mediaType, String startTime, String endTime, HttpServletResponse response);
 
     List<KuaiShouOperateProjectVo> getOperateProjectInfo(Integer pageNum, int pageSize, String mediaType, String startTime, String endTime, String userId) throws ParseException;
 

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/BytedanceAccountReportDailyDwServiceImpl.java

@@ -100,7 +100,7 @@ public class BytedanceAccountReportDailyDwServiceImpl implements IBytedanceAccou
             order = "DESC";
         }
         if (Check.isNull(sortCode)) {
-            sortCode = "SUM(cost)";
+            sortCode = "cost";
         }
         Integer startTimeInt = DateUtils.getDateInteger(startTime);
         Integer endTimeInt = DateUtils.getDateInteger(endTime);

+ 63 - 73
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -1460,7 +1460,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             long nowDate = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
 
             long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
+
             long entDate = Long.valueOf(DateUtils.getDateInteger(endTime));
+
             //计算环比 时间值 上阶段时间 以及 两个日期之间的 间隔天数
             Map<String, String> lastTime = DateUtils.getStartEndTime(startTime, endTime);
             long lastTimeStart = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeStart")));
@@ -1787,76 +1789,76 @@ public class MaterialStareServiceImpl implements MaterialStareService {
         DecimalFormat decimalFormat = new DecimalFormat("0.00%");
         long now = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
         List<KuaiShouOperateProjectVo> listOperate = new ArrayList<>();
-            //查询当前人员所有下级
-            Set<String> operatorUserIds = getAffiliateId(userId);
-            //2022-02-15 ==>> 20220215
-            long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
-            long entDate = Long.valueOf(DateUtils.getDateInteger(endTime));
-
-            //计算环比 时间值 上阶段时间 以及 两个日期之间的 间隔天数
-            Map<String, String> lastTime = DateUtils.getStartEndTime(startTime, endTime);
-            long lastTimeStart = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeStart")));
-            long lastTimeEnd = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeEnd")));
-            Integer daysBetween = Integer.valueOf(lastTime.get("daysBetween")) + 1;
+        //查询当前人员所有下级
+        Set<String> operatorUserIds = getAffiliateId(userId);
+        //2022-02-15 ==>> 20220215
+        long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
+        long entDate = Long.valueOf(DateUtils.getDateInteger(endTime));
 
-            Map<String, Object> parameterMap = new HashMap<>();
-            parameterMap.put("startDate", startDate);
-            parameterMap.put("endDate", entDate);
-            parameterMap.put("lastTimeStart", lastTimeStart);
-            parameterMap.put("lastTimeEnd", lastTimeEnd);
-            parameterMap.put("userIds", operatorUserIds);
-            parameterMap.put("startEqually", DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(startTime)), -7)));
-            parameterMap.put("endEqually", DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(endTime)), -7)));
+        //计算环比 时间值 上阶段时间 以及 两个日期之间的 间隔天数
+        Map<String, String> lastTime = DateUtils.getStartEndTime(startTime, endTime);
+        long lastTimeStart = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeStart")));
+        long lastTimeEnd = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeEnd")));
+        Integer daysBetween = Integer.valueOf(lastTime.get("daysBetween")) + 1;
+
+        Map<String, Object> parameterMap = new HashMap<>();
+        parameterMap.put("startDate", startDate);
+        parameterMap.put("endDate", entDate);
+        parameterMap.put("lastTimeStart", lastTimeStart);
+        parameterMap.put("lastTimeEnd", lastTimeEnd);
+        parameterMap.put("userIds", operatorUserIds);
+        parameterMap.put("startEqually", DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(startTime)), -7)));
+        parameterMap.put("endEqually", DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(endTime)), -7)));
 
-            //头条
-            if (mediaType.equals("1")) {
-                List<Long> projectIds = materialStareMapper.getBytedanceProjectList(parameterMap);
-                if(Check.isNull(projectIds)){
-                    return listOperate;
-                }
-                parameterMap.put("projectIds", projectIds);
-                PageHelper.startPage(pageNum, pageSize);
-                if (startDate == now || entDate == now) {
-                    parameterMap.put("tableName", "application.bytedance_advertiser_report_hourly_dw");
-                    parameterMap.put("hour", DateUtils.getNowHour());
-                } else {
-                    parameterMap.put("tableName", "application.bytedance_advertiser_report_daily_dw");
-                }
-                listOperate = materialStareMapper.getBytedanceOperateProjectInfoNew(parameterMap);
+        //头条
+        if (mediaType.equals("1")) {
+            List<Long> projectIds = materialStareMapper.getBytedanceProjectList(parameterMap);
+            if (Check.isNull(projectIds)) {
+                return listOperate;
             }
-            //快手
-            if (mediaType.equals("2")) {
-                List<Long> projectIds = materialStareMapper.getKuaishouProjectList(parameterMap);
-               if(Check.isNull(projectIds)){
-                   return listOperate;
-               }
-                parameterMap.put("projectIds", projectIds);
-                if (startDate == now || entDate == now) {
-                    parameterMap.put("tableName", "application.kuaishou_account_report_hourly_dw");
-                    parameterMap.put("hour", DateUtils.getNowHour());
+            parameterMap.put("projectIds", projectIds);
+            PageHelper.startPage(pageNum, pageSize);
+            if (startDate == now || entDate == now) {
+                parameterMap.put("tableName", "application.bytedance_advertiser_report_hourly_dw");
+                parameterMap.put("hour", DateUtils.getNowHour());
+            } else {
+                parameterMap.put("tableName", "application.bytedance_advertiser_report_daily_dw");
+            }
+            listOperate = materialStareMapper.getBytedanceOperateProjectInfoNew(parameterMap);
+        }
+        //快手
+        if (mediaType.equals("2")) {
+            List<Long> projectIds = materialStareMapper.getKuaishouProjectList(parameterMap);
+            if (Check.isNull(projectIds)) {
+                return listOperate;
+            }
+            parameterMap.put("projectIds", projectIds);
+            if (startDate == now || entDate == now) {
+                parameterMap.put("tableName", "application.kuaishou_account_report_hourly_dw");
+                parameterMap.put("hour", DateUtils.getNowHour());
                    /* //查询 当天有效 上新计划 上新组
                     JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(null, projectIds.get(0)+"", null, now, now);
                     int newUnitNumNow = 0;
                     int trustUnitNum = 0;
                     newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     trustUnitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum");//智能托管*/
-                } else {
-                    parameterMap.put("tableName", "application.kuaishou_account_report_daily_dw");
-                }
-                PageHelper.startPage(pageNum, pageSize);
-                listOperate = materialStareMapper.getKuaiShouOperateProjectInfoNew(parameterMap);
-                for (KuaiShouOperateProjectVo vo : listOperate) {
-                    List<JSONObject> adSceneDate = JSONObject.parseArray( vo.getAdSceneDateStr(), JSONObject.class);
-                    vo.setAdSceneDate(adSceneDate);
-                }
+            } else {
+                parameterMap.put("tableName", "application.kuaishou_account_report_daily_dw");
             }
-            //计算同比 时间值 只支持7天
-            if (daysBetween > 7) {
-                for (KuaiShouOperateProjectVo projectVo : listOperate) {
-                    projectVo.setEquallyRate("-");
-                }
+            PageHelper.startPage(pageNum, pageSize);
+            listOperate = materialStareMapper.getKuaiShouOperateProjectInfoNew(parameterMap);
+            for (KuaiShouOperateProjectVo vo : listOperate) {
+                List<JSONObject> adSceneDate = JSONObject.parseArray(vo.getAdSceneDateStr(), JSONObject.class);
+                vo.setAdSceneDate(adSceneDate);
             }
-         return listOperate;
+        }
+        //计算同比 时间值 只支持7天
+        if (daysBetween > 7) {
+            for (KuaiShouOperateProjectVo projectVo : listOperate) {
+                projectVo.setEquallyRate("-");
+            }
+        }
+        return listOperate;
     }
 
 //===========================================查询下级员工========================
@@ -1891,25 +1893,13 @@ public class MaterialStareServiceImpl implements MaterialStareService {
             subordinate.add(userId);
             return subordinate;
         } else {
-            result = querySubordinate(subordinate, subordinate, null);
+            //获取其下组员
+            result = materialStareMapper.getSaleDirctorItsTeamMember(userId);
             result.add(userId);
         }
         return result;
     }
 
-    //递归查询
-    private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result, String companyId) {
-        if (leaderIds.isEmpty()) {
-            return result;
-        }
-        Set<String> temp = materialStareMapper.querySubordinateRecursive(companyId, leaderIds);
-        result.addAll(temp);
-        querySubordinate(temp, result, companyId);
-        return result;
-    }
-//===========================================查询下级员工========================
-
-
     //=========================查询下级的项目以及账户===============================================
     @Override
     public Result<List<JSONObject>> participateListByMediaIdAllSubordinate(JSONObject requestJson) {