This commit is contained in:
pengjie 2024-03-07 17:10:25 +08:00
parent 07dc224ff0
commit 833a58155f
16 changed files with 365 additions and 124 deletions

View File

@ -16,6 +16,7 @@ public class CorsConfig{
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
// config.addAllowedOrigin("http://10.75.253.12:6090");
// config.addAllowedOrigin("http://183.63.230.59:6090");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

View File

@ -1,6 +1,5 @@
package com.zhgd.xmgl.modules.basicdata.controller.admin;
import cn.xuyanwu.spring.file.storage.FileInfo;
import cn.xuyanwu.spring.file.storage.FileStorageService;
import com.zhgd.annotation.OperLog;
import com.zhgd.file.FileUtil;
@ -17,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.Locale;
import java.util.Map;
/**
@ -42,41 +41,56 @@ public class FileController {
/**
* 上传文件到指定存储平台成功返回文件信息
*/
@OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传")
@ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST")
@PostMapping("/upload")
public Result<FileInfo> uploadPlatform(MultipartFile file) {
return Result.success(fileStorageService.of(file)
.setPlatform("minio-1") //使用指定的存储平台
.upload());
}
// @OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传")
// @ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST")
// @PostMapping("/upload")
// public Result<FileInfo> uploadPlatform(MultipartFile file) {
// return Result.success(fileStorageService.of(file)
// .setPlatform("minio-1") //使用指定的存储平台
// .upload());
// }
/**
* 上传文件到本地成功返回文件信息
*/
// @OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传")
// @ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST")
// @PostMapping("/upload")
// public Result<Map<String, Object>> upload(MultipartFile file) {
// String[] FILE_SUFFIX_SUPPORT ={".jsp",".php",".asp",".aspx"};
// // 校验文件是否为空
// if (file == null) {
// throw new RuntimeException("文件不能为空!");
// }
// //得到文件名
// String originalFilename = file.getOriginalFilename();
// // 校验文件后缀
// if (!originalFilename.contains(".")) {
// throw new RuntimeException("文件不能没有后缀!");
// }
// String suffix = originalFilename.substring(originalFilename.lastIndexOf('.'));
// for (String s : FILE_SUFFIX_SUPPORT) {
// //转换为小写比较Locale.ROOT为区域转换规则可不写
// if (s.equals(suffix.toLowerCase(Locale.ROOT))) {
// throw new RuntimeException("请上传正常的文件!");
// }
// }
// return Result.success(fileDetailService.upload(file));
@OperLog(operModul = "文件管理", operType = "文件上传", operDesc = "文件上传")
@ApiOperation(value = "文件上传", notes = "文件上传", httpMethod="POST")
@PostMapping("/upload")
public Result<Map<String, Object>> upload(MultipartFile file) {
String[] FILE_SUFFIX_SUPPORT ={".jsp",".php",".asp",".aspx"};
// 校验文件是否为空
if (file == null) {
throw new RuntimeException("文件不能为空!");
}
//得到文件名
String originalFilename = file.getOriginalFilename();
// 校验文件后缀
if (!originalFilename.contains(".")) {
throw new RuntimeException("文件不能没有后缀!");
}
String suffix = originalFilename.substring(originalFilename.lastIndexOf('.'));
for (String s : FILE_SUFFIX_SUPPORT) {
//转换为小写比较Locale.ROOT为区域转换规则可不写
if (s.equals(suffix.toLowerCase(Locale.ROOT))) {
throw new RuntimeException("请上传正常的文件!");
}
}
return Result.success(fileDetailService.upload(file));
}
/**
* 上传BASE64文件
*/
// @OperLog(operModul = "文件管理", operType = "BASE64文件上传", operDesc = "BASE64文件上传")
// @ApiOperation(value = "BASE64文件上传", notes = "BASE64文件上传", httpMethod="POST")
// @ApiImplicitParam(name = "base64", value = "BASE64字符串", required = true, dataType = "String")
// @PostMapping("/uploadBase64")
// public Result<FileInfo> uploadBase64(@ApiIgnore @RequestBody Map<String, Object> map) {
// String base64 = MapUtils.getString(map, "base64");
// MultipartFile multipartFile = FileUtil.base64toMultipart(base64, "text.jpg");
// return Result.success(fileStorageService.of(multipartFile)
// .setPlatform("minio-1") //使用指定的存储平台
// .upload());
// }
/**
@ -86,63 +100,31 @@ public class FileController {
@ApiOperation(value = "BASE64文件上传", notes = "BASE64文件上传", httpMethod="POST")
@ApiImplicitParam(name = "base64", value = "BASE64字符串", required = true, dataType = "String")
@PostMapping("/uploadBase64")
public Result<FileInfo> uploadBase64(@ApiIgnore @RequestBody Map<String, Object> map) {
public Result<Map<String, Object>> uploadBase64(@ApiIgnore @RequestBody Map<String, Object> map) {
String base64 = MapUtils.getString(map, "base64");
MultipartFile multipartFile = FileUtil.base64toMultipart(base64, "text.jpg");
return Result.success(fileStorageService.of(multipartFile)
.setPlatform("minio-1") //使用指定的存储平台
.upload());
return Result.success(fileDetailService.upload(multipartFile));
}
// /**
// * 上传BASE64文件
// */
// @OperLog(operModul = "文件管理", operType = "BASE64文件上传", operDesc = "BASE64文件上传")
// @ApiOperation(value = "BASE64文件上传", notes = "BASE64文件上传", httpMethod="POST")
// @ApiImplicitParam(name = "base64", value = "BASE64字符串", required = true, dataType = "String")
// @PostMapping("/uploadBase64")
// public Result<Map<String, Object>> uploadBase64(@ApiIgnore @RequestBody Map<String, Object> map) {
// String base64 = MapUtils.getString(map, "base64");
// MultipartFile multipartFile = FileUtil.base64toMultipart(base64, "text.jpg");
// return Result.success(fileDetailService.upload(multipartFile));
// }
/**
* 下载文件
*/
@OperLog(operModul = "文件管理", operType = "文件下载", operDesc = "文件下载")
@ApiOperation(value = "文件下载", notes = "文件下载", httpMethod="POST")
@ApiImplicitParam(name = "fileUrl", value = "文件路径", paramType = "body", dataType = "String")
@PostMapping("/download")
public void download(@ApiIgnore @RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
// 获取文件信息
String fileUrl = MapUtils.getString(map, "fileUrl");
FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
if (null == fileInfo) {
throw new Exception("缩略图文件下载失败文件不存在fileInfo" + fileInfo);
}
response.setHeader("Content-disposition", "attachment; filename=" + fileUrl.substring(fileUrl.lastIndexOf("/") + 1));
response.setContentType("application/octet-stream");// 定义输出类型
fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
}
/**
* 获取预览文件流
*/
@OperLog(operModul = "文件管理", operType = "获取预览文件流", operDesc = "获取预览文件流")
@ApiOperation(value = "获取预览文件流", notes = "获取预览文件流", httpMethod="POST")
@GetMapping("/preview")
public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception {
// 获取文件信息
FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
if (null == fileInfo) {
throw new Exception("缩略图文件预览失败文件不存在fileInfo" + fileInfo);
}
response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8"));
response.setContentType("application/octet-stream");// 定义输出类型
fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
}
// @OperLog(operModul = "文件管理", operType = "文件下载", operDesc = "文件下载")
// @ApiOperation(value = "文件下载", notes = "文件下载", httpMethod="POST")
// @ApiImplicitParam(name = "fileUrl", value = "文件路径", paramType = "body", dataType = "String")
// @PostMapping("/download")
// public void download(@ApiIgnore @RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
// // 获取文件信息
// String fileUrl = MapUtils.getString(map, "fileUrl");
// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
// if (null == fileInfo) {
// throw new Exception("缩略图文件下载失败文件不存在fileInfo" + fileInfo);
// }
// response.setHeader("Content-disposition", "attachment; filename=" + fileUrl.substring(fileUrl.lastIndexOf("/") + 1));
// response.setContentType("application/octet-stream");// 定义输出类型
// fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
// }
/**
* 获取预览文件流
@ -152,6 +134,23 @@ public class FileController {
// @GetMapping("/preview")
// public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception {
// // 获取文件信息
// fileDetailService.download(fileUrl, response);
// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl);
// if (null == fileInfo) {
// throw new Exception("缩略图文件预览失败文件不存在fileInfo" + fileInfo);
// }
// response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8"));
// response.setContentType("application/octet-stream");// 定义输出类型
// fileStorageService.download(fileInfo).outputStream(response.getOutputStream());
// }
/**
* 获取预览文件流
*/
@OperLog(operModul = "文件管理", operType = "获取预览文件流", operDesc = "获取预览文件流")
@ApiOperation(value = "获取预览文件流", notes = "获取预览文件流", httpMethod="POST")
@GetMapping("/preview")
public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception {
// 获取文件信息
fileDetailService.download(fileUrl, response);
}
}

View File

@ -9,12 +9,15 @@ import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.constant.CommonConstant;
import com.zhgd.mybatis.Aes;
import com.zhgd.xmgl.modules.basicdata.dto.SystemUserAuthDto;
import com.zhgd.xmgl.modules.basicdata.entity.EnterpriseMain;
import com.zhgd.xmgl.modules.basicdata.entity.Government;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUserDataScope;
import com.zhgd.xmgl.modules.basicdata.entity.*;
import com.zhgd.xmgl.modules.basicdata.mapper.BaseActionMapper;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserRoleMapper;
import com.zhgd.xmgl.modules.basicdata.service.*;
import com.zhgd.xmgl.modules.basicdata.vo.UserLoginVo;
import com.zhgd.xmgl.modules.safety.entity.InspectRecord;
import com.zhgd.xmgl.modules.safety.entity.ProjectSubItem;
import com.zhgd.xmgl.modules.safety.service.IInspectRecordService;
import com.zhgd.xmgl.modules.safety.service.IProjectSubItemService;
import com.zhgd.xmgl.security.JwtTokenProvider;
import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil;
@ -32,8 +35,7 @@ import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@ -67,6 +69,12 @@ public class SystemUserAuthController {
@Autowired
private ISystemUserDataScopeService systemUserDataScopeService;
@Autowired
private BaseActionMapper baseActionMapper;
@Autowired
private SystemUserRoleMapper systemUserRoleMapper;
/**
* 用户登录
* @return
@ -267,4 +275,123 @@ public class SystemUserAuthController {
ssoToken = ssoToken.replace("-", "+").replace("_", "/");
System.out.println(Aes.decrypt(ssoToken, "ssologin66!@#$%^"));
}
@Autowired
private IEngineeringService engineeringService;
@Autowired
private IProjectSubItemService projectSubItemService;
@Autowired
private IInspectRecordService inspectRecordService;
@Operation(summary = "获取用户代办事项", description = "验证token的有效性", tags = {"user"})
@GetMapping("/getToDoItems")
public RestResult<List<Map<String, Object>>> getToDoItems() {
List<Map<String, Object>> listMap = new ArrayList<>();
SecurityUser user = SecurityUtil.getUser();
Set<String> actionCodes = new HashSet<>();
if (user.isManager() && user.getAccountType() != 3) {
actionCodes = baseActionMapper.getActionCodes(user.getAccountType()).stream()
.map(a -> a.getActionCode()).collect(Collectors.toSet());
} else {
SystemUserRole systemUserRole = systemUserRoleMapper.selectOne(Wrappers.<SystemUserRole>lambdaQuery().eq(SystemUserRole::getUserId, user.getUserId()));
if (systemUserRole != null) {
String roleId = systemUserRole.getRoleId();
actionCodes = baseActionMapper.getActionCodeByRole(roleId).stream()
.map(a -> a.getActionCode()).collect(Collectors.toSet());
}
}
List<Engineering> engineerings = engineeringService.list();
// 质量初审
if (actionCodes.contains("quality_inspect_examine")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 2)
.eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 1));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "质量管理初审");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 质量终审
if (actionCodes.contains("quality_inspect_check")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 2)
.eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 2));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "质量管理终审");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 质量整改
if (actionCodes.contains("quality_inspect_update")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 2)
.eq(InspectRecord::getState, 2));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "质量问题整改");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 安全初审
if (actionCodes.contains("safe_inspect_examine")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 1)
.eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 1));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "安全管理初审");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 安全终审
if (actionCodes.contains("safe_inspect_check")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 1)
.eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 2));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "安全管理终审");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 安全整改
if (actionCodes.contains("safe_inspect_update")) {
List<InspectRecord> list = inspectRecordService.list(Wrappers.<InspectRecord>lambdaQuery()
.eq(InspectRecord::getType, 1)
.eq(InspectRecord::getState, 2));
for (InspectRecord inspectRecord : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "安全问题整改");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(inspectRecord.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
// 施工节点审批
if (actionCodes.contains("sub_item_examine")) {
List<ProjectSubItem> list = projectSubItemService.list(Wrappers.<ProjectSubItem>lambdaQuery().eq(ProjectSubItem::getApprovalStatus, 0));
for (ProjectSubItem projectSubItem : list) {
Map<String, Object> map = new HashMap<>();
map.put("type", "施工节点审批");
map.put("projectName", engineerings.stream().filter(e -> e.getEngineeringSn().equals(projectSubItem.getEngineeringSn()))
.collect(Collectors.toList()).get(0).getEngineeringName());
listMap.add(map);
}
}
return RestResult.success().data(listMap);
}
}

View File

@ -98,7 +98,9 @@ public class SystemUserOpController {
if (systemUserEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = systemUserService.removeInfo(systemUserEntity.getUserId());
systemUserRoleService.remove(Wrappers.<SystemUserRole>lambdaQuery()
.eq(SystemUserRole::getUserId, systemUserEntity.getUserId()));
boolean ok = systemUserService.removeById(systemUserEntity.getUserId());
if (ok) {
result.success("删除成功!");
}
@ -123,7 +125,22 @@ public class SystemUserOpController {
systemUserVo.setRoleId(systemUserOpVo.getRole());
systemUserVo.setState(systemUserOpVo.getEnable());
systemUserVo.setUserTel(systemUserOpVo.getNumPhone());
systemUserService.updateInfo(systemUserVo);
SystemUser systemUser1 = systemUserService.getOne(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getAccount, systemUserOpVo.getName())
.ne(SystemUser::getUserId, systemUserOpVo.getId()));
if (systemUser1 != null) {
throw new CustomException("该用户账号已被使用!");
}
SystemUser systemUser = new SystemUser();
BeanUtils.copyProperties(systemUserVo, systemUser);
systemUser.setShowPassword(systemUser.getPassword());
systemUserService.updateById(systemUser);
//新增用户角色
systemUserRoleService.remove(Wrappers.<SystemUserRole>lambdaQuery()
.eq(SystemUserRole::getUserId, systemUser.getUserId()));
SystemUserRole systemUserRole = new SystemUserRole();
systemUserRole.setRoleId(systemUserVo.getRoleId());
systemUserRole.setUserId(systemUser.getUserId());
systemUserRoleService.save(systemUserRole);
result.success("修改成功!");
}
return result;

View File

@ -13,14 +13,12 @@ import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService;
import com.zhgd.xmgl.modules.basicdata.statistics.EngineeringStat;
import com.zhgd.xmgl.modules.basicdata.vo.EngineeringVo;
import com.zhgd.xmgl.valid.AddGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -74,7 +72,7 @@ public class EngineeringController {
@OperLog(operModul = "工程管理", operType = "新增", operDesc = "项目报监")
@ApiOperation(value = " 项目报监", notes = "项目报监", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<Engineering> add(@RequestBody @Validated(AddGroup.class) EngineeringVo engineeringVo) {
public Result<Engineering> add(@RequestBody EngineeringVo engineeringVo) {
Result<Engineering> result = new Result<Engineering>();
Engineering engineering = engineeringService.getOne(Wrappers.<Engineering>lambdaQuery()
.eq(Engineering::getEngineeringName, engineeringVo.getEngineeringName()));

View File

@ -284,6 +284,11 @@ public class Engineering implements Serializable {
*/
@ApiModelProperty(value = "工程状态(1:未开工;2:在建;3:在建.普通停工;4:在建.处罚停工;5:在建.完工;6:待竣工;7:竣工;8:其他)")
private Integer state;
/**
* 工程性质
*/
@ApiModelProperty(value = "工程性质")
private Integer nature;
/**
* 工程状态名称
*/

View File

@ -103,7 +103,7 @@ public class EngineeringServiceImpl extends ServiceImpl<EngineeringMapper, Engin
@Override
public boolean saveInfo(EngineeringVo engineeringVo) {
engineeringVo.setState(1);
// engineeringVo.setState(1);
engineeringVo.setCreateTime(new Date());
engineeringVo.setProjectSn(projectService.list().get(0).getProjectSn());
engineeringVo.setEngineeringSn(CommonUtil.getUUid());

View File

@ -104,7 +104,7 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleMapper, SystemR
if (systemRoleEntity != null) {
throw new CustomException("角色名称已存在,请重新输入!");
}
systemRole.setSn(StringUtils.isBlank(systemRole.getSn()) ? governmentService.list().get(0).getGovernmentSn() : systemRole.getSn());
systemRole.setSn(StringUtils.isBlank(systemRole.getSn()) ? user.getSn() : systemRole.getSn());
systemRole.setRoleType(systemRole.getRoleType() == null ? user.getAccountType() : systemRole.getRoleType());
systemRole.setCreateBy(user.getUserId());
systemRole.setCreateTime(new Date());

View File

@ -104,7 +104,7 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
SystemUser systemUser = new SystemUser();
BeanUtils.copyProperties(systemUserVo, systemUser);
systemUser.setCreateTime(new Date());
systemUser.setSn(StringUtils.isBlank(systemUserVo.getSn()) ? governmentService.list().get(0).getGovernmentSn() : systemUserVo.getSn());
systemUser.setSn(StringUtils.isBlank(systemUserVo.getSn()) ? user.getSn() : systemUserVo.getSn());
systemUser.setPassword(systemUser.getShowPassword());
systemUser.setIsManager(systemUserVo.getIsManager() == null ? false : systemUserVo.getIsManager());
systemUser.setAccountType(systemUserVo.getAccountType() == null ? user.getAccountType() : systemUserVo.getAccountType());
@ -149,9 +149,10 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
if (systemUser1 != null) {
throw new CustomException("该用户账号已被使用!");
}
SecurityUser user = SecurityUtil.getUser();
SystemUser systemUser = new SystemUser();
BeanUtils.copyProperties(systemUserVo, systemUser);
systemUser.setShowPassword(systemUser.getPassword());
systemUser.setPassword(systemUser.getShowPassword());
this.updateById(systemUser);
//新增用户角色
systemUserRoleMapper.delete(Wrappers.<SystemUserRole>lambdaQuery()
@ -159,14 +160,54 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
SystemUserRole systemUserRole = new SystemUserRole();
systemUserRole.setRoleId(systemUserVo.getRoleId());
systemUserRole.setUserId(systemUser.getUserId());
//同步用户
SystemUserSyncVo systemUserSyncVo = new SystemUserSyncVo();
JSONObject jsonObject = new JSONObject();
jsonObject.put("uid", user.getAccount());
jsonObject.put("exp", DateUtil.offsetMinute(new Date(), 10).getTime());
systemUserSyncVo.setToken(Aes.hzEncrypt(JSON.toJSONString(jsonObject)));
systemUserSyncVo.setId(systemUser.getAccount());
systemUserSyncVo.setRealName(systemUser.getRealName());
systemUserSyncVo.setPwd(systemUser.getShowPassword());
systemUserSyncVo.setRole(systemUserVo.getRoleId());
systemUserSyncVo.setEnable(systemUser.getState());
systemUserSyncVo.setNumPhone(systemUser.getUserTel());
systemUserSyncVo.setAccountType(systemUser.getAccountType());
systemUserSyncVo.setSn(systemUser.getSn());
String result = asyncAttendance.syncUser(2, systemUserSyncVo);
if (result != null) {
JSONObject object = JSONObject.parseObject(result);
if (object.getInteger("code") != 200) {
throw new CustomException(object.getString("msg"));
}
}
return systemUserRoleMapper.insert(systemUserRole);
}
@Override
public boolean removeInfo(String userId) {
SystemUser systemUser = this.getById(userId);
systemUserRoleMapper.delete(Wrappers.<SystemUserRole>lambdaQuery()
.eq(SystemUserRole::getUserId, userId));
return this.removeById(userId);
boolean flag = this.removeById(userId);
if (flag) {
SecurityUser user = SecurityUtil.getUser();
SystemUserSyncVo systemUserSyncVo = new SystemUserSyncVo();
JSONObject jsonObject = new JSONObject();
jsonObject.put("uid", user.getAccount());
jsonObject.put("exp", DateUtil.offsetMinute(new Date(), 10).getTime());
systemUserSyncVo.setToken(Aes.hzEncrypt(JSON.toJSONString(jsonObject)));
systemUserSyncVo.setId(systemUser.getAccount());
String result = asyncAttendance.syncUser(3, systemUserSyncVo);
if (result != null) {
JSONObject object = JSONObject.parseObject(result);
if (object.getInteger("code") != 200) {
throw new CustomException(object.getString("msg"));
}
}
}
return flag;
}
@Override

View File

@ -11,6 +11,9 @@ public class SystemUserSyncVo {
@ApiModelProperty(value = "token")
private String token;
@ApiModelProperty(value = "用户ID(对应account属性大平台主键ID)")
private String id;
@ApiModelProperty(value = "登录账号")
private String uid;

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "在建项目指标",
"createTime" : null,
"updateTime" : 1693367757978,
"updateTime" : 1706864647618,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -34,4 +34,4 @@
"responseBodyDefinition" : null
}
================================
return db.selectOne("SELECT IFNULL(SUM(IF(is_important = 1 AND examine_state = 3, 1, 0)), 0) importance, IFNULL(SUM(IF(engineering_type = 2 AND state = 2 AND examine_state = 3, 1, 0)), 0) bridge, IFNULL(SUM(IF(engineering_type = 3 AND state = 2 AND examine_state = 3, 1, 0)), 0) tunnel, IFNULL(SUM(IF(engineering_type = 4 AND state = 2 AND examine_state = 3, 1, 0)), 0) station, IFNULL(SUM(IF(state = 8, 1, 0)), 0) rebuild, IFNULL(SUM(IF(state = 9, 1, 0)), 0) extension, IFNULL(SUM(IF(state IN(2, 8, 9), 1, 0)), 0) total, IFNULL(SUM(IF(state = 7, 1, 0)), 0) finished, IFNULL(SUM(IF(state in (3, 4), 1, 0)), 0) shutdown, IFNULL(SUM(IF(state in (2, 3, 4, 7), 1, 0)), 0) total1,(SELECT COUNT( * ) FROM engineering WHERE YEAR(examine_time) = YEAR(CURDATE()) AND examine_state = 3) newBuild FROM engineering WHERE #project ")
return db.selectOne("SELECT COUNT( id ) num,SUM( engineering_cost ) cost,IFNULL( SUM( IF ( is_important = 1 AND examine_state = 3, 1, 0 )), 0 ) importance,IFNULL( SUM( IF ( engineering_type = 2, 1, 0 )), 0 ) bridge,IFNULL( SUM( IF ( engineering_type = 3, 1, 0 )), 0 ) tunnel,IFNULL( SUM( IF ( engineering_type = 4, 1, 0 )), 0 ) station,IFNULL( SUM( IF ( nature = 1, 1, 0 )), 0 ) newBuild, IFNULL( SUM( IF ( nature = 2, 1, 0 )), 0 ) reBuild,IFNULL( SUM( IF ( nature = 3, 1, 0 )), 0 ) extension,IFNULL( SUM( IF ( state = 4, 1, 0 )), 0 ) finished,IFNULL( SUM( IF ( state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( state = 3, 1, 0 )), 0 ) shutdown FROM engineering WHERE #project ")

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "投资管理",
"createTime" : null,
"updateTime" : 1690543632559,
"updateTime" : 1706587043096,
"lock" : null,
"createBy" : "admin",
"updateBy" : "admin",
@ -37,20 +37,20 @@ BigDecimal applyAmountTotal = db.selectValue("SELECT IFNULL(SUM(apply_payment),
BigDecimal paymentTotal = db.selectValue("SELECT IFNULL(SUM(payment), 0) FROM investment_payment_stat WHERE #project")
BigDecimal big = new BigDecimal(10000);
result.put("paymentByMonth", paymentByMonth.divide(big))
result.put("applyAmountByMonth", applyAmountByMonth.divide(big))
result.put("realPayAmountByMonth", realPayAmountByMonth.divide(big))
result.put("paymentByMonth", paymentByMonth.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("applyAmountByMonth", applyAmountByMonth.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("realPayAmountByMonth", realPayAmountByMonth.divide(big, 2, BigDecimal.ROUND_HALF_UP))
var unPayAmountByMonth = applyAmountByMonth.subtract(realPayAmountByMonth);
result.put("unPayAmountByMonth", unPayAmountByMonth > 0 ? unPayAmountByMonth.divide(big) : 0)
result.put("unPayAmountByMonth", unPayAmountByMonth > 0 ? unPayAmountByMonth.divide(big, 2, BigDecimal.ROUND_HALF_UP) : 0)
result.put("totalAmount", totalAmount.divide(big))
result.put("totalAmount", totalAmount.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("payRatio", realPayAmountTotal == 0 ? 0 : realPayAmountTotal.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.put("paymentTotal", paymentTotal.divide(big))
result.put("applyAmountTotal", applyAmountTotal.divide(big))
result.put("settlementAmount", settlementAmount.divide(big))
result.put("paymentTotal", paymentTotal.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("applyAmountTotal", applyAmountTotal.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("settlementAmount", settlementAmount.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("payRatio1", realPayAmountTotal == 0 ? 0 : realPayAmountTotal.divide(settlementAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.put("settlementAmountByYear", settlementAmountByYear.divide(big))
result.put("settlementAmountByYear", settlementAmountByYear.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("payRatio2", realPayAmountByYear == 0 ? 0 : realPayAmountByYear.divide(totalAmountByYear, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.put("realPayAmountTotal", realPayAmountTotal.divide(big))
result.put("realPayAmountByYear", realPayAmountByYear.divide(big))
result.put("realPayAmountTotal", realPayAmountTotal.divide(big, 2, BigDecimal.ROUND_HALF_UP))
result.put("realPayAmountByYear", realPayAmountByYear.divide(big, 2, BigDecimal.ROUND_HALF_UP))
return result

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "环境报警列表(最近20条)",
"createTime" : null,
"updateTime" : 1688215422339,
"updateTime" : 1706838795058,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -22,4 +22,4 @@
"responseBodyDefinition" : null
}
================================
return db.select("SELECT type, cause, create_time, state FROM environment_alarm WHERE #project order by create_time desc limit 20")
return db.select("SELECT type, cause, date_format(create_time,'%Y-%m-%d %H:%i:%S') as create_time, state FROM environment_alarm WHERE #project order by create_time desc limit 20")

View File

@ -5,7 +5,7 @@
"groupId" : "485e36d471af4f809398babc4abadafe",
"name" : "查询工程分类统计",
"createTime" : null,
"updateTime" : 1691574587721,
"updateTime" : 1699250036244,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -16,7 +16,7 @@
"requestBody" : "",
"headers" : [ {
"name" : "Authorization",
"value" : "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJnZGFkbWluIiwiaWF0IjoxNjg0MjAxNzgwLCJleHAiOjE2ODQyODgxODB9.QDnW2gWL3dXo5IcVbFCkGWapOxm74MmSpqkJ6Zci7rc",
"value" : "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjc3p3IiwiaWF0IjoxNjk5MjQ5NDUyLCJleHAiOjE2OTkzMzU4NTJ9.vVpWEt2-sdJ91jcvecKd2JSNyV-D3EsppFdPFQGI0ZQ",
"description" : null,
"required" : false,
"dataType" : "String",
@ -28,26 +28,76 @@
"children" : null
} ],
"paths" : [ ],
"responseBody" : "{\n \"result\": [\n {\n \"num\": 1,\n \"dict_value\": \"房屋建筑\",\n \"ratio\": 100\n },\n {\n \"num\": 0,\n \"dict_value\": \"市政公用\",\n \"ratio\": 0\n },\n {\n \"num\": 0,\n \"dict_value\": \"其他\",\n \"ratio\": 0\n }\n ],\n \"code\": 200,\n \"success\": true,\n \"message\": \"success\",\n \"timestamp\": \"1684201634237\"\n}",
"responseBody" : "{\n \"result\": [\n {\n \"num\": 1,\n \"dict_value\": \"房屋建筑\",\n \"ratio\": 50\n },\n {\n \"num\": 0,\n \"dict_value\": \"市政公用\",\n \"ratio\": 0\n },\n {\n \"num\": 1,\n \"dict_value\": \"其他\",\n \"ratio\": 50\n }\n ],\n \"code\": 200,\n \"success\": true,\n \"message\": \"success\",\n \"timestamp\": \"1699250029028\"\n}",
"description" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
"responseBodyDefinition" : {
"name" : "",
"value" : "",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "401",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "success",
"value" : "false",
"description" : "",
"required" : false,
"dataType" : "Boolean",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "message",
"value" : "登录信息异常,请刷新或重新登录!",
"description" : "",
"required" : false,
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
} ]
}
}
================================
import java.math.BigDecimal
List list = db.select("SELECT d.dict_value, COUNT( a.id ) num FROM engineering a RIGHT JOIN system_dict_data d ON a.engineering_type = d.dict_label AND #projectalias WHERE a.examine_state = 3 AND d.dict_type = 'engineering_type' GROUP BY d.dict_value ORDER BY d.dict_sort")
List dictList = db.select("SELECT dict_value, dict_label num FROM system_dict_data where dict_type = 'engineering_type' ORDER BY dict_sort")
Map totalMap = db.selectOne("SELECT COUNT(id) num FROM engineering WHERE examine_state = 3 AND #project")
String total = totalMap.get("num")
List result = new ArrayList();
Integer other = 0;
Integer index = 0
for (item in list) {
for (item in dictList) {
Map map = item
var dict_value = map.get("dict_value")
var num = map.get("num")::int
var num = list.filter(item => item.dict_value.equals(dict_value)).size()
Map resultMap = new HashMap();
if (index < 3){
if (index < 2){
resultMap.put("dict_value" ,dict_value)
resultMap.put("num" ,num)
BigDecimal totalNum = new BigDecimal(total);

View File

@ -5,7 +5,7 @@
"groupId" : "485e36d471af4f809398babc4abadafe",
"name" : "顶部查询工程统计信息",
"createTime" : null,
"updateTime" : 1684807167570,
"updateTime" : 1706855342407,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
@ -34,4 +34,4 @@
"responseBodyDefinition" : null
}
================================
return db.selectOne("SELECT IFNULL(SUM(IF(examine_state = 3, 1, 0)),0) total,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state > 1, 1, 0)),0) newBuild,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state = 7, 1, 0)),0) finish,IFNULL(SUM(IF(is_important = 1 AND state > 1, 1, 0)),0) important FROM engineering WHERE #project")
return db.selectOne("SELECT IFNULL(SUM(IF(examine_state = 3, 1, 0)),0) total,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state > 1, 1, 0)),0) newBuild,IFNULL(SUM(IF(YEAR(start_time) = YEAR(NOW()) AND state = 7, 1, 0)),0) finish,IFNULL(SUM(IF(is_important = 1 AND state > 1, 1, 0)),0) important,IFNULL( SUM( IF ( examine_state = 3 AND state = 1, 1, 0 )), 0 ) unStart,IFNULL( SUM( IF ( examine_state = 3 AND state = 2, 1, 0 )), 0 ) building,IFNULL( SUM( IF ( examine_state = 3 AND state = 4, 1, 0 )), 0 ) complete FROM engineering WHERE #project")

BIN
tree.txt

Binary file not shown.