Browse Source

小程序任务列表

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
3b287b0bf1
6 changed files with 63 additions and 20 deletions
  1. +54
    -19
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java
  2. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/InspectionInfoVo.java
  3. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml
  4. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml
  5. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml
  6. +2
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml

+ 54
- 19
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java View File

import com.tuoheng.miniprogram.dao.*; import com.tuoheng.miniprogram.dao.*;
import com.tuoheng.miniprogram.entity.*; import com.tuoheng.miniprogram.entity.*;
import com.tuoheng.miniprogram.entity.query.InspectionQuery; import com.tuoheng.miniprogram.entity.query.InspectionQuery;
import com.tuoheng.miniprogram.enums.UserTypeEnum;
import com.tuoheng.miniprogram.service.IInspectionService; import com.tuoheng.miniprogram.service.IInspectionService;
import com.tuoheng.miniprogram.utils.ShiroUtils; import com.tuoheng.miniprogram.utils.ShiroUtils;
import com.tuoheng.miniprogram.vo.AirLineVO; import com.tuoheng.miniprogram.vo.AirLineVO;
// String username = SecurityUserUtils.username(); // String username = SecurityUserUtils.username();
//获取租户id //获取租户id
String tenantId = ShiroUtils.getTenantId(); String tenantId = ShiroUtils.getTenantId();
String username = "wangwang";
String username = "admin";
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(StringUtils.isNotEmpty(username), User::getUsername, username) .eq(StringUtils.isNotEmpty(username), User::getUsername, username)
.eq(User::getStatus, 1).eq(User::getMark, 1)); .eq(User::getStatus, 1).eq(User::getMark, 1));
} }
query.setStartTimeDate(startTime); query.setStartTimeDate(startTime);
query.setEndTimeDate(endTime); query.setEndTimeDate(endTime);
// 根据部门id获取此部门id和所有下级部门id封装list集合
List<String> deptLists = deptMapper.selectAllChildListById(query.getDeptId());
if (StringUtils.isEmpty(deptLists)){
Integer type = user.getType();
if(null == type){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
} }

List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>(); List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>();

for (int i = 0; i < deptLists.size(); i++) {
String deptId = deptLists.get(i);
query.setDeptId(deptId);
IPage<InspectionInfoVo> pageData = inspectionMapper.queryPage(page,query);
pageData.getRecords().stream().forEach(x->{
//用户角色判断 1超级管理员 2部门管理员 3普通用户
if(UserTypeEnum.SUPER_ADMIN.getCode()==type){
IPage<InspectionInfoVo> IPageData = inspectionMapper.queryPage(page, query);
IPageData.getRecords().stream().forEach(x->{
int problemsFoundNum = 0; int problemsFoundNum = 0;
int problemsVerifiedNum = 0; int problemsVerifiedNum = 0;
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
} }
problemsVerifiedNum = inspectionFileList.size(); problemsVerifiedNum = inspectionFileList.size();
for (InspectionFile inspectionFile : inspectionFileList) { for (InspectionFile inspectionFile : inspectionFileList) {
if (5 == inspectionFile.getStatus()) {
if (15 == inspectionFile.getStatus()) {
problemsFoundNum += 1; problemsFoundNum += 1;
} }
} }
//获取任务deptId1:1为部门任务 0为子部门任务
if(deptIdInt.equals(deptId)){
x.setFlag(1);
}else {
x.setFlag(0);
}
x.setFlag(1);
x.setProblemsFoundNum(problemsFoundNum); x.setProblemsFoundNum(problemsFoundNum);
x.setProblemsVerifiedNum(problemsVerifiedNum); x.setProblemsVerifiedNum(problemsVerifiedNum);
}); });
List<InspectionInfoVo> records = pageData.getRecords();
List<InspectionInfoVo> records = IPageData.getRecords();
for (InspectionInfoVo record : records) { for (InspectionInfoVo record : records) {
inspectionInfoVoList.add(record); inspectionInfoVoList.add(record);
} }


} }
//登录用户角色为部门管理员或普通用户
if(UserTypeEnum.ADMIN.getCode()==type || UserTypeEnum.ORDINARY_USER.getCode()==type){
// 根据部门id获取此部门id和所有下级部门id封装list集合
List<String> deptLists = deptMapper.selectAllChildListById(query.getDeptId());
if (StringUtils.isEmpty(deptLists)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
for (int i = 0; i < deptLists.size(); i++) {
String deptId = deptLists.get(i);
query.setDeptId(deptId);
IPage<InspectionInfoVo> pageData = inspectionMapper.queryPage(page,query);
pageData.getRecords().stream().forEach(x->{
int problemsFoundNum = 0;
int problemsVerifiedNum = 0;
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(StringUtils.isNotEmpty(x.getId()), InspectionFile::getInspectionId, x.getId())
.eq(InspectionFile::getTenantId, 0)
.eq(InspectionFile::getMark,1));
if(StringUtils.isEmpty(inspectionFileList)){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
problemsVerifiedNum = inspectionFileList.size();
for (InspectionFile inspectionFile : inspectionFileList) {
if (15 == inspectionFile.getStatus()) {
problemsFoundNum += 1;
}
}
//获取任务deptId1:1为部门任务 0为子部门任务
if(deptIdInt.equals(deptId)){
x.setFlag(1);
}else {
x.setFlag(0);
}
x.setProblemsFoundNum(problemsFoundNum);
x.setProblemsVerifiedNum(problemsVerifiedNum);
});
List<InspectionInfoVo> records = pageData.getRecords();
for (InspectionInfoVo record : records) {
inspectionInfoVoList.add(record);
}
}
}

pageDataVo.setRecords(inspectionInfoVoList); pageDataVo.setRecords(inspectionInfoVoList);





+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/vo/InspectionInfoVo.java View File

private Integer problemsFoundNum; private Integer problemsFoundNum;


/** /**
* 已核实问题数量(status状态为10已忽略和15已确认)
* 已核实问题数量(status状态15已确认)
*/ */
private Integer problemsVerifiedNum; private Integer problemsVerifiedNum;



+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml View File

live-channel-domain-url: https://streaming.t-aaron.com/ live-channel-domain-url: https://streaming.t-aaron.com/
# 高德Key # 高德Key
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
# 文件配置 # 文件配置
uploads: uploads:
#上传的服务器上的映射文件夹 #上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml View File

live-channel-domain-url: https://streaming.t-aaron.com/ live-channel-domain-url: https://streaming.t-aaron.com/
# 高德Key # 高德Key
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
# 文件配置 # 文件配置
uploads: uploads:
#上传的服务器上的映射文件夹 #上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml View File

live-channel-domain-url: https://streaming.t-aaron.com/ live-channel-domain-url: https://streaming.t-aaron.com/
# 高德Key # 高德Key
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
# 文件配置 # 文件配置
uploads: uploads:
#上传的服务器上的映射文件夹 #上传的服务器上的映射文件夹

+ 2
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml View File

live-channel-domain-url: https://streaming.t-aaron.com/ live-channel-domain-url: https://streaming.t-aaron.com/
# 高德Key # 高德Key
gaodeKey: c01a978a4a24759282f6e3a9b9a0974d gaodeKey: c01a978a4a24759282f6e3a9b9a0974d
#飞手平台地址
pilot-url: http://192.168.11.11:7011/pilot/web/
# 文件配置 # 文件配置
uploads: uploads:
#上传的服务器上的映射文件夹 #上传的服务器上的映射文件夹

Loading…
Cancel
Save