|
@@ -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) {
|