diff --git a/src/main/java/com/zhgd/config/CorsConfig.java b/src/main/java/com/zhgd/config/CorsConfig.java index 233e0b6..c81a1a3 100644 --- a/src/main/java/com/zhgd/config/CorsConfig.java +++ b/src/main/java/com/zhgd/config/CorsConfig.java @@ -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(); diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java index c20a2bb..1cb7664 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java @@ -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 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 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> 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> 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 uploadBase64(@ApiIgnore @RequestBody Map 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 uploadBase64(@ApiIgnore @RequestBody Map map) { + public Result> uploadBase64(@ApiIgnore @RequestBody Map 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> uploadBase64(@ApiIgnore @RequestBody Map 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 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 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); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserAuthController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserAuthController.java index 8b0adac..1fc8812 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserAuthController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserAuthController.java @@ -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>> getToDoItems() { + List> listMap = new ArrayList<>(); + SecurityUser user = SecurityUtil.getUser(); + Set 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.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 engineerings = engineeringService.list(); + // 质量初审 + if (actionCodes.contains("quality_inspect_examine")) { + List list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 2) + .eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 1)); + for (InspectRecord inspectRecord : list) { + Map 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 list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 2) + .eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 2)); + for (InspectRecord inspectRecord : list) { + Map 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 list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 2) + .eq(InspectRecord::getState, 2)); + for (InspectRecord inspectRecord : list) { + Map 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 list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 1) + .eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 1)); + for (InspectRecord inspectRecord : list) { + Map 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 list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 1) + .eq(InspectRecord::getState, 3).eq(InspectRecord::getLevel, 2)); + for (InspectRecord inspectRecord : list) { + Map 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 list = inspectRecordService.list(Wrappers.lambdaQuery() + .eq(InspectRecord::getType, 1) + .eq(InspectRecord::getState, 2)); + for (InspectRecord inspectRecord : list) { + Map 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 list = projectSubItemService.list(Wrappers.lambdaQuery().eq(ProjectSubItem::getApprovalStatus, 0)); + for (ProjectSubItem projectSubItem : list) { + Map 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); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java index 6093e7f..b2826c2 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java @@ -98,7 +98,9 @@ public class SystemUserOpController { if (systemUserEntity == null) { result.error500("未找到对应实体"); } else { - boolean ok = systemUserService.removeInfo(systemUserEntity.getUserId()); + systemUserRoleService.remove(Wrappers.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.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.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; diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/EngineeringController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/EngineeringController.java index fec3f14..b9beb68 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/EngineeringController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/project/EngineeringController.java @@ -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 add(@RequestBody @Validated(AddGroup.class) EngineeringVo engineeringVo) { + public Result add(@RequestBody EngineeringVo engineeringVo) { Result result = new Result(); Engineering engineering = engineeringService.getOne(Wrappers.lambdaQuery() .eq(Engineering::getEngineeringName, engineeringVo.getEngineeringName())); diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Engineering.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Engineering.java index 0106d8c..1ac6622 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Engineering.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/Engineering.java @@ -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; /** * 工程状态名称 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/EngineeringServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/EngineeringServiceImpl.java index da33977..aafb7b9 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/EngineeringServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/EngineeringServiceImpl.java @@ -103,7 +103,7 @@ public class EngineeringServiceImpl extends ServiceImpllambdaQuery() @@ -159,14 +160,54 @@ public class SystemUserServiceImpl extends ServiceImpllambdaQuery() .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 diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/vo/SystemUserSyncVo.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/vo/SystemUserSyncVo.java index 50e58f3..741ce32 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/vo/SystemUserSyncVo.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/vo/SystemUserSyncVo.java @@ -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; diff --git a/src/main/resources/magic/api/惠州项目管理政务版/在建项目指标.ms b/src/main/resources/magic/api/惠州项目管理政务版/在建项目指标.ms index 7f0b923..5ea07af 100644 --- a/src/main/resources/magic/api/惠州项目管理政务版/在建项目指标.ms +++ b/src/main/resources/magic/api/惠州项目管理政务版/在建项目指标.ms @@ -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 ") \ No newline at end of file +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 ") \ No newline at end of file diff --git a/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms b/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms index f32e8b5..74ee45b 100644 --- a/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms +++ b/src/main/resources/magic/api/惠州项目管理政务版/投资管理.ms @@ -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 \ No newline at end of file diff --git a/src/main/resources/magic/api/惠州项目管理政务版/环境报警列表(最近20条).ms b/src/main/resources/magic/api/惠州项目管理政务版/环境报警列表(最近20条).ms index 93a2511..723eff9 100644 --- a/src/main/resources/magic/api/惠州项目管理政务版/环境报警列表(最近20条).ms +++ b/src/main/resources/magic/api/惠州项目管理政务版/环境报警列表(最近20条).ms @@ -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") \ No newline at end of file +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") \ No newline at end of file diff --git a/src/main/resources/magic/api/监管决策BI/查询工程分类统计.ms b/src/main/resources/magic/api/监管决策BI/查询工程分类统计.ms index dca9a8c..6a8aa95 100644 --- a/src/main/resources/magic/api/监管决策BI/查询工程分类统计.ms +++ b/src/main/resources/magic/api/监管决策BI/查询工程分类统计.ms @@ -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); diff --git a/src/main/resources/magic/api/监管决策BI/顶部查询工程统计信息.ms b/src/main/resources/magic/api/监管决策BI/顶部查询工程统计信息.ms index cc90054..2ee857a 100644 --- a/src/main/resources/magic/api/监管决策BI/顶部查询工程统计信息.ms +++ b/src/main/resources/magic/api/监管决策BI/顶部查询工程统计信息.ms @@ -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") \ No newline at end of file +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") \ No newline at end of file diff --git a/tree.txt b/tree.txt deleted file mode 100644 index 870e569..0000000 Binary files a/tree.txt and /dev/null differ