Commit 8417384f authored by 陈晓晋's avatar 陈晓晋

app任务查询接口20230803

parent a927ecd3
......@@ -40,6 +40,12 @@
<artifactId>hutool-all</artifactId>
<version>5.8.5</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
package com.censoft.censoftrongtong.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* 首页相关接口Controller
*
* @author ruoyi
* @date 2023-03-20
*/
@Api(tags = {"首页统计相关接口"})
@RestController
@RequestMapping("/system/index")
@AllArgsConstructor
public class IndexController extends BaseController {
/**
* 项目,楼栋,楼层和房间数据统计
*/
@ApiOperation("项目,楼栋,楼层和房间数据统计")
@GetMapping("/getBaseInfoNum")
public R getQygk() {
int projectCount = 0;//项目数量
int buildingCount = 0;//楼栋数量
int floorCount = 0;//楼层数量
int roomCount = 0;//房间数
Map<String, String> map_gk = new HashMap<>();
map_gk.put("projectNum", projectCount + "");
map_gk.put("buildingNum", buildingCount + "");
map_gk.put("floorNum", floorCount + "");
map_gk.put("roomNum", roomCount + "");
return R.ok(map_gk);
}
}
......@@ -20,18 +20,14 @@ import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUploadFileService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -188,7 +184,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/create/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUser(String status) {
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUser(String status,String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("wait".equals(status)) {
......@@ -202,7 +198,7 @@ public class RiskPlanAppController extends BaseController {
, RiskPlanStatusType.PROJECT_REPORT, RiskPlanStatusType.FINISH);
state = "已执行";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, getUserId(), null, null);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, getUserId(), null, null,name);
String finalState = state;
list.forEach(dto -> {
dto.setState(finalState);
......@@ -217,7 +213,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/allocation/list")
public R<List<RiskPlanAppListDto>> getAllocationRiskPlanAppListDtoListByCreateUser(String status) {
public R<List<RiskPlanAppListDto>> getAllocationRiskPlanAppListDtoListByCreateUser(String status,String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("wait".equals(status)) {
......@@ -231,7 +227,7 @@ public class RiskPlanAppController extends BaseController {
, RiskPlanStatusType.PROJECT_REPORT, RiskPlanStatusType.FINISH);
state = "已完成";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, getUserId(), null);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, getUserId(), null,name);
String finalState = state;
list.forEach(dto -> {
Long finishNumber = riskPlanUserBuildingService.countStatusByPlanIdAndStatus(dto.getId(), "finish");
......@@ -260,7 +256,7 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/task/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByLeaderUser(String status) {
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByLeaderUser(String status,String name) {
List<RiskPlanStatusType> statusList = new ArrayList<>();
String state = "";
if ("running".equals(status)) {
......@@ -275,7 +271,7 @@ public class RiskPlanAppController extends BaseController {
state = "已退回";
}
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, null, getUserId());
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoList(statusList, null, null, getUserId(),name);
String finalState = state;
list.forEach(dto -> {
Long finishNumber = riskPlanUserBuildingService.countStatusByPlanIdAndStatus(dto.getId(), "finish");
......@@ -675,9 +671,9 @@ public class RiskPlanAppController extends BaseController {
* @real_return {@link R<List<RiskPlanAppListDto>>}
*/
@GetMapping("/details/list")
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUserDeptId() {
public R<List<RiskPlanAppListDto>> getRiskPlanAppListDtoListByCreateUserDeptId(String name) {
Long deptId = getLoginUser().getDeptId();
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoListByCreateUserDeptId(deptId);
List<RiskPlanAppListDto> list = riskPlanService.getRiskPlanAppListDtoListByCreateUserDeptId(deptId,name);
list.forEach(dto -> {
dto.setState(RiskPlanStatusType.getTitleByStatus(dto.getStatus()).getTitle());
});
......
......@@ -89,6 +89,12 @@ public class RiskPlan extends BaseEntityClean
@TableField(exist = false)
private String projectName;
/**
* 是否台账
*/
@TableField(exist = false)
private String isLedger;
......
......@@ -2,12 +2,9 @@ package com.censoft.censoftrongtong.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.censoft.censoftrongtong.domain.RiskPlan;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.enums.RiskPlanStatusType;
import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.List;
/**
......@@ -67,7 +64,7 @@ public interface RiskPlanMapper extends BaseMapper<RiskPlan>
public int deleteRiskPlanByIds(Long[] ids);
List<RiskPlanAppListDto> getRiskPlanAppListDtoList(@Param("statusStringList") List<String> statusStringList
, @Param("createUserId") Long createUserId, @Param("leaderUserId") Long leaderUserId, @Param("workUserId") Long workUserId);
, @Param("createUserId") Long createUserId, @Param("leaderUserId") Long leaderUserId, @Param("workUserId") Long workUserId,@Param("name") String name);
RiskPlanAppDetailsDto getRiskPlanAppDetailsDtoByPlanId(@Param("planId") Long planId);
......@@ -81,5 +78,5 @@ public interface RiskPlanMapper extends BaseMapper<RiskPlan>
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByApproveUser(@Param("userId") Long userId
,@Param("status") String status,@Param("result") String result);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(@Param("deptId") Long deptId);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(@Param("deptId") Long deptId,@Param("name") String name);
}
......@@ -3,7 +3,6 @@ package com.censoft.censoftrongtong.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.censoft.censoftrongtong.domain.LedgerBuilding;
import com.censoft.censoftrongtong.domain.RiskPlan;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppApproveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppDetailsDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppListDto;
......@@ -71,7 +70,7 @@ public interface IRiskPlanService extends IService<RiskPlan>
int saveRiskPlan(RiskPlan riskPlan);
List<RiskPlanAppListDto> getRiskPlanAppListDtoList(List<RiskPlanStatusType> statusList, Long createUserId
, Long leaderUserId, Long workUserId);
, Long leaderUserId, Long workUserId,String name);
RiskPlanAppDetailsDto getRiskPlanAppDetailsDtoByPlanId(Long planId,Long buildingId);
......@@ -83,7 +82,7 @@ public interface IRiskPlanService extends IService<RiskPlan>
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByApproveUser(Long userId,String status,String result);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(Long deptId);
List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(Long deptId,String name);
int updateRiskPlanById(RiskPlan riskPlan);
}
package com.censoft.censoftrongtong.service.impl;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.censoft.censoftrongtong.domain.LedgerBuilding;
import com.censoft.censoftrongtong.domain.RiskPlan;
......@@ -18,11 +13,12 @@ import com.censoft.censoftrongtong.enums.RiskPlanStatusType;
import com.censoft.censoftrongtong.mapper.RiskPlanMapper;
import com.censoft.censoftrongtong.service.*;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* 风险计划Service业务层处理
......@@ -160,7 +156,7 @@ public class RiskPlanServiceImpl extends ServiceImpl<RiskPlanMapper, RiskPlan> i
@Override
public List<RiskPlanAppListDto> getRiskPlanAppListDtoList(List<RiskPlanStatusType> statusList, Long createUserId
, Long leaderUserId, Long workUserId) {
, Long leaderUserId, Long workUserId,String name) {
List<String> statusStringList = null;
//枚举类转化为数据库存的状态值
if (statusList != null) {
......@@ -170,7 +166,7 @@ public class RiskPlanServiceImpl extends ServiceImpl<RiskPlanMapper, RiskPlan> i
}
//查询并把状态值转化为状态名称
return riskPlanMapper.getRiskPlanAppListDtoList(statusStringList, createUserId, leaderUserId, workUserId)
return riskPlanMapper.getRiskPlanAppListDtoList(statusStringList, createUserId, leaderUserId, workUserId,name)
.stream()
.map(dto -> {
String status = RiskPlanStatusType.getTitleByStatus(dto.getStatus()).getTitle();
......@@ -357,8 +353,8 @@ public class RiskPlanServiceImpl extends ServiceImpl<RiskPlanMapper, RiskPlan> i
}
@Override
public List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(Long deptId) {
return riskPlanMapper.getRiskPlanAppListDtoListByCreateUserDeptId(deptId);
public List<RiskPlanAppListDto> getRiskPlanAppListDtoListByCreateUserDeptId(Long deptId,String name) {
return riskPlanMapper.getRiskPlanAppListDtoListByCreateUserDeptId(deptId,name);
}
@Override
......
......@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectRiskPlanList" parameterType="com.censoft.censoftrongtong.domain.RiskPlan" resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppTaskDetailsDto" >
SELECT * FROM(
SELECT
rp.id,
rp.`no`,
......@@ -60,22 +61,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_user su2 ON su2.user_id = rp.leader_user_id
LEFT JOIN sys_dept sd1 ON sd1.dept_id = rp.create_dept_id
LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN sys_dept sd2 ON sd2.dept_id = lp.dept_id
LEFT JOIN sys_dept sd2 ON sd2.dept_id = lp.dept_id) TT
<where>
<if test="name != null and name != ''"> and rp.name like concat('%', #{name}, '%')</if>
<if test="no != null and no != ''"> and rp.no = #{no}</if>
<if test="projectId != null "> and rp.project_id = #{projectId}</if>
<if test="buildingIds != null and buildingIds != ''"> and rp.building_ids = #{buildingIds}</if>
<if test="createUserId != null "> and rp.create_user_id = #{createUserId}</if>
<if test="createDeptId != null "> and rp.create_dept_id = #{createDeptId}</if>
<if test="leaderUserId != null "> and rp.leader_user_id = #{leaderUserId}</if>
<if test="workUserIds != null and workUserIds != ''"> and rp.work_user_ids = #{workUserIds}</if>
<if test="approveUserId != null "> and rp.approve_user_id = #{approveUserId}</if>
<if test="startTime != null "> and rp.start_time = #{startTime}</if>
<if test="endTime != null "> and rp.end_time = #{endTime}</if>
<if test="status != null and status != ''"> and rp.status = #{status}</if>
<if test="isLedger != null and isLedger != ''"> and ( TT.`status` = 'FINISH' OR TT.`status` = 'REVOKE' )</if>
<if test="name != null and name != ''"> and TT.name like concat('%', #{name}, '%')</if>
<if test="no != null and no != ''"> and TT.no = #{no}</if>
<if test="projectId != null "> and TT.project_id = #{projectId}</if>
<if test="buildingIds != null and buildingIds != ''"> and TT.building_ids = #{buildingIds}</if>
<if test="createUserId != null "> and TT.create_user_id = #{createUserId}</if>
<if test="createDeptId != null "> and TT.create_dept_id = #{createDeptId}</if>
<if test="leaderUserId != null "> and TT.leader_user_id = #{leaderUserId}</if>
<if test="workUserIds != null and workUserIds != ''"> and TT.work_user_ids = #{workUserIds}</if>
<if test="approveUserId != null "> and TT.approve_user_id = #{approveUserId}</if>
<if test="startTime != null "> and TT.start_time = #{startTime}</if>
<if test="endTime != null "> and TT.end_time = #{endTime}</if>
<if test="status != null and status != ''"> and TT.status = #{status}</if>
</where>
order by rp.id desc
order by TT.id desc
</select>
<select id="selectRiskPlanById" parameterType="Long" resultMap="RiskPlanResult">
......@@ -98,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="createUserId != null"> and rp.create_user_id = #{createUserId}</if>
<if test="leaderUserId != null"> and rp.leader_user_id = #{leaderUserId}</if>
<if test="name != null"> and rp.name like concat('%', #{name}, '%')</if>
<if test="workUserId != null"> and (find_in_set(#{workUserId},rp.work_user_ids) or rp.leader_user_id = #{workUserId}) </if>
<if test="statusStringList != null and statusStringList.size >0">
and rp.`status` in
......@@ -258,6 +262,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
( rp.`status` = 'FINISH' OR rp.`status` = 'REVOKE' )
AND ( sd.dept_id = #{deptId} OR FIND_IN_SET( #{deptId}, sd.ancestors ) )
<if test="name != null"> and rp.name like concat('%', #{name}, '%')</if>
GROUP BY
rp.id
ORDER BY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment