Просмотр исходного кода

Merge branch 'test' into test-d

dongxin 1 год назад
Родитель
Сommit
6fae429c82

+ 2 - 8
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -3,7 +3,6 @@ package com.ydtech.modules.admin.controller;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.extra.spring.SpringUtil;
-import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,9 +18,6 @@ import com.ydtech.modules.admin.components.request.UnionPayRequest;
 import com.ydtech.modules.admin.components.response.UnionPayResponse;
 import com.ydtech.modules.admin.constants.RoleConstants;
 import com.ydtech.modules.admin.constants.UserWorkStatus;
-import com.ydtech.modules.admin.dao.SysAgencyLeaderMapper;
-import com.ydtech.modules.admin.dao.SysPartnerMapper;
-import com.ydtech.modules.admin.dao.SysUserMapper;
 import com.ydtech.modules.admin.dao.SysUserRecordMapper;
 import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.*;
@@ -52,7 +48,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.models.auth.In;
 import jodd.util.StringUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -63,7 +58,6 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.time.LocalDate;
 import java.util.*;
@@ -1319,8 +1313,8 @@ public class SysUserController extends BaseController {
      */
     @ApiOperation(value = "电销管理人数据列表")
     @GetMapping(value = "/findDxUserList")
-    public HttpResult findDxUserList() {
-        return HttpResult.ok(sysUserService.findDxUserList());
+    public HttpResult findDxUserList(String type) {
+        return HttpResult.ok(sysUserService.findDxUserList(type));
     }
 
 }

+ 4 - 20
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -14,6 +14,7 @@ import com.ydtech.modules.admin.service.TaskStatisticsService;
 import com.ydtech.modules.admin.utils.KztGetDeptUtils;
 import io.swagger.annotations.*;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -399,17 +400,9 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentData")
     @ApiOperation(value = "控制台-业务数据-代理人")
-    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<IPage<BusinessAgentData>> getBusinessAgentData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         try{
-            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
-            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
-            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
-                if("1".equals(kztGetDeptUtilsDto.getType())){
-                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
-                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
-                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
-                }
-            }
+
             IPage<BusinessAgentData> result = taskStatisticsService.getBusinessAgentData(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){
@@ -424,17 +417,8 @@ public class TaskStatisticsController {
      **/
     @PostMapping("getBusinessAgentDataTotal")
     @ApiOperation(value = "控制台-业务数据-代理人-合计")
-    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo, HttpServletRequest httpServerRequest) {
+    public HttpResult<BusinessAgentData> getBusinessAgentDataTotal(@RequestBody TaskStatisticsVo taskStatisticsVo) {
         try{
-            KztGetDeptUtils kztGetDeptUtils = new KztGetDeptUtils();
-            KztGetDeptUtilsDto kztGetDeptUtilsDto = kztGetDeptUtils.KztGetDeptIds(httpServerRequest.getRequestURL().toString());
-            if(ObjectUtils.isNotEmpty(kztGetDeptUtilsDto)){
-                if("1".equals(kztGetDeptUtilsDto.getType())){
-                    taskStatisticsVo.setDeptIds(kztGetDeptUtilsDto.getIds());
-                } else if ("2".equals(kztGetDeptUtilsDto.getType())) {
-                    taskStatisticsVo.setUserIds(kztGetDeptUtilsDto.getIds());
-                }
-            }
             BusinessAgentData result = taskStatisticsService.getBusinessAgentDataTotal(taskStatisticsVo);
             return HttpResult.ok("查询数据成功", result);
         }catch (Exception e){

+ 9 - 1
src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java

@@ -10,7 +10,6 @@ import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.report.user.QianLineQDPersonnelReportDto;
 import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.base.model.dto.PageDto;
-import com.ydtech.modules.order.entity.BasePageResult;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
@@ -539,6 +538,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
      * 根据登陆者 id deptId 查询
      */
     List<SysUser> selectLeaderBylanderInfo(@Param("deptId") String deptId, @Param("leaderId") String leaderId, @Param("userId") String userId);
+
+
+    /**
+     * @version
+     * @author: hxl
+     * @Date: 2024/9/24 17:35
+     * @Description: 查询电销的管理人列表
+     */
+    List<SysUser> findDxZyUserList();
 }
 
 

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java

@@ -163,4 +163,7 @@ public class TaskStatisticsVo implements Serializable {
 
     @ApiModelProperty(value = "筛选录单开始时间")
     private String enterTimeEnd;
+
+    @ApiModelProperty(value = "时间类型")
+    private String timeType;
 }

+ 1 - 4
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -14,10 +14,7 @@ import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.base.model.dto.PageDto;
 import com.ydtech.modules.base.model.vo.PageVo;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -276,7 +273,7 @@ public interface SysUserService extends BaseIService<SysUser> {
      *  @Date: 2024/9/24 17:35
      *  @Description:  查询电销的管理人列表
      */
-    List<SysUser> findDxUserList();
+    List<SysUser> findDxUserList(String type);
 
     List<Map<String,String>>  selectHxUserList(SysUserDto sysUserDto);
 

+ 6 - 2
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -60,7 +60,6 @@ import org.springframework.util.CollectionUtils;
 import org.springframework.util.ObjectUtils;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import java.io.*;
 import java.math.BigDecimal;
 import java.net.HttpURLConnection;
@@ -2482,7 +2481,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
      * @Description: 电销管理人数据
      */
     @Override
-    public List<SysUser> findDxUserList() {
+    public List<SysUser> findDxUserList(String type) {
+        if("1".equals(type)){
+            return sysUserMapper.findDxUserList();
+        }else if("2".equals(type)){
+            return sysUserMapper.findDxZyUserList();
+        }
         return sysUserMapper.findDxUserList();
     }
 

+ 27 - 14
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -689,6 +689,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
 
+        if(StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) &&  (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) &&  StringUtils.isEmpty(taskStatisticsVo.getDeptId()) ) ){
+            return new Page<>(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageNum());
+        }
 
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());
         taskStatisticsVo.setCreatetimeStart(dateMapByType.get("startDate"));
@@ -861,6 +864,9 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setUserIds(new ArrayList<>());
             }
         }
+        if (StringUtils.isNotEmpty(taskStatisticsVo.getTreeType()) && (StringUtils.isEmpty(taskStatisticsVo.getTreeUserId()) && StringUtils.isEmpty(taskStatisticsVo.getDeptId()))) {
+            return new BusinessAgentData();
+        }
 
         String deptId = BaseController.getDeptId();
         BusinessAgentData result = this.taskStatisticsMapper.getBusinessAgentDataTotalAdd(taskStatisticsVo);
@@ -882,7 +888,7 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         BigDecimal subtract = entranceAllFee.subtract(exportAllFee);
         result.setDistributionAmount(subtract); //毛利润
         if(subtract.compareTo(BigDecimal.ZERO)>0){
-            BigDecimal resultDivided = subtract.divide(sumPremium, 2, RoundingMode.HALF_UP); //人均产能
+            BigDecimal resultDivided = subtract.divide(sumPremium, 4, RoundingMode.HALF_UP); //人均产能
             result.setDistributionAmountRate(resultDivided);
         }else {
             result.setDistributionAmountRate(BigDecimal.ZERO);
@@ -1140,20 +1146,27 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         String  endDateStr = new String();
         if (StringUtils.isNotEmpty(type)) {
             switch (type) {
-                case "1" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),0) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
-                case "2" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),1) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
-                case "3" : startDateStr= SliceUpDateUtil.getBeforeDay(new Date(),6) + " 00:00:00";
-                           endDateStr=SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
-                           break;
+                case "1" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+                case "2" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),1) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+                case "3" :  startDateStr = SliceUpDateUtil.getBeforeDay(new Date(),6) + " 00:00:00";
+                    endDateStr = SliceUpDateUtil.getBeforeDay(new Date(),0) + " 23:59:59";
+                    break;
+            }
+            if (StringUtils.isNotEmpty(taskStatisticsVo.getTimeType())) {
+                switch (taskStatisticsVo.getTimeType()) {
+                    case "1" :  taskStatisticsVo.setEnterTimeStart(startDateStr);
+                        taskStatisticsVo.setEnterTimeEnd(endDateStr);
+                        break;
+                    case "2" :  taskStatisticsVo.setSigningTimeStart(startDateStr);
+                        taskStatisticsVo.setSigningTimeEnd(endDateStr);
+                        break;
+                }
             }
-            taskStatisticsVo.setSigningTimeStart(startDateStr);
-            taskStatisticsVo.setSigningTimeEnd(endDateStr);
-            taskStatisticsVo.setEnterTimeStart(startDateStr);
-            taskStatisticsVo.setEnterTimeEnd(endDateStr);
         }
     }
+
 }

+ 11 - 1
src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java

@@ -340,6 +340,7 @@ public class UserReportServiceImpl implements UserReportService {
             List<QxFrontlineAgentDto> getQxFrontlineAgentList = sysUserMapper.getQxFrontlineAgentList(qxFrontlineAgentVo);
             if (qxFrontlineAgentVo.getManagementSource().equals("1")) {// 渠道
                 getQxFrontlineAgentList .clear();
+
                 getQxFrontlineAgentList.addAll(userReportMapper.selectChannelPersonOld(qxFrontlineAgentVo));
             } else if (qxFrontlineAgentVo.getManagementSource().equals("2")) {// 代理人
                 this.agentPerson(getQxFrontlineAgentList, qxFrontlineAgentVo);
@@ -399,8 +400,17 @@ public class UserReportServiceImpl implements UserReportService {
 
     @Override
     public HttpResult agentExcel(QxFrontlineAgentVo qxFrontlineAgentVo) {
-//        QxFrontlineAgentExcel
 
+        String leaderId = qxFrontlineAgentVo.getLeaderId();
+        if(StringUtils.isNotEmpty(leaderId)) {
+            //获取领导人下级所有
+            List<String> ids = new ArrayList<>();
+            List<String> userList = this.getUserTreeHx(leaderId, ids);
+            userList.add(leaderId);
+            if (userList.size() > 0) {
+                qxFrontlineAgentVo.setLeaderIds(userList);
+            }
+        }
         HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
         qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
         qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));

+ 3 - 1
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -685,7 +685,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         }
         //车险查询添加电销组长可以查询电销下的数据   电销组长 72
         if (dept != null && "3".equals(dept.getManagementSource()) && userRole != null && userRole.getRoleId() == 72) {
-            deptId = dept.getId();
+            //  add  by hxl  去除机构查询
+            //deptId = dept.getId();
+            orderQueryVo.setDeptId(null);
             isDxFlag = true;
         }
         Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page, orderQueryVo, adminFalg, isCdy, deptId, isDxFlag);

+ 10 - 4
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1984,10 +1984,6 @@
         WHERE
         su4.id IN ( su1.id, su2.id, su3.id )
         ) AS subquery
-        WHERE
-        <if test = "managementSource != null  and  managementSource != ''" >
-         management_source = #{managementSource}
-        </if>
         ORDER BY 1
        ) > 0 )
     </select>
@@ -2080,4 +2076,14 @@
             AND su.id NOT LIKE '%M%'
         </where>
     </select>
+
+    <select id="findDxZyUserList" resultType="com.ydtech.modules.admin.model.SysUser">
+        SELECT t1.id   AS id,
+               t1.NAME AS NAME
+        FROM sys_user t1
+                 LEFT JOIN sys_dept t2 ON t1.dept_id = t2.id
+        WHERE t1.`status` = 1
+          AND t1.id LIKE '%M%'
+          AND t2.management_source = 3
+    </select>
 </mapper>

+ 0 - 2
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -306,7 +306,6 @@
         LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
         <where>
             iac.orderstatus = '3'
-            and io.orderstatus = '3'
 
             <if test="vo.userId !=null  and vo.userId!=''">
                 and su.id=#{vo.userId}
@@ -347,7 +346,6 @@
                        left join sys_user su on io.userid =su.id
               <where>
                   iac.orderstatus = '3'
-                  and io.orderstatus = '3'
 
                   <if test="vo.userId !=null  and vo.userId!=''">
                       and su.id=#{vo.userId}