Преглед на файлове

首页一层当月合同额明细

sl преди 1 година
родител
ревизия
69717f2011

+ 9 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/controller/IndexController.java

@@ -20,6 +20,7 @@ import org.jeecg.modules.Index.service.IndexZcbService;
 import org.jeecg.modules.Index.util.AuthMark;
 import org.jeecg.modules.Index.util.CommonMethod;
 import org.jeecg.modules.dataSourceSwitch.annotation.TargetDataSource;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -94,6 +95,14 @@ public class IndexController {
         return Result.ok(result);
     }
 
+    @ApiOperation(value = "首页一层当月合同额明细", notes = "首页一层当月合同额明细")
+    @PostMapping("getDetailIncome")
+    @TargetDataSource
+    public Result<List<ComContractInfoExchange>> getDetailIncome(@RequestBody(required = false) List<String> departNameList, HttpServletRequest request){
+        List<ComContractInfoExchange> comContractInfoExchangeList = indexService.getDetailIncome(request, departNameList);
+        return Result.OK(comContractInfoExchangeList);
+    }
+
     @ApiOperation(value = "计算已收款", notes = "计算已收款")
     @GetMapping("getTotalReceived")
     public Result<IndexTotalVo> getTotalReceived(HttpServletRequest request,List<String> departNameList) {

+ 5 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/service/IndexService.java

@@ -3,6 +3,8 @@ package org.jeecg.modules.Index.service;
 
 import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
 import org.jeecg.modules.Index.entity.vo.*;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
+import org.jeecg.modules.xmcbDetail.mapper.ComContractInfoExchangeMapper;
 
 
 import javax.servlet.http.HttpServletRequest;
@@ -13,6 +15,9 @@ import java.util.Map;
 public interface IndexService {
     IndexTotalVo getTotalIncome(HttpServletRequest request,List<String> departNameList);
 
+    /*合同额一层 当月合同额明细*/
+    List<ComContractInfoExchange> getDetailIncome(HttpServletRequest request, List<String> departNameList);
+
     IndexTotalVo getTotalReceived(HttpServletRequest request,List<String> departNameList);
 
     ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto,List<String> departNameList);

+ 75 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/service/impl/IndexServiceImpl.java

@@ -2,8 +2,10 @@ package org.jeecg.modules.Index.service.impl;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.TypeReference;
+import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.api.ISysBaseAPI;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
@@ -27,9 +29,12 @@ import org.jeecg.modules.projectCost.service.IProjectCostService;
 import org.jeecg.modules.system.mapper.SysDepartMapper;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserDepartService;
+import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
 import org.jeecg.modules.xmcbDetail.mapper.ComContractInfoExchangeMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
@@ -328,6 +333,76 @@ public class IndexServiceImpl implements IndexService {
         return incomeDataInfoVO;
     }
 
+    /*合同额一层 当月合同额明细*/
+    @Override
+    public List<ComContractInfoExchange> getDetailIncome(HttpServletRequest request, List<String> departNameList) {
+        String userNameByToken = JwtUtil.getUserNameByToken(request);
+        LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
+        String role = commonMethod.getRole(sysUser.getUsername());
+        if (departNameList != null && !departNameList.isEmpty() && AuthMark.BOSS.equals(role))
+            role = AuthMark.DEPT_LEADER;
+        List<ComContractInfoExchange> comContractInfoExchangeList = new ArrayList<>();
+        String depart = null;
+        ArrayList<String> tasknoList = new ArrayList<>();
+        if (AuthMark.DEPT_LEADER.equals(role)) {
+            List<String> departNames = null;
+            if (departNameList != null && !departNameList.isEmpty()) {
+                departNames = departNameList;
+            } else {
+                String[] deptIds = sysUser.getDepartIds().split(",");
+                departNames = sysDepartMapper.getDepNameByIds(deptIds);
+            }
+            if (departNames.isEmpty()) return comContractInfoExchangeList;
+
+            StringBuilder stringBuilder = new StringBuilder();
+            for (String departName : departNames) {
+                stringBuilder.append(departName).append("|");
+            }
+            depart = stringBuilder.toString();
+            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
+            if (ObjectUtils.isNotEmpty(cacheObject)) {
+                comContractInfoExchangeList = cacheObject;
+                return comContractInfoExchangeList;
+            }
+
+            List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
+            List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
+            tasknoList.addAll(ZrbmTasknoList);
+            tasknoList.addAll(XdbmTasknoList);
+            if (tasknoList.isEmpty()) return comContractInfoExchangeList;
+        }
+
+        if (depart == null) {
+            depart = "Boss";
+//            return comContractInfoExchangeList;
+            List<ComContractInfoExchange> cacheObject = (List<ComContractInfoExchange>) redisUtil.get(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role);
+            if (ObjectUtils.isNotEmpty(cacheObject)) {
+                comContractInfoExchangeList = cacheObject;
+                return comContractInfoExchangeList;
+            }
+        }
+
+        //当年合同额,例:>= 2023-01-01 00:00:00   < 2024-01-01 00:00:00
+        Calendar instance = Calendar.getInstance();
+        //当月合同额,例:>= 2023-12-01 00:00:00   < 2024-01-01 00:00:00
+        instance.setTime(new Date());
+        setZeroMonth(instance);
+        Date currentMothBginDate = instance.getTime();
+        instance.add(Calendar.MONTH, 1);
+        Date currentMothEndDate = instance.getTime();
+
+        if (AuthMark.DEPT_LEADER.equals(role)) {
+            comContractInfoExchangeList = exchangeMapper.getIncomeDetailByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
+        } else if (AuthMark.BOSS.equals(role)) {
+            comContractInfoExchangeList = exchangeMapper.getIncomeDetailByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
+        }
+
+        redisUtil.set(CacheKey.INCOMEDETAIL_DATA_REDIS_KEY + ":" + depart + ":" + role, comContractInfoExchangeList, 1000L * 60 * 60 * 10);
+
+        return comContractInfoExchangeList;
+    }
+
+
     /*已收款一层*/
     @Override
     public IndexTotalVo getTotalReceived(HttpServletRequest request, List<String> departNameList) {

+ 3 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/util/CacheKey.java

@@ -5,6 +5,9 @@ public class CacheKey {
     /*首页合同额*/
     public static final String INCOME_DATA_REDIS_KEY = "incomeDataRedisKey:";
 
+    /*首页当月合同额明细*/
+    public static final String INCOMEDETAIL_DATA_REDIS_KEY = "incomeDetailDataRedisKey:";
+
     /*首页合同数量*/
     public static final String CONTRACT_DATA_REDIS_KEY = "contractDataRedisKey:";
 

+ 5 - 0
module_kzks/src/main/java/org/jeecg/modules/xmcbDetail/mapper/ComContractInfoExchangeMapper.java

@@ -46,8 +46,13 @@ public interface ComContractInfoExchangeMapper extends BaseMapper<ComContractInf
 
     BigDecimal getIncomeYearTotalByTasknoListAndByQsrqRange(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
+    //获取首页当月合同额的明细
+    List<ComContractInfoExchange> getIncomeDetailByTasknoListAndByQsrqRange(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
+
     BigDecimal getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
+    //获取首页当月合同额的明细
+    List<ComContractInfoExchange> getIncomeDetailByTasknoListAndByQsrqRangeIfBoss(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     BigDecimal getContractNumYearTotalByTasknoListAndByQsrqRange(@Param("tasknoList") List<String> tasknoList, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 

+ 16 - 0
module_kzks/src/main/java/org/jeecg/modules/xmcbDetail/mapper/xml/ComContractInfoExchangeMapper.xml

@@ -13,6 +13,16 @@
         </foreach>
     </select>
 
+    <select id="getIncomeDetailByTasknoListAndByQsrqRange" resultType="org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange">
+        select * from com_contract_info_exchange as a where a.sjly = 20
+        and a.qsrq <![CDATA[ >= ]]> #{beginDate}
+        and a.qsrq &lt; #{endDate}
+        and a.rwbh in
+        <foreach item='item' index='index' collection='tasknoList' open='(' separator=',' close=')'>
+            #{item}
+        </foreach>
+    </select>
+
     <select id="getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss" resultType="java.math.BigDecimal">
         select sum(a.htfpe)
         from (select htfpe, qsrq from com_contract_info_exchange where sjly = 20) a
@@ -20,6 +30,12 @@
                   and a.qsrq &lt; #{endDate}
     </select>
 
+    <select id="getIncomeDetailByTasknoListAndByQsrqRangeIfBoss" resultType="org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange">
+        select * from com_contract_info_exchange as a where a.sjly = 20
+        and a.qsrq <![CDATA[ >= ]]> #{beginDate}
+          and a.qsrq &lt; #{endDate}
+    </select>
+
 
     <select id="getContractNumYearTotalByTasknoListAndByQsrqRange" resultType="java.math.BigDecimal">
         select count(distinct(a.htbh))