From 76780e2eda1bd8e7563babd9d1d6cb2aecdf0f48 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Sat, 26 Nov 2022 18:07:39 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=87=8D=E5=A4=8D=E7=94=B3=E8=AF=B7=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF=EF=BC=8C=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E6=94=B9=E5=9B=9E=E5=8E=9F=E9=80=BB=E8=BE=91=202.?= =?UTF-8?q?=E8=B5=84=E9=87=91=E6=8A=A5=E8=A1=A8=E5=A4=A7=E5=B1=8F=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterControllerV2.java | 45 ++-- .../TAbilityApplicationController.java | 63 +++++ .../dao/TAbilityApplicationDao.java | 18 ++ .../service/TAbilityApplicationService.java | 16 ++ .../impl/TAbilityApplicationServiceImpl.java | 110 +++++++++ .../processForm/TAbilityApplicationDao.xml | 221 ++++++++++++++++++ 6 files changed, 452 insertions(+), 21 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index 607b2e1d..2ccf3a58 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -115,7 +115,7 @@ public class AbilityCenterControllerV2 { abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识 final Optional deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final UserDetail user = SecurityUser.getUser(); - switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + /*switch (Constant.ProjectPlace.getByFlag(projectPlace)) { case TSINGTAO: { // 青岛市局 异步会死锁 deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); } @@ -123,7 +123,8 @@ public class AbilityCenterControllerV2 { default: { executor.execute(() -> deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user)); } - } + }*/ + executor.execute(() -> deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user)); return new Result().ok(LocalDateTime.now().toString()); } @@ -144,7 +145,7 @@ public class AbilityCenterControllerV2 { logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO)); final Optional deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final UserDetail user = SecurityUser.getUser(); - switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + /*switch (Constant.ProjectPlace.getByFlag(projectPlace)) { case TSINGTAO: { // 青岛市局 异步会死锁 deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); } @@ -153,32 +154,34 @@ public class AbilityCenterControllerV2 { //executor.execute(() -> deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user)); deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); } - } + }*/ + deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); + return new Result().ok(LocalDateTime.now().toString()); } private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional deptDTO, String applyFlag, UserDetail user) { + List tAbilityApplicationDTOList = abilityBatchApplicationDTO.getSystem().stream().map(index -> { - //if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 - // logger.error("重复发起申请"); - // return null; - //} - - //2022-11-22 资源重复申请判断更新 - if (index.containsKey("channelId")) { - String today = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN); - if (tAbilityApplicationService.countUserCameraApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId")), today) > 0) { - logger.error("重复发起申请"); - return null; - } - } else { - if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 - logger.error("重复发起申请"); - return null; - } + if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 + logger.error("重复发起申请"); + return null; } + //2022-11-22 资源重复申请判断更新 + //if (index.containsKey("channelId")) { + // String today = DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN); + // if (tAbilityApplicationService.countUserCameraApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId")), today) > 0) { + // logger.error("重复发起申请"); + // return null; + // } + //} else { + // if (tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) { // 防止重复发起申请 + // logger.error("重复发起申请"); + // return null; + // } + //} TAbilityApplicationDTO tAbilityApplicationDTO = new TAbilityApplicationDTO(); tAbilityApplicationDTO.setArea(abilityBatchApplicationDTO.getArea()); tAbilityApplicationDTO.setAttachment(abilityBatchApplicationDTO.getAttachment()); diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index 63f787ab..1a45633e 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -554,4 +554,67 @@ public class TAbilityApplicationController { } + @GetMapping("/getDistrictFundStatement") + @ApiOperation("获取区市资金报表") + @LogOperation("获取区市资金报表") + public Result getDistrictFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getDistrictFundStatement(params)); + } + + @GetMapping("/getComponentFundStatement") + @ApiOperation("获取组件节约资金列表") + @LogOperation("获取组件节约资金列表") + public Result getComponentFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getComponentFundStatement(params)); + } + + + @GetMapping("/getResourceFundStatement") + @ApiOperation("获取应用资源节约资金列表") + @LogOperation("获取应用资源节约资金列表") + public Result getResourceFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getResourceFundStatement(params)); + } + + + @GetMapping("/getInfrastructureFundStatement") + @ApiOperation("获取基础设施节约资金列表") + @LogOperation("获取基础设施节约资金列表") + public Result getInfrastructureFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getInfrastructureFundStatement(params)); + } + + + @GetMapping("/getProvideDeptFundStatement") + @ApiOperation("获取提供部门节约资金列表") + @LogOperation("获取提供部门节约资金列表") + public Result getProvideDeptFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getProvideDeptFundStatement(params)); + } + + + @GetMapping("/getApplyDeptFundStatement") + @ApiOperation("获取申请部门节约资金列表") + @LogOperation("获取申请部门节约资金列表") + public Result getApplyDeptFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getApplyDeptFundStatement(params)); + } + + + @GetMapping("/getProvideDistrictFundStatement") + @ApiOperation("获取提供区市节约资金列表") + @LogOperation("获取提供区市节约资金列表") + public Result getProvideDistrictFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getProvideDistrictFundStatement(params)); + } + + + @GetMapping("/getApplyDistrictFundStatement") + @ApiOperation("获取申请区市节约资金列表") + @LogOperation("获取申请区市节约资金列表") + public Result getApplyDistrictFundStatement (Map params) { + return new Result().ok(tAbilityApplicationService.getApplyDistrictFundStatement(params)); + } + + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java b/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java index 1048f710..d998196c 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/dao/TAbilityApplicationDao.java @@ -64,4 +64,22 @@ public interface TAbilityApplicationDao extends BaseDao exportFundStatementTable(@Param("params") Map params); Long getFundStatementCount(@Param("params") Map params); + + List getDistrictFundStatement(); + + List getCenusDistrictList(); + + List getComponentFundStatement(); + + List getResourceFundStatement(); + + List getInfrastructureFundStatement(); + + List getProvideDeptFundStatement(); + + List getApplyDeptFundStatement(); + + List getProvideDistrictFundStatement(); + + List getApplyDistrictFundStatement(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java index 1d38c71d..63bd6236 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/TAbilityApplicationService.java @@ -68,4 +68,20 @@ public interface TAbilityApplicationService extends CrudService params); Object exportFundStatementTable(Map params); + + Object getDistrictFundStatement(Map params); + + Object getComponentFundStatement(Map params); + + Object getResourceFundStatement(Map params); + + Object getInfrastructureFundStatement(Map params); + + Object getProvideDeptFundStatement(Map params); + + Object getApplyDeptFundStatement(Map params); + + Object getProvideDistrictFundStatement(Map params); + + Object getApplyDistrictFundStatement(Map params); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java index 8f67f666..eb46c6a8 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java @@ -1,16 +1,21 @@ package io.renren.modules.processForm.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.renren.common.service.impl.CrudServiceImpl; import io.renren.common.utils.ConvertUtils; import io.renren.common.utils.DateUtils; +import io.renren.modules.activiti.service.ActRunningService; import io.renren.modules.processForm.dao.TAbilityApplicationDao; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.entity.TAbilityApplicationEntity; import io.renren.modules.processForm.service.TAbilityApplicationService; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; +import net.sf.jsqlparser.statement.create.table.Index; +import org.activiti.engine.HistoryService; +import org.activiti.engine.history.HistoricProcessInstance; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,6 +39,9 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl getWrapper(Map params) { QueryWrapper wrapper = new QueryWrapper<>(); @@ -149,6 +157,29 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl cameraList = abilityApplicationDao.getApplyCameraList(userDetail.getId(), currentTime); + cameraList.forEach(index -> { + HistoricProcessInstance processInstanceDTO = + historyService.createHistoricProcessInstanceQuery().processInstanceId(index.get("instanceId").toString()).includeProcessVariables().singleResult(); + if (processInstanceDTO != null) { + logger.info(processInstanceDTO.getProcessVariables().toString()); + if (processInstanceDTO.getProcessVariables().containsKey("backToFirst")) { + try { + Boolean backToFirst = Boolean.parseBoolean(processInstanceDTO.getProcessVariables().getOrDefault("backToFirst", "false").toString()); + if (backToFirst.equals(Boolean.TRUE)) { + index.put("backToFirst", "true"); + } else { + index.put("backToFirst", "false"); + } + } catch (Exception exception) { + logger.info(exception.toString()); + } + } else { + index.put("backToFirst", "false"); + } + } else { + index.put("backToFirst", ""); + } + }); return cameraList.isEmpty() ? new ArrayList<>() : cameraList; } @@ -179,5 +210,84 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl params) { + List cenusDistrictList = abilityApplicationDao.getCenusDistrictList(); + List resultList = new ArrayList<>(); + resultList.addAll(cenusDistrictList); + return resultList; + } + + @Override + public Object getComponentFundStatement(Map params) { + List cenusDistrictList = abilityApplicationDao.getComponentFundStatement(); + Long total = 0L; + for (Map map : cenusDistrictList) { + total = total + Long.parseLong(map.get("applyPrice").toString()); + } + Map resultMap = new HashMap<>(); + resultMap.put("list", cenusDistrictList); + resultMap.put("total", total); + return resultMap; + } + + @Override + public Object getResourceFundStatement(Map params) { + List list = abilityApplicationDao.getResourceFundStatement(); + Long total = 0L; + for (Map map : list) { + total = total + Long.parseLong(map.get("applyPrice").toString()); + } + Map resultMap = new HashMap<>(); + resultMap.put("list", list); + resultMap.put("total", total); + return resultMap; + } + + @Override + public Object getInfrastructureFundStatement(Map params) { + List list = abilityApplicationDao.getInfrastructureFundStatement(); + Long total = 0L; + for (Map map : list) { + total = total + Long.parseLong(map.get("applyPrice").toString()); + } + Map resultMap = new HashMap<>(); + resultMap.put("list", list); + resultMap.put("total", total); + return resultMap; + } + + @Override + public Object getProvideDeptFundStatement(Map params) { + List deptList = abilityApplicationDao.getProvideDeptFundStatement(); + List resultList = new ArrayList<>(); + resultList.addAll(deptList); + return resultList; + } + + @Override + public Object getApplyDeptFundStatement(Map params) { + List deptList = abilityApplicationDao.getApplyDeptFundStatement(); + List resultList = new ArrayList<>(); + resultList.addAll(deptList); + return resultList; + } + + @Override + public Object getProvideDistrictFundStatement(Map params) { + List deptList = abilityApplicationDao.getProvideDistrictFundStatement(); + List resultList = new ArrayList<>(); + resultList.addAll(deptList); + return resultList; + } + + @Override + public Object getApplyDistrictFundStatement(Map params) { + + List deptList = abilityApplicationDao.getApplyDistrictFundStatement(); + List resultList = new ArrayList<>(); + resultList.addAll(deptList); + return resultList; + } } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml index 3a910ffc..43d98f0c 100644 --- a/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml +++ b/renren-admin/src/main/resources/mapper/processForm/TAbilityApplicationDao.xml @@ -697,4 +697,225 @@ ) temp + + + + + + + + + + + + + + + + + + + + \ No newline at end of file