|
@@ -7,9 +7,10 @@ import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.RedisUtil;
|
|
|
-import org.jeecg.modules.Index.entity.ContractDataInfoVo;
|
|
|
-import org.jeecg.modules.Index.entity.IncomeDataInfoVo;
|
|
|
-import org.jeecg.modules.Index.entity.LreDataInfoVO;
|
|
|
+import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
|
|
|
+import org.jeecg.modules.Index.entity.vo.ContractDataInfoVo;
|
|
|
+import org.jeecg.modules.Index.entity.vo.IncomeDataInfoVo;
|
|
|
+import org.jeecg.modules.Index.entity.vo.LreDataInfoVo;
|
|
|
import org.jeecg.modules.Index.service.IndexService;
|
|
|
import org.jeecg.modules.kyTaskInfo.service.IKyTaskInfoService;
|
|
|
import org.jeecg.modules.projectCost.entity.ProjectCost;
|
|
@@ -47,22 +48,30 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
- /**用户id与部门id对应表*/
|
|
|
+ /**
|
|
|
+ * 用户id与部门id对应表
|
|
|
+ */
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
private ISysUserDepartService sysUserDepartService;
|
|
|
|
|
|
- /**部门信息表*/
|
|
|
+ /**
|
|
|
+ * 部门信息表
|
|
|
+ */
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
private ISysDepartService sysDepartService;
|
|
|
|
|
|
- /**科研任务信息表*/
|
|
|
+ /**
|
|
|
+ * 科研任务信息表
|
|
|
+ */
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
private IKyTaskInfoService kyTaskInfoService;
|
|
|
|
|
|
- /**项目成本信息表*/
|
|
|
+ /**
|
|
|
+ * 项目成本信息表
|
|
|
+ */
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
private IProjectCostService projectCostService;
|
|
@@ -222,7 +231,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
@Override
|
|
|
public ContractDataInfoVo getTotalContract(HttpServletRequest request) {
|
|
|
- //首页收入渲染对象
|
|
|
+ //首页合同渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
ContractDataInfoVo contractDataInfoVo = new ContractDataInfoVo();
|
|
|
contractDataInfoVo.setContractYearTotal(initValue);
|
|
@@ -367,6 +376,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return finalContractDataInfoVo;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public void setZeroYear(Calendar instance) {
|
|
|
instance.set(Calendar.MONTH, 0);
|
|
|
instance.set(Calendar.DAY_OF_MONTH, 0);
|
|
@@ -384,15 +394,54 @@ public class IndexServiceImpl implements IndexService {
|
|
|
instance.set(Calendar.MILLISECOND, 0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public String getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+
|
|
|
+ String resultl;
|
|
|
+ switch (indexInfoParamDto.getTime()) {
|
|
|
+ case "year":
|
|
|
+ resultl = getContractAmountInfoIfYear(request, indexInfoParamDto);
|
|
|
+ case "month":
|
|
|
+ resultl = getContractAmountInfoIfMonth(request, indexInfoParamDto);
|
|
|
+ case "day":
|
|
|
+ resultl = getContractAmountInfoIfDay(request, indexInfoParamDto);
|
|
|
+ default:
|
|
|
+ resultl = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultl;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String getContractAmountInfoIfYear(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getContractAmountInfoIfMonth(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String getContractAmountInfoIfDay(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 计算某部门某段时间的利润额
|
|
|
*
|
|
|
* @return taskNoListNew
|
|
|
*/
|
|
|
- public BigDecimal countLre(List<String> taskNoListNew){
|
|
|
+ public BigDecimal countLre(List<String> taskNoListNew) {
|
|
|
//3.根据任务号taskno查找需要计算的所有数据list
|
|
|
List<ProjectCost> costList = new ArrayList<>();
|
|
|
- for(String taskNo1:taskNoListNew){
|
|
|
+ for (String taskNo1 : taskNoListNew) {
|
|
|
costList.addAll(projectCostService.costListByTaskNo(taskNo1));
|
|
|
}
|
|
|
// System.out.println(costList);
|
|
@@ -404,9 +453,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// List<ProjectCost> costListJZp = new ArrayList<>();
|
|
|
List<String> pcCodeList = new ArrayList<>();
|
|
|
|
|
|
- for(ProjectCost projectCost:costList){
|
|
|
+ for (ProjectCost projectCost : costList) {
|
|
|
sumLreYear = sumLreYear.add(projectCost.getLre());
|
|
|
- if(projectCost.getStatus().equals("1")){
|
|
|
+ if (projectCost.getStatus().equals("1")) {
|
|
|
// costListJZp.add(projectCost);//增添解组批任务列表
|
|
|
pcCodeList.add(projectCost.getPccode());//增加解组批任务pcCode用来查找组批任务
|
|
|
}
|
|
@@ -417,7 +466,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// System.out.println(costListJZp);
|
|
|
//新建一个list来给list中的数据去重 多个解组批任务是同一个pcCode
|
|
|
List<String> pcCodeListNew = new ArrayList<>();
|
|
|
- for(String pcCode:pcCodeList){
|
|
|
+ for (String pcCode : pcCodeList) {
|
|
|
if (!pcCodeListNew.contains(pcCode)) {
|
|
|
pcCodeListNew.add(pcCode);
|
|
|
}
|
|
@@ -427,9 +476,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//6.根据taskno=pcCode去找组批任务列表
|
|
|
List<ProjectCost> costListZp = new ArrayList<>();
|
|
|
- for(String pcCode2:pcCodeListNew){
|
|
|
- for(ProjectCost projectCost2:costList){
|
|
|
- if(projectCost2.getTaskno().equals(pcCode2)){
|
|
|
+ for (String pcCode2 : pcCodeListNew) {
|
|
|
+ for (ProjectCost projectCost2 : costList) {
|
|
|
+ if (projectCost2.getTaskno().equals(pcCode2)) {
|
|
|
costListZp.add(projectCost2);//增加组批任务列表用来扣除组批任务的利润额
|
|
|
}
|
|
|
}
|
|
@@ -440,16 +489,16 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//7.根据组批任务的reftaskno去找taskno=reftaskno的组批任务的子任务 lre-组批任务子任务lre
|
|
|
//组批任务子任务
|
|
|
List<ProjectCost> costListZpZrw = new ArrayList<>();
|
|
|
- for(ProjectCost projectCost3:costListZp){
|
|
|
+ for (ProjectCost projectCost3 : costListZp) {
|
|
|
//lre-组批lre
|
|
|
sumLreYear = sumLreYear.subtract(projectCost3.getLre());
|
|
|
//根据组批任务的reftaskno去找taskno=reftaskno的组批任务的子任务
|
|
|
- for(ProjectCost projectCost4:costList){
|
|
|
- try{
|
|
|
- if(projectCost3.getTaskno().equals(projectCost4.getReftaskno())){
|
|
|
+ for (ProjectCost projectCost4 : costList) {
|
|
|
+ try {
|
|
|
+ if (projectCost3.getTaskno().equals(projectCost4.getReftaskno())) {
|
|
|
costListZpZrw.add(projectCost4);//增加组批任务子任务
|
|
|
}
|
|
|
- }catch (NullPointerException e){
|
|
|
+ } catch (NullPointerException e) {
|
|
|
System.out.println("当前数据的reftaskno为null,直接略过即可");
|
|
|
}
|
|
|
|
|
@@ -459,7 +508,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// System.out.println(costListZpZrw);
|
|
|
// System.out.println("//////////////////////////////////////////////");
|
|
|
|
|
|
- for(ProjectCost projectCost5:costListZpZrw){
|
|
|
+ for (ProjectCost projectCost5 : costListZpZrw) {
|
|
|
//lre-组批子任务lre
|
|
|
sumLreYear = sumLreYear.subtract(projectCost5.getLre());
|
|
|
}
|
|
@@ -471,16 +520,16 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getTaskNoListFDepTime(List<String> sysDepartNames, String timeStatus){
|
|
|
+ public List<String> getTaskNoListFDepTime(List<String> sysDepartNames, String timeStatus) {
|
|
|
//获取需要的时间范围
|
|
|
//int:0当年范围 1去年同期 2当月 3上个月 4 去年同期月份
|
|
|
// HashMap<String, Date> timeRangeMap = getTimeRange(0);
|
|
|
|
|
|
//2.根据部门名称(zrbm、jycs)和实际完成时间(目前是当年)查询taskno
|
|
|
List<String> taskNoList = new ArrayList<>();
|
|
|
- for(String sysDepartName:sysDepartNames){
|
|
|
+ for (String sysDepartName : sysDepartNames) {
|
|
|
List<String> taskNoList1 = new ArrayList<>();
|
|
|
- switch (timeStatus){
|
|
|
+ switch (timeStatus) {
|
|
|
case "0"://当年的所有任务
|
|
|
taskNoList1 = kyTaskInfoService.getKyTaskNoByNameCurrYear(sysDepartName);
|
|
|
break;
|
|
@@ -508,7 +557,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
//新建一个list来给list中的数据去重 防止责任部门和下达部门都为一个部门,可能会信息重复
|
|
|
List<String> taskNoListNew = new ArrayList<>();
|
|
|
- for(String taskNo:taskNoList){
|
|
|
+ for (String taskNo : taskNoList) {
|
|
|
if (!taskNoListNew.contains(taskNo)) {
|
|
|
taskNoListNew.add(taskNo);
|
|
|
}
|
|
@@ -521,9 +570,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Result<LreDataInfoVO> countLre(){
|
|
|
+ public Result<LreDataInfoVo> countLre() {
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
- LreDataInfoVO lreDataInfoVO = new LreDataInfoVO();
|
|
|
+ LreDataInfoVo lreDataInfoVO = new LreDataInfoVo();
|
|
|
lreDataInfoVO.setLreYearTotal(initValue);
|
|
|
lreDataInfoVO.setLreYearTq(initValue);
|
|
|
lreDataInfoVO.setLreYearTb(initValue);
|
|
@@ -556,13 +605,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
System.out.println("----------------------------------------------------");
|
|
|
|
|
|
//2.计算年同比增长率
|
|
|
- try{
|
|
|
+ try {
|
|
|
BigDecimal tbGrowthYear = ((sumLreYear.subtract(sumLreLastYear)).divide(sumLreLastYear, 2, RoundingMode.HALF_UP));
|
|
|
lreDataInfoVO.setLreYearTb(tbGrowthYear);
|
|
|
System.out.println("年利润同比增长率为:");
|
|
|
System.out.println(tbGrowthYear);
|
|
|
System.out.println("----------------------------------------------------");
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
lreDataInfoVO.setLreYearTb(eValue);
|
|
|
}
|
|
|
|
|
@@ -586,13 +635,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
System.out.println("----------------------------------------------------");
|
|
|
|
|
|
//2.计算月环比增长率
|
|
|
- try{
|
|
|
+ try {
|
|
|
BigDecimal hbGrowthMonth = ((sumLreCurrMonth.subtract(sumLreLastMonth)).divide(sumLreLastMonth, 2, RoundingMode.HALF_UP));
|
|
|
lreDataInfoVO.setLreMonthHb(hbGrowthMonth);
|
|
|
System.out.println("月环比为:");
|
|
|
System.out.println(hbGrowthMonth);
|
|
|
System.out.println("----------------------------------------------------");
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
lreDataInfoVO.setLreMonthHb(eValue);
|
|
|
}
|
|
|
|
|
@@ -612,17 +661,18 @@ public class IndexServiceImpl implements IndexService {
|
|
|
System.out.println("月同比为:");
|
|
|
System.out.println(tbGrowthMonth);
|
|
|
System.out.println("----------------------------------------------------");
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
lreDataInfoVO.setLreMonthTb(eValue);
|
|
|
}
|
|
|
return Result.OK(lreDataInfoVO);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 通过登录的用户找到相应的部门,可能一个或两个
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getDepNameBySysUser(){
|
|
|
+ public List<String> getDepNameBySysUser() {
|
|
|
// 获取登录人用户信息 V2.0版本:
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
// 获取用户id
|
|
@@ -632,7 +682,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
System.out.println(sysUserDepartIds);
|
|
|
///根据部门id去找部门名称
|
|
|
List<String> sysDepartNames = new ArrayList<>();
|
|
|
- for(String sysUserDepartId:sysUserDepartIds){
|
|
|
+ for (String sysUserDepartId : sysUserDepartIds) {
|
|
|
sysDepartNames.add(sysDepartService.getDepNameById(sysUserDepartId));
|
|
|
}
|
|
|
System.out.println(sysDepartNames);
|