diff --git a/pom.xml b/pom.xml index b7947591a..abee8d711 100644 --- a/pom.xml +++ b/pom.xml @@ -355,6 +355,12 @@ ${ruoyi-vue-plus.version} + + com.ruoyi + ruoyi-rsaencrypt + ${ruoyi-vue-plus.version} + + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SysFileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SysFileController.java index f0cb8cf2d..2f8f097c8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SysFileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SysFileController.java @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.common; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.file.service.ISysFileService; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -30,6 +31,7 @@ public class SysFileController /*文件上传请求*/ + @RsaSecurityParameter @PostMapping("upload") public R upload(MultipartFile file) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/BuyHousesController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/BuyHousesController.java index 7d58874e2..20d902e7c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/BuyHousesController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/BuyHousesController.java @@ -3,23 +3,19 @@ package com.ruoyi.web.controller.house; import java.io.IOException; import java.util.List; import java.util.Arrays; -import java.util.concurrent.TimeUnit; -import com.ruoyi.system.domain.BuyHouses; -import com.ruoyi.system.domain.bo.HousesReviewBo; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.system.domain.dto.BuyHousesEvent; import lombok.RequiredArgsConstructor; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; -import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.validate.AddGroup; -import com.ruoyi.common.core.validate.EditGroup; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.vo.BuyHousesVo; @@ -47,6 +43,7 @@ public class BuyHousesController extends BaseController { @SaCheckPermission("system:houses:list") @GetMapping("/list") public TableDataInfo list(BuyHousesBo bo, PageQuery pageQuery) { + bo.setProcessStatus(Constants.SUCCEED); return iBuyHousesService.queryPageList(bo, pageQuery); } @@ -57,13 +54,13 @@ public class BuyHousesController extends BaseController { * @throws IOException */ @PostMapping("/subscribeExport") - public R subscribeExport(BuyHousesBo bo) throws IOException { + public R subscribeExport(@RequestBody BuyHousesEvent bo) throws IOException { return iBuyHousesService.subscribeExport(bo); } /** * 导出excel */ - @GetMapping("/exportExcel") + @PostMapping("/exportExcel") public void exportExcel(BuyHousesBo bo,HttpServletResponse response){ iBuyHousesService.exportExcel(bo,response); } @@ -91,27 +88,6 @@ public class BuyHousesController extends BaseController { return R.ok(iBuyHousesService.queryById(id)); } - /** - * 新增【请填写功能名称】 - */ - /*@SaCheckPermission("system:houses:add") - @Log(title = "【购房申请添加】", businessType = BusinessType.INSERT) - @RepeatSubmit() - @PostMapping() - public R add(@Validated(AddGroup.class) @RequestBody BuyHousesBo bo) { - return toAjax(iBuyHousesService.insertByBo(bo)); - }*/ - - /** - * 修改【请填写功能名称】 - */ - /* @SaCheckPermission("system:houses:edit") - @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) - @RepeatSubmit() - @PutMapping() - public R edit(@Validated(EditGroup.class) @RequestBody BuyHousesBo bo) { - return toAjax(iBuyHousesService.updateByBo(bo)); - }*/ /** * 删除【请填写功能名称】 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/HousesReviewController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/HousesReviewController.java index 867cf971e..aa2349899 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/HousesReviewController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/HousesReviewController.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -13,10 +14,12 @@ import com.ruoyi.common.core.validate.AddGroup; import com.ruoyi.common.core.validate.EditGroup; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.excel.ExcelResult; +import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.BuyHouses; import com.ruoyi.system.domain.HousesReview; import com.ruoyi.system.domain.bo.HousesReviewBo; +import com.ruoyi.system.domain.dto.HousesReviewEvent; import com.ruoyi.system.domain.vo.HousesReviewVo; import com.ruoyi.system.mapper.BuyHousesMapper; import com.ruoyi.system.service.IHousesReviewService; @@ -63,6 +66,19 @@ public class HousesReviewController extends BaseController { } + /** + * 购房登记录入管理列表 + * @param bo + * @param pageQuery + * @return + */ + @SaCheckPermission("system:manager:reviewList") + @GetMapping("/manager/list") + public TableDataInfo managerReviewList(HousesReviewBo bo, PageQuery pageQuery) { + bo.setProcessStatus(Constants.SUCCEED); + return iHousesReviewService.queryPageList(bo, pageQuery); + } + /** * 预约导出 * @param bo @@ -70,14 +86,14 @@ public class HousesReviewController extends BaseController { * @throws IOException */ @PostMapping("/subscribeExport") - public R subscribeExport(HousesReviewBo bo) throws IOException { + public R subscribeExport(HousesReviewEvent bo) throws IOException { return iHousesReviewService.subscribeExport(bo); } /** * 导出excel */ - @GetMapping("/exportExcel") + @PostMapping("/exportExcel") public void exportExcel(HousesReviewBo bo,HttpServletResponse response){ iHousesReviewService.exportExcel(bo,response); } @@ -88,6 +104,10 @@ public class HousesReviewController extends BaseController { @SaCheckPermission("system:review:list") @GetMapping("/registrationManagement/list") public TableDataInfo list(HousesReviewBo bo, PageQuery pageQuery) { + boolean admin = LoginHelper.isAdmin(); + if (!admin){ + bo.setProjectName(LoginHelper.getUsername()); + } return iHousesReviewService.queryPageList(bo, pageQuery); } @@ -107,7 +127,7 @@ public class HousesReviewController extends BaseController { * * @param id 主键 */ - @SaCheckPermission("system:review:query") + @SaCheckPermission("system:review:edit") @GetMapping("/registrationManagement/{id}") public R getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) { @@ -140,7 +160,7 @@ public class HousesReviewController extends BaseController { * 删除购房复审登记 * @param ids 主键串 */ - @SaCheckPermission("system:review:remove") + @SaCheckPermission("system:review:edit") @Log(title = "购房复审登记", businessType = BusinessType.DELETE) @DeleteMapping("/registrationManagement/{ids}") public R remove(@NotEmpty(message = "主键不能为空") @@ -170,7 +190,7 @@ public class HousesReviewController extends BaseController { List collect1 = buyHousesMapper.selectList(queryWrapper).stream().map(BuyHouses::getCardId).collect(Collectors.toList()); for (HousesReview housesReview : list) { housesReview.setProcessKey("house_review"); - housesReview.setProcessStatus("submit"); + housesReview.setProcessStatus(Constants.SUBMIT); if ( collect1.size() > 0 && collect1.contains(housesReview.getCard()) ) { housesReview.setSourceBy("1"); } else { @@ -208,7 +228,4 @@ public class HousesReviewController extends BaseController { public R getMaterialByBusinessId(@PathVariable(value = "id") Long id){ return iHousesReviewService.getMaterialByBusinessId(id); } - - - } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 75611c7e5..18a7417ef 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -16,9 +16,9 @@ import com.ruoyi.common.utils.JsonUtils; import com.ruoyi.common.utils.StrUtils; import com.ruoyi.common.utils.redis.RedisUtils; import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; import com.ruoyi.sms.core.SmsTemplate; import com.ruoyi.sms.entity.SmsResult; -import com.ruoyi.system.domain.BuyHouses; import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysUserService; @@ -106,6 +106,7 @@ public class SysLoginController { * 退出登录 */ @SaIgnore + @RsaSecurityParameter @PostMapping("/logout") public R logout() { loginService.logout(); @@ -147,19 +148,24 @@ public class SysLoginController { */ @SaIgnore @RateLimiter(count = 2, time = 10) + @RsaSecurityParameter(inDecode = true) @PostMapping("/userLogin") - public R> userLogin( + public R userLogin( @Validated({LoginBody.passwordLogin.class}) @RequestBody LoginBody loginBody) { - Map ajax = new HashMap<>(); // 生成令牌 - String token = loginService.userLogin(loginBody.getUsername(), loginBody.getPassword()); - ajax.put(Constants.TOKEN, token); - return R.ok(ajax); + return R.ok("登录成功",loginService.userLogin(loginBody.getUsername(), loginBody.getPassword())); + } + /** + * 手机号登录 + * @param loginBody + * @return + */ @SaIgnore // @RateLimiter(count = 2, time = 10) + @RsaSecurityParameter(inDecode = true) @PostMapping("/userSmsLogin") public R> userSmsLogin(@Validated(LoginBody.smgLogin.class) @RequestBody LoginBody loginBody) { Map ajax = new HashMap<>(); @@ -176,6 +182,7 @@ public class SysLoginController { */ @SaIgnore @RateLimiter(count = 1, time = 10) + @RsaSecurityParameter(inDecode = true) @PostMapping("/userUpdatePwd") public R userUpdatePwd(@Validated(LoginBody.forgetPasswordLogin.class) @RequestBody LoginBody loginBody) { return loginService.userUpdatePwd(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode()); @@ -189,6 +196,7 @@ public class SysLoginController { @SaIgnore @RateLimiter(count = 1, time = 10) @PostMapping("/userRegister") + @RsaSecurityParameter(inDecode = true) public R userRegister(@Validated(LoginBody.registerUser.class) @RequestBody LoginBody loginBody) { return loginService.userRegister(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode()); } @@ -200,6 +208,7 @@ public class SysLoginController { */ // @RateLimiter(count = 1) @SaIgnore + @RsaSecurityParameter() @GetMapping("/forgotSendAliYun") public R forgotSendAliYun(String phones) { boolean matches = phones.matches("^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"); @@ -216,6 +225,7 @@ public class SysLoginController { */ // @RateLimiter(count = 1,time = 20) @SaIgnore + @RsaSecurityParameter @GetMapping("/registerSendAliYun") public R registerSendAliYun(String phones) { boolean matches = phones.matches("^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"); @@ -233,6 +243,7 @@ public class SysLoginController { // @RateLimiter(count = 1,time = 20) @SaIgnore @GetMapping("/smsLoginSendAliYun") + @RsaSecurityParameter public R smsLoginSendAliYun(String phones) { boolean matches = phones.matches("^1(3\\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"); if (!matches) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/HouseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/HouseController.java index cddf2b400..4e9fb9a29 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/HouseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/HouseController.java @@ -13,6 +13,7 @@ import com.ruoyi.common.core.validate.AddGroup; import com.ruoyi.common.core.validate.DownloadGroup; import com.ruoyi.common.core.validate.EditGroup; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; import com.ruoyi.system.domain.BuyHouses; import com.ruoyi.system.domain.bo.BuyHousesBo; import com.ruoyi.system.service.IBuyHousesService; @@ -36,19 +37,21 @@ public class HouseController extends BaseController { /** * 购房申请添加 */ - @Log(title = "【购房申请添加】", businessType = BusinessType.INSERT) + /* @Log(title = "【购房申请添加】", businessType = BusinessType.INSERT) @RepeatSubmit() @PostMapping() + @RsaSecurityParameter(inDecode = true) public R add(@Validated(AddGroup.class) @RequestBody BuyHousesBo bo) { return toAjax(iBuyHousesService.insertByBo(bo)); - } + }*/ /** * 购房申请修改 */ @Log(title = "【购房申请修改】", businessType = BusinessType.UPDATE) @RepeatSubmit() - @PutMapping() + @PostMapping() + @RsaSecurityParameter(inDecode = true) public R edit(@Validated(EditGroup.class) @RequestBody BuyHousesBo bo) { return toAjax(iBuyHousesService.updateByBo(bo)); } @@ -58,7 +61,8 @@ public class HouseController extends BaseController { */ @Log(title = "【购房获取详情】", businessType = BusinessType.OTHER) @RepeatSubmit() - @PostMapping("info") + @PostMapping("/info") + @RsaSecurityParameter(inDecode = true) public R getInfo(@RequestBody BuyHouses buyHouses) { return iBuyHousesService.getInfo(buyHouses); } @@ -68,15 +72,26 @@ public class HouseController extends BaseController { * 下载人才认定申请表 */ @PostMapping("/download") + @RsaSecurityParameter(inDecode = true) public R downloadWord(@Validated(DownloadGroup.class) @RequestBody BuyHousesBo buyHousesBo){ return iBuyHousesService.downloadWord(buyHousesBo); } + /** + * 下载认定通知单 + */ + @GetMapping("/downloadInform") + @RsaSecurityParameter + public R downloadInform(){ + return iBuyHousesService.downloadInform(); + } + /** * 获取流程进度列表 * @return */ @GetMapping("/declareList") + @RsaSecurityParameter public R getDeclareList(){ return R.ok(iBuyHousesService.getDeclareList()); } @@ -86,6 +101,7 @@ public class HouseController extends BaseController { * 通过调用高新人才判断该身份证是否具备人才资格 */ @PostMapping("/CandidatesInfo") + @RsaSecurityParameter(inDecode = true) public R getGaoXinCandidateInfoByCardId(@RequestBody BuyHouses buyHouses){ String cardId = buyHouses.getCardId(); if (ObjectUtil.isNull(cardId) || ObjectUtil.isEmpty(cardId)){ @@ -93,4 +109,19 @@ public class HouseController extends BaseController { } return iBuyHousesService.getGaoXinCandidateInfoByCardId(cardId); } + @GetMapping("/checkStatus") + @RsaSecurityParameter + public R checkStatus(){ + return iBuyHousesService.checkStatus(); + } + + /** + * 获取审核日志 + * @return + */ + @GetMapping("/buyHouseLogs") + @RsaSecurityParameter + public R getBuyHouseLog(){ + return iBuyHousesService.getBuyHousesLogsByUserId(); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java index 802d33446..d9bb5a10a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java @@ -10,6 +10,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; import com.ruoyi.work.domain.ActProcess; import com.ruoyi.work.domain.HisProcess; import com.ruoyi.work.domain.TProcess; @@ -128,6 +129,7 @@ public class UserController extends BaseController { */ @Log(title = "获取当前业务运行到那一步",businessType = BusinessType.OTHER) @PostMapping("/processPlan") + @RsaSecurityParameter(inDecode = true) public R processPlan(@RequestBody ActProcess actProcess){ List tProcesses = processMapper.selectList(new LambdaQueryWrapper() .eq(TProcess::getProcessKey, actProcess.getProcessKey())); @@ -140,10 +142,8 @@ public class UserController extends BaseController { processVo.setBusinessId(actProcess.getBusinessId()); processVo.setParams(map); hashMap.put("status",map.get("processStatus")); -// hashMap.put("cardId",map.get("cardId")); List processPlan= WorkComplyUtils.getProcessPlan(processVo); hashMap.put("list",processPlan); return R.ok(hashMap); } - } diff --git a/ruoyi-admin/src/main/resources/404.jpg b/ruoyi-admin/src/main/resources/404.jpg new file mode 100644 index 000000000..9eb2efe7e Binary files /dev/null and b/ruoyi-admin/src/main/resources/404.jpg differ diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index deeaa07bd..fc33b16a5 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -102,7 +102,8 @@ spring: spring: redis: # 地址 - host: 119.96.86.131 +# host: 119.96.86.131 + host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 @@ -173,7 +174,7 @@ sms: # 本地文件存储 file: domain: http://192.168.0.54:8080 - path: D:\\gaoxin\\images\\ + path: D:\\gaoxin\\images prefix: /images size: 10 template: D:\\gaoxin\\file\\ diff --git a/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java b/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java index dac025c8a..772426ab8 100644 --- a/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java +++ b/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java @@ -1,13 +1,24 @@ package com.ruoyi.test; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.codec.Base64; +import cn.hutool.core.io.resource.ClassPathResource; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.CipherMode; import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.SmUtil; +import cn.hutool.crypto.asymmetric.ECIES; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.RSA; +import cn.hutool.crypto.asymmetric.SM2; +import cn.hutool.crypto.symmetric.SM4; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSON; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; +import com.antherd.smcrypto.sm2.Keypair; +import com.antherd.smcrypto.sm2.Sm2; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.config.RuoYiConfig; @@ -17,11 +28,12 @@ import com.ruoyi.common.helper.DataBaseHelper; import com.ruoyi.common.utils.AesUtil; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.rsaencrypt.utls.RSAUtil; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.vo.HousesReviewVo; -import com.ruoyi.system.domain.vo.MaterialModuleVo; import com.ruoyi.system.domain.vo.MaterialTalentsVo; import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.IBuyHousesService; import com.ruoyi.system.service.impl.MaterialModuleServiceImpl; import com.ruoyi.system.service.impl.SysConfigServiceImpl; import com.ruoyi.work.domain.ActProcess; @@ -36,12 +48,22 @@ import com.ruoyi.work.mapper.ProcessMapper; import com.ruoyi.work.service.impl.ProcessServiceImpl; import com.ruoyi.work.utils.WorkComplyUtils; import org.apache.commons.text.CaseUtils; +import org.bouncycastle.crypto.engines.SM2Engine; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.util.ReflectionUtils; +import javax.crypto.SecretKey; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Method; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.KeyPair; +import java.security.PrivateKey; +import java.security.PublicKey; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -91,6 +113,12 @@ public class DemoUnitTest { @Autowired private MaterialModuleServiceImpl materialModuleService; + @Autowired + private IBuyHousesService iBuyHousesService; + + @Autowired + private BuyHousesMemberMapper buyHousesMemberMapper; + @DisplayName("测试 @SpringBootTest @Test @DisplayName 注解") @Test @@ -361,8 +389,8 @@ public class DemoUnitTest { System.out.println("s = " + s); LinkedHashMap hashMap = new LinkedHashMap<>(); JSONObject json1 = JSONUtil.createObj() - .set("loginName", AesUtil.encryptBASE64("15881326343")) - .set("password",AesUtil.encryptBASE64("Feng19891217")); + .set("loginName", AesUtil.encryptBASE64("15881326343")) + .set("password",AesUtil.encryptBASE64("Feng19891217")); // hashMap.put("loginName", AesUtil.encryptBASE64("18716148446")); // hashMap.put("password",AesUtil.encryptBASE64("1234Qwer")); @@ -377,4 +405,131 @@ public class DemoUnitTest { List materialInfo = materialModuleService.getMaterialInfo(map); System.out.println("materialInfo = " + materialInfo);*/ } + + @Test + public void ddd() throws IOException { + + URL url = new URL("https://gx.chengdutalent.cn:8010/upload/GXTalents/images/d69af77836264dd897b2fe3d55a9edd3.jpg"); +// URL url = new URL("https://gx.chengdutalent.cn:8010/upload/GXTalents/images/ac2144e52f5a44be8f21a3ff3cfdc3ab.jpg"); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET");//POST + //防止屏蔽程序抓取而返回403错误 + conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + conn.setConnectTimeout(5000); + conn.setReadTimeout(5000); + int responseCode = conn.getResponseCode(); + /*InputStream inputStream = conn.getInputStream(); + byte[] temp = new byte[inputStream.available()]; + FileOutputStream fos = new FileOutputStream("D:\\"); + int len = 0; + while ((len = inputStream.read(temp)) != -1) { + fos.write(temp, 0, len); + } +*/ + InputStream inputStream =conn.getInputStream(); + byte[] temp =new byte[inputStream.available()]; + if (temp.length==0) { + ClassPathResource classPathResource = new ClassPathResource("/404.jpg"); + inputStream = classPathResource.getStream(); + temp = new byte[inputStream.available()]; + } + FileOutputStream fos = new FileOutputStream("D:\\ddd.jpg"); + int len = 0; + while ((len = inputStream.read(temp)) != -1) { + fos.write(temp, 0, len); + } + inputStream.close(); + fos.close(); + inputStream.close(); + fos.close(); + System.out.println("responseCode = " + responseCode); + } + @Test + public void test4454545() throws Exception { + Keypair keypair = Sm2.generateKeyPairHex(); + String privateKey = "9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e"; + System.out.println("privateKey = " + privateKey); + String publicKey = "0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; + System.out.println("publicKey = " + publicKey); + final String VUE_PUBLIC_KEY = "048af4184056315a9ecfcc14280b32504ba194ec8dd0e06b298c4a1aa557e7e9a5d15e1293392f741f7fb31a82e55785b7f1880d61b57def1e38e3f06435fb0502"; + String s2 = Sm2.doEncrypt("12312312", VUE_PUBLIC_KEY); + String s3 = Sm2.doDecrypt("5c63a8de6826da7d293935766a0c13048e3aff31f9830160e0ec05b977d5153b3951f5c35207e9b7b7114e70991a4f199075ecb38b6fa33f1dab0aa2d25d2b94a989cb6f0da0e55f005b631973f18e64b65861774367502288448b8b12c9054a0baedd3d957474fcea8dcc7915826ca7d51bcb120c36184eb928e13d67042e408afa6258b68eb5c9cc609f594b2d9c047f634e9ff319f221ffbebf7253a95833224c1978", privateKey); + System.out.println("s3 = " + s3); + System.out.println("s2 = " + s2); + + SecretKey sm4 = SecureUtil.generateKey("SM4"); +// byte[] encoded = sm4.getEncoded(); +// String encode = Base64.encode(encoded); + String encode = "08H5sBeeEsvMrmLMvcetrQ=="; + SM4 sm41 = SmUtil.sm4(Base64.decode(encode)); +// sm41.setMode(CipherMode.encrypt) + String s1 = sm41.encryptHex("12346"); + System.out.println("s1 = " + s1); +// System.out.println("encode = " + encode); + /*SM4 sm41 = SmUtil.sm4(Base64.decode(encode)); + BuyHouses buyHouses = buyHousesMapper.selectById(820); + List buyHousesMembers = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, "41")); + buyHouses.setBuyHousesMemberList(buyHousesMembers); + String s = sm41.encryptHex(buyHouses.toString()); + System.out.println("s = " + s);*/ + + KeyPair pair = SecureUtil.generateKeyPair("SM2"); + byte[] publicEncoded = pair.getPublic().getEncoded(); + byte[] privateEncoded = pair.getPrivate().getEncoded(); + + + String PUBLIC_KEY = Base64.encode(publicEncoded); + System.out.println("publicKeyBase64 = " + PUBLIC_KEY); + + String PRIVATE_KEY = Base64.encode(privateEncoded); + System.out.println("privateKeyBase64 = " + PRIVATE_KEY); + SM2 sm2 = SmUtil.sm2(PRIVATE_KEY, VUE_PUBLIC_KEY); + sm2.setMode(SM2Engine.Mode.C1C3C2); + + //使用前端得公钥加密 + String s = sm2.encryptBase64("123123", KeyType.PublicKey); + System.out.println("s = " + s); + + //解密使用后端得公钥加密,私钥来解密 +// String s1 = sm2.decryptStr(s, KeyType.PrivateKey); +// System.out.println("s1 = " + s1); + +// String s = RSAUtil.privateKeyDecryptStr("04463afac00a7ef5e500bc26c74f1340f8685a1da9a1de5a87e8babb0cdfd2ef5c55091d679cf1665a3c13986b71951205fc0de60a8a2287aaeb15efac7b44130d56787ef5fbfb842cc40704dabfc7c0c73853586a31a72e8afe2f0537a1a794ce861c224b1b16844f0b5612ec9623d51d55baa36664c205660940947b3211d8929aa2e165badf4f72729e0349bfb8a326d0f68f4205769b1f043190b5c78fa200d6c9bfdf"); +// System.out.println("s = " + s); +// String s3 = StrUtil.utf8Str(sm2.decryptStr("04b8f145be1be60714eabac0ed712f6a4647fb88dd22c08e17e47120dc166d9e7016f61d17a0bd126a8e552fbeef71ebe26c1324a549058d63058795019cfa2d8eba414560e457d5dacc25794671818a106d4d55bc4a349aad8486ee669dbe09c7c02d80b8f647ce402179cbcefba1e842cc2370f2e8d0dcbe5e3b6caa48664f62712643d64949b65bb38bdf0d2c7092c77293e12542797f37f3aa8035e796a1df79c26d91", KeyType.PrivateKey)); +// System.out.println("s3= " + s3); + /* + List buyHousesMembers = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, "41")); + buyHouses.setBuyHousesMemberList(buyHousesMembers); + SM2 sm2 = SmUtil.sm2(PRIVATE_KEY, PUBLIC_KEY); + String s = sm2.encryptBase64(buyHouses.toString(), KeyType.PublicKey); + String s1 = StrUtil.utf8Str(sm2.decryptStr(s, KeyType.PrivateKey)); + System.out.println("s1 = " + s1);*/ +// RSA rsa = new RSA(PRIVATE_KEY,PUBLIC_KEY); +// String s = rsa.encryptBase64(buyHouses.toString(), KeyType.PublicKey); +// System.out.println("s = " + s); +// String s1 = rsa.decryptStr(s, KeyType.PrivateKey); +// System.out.println("s1 = " + s1); + + + String privateKeyBase641 = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALiB/4PE2IBQkxDI6yughGTVlBAj3Q/PYVi3qwjWnlIDLblG/BvihtMZxRbwQgmpsuUvnyVuMMYtMsP1xZQglmSLfxWyY0ke43u7VwDe3NnR3o/JjHQtQPfxHjlO9ziJP1PnrIaQpWpQ8UoRIUZMDdWWbt31Br6DuyC32TB/NtunAgMBAAECgYBNHgiuCphzCTpuyYuBsJWlj59TH6pF8We+rQXPq+SAYtO5nPHCteukUCEQdVskrskXAdCC1IuOSVXukcsDHpu8tHIEqfUHpuMlBZEa3hCmDeDBYcW2+Z/9NnBIi8+G6me1FNfTWrZegth7EWwt/qxdwFOl0PsNbqBJxVHyJxTIAQJBAOkW3PwrguUm2wujR7EkxCSTC8KnuKLngeOX9L1vupMrMhUjuupoRzfZYD+k3m14mUfS7jqrWKW4E9flg0/5IG0CQQDKpLJ4EjoAg7Gm0oXliWRYS/ijiZXdRmgWEj1taptTjKkIPtmIPcxutdbidwcrftbOJb+JAMvCEhMaT0UsyKfjAkEAkFAXgglugXINLKdrO8IHrp1cKqitKC8tvDvYy3DhkzyrRWtZzsfBUFLFxKHPFPgV7uIpnSl5OSE/J+xx4JHeAQJBAKtRXgig8CRrMg/lP4n1A76aS9SGhwqRcYHnXcNZM4QJEQaFjAbgqCqY1NiU5JzjGNsjkrBS2fBys2+0wLjB0x0CQQC88VLSYuh0+vrXOgyDR/hViEDePTdeubb6xggvxC8yazETXxHsougeLzeUQgKGl4nNLrQb0pv2tV7jLsFFJOkZ"; + String publicKeyBase641 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC4gf+DxNiAUJMQyOs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lizx/rMVeIKMH3nBVacOi5tPEgk8NoyzOxPptQk/dKQQGdceRMZPwTzW0+eDvEL5+cryAvVLTnaC0rie4Gp0hLXKdOoiJNzAK0htwlZHaQ0dtJFr0B2Fi++VrVswx2HuatDI2ibZ2XxE4QmCEM1CZoL7QbzP4dHoJAE3Ax6LSEBO3TuBmM+LrLmgh2gLTx7acpI2rW/Pt8gxRfkuDr1u5KMeOihZPIwkta8e1Ltsk7I2mbf3LhqhRns+MBydDZ4Wldj8ilCPOv6Dv40gNq4YuopHIFdUh2trD56uEJToftlo4FCSKuJWudLrPr81ZciGPMv4v3dG2P6gkgN6bRS7fqYFgLPasfcCyN4sLQKyBDOeRlNZjBvbgc71baZYxcy7JQhNHnegNeFL6fpXrWDnCcWGpvvS+Z5h0RQbdOddD2ESB8OZF7ix3fmUT2gJBEt+peAZYpaifyrOj/2t37GODyOzyc6HX4jVx/NAXV+cJi/dMmJ9Hbcfa3NnJYIJiYDCthv2WiFndJlqbYPO48yKmR8vTgKIeIyUxDwS9WGRhGY="; + +// RSA rsa = new RSA(privateKeyBase641,publicKeyBase641); +// String s = rsa.encryptBase64(buyHouses.toString(), KeyType.PublicKey); +// String s1 = rsa.decryptStr(text, KeyType.PrivateKey); +// System.out.println("s1 = " + s1); + +// String publicKeyBase64 = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQDNGdBB8hITt279hmBeCzZCP/CpszHhhW6IFPp5OGWkDV7w+l5HGv34IS9Asci7d1bft4ivMrEdJOmznkAO20Q=="; +// String privateKeyBase64 = "MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgLhQzxGWzCwx5HCWgMu5dF3jCrgWR81TKeTBH1u7LqA2gCgYIKoZIzj0DAQehRANCAARAM0Z0EHyEhO3bv2GYF4LNkI/8KmzMeGFbogU+nk4ZaQNXvD6Xkca/fghL0CxyLt3Vt+3iK8ysR0k6bOeQA7bR"; +// final ECIES ecies = new ECIES(privateKeyBase64,publicKeyBase64); + +// String encryptStr = ecies.encryptBase64(buyHouses.toString(), KeyType.PublicKey); +// String decryptStr = StrUtil.utf8Str(ecies.decrypt(encryptStr, KeyType.PrivateKey)); +// System.out.println("decryptStr = " + decryptStr); + } + } + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 2197e5a3d..cbaff1d45 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -73,33 +73,45 @@ public interface Constants { String TOKEN = "token"; /** - * 审核等待中 + * 待提交 */ - String WAIT = "wait"; + String SUBMIT = "0"; /** - * 审核成功 + * 审核等待中 */ - String SUCCEED = "succeed"; + String WAIT = "1"; /** * 审核失败 */ - String FAILD = "faild"; + String FAILD = "2"; + + + /** + * 公式中 + */ + String PUBLICS = "3"; + + /** + * 公式失败 + */ + String PUBLICSFail = "4"; + + /** + * 审核成功 + */ + String SUCCEED = "5"; + + /** + * 取消资格 + */ + String CANCEL = "6"; /** * 数据不存在 */ String NONENTITY = "nonentity"; - /** - * 待提交 - */ - String SUBMIT = "submit"; - - /** - * 公式中 - */ - String PUBLICS = "publics"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index bd316079a..cb914abcb 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; @@ -39,6 +40,7 @@ public class BaseEntity implements Serializable { * 创建时间 */ @TableField(fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java index 381a6f602..343d55aec 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java @@ -47,6 +47,9 @@ public class R implements Serializable { public static R ok(String msg, T data) { return restResult(data, SUCCESS, msg); } + public static R ok(int code,String msg, T data) { + return restResult(data, code, msg); + } public static R fail() { return restResult(null, FAIL, "操作失败"); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/FutureUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/FutureUtil.java new file mode 100644 index 000000000..eea2d7d07 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/FutureUtil.java @@ -0,0 +1,168 @@ +package com.ruoyi.common.utils; + +import lombok.extern.slf4j.Slf4j; + +import java.util.concurrent.*; +import java.util.function.Function; +import java.util.function.Supplier; + +/** +* 多任务处理工具类 +* @Author WhHao +* @Date 2022/8/10 16:04 +* @Return +*/ +@Slf4j +public class FutureUtil { + + /** + * cpu 核心数 + */ + private static final int AVALIABLE_PROCESSORS = Runtime.getRuntime().availableProcessors(); + + // 最大超时时间 + private static final int TIMEOUT_VALUE = 1500; + // 时间单位 + private static final TimeUnit TIMEOUT_UNIT = TimeUnit.MILLISECONDS; + + + /** + * Singleton delay scheduler, used only for starting and * cancelling tasks. + */ + public static final class Delayer { + + static final ScheduledThreadPoolExecutor delayer; + + /** + * 异常线程,不做请求处理,只抛出异常 + */ + static { + delayer = new ScheduledThreadPoolExecutor(1, new DaemonThreadFactory()); + delayer.setRemoveOnCancelPolicy(true); + } + + static ScheduledFuture delay(Runnable command, long delay, TimeUnit unit) { + return delayer.schedule(command, delay, unit); + } + + static final class DaemonThreadFactory implements ThreadFactory { + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r); + t.setDaemon(true); + t.setName("CompletableFutureScheduler"); + return t; + } + } + } + + /** + * 根据服务器cpu自定义线程池 + */ + private static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( + AVALIABLE_PROCESSORS, + 3 * AVALIABLE_PROCESSORS, + 3, + TimeUnit.SECONDS, + new LinkedBlockingDeque<>(20), + new ThreadPoolExecutor.CallerRunsPolicy() + ); + + /** + * 有返回值的异步 + * @param supplier + * @param + * @return + */ + public static CompletableFuture supplyAsync(Supplier supplier){ + return supplyAsync(TIMEOUT_VALUE,TIMEOUT_UNIT,supplier); + } + + /** + * 有返回值的异步 - 可设置超时时间 + * @param timeout + * @param unit + * @param supplier + * @param + * @return + */ + public static CompletableFuture supplyAsync(long timeout, TimeUnit unit,Supplier supplier){ + return CompletableFuture.supplyAsync(supplier, threadPoolExecutor) + .applyToEither(timeoutAfter(timeout,unit), Function.identity()) + .exceptionally(throwable -> { + throwable.printStackTrace(); + log.error(throwable.getMessage()); + return null; + }); + } + + /** + * 无返回值的异步 + * @param runnable + * @return + */ + public static CompletableFuture runAsync(Runnable runnable){ + return runAsync(TIMEOUT_VALUE,TIMEOUT_UNIT,runnable); + } + + /** + * 无返回值的异步 - 可设置超时时间 + * @param runnable + * @return + */ + public static CompletableFuture runAsync(long timeout, TimeUnit unit,Runnable runnable){ + return CompletableFuture.runAsync(runnable,threadPoolExecutor) + .applyToEither(timeoutAfter(timeout,unit), Function.identity()) + .exceptionally(throwable -> { + throwable.printStackTrace(); + log.error(throwable.getMessage()); + return null; + }); + } + + /** + * 统一处理异步结果 + * @param futures + * @return + */ + public static CompletableFuture allOf(CompletableFuture... futures){ + return allOf(TIMEOUT_VALUE,TIMEOUT_UNIT,futures); + } + + /** + * 统一处理异步结果 - 可设置超时时间 + * @param futures + * @return + */ + public static CompletableFuture allOf(long timeout, TimeUnit unit,CompletableFuture... futures){ + return CompletableFuture.allOf(futures) + .applyToEither(timeoutAfter(timeout,unit), Function.identity()) + .exceptionally(throwable -> { + throwable.printStackTrace(); + log.error(throwable.getMessage()); + return null; + }); + } + + /** + * 异步超时处理 + * @param timeout + * @param unit + * @param + * @return + */ + public static CompletableFuture timeoutAfter(long timeout, TimeUnit unit) { + CompletableFuture result = new CompletableFuture(); + // timeout 时间后 抛出TimeoutException 类似于sentinel / watcher + Delayer.delayer.schedule(() -> result.completeExceptionally(new TimeoutException()), timeout, unit); + return result; + } + + public static CompletableFuture timeoutAfter() { + CompletableFuture result = new CompletableFuture(); + // timeout 时间后 抛出TimeoutException 类似于sentinel / watcher + Delayer.delayer.schedule(() -> result.completeExceptionally(new TimeoutException()), TIMEOUT_VALUE, TIMEOUT_UNIT); + return result; + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MyFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MyFileUtils.java index e43602896..9a431a2a9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MyFileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MyFileUtils.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.file; +import cn.hutool.core.io.resource.ClassPathResource; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.ArrayUtils; @@ -97,15 +98,28 @@ public class MyFileUtils extends FileUtils URL url = new URL(str); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET");//POST - InputStream inputStream = conn.getInputStream(); - FileOutputStream fos = new FileOutputStream(fileName); - byte[] temp = new byte[1024]; - int len = 0; - while ((len = inputStream.read(temp)) != -1) { - fos.write(temp, 0, len); + //防止屏蔽程序抓取而返回403错误 + conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + conn.setConnectTimeout(5000); + conn.setReadTimeout(5000); + int responseCode = conn.getResponseCode(); + System.out.println("responseCode = " + responseCode); + InputStream inputStream = conn.getInputStream();; + byte[] temp = new byte[inputStream.available()];; + if (200==responseCode) { + if (temp.length==0) { + ClassPathResource classPathResource = new ClassPathResource("/404.jpg"); + inputStream = classPathResource.getStream(); + temp = new byte[inputStream.available()]; + } + FileOutputStream fos = new FileOutputStream(fileName); + int len = 0; + while ((len = inputStream.read(temp)) != -1) { + fos.write(temp, 0, len); + } + inputStream.close(); + fos.close(); } - inputStream.close(); - fos.close(); } catch (Exception e) { e.printStackTrace(); } @@ -269,11 +283,11 @@ public class MyFileUtils extends FileUtils StringBuilder contentDispositionValue = new StringBuilder(); contentDispositionValue.append("attachment; filename=") - .append(percentEncodedFileName) - .append(";") - .append("filename*=") - .append("utf-8''") - .append(percentEncodedFileName); + .append(percentEncodedFileName) + .append(";") + .append("filename*=") + .append("utf-8''") + .append(percentEncodedFileName); response.setHeader("Content-disposition", contentDispositionValue.toString()); } diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java b/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java index 2f7ef168b..c5aa14c7a 100644 --- a/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java +++ b/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java @@ -92,8 +92,8 @@ public class FileUploadUtils */ public static final String extractFilename(MultipartFile file) { - return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), - FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file)); + return StringUtils.format("{}/{}.{}", DateUtils.datePath(), + Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file)); } private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException diff --git a/ruoyi-rsaencrypt/pom.xml b/ruoyi-rsaencrypt/pom.xml new file mode 100644 index 000000000..dc85a7309 --- /dev/null +++ b/ruoyi-rsaencrypt/pom.xml @@ -0,0 +1,31 @@ + + + + ruoyi-vue-plus + com.ruoyi + 4.6.0 + + 4.0.0 + + ruoyi-rsaencrypt + + + 数据加密模块 + + + + + com.ruoyi + ruoyi-common + + + com.antherd + sm-crypto + 0.3.2 + + + + + diff --git a/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/DecodeRequestBodyAdvice.java b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/DecodeRequestBodyAdvice.java new file mode 100644 index 000000000..7f17156d2 --- /dev/null +++ b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/DecodeRequestBodyAdvice.java @@ -0,0 +1,133 @@ +package com.ruoyi.rsaencrypt.advice; +import cn.hutool.core.io.FastByteArrayOutputStream; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.stream.StreamUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.ruoyi.common.utils.StreamUtils; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; +import com.ruoyi.rsaencrypt.utls.RSAUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.MethodParameter; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpInputMessage; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Type; +import java.rmi.ServerException; +import java.util.List; + +/** + * @author monkey + * @desc 请求数据解密 + * @date 2018/10/29 20:17 + */ +@ControllerAdvice +@RsaSecurityParameter() +public class DecodeRequestBodyAdvice implements RequestBodyAdvice { + + private static final Logger logger = LoggerFactory.getLogger(DecodeRequestBodyAdvice.class); + + @Override + public boolean supports(MethodParameter methodParameter, Type type, Class> aClass) { + return true; + } + + @Override + public Object handleEmptyBody(Object body, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class> aClass) { + return body; + } + + @Override + public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter methodParameter, Type type, Class> aClass) throws IOException { + try { + if (methodParameter.getMethod().isAnnotationPresent(RsaSecurityParameter.class)) { + //获取注解配置的包含和去除字段 + RsaSecurityParameter serializedField = methodParameter.getMethodAnnotation(RsaSecurityParameter.class); + //入参是否需要解密 + if (serializedField.inDecode()) { + logger.info("注解RsaSecurityParameter,对方法method :【" + methodParameter.getMethod().getName() + "】返回数据进行解密"); + return new RsaHttpInputMessage(inputMessage); + } + } + return inputMessage; + } catch (Exception e) { + e.printStackTrace(); + logger.error("对方法method :【" + methodParameter.getMethod().getName() + "】返回数据进行解密出现异常:" + e.getMessage()); + throw new RuntimeException(e.getMessage()); + } + } + + @Override + public Object afterBodyRead(Object body, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type, Class> aClass) { + return body; + } + + class RsaHttpInputMessage implements HttpInputMessage { + private HttpHeaders headers; + + private InputStream body; + + public RsaHttpInputMessage(HttpInputMessage inputMessage) throws Exception { + this.headers = inputMessage.getHeaders(); + String targe="pc"; + List list = headers.get("targe"); + if (ObjectUtil.isNotNull(list) && list.size()>0) { + boolean wxixin = list.contains("weixin"); + if (wxixin) { + targe = "weixin"; + } + } + this.body = IoUtil.toUtf8Stream(easpString(IoUtil.readUtf8(inputMessage.getBody()),targe)); + } + + @Override + public InputStream getBody() { + return body; + } + + @Override + public HttpHeaders getHeaders() { + return headers; + } + + public String easpString(String requestData,String targe) throws IOException { + if (requestData != null && !requestData.equals("")) { + if (StringUtils.isEmpty(requestData)) { + throw new RuntimeException("参数【requestData】缺失异常!"); + } else { + String content = null; + try { + logger.info("解密密文:"+requestData); + if ("weixin".equals(targe)){ + content = RSAUtil.privateKeyDecryptStr(requestData); + }else { + String data1 = requestData.substring(1); + String substring = requestData.substring(1, data1.length()); + content = RSAUtil.privateKeyDecryptStr(substring); + } + logger.info("解密明文:"+content); + } catch (Exception e) { + throw new RuntimeException("msg:参数【aseKey】解析异常!"); + } + try { + } catch (Exception e) { + throw new ServerException("msg:参数【content】解析异常!"); + } + if (StringUtils.isEmpty(content)) { + throw new RuntimeException("msg:参数【requestData】解析参数空指针异常!"); + } + return content; + } + } + throw new RuntimeException("msg:参数【requestData】不合法异常!"); + } + } +} diff --git a/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/EncodeResponseBodyAdvice.java b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/EncodeResponseBodyAdvice.java new file mode 100644 index 000000000..faa09952a --- /dev/null +++ b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/advice/EncodeResponseBodyAdvice.java @@ -0,0 +1,88 @@ +package com.ruoyi.rsaencrypt.advice; +import cn.hutool.core.codec.Base64; +import cn.hutool.core.text.UnicodeUtil; +import cn.hutool.core.util.ByteUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.utils.JsonUtils; +import com.ruoyi.rsaencrypt.annotation.RsaSecurityParameter; +import com.ruoyi.rsaencrypt.utls.RSAUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.MethodParameter; +import org.springframework.http.MediaType; +import org.springframework.http.server.ServerHttpRequest; +import org.springframework.http.server.ServerHttpResponse; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; + +import java.net.URLEncoder; +import java.util.HashMap; + +/** + * @author monkey + * @desc 返回数据加密 + * @date 2018/10/25 20:17 + */ +@ControllerAdvice +@RsaSecurityParameter() +public class EncodeResponseBodyAdvice implements ResponseBodyAdvice { + private final static Logger logger = LoggerFactory.getLogger(EncodeResponseBodyAdvice.class); + + @Override + public boolean supports(MethodParameter methodParameter, Class aClass) { + return true; + } + + @Override + public Object beforeBodyWrite(Object body, MethodParameter methodParameter, MediaType mediaType, Class aClass, ServerHttpRequest serverHttpRequest, ServerHttpResponse serverHttpResponse) { + // 此处要用反射将字段中的注解解析出来 + if (methodParameter.getMethod().isAnnotationPresent(RsaSecurityParameter.class)) { + //获取注解配置的包含和去除字段 + RsaSecurityParameter serializedField = methodParameter.getMethodAnnotation(RsaSecurityParameter.class); + //出参是否需要加密 + if (serializedField.outEncode()) { + return encodeRsa(methodParameter, body); + } + } + JSONObject jsonObject = JSONUtil.parseObj(body); + Object code = jsonObject.get("code"); + String num = "500"; + String num2 ="401"; + String num3 ="403"; + if (ObjectUtil.isNotNull(code)){ + if (num.equals(code.toString()) || num2.equals(code.toString()) || num3.equals(code.toString())){ + return encodeRsa(methodParameter, body); + } + } + return body; + } + + /** + * RSA私钥加密 + * + * @param methodParameter + * @param body + * @return + */ + private Object encodeRsa(MethodParameter methodParameter, Object body) { + ObjectMapper objectMapper = new ObjectMapper(); + try { + String result = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(body); + logger.info("对返回数据 :【" + result + "】进行加密"); + String s = RSAUtil.publicKeyEncryptBase64(result); + logger.info("加密之后密文:"+s); + return s; + } catch (Exception e) { + e.printStackTrace(); + logger.error("对方法method :【" + methodParameter.getMethod().getName() + "】返回数据进行加密出现异常:" + e.getMessage()); + } + return body; + } +} + + + diff --git a/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/annotation/RsaSecurityParameter.java b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/annotation/RsaSecurityParameter.java new file mode 100644 index 000000000..880f5b15e --- /dev/null +++ b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/annotation/RsaSecurityParameter.java @@ -0,0 +1,33 @@ +package com.ruoyi.rsaencrypt.annotation; + +import org.springframework.core.annotation.Order; +import org.springframework.web.bind.annotation.Mapping; + +import java.lang.annotation.*; + + +/** + * @author monkey + * @desc 请求RSA数据解密 + * @date 2018/10/25 20:17 + */ +@Target({ElementType.METHOD,ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Mapping +@Documented +@Order(0) +public @interface RsaSecurityParameter { + + /** + * 入参是否解密,默认不解密 + */ + boolean inDecode() default false; + + /** + * 出参是否加密,默认加密 + */ + boolean outEncode() default true; + + + +} diff --git a/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/utls/RSAUtil.java b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/utls/RSAUtil.java new file mode 100644 index 000000000..4c445a7d0 --- /dev/null +++ b/ruoyi-rsaencrypt/src/main/java/com/ruoyi/rsaencrypt/utls/RSAUtil.java @@ -0,0 +1,27 @@ +package com.ruoyi.rsaencrypt.utls; +import com.antherd.smcrypto.sm2.Sm2; + +/** + * RSA加解密工具类 + * @author Administrator + */ +public class RSAUtil { + + + public static final String PRIVATE_KEY = "9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e"; + public static final String VUE_PUBLIC_KEY = "048af4184056315a9ecfcc14280b32504ba194ec8dd0e06b298c4a1aa557e7e9a5d15e1293392f741f7fb31a82e55785b7f1880d61b57def1e38e3f06435fb0502"; + public static final String PUBLIC_KEY1 = "0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; + /** + * 公钥加密 + */ + public static String publicKeyEncryptBase64(String data){ + return Sm2.doEncrypt(data, VUE_PUBLIC_KEY); + } + + /** + * 私钥解密 + */ + public static String privateKeyDecryptStr(String data){ + return Sm2.doDecrypt(data,PRIVATE_KEY); + } +} diff --git a/ruoyi-rsaencrypt/src/main/resources/META-INF/spring.factories b/ruoyi-rsaencrypt/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..017ea67a5 --- /dev/null +++ b/ruoyi-rsaencrypt/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.ruoyi.rsaencrypt.advice.DecodeRequestBodyAdvice,\ +com.ruoyi.rsaencrypt.advice.EncodeResponseBodyAdvice diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/common/WorkBusinessRule.java b/ruoyi-system/src/main/java/com/ruoyi/system/common/WorkBusinessRule.java index 6bc4f6992..5d378a580 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/common/WorkBusinessRule.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/common/WorkBusinessRule.java @@ -16,12 +16,12 @@ public class WorkBusinessRule { public String getDistrict(String district){ //先获取业务数据 - QueryWrapper qw = new QueryWrapper<>(); qw.eq("crux_key","buy_house_audit"); qw.eq("other_key",district); BuyHouseCheckVo buyHouseCheckVo = buyHouseCheckMapper.selectVoOne(qw); return buyHouseCheckVo.getPerson(); } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouses.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouses.java index 60f1ad173..5d08ec269 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouses.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouses.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; import lombok.Data; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -168,7 +169,7 @@ public class BuyHouses extends BaseEntity { private String companyId; @TableField(exist = false) - private List buyHousesMemberList; + private List buyHousesMemberList=new ArrayList<>(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialModule.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialModule.java index b948e952b..8ff80c57d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialModule.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialModule.java @@ -54,4 +54,15 @@ public class MaterialModule extends BaseEntity { @TableField(exist = false) private String file; + + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SubscribeExport.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SubscribeExport.java index 1fd5e26ba..511b56a7a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SubscribeExport.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SubscribeExport.java @@ -23,7 +23,7 @@ public class SubscribeExport extends BaseEntity { private static final long serialVersionUID=1L; /** - * + * */ @TableId(value = "id") private Long id; @@ -36,4 +36,8 @@ public class SubscribeExport extends BaseEntity { */ private String userId; + private String description; + + private String processKey; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java index 1191f1c1c..a40680126 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java @@ -3,12 +3,7 @@ package com.ruoyi.system.domain; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; -import java.io.Serializable; import java.util.Date; -import java.math.BigDecimal; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialModuleBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialModuleBo.java index 6ce13d65c..652a272de 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialModuleBo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialModuleBo.java @@ -60,5 +60,15 @@ public class MaterialModuleBo extends BaseEntity { @NotNull(message = "是否必填不能为空", groups = { AddGroup.class, EditGroup.class }) private String isMust; + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SubscribeExportBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SubscribeExportBo.java index b396515d6..140b79745 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SubscribeExportBo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SubscribeExportBo.java @@ -22,7 +22,7 @@ import com.ruoyi.common.core.domain.BaseEntity; public class SubscribeExportBo extends BaseEntity { /** - * + * */ @NotNull(message = "不能为空", groups = { EditGroup.class }) private Long id; @@ -39,5 +39,9 @@ public class SubscribeExportBo extends BaseEntity { @NotBlank(message = "申请人id不能为空", groups = { AddGroup.class, EditGroup.class }) private String userId; + private String description; + + private String processKey; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/UserBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/UserBo.java index ccdc58daf..8105f52e1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/UserBo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/UserBo.java @@ -8,8 +8,6 @@ import javax.validation.constraints.*; import java.util.Date; -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.domain.BaseEntity; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BuyHousesEvent.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BuyHousesEvent.java new file mode 100644 index 000000000..9038cfe20 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BuyHousesEvent.java @@ -0,0 +1,182 @@ +package com.ruoyi.system.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.system.domain.BuyHousesMember; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * 【请填写功能名称】对象 buy_houses + * + * @author ruoyi + * @date 2023-02-24 + */ +@Data +public class BuyHousesEvent extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + /** + * 户口簿内页/护照内页 + */ + private String insidepageUrl; + /** + * 身份证/护照 + */ + private String cardId; + /** + * 承诺书 + */ + private String commitmentUrl; + /** + * 单位地址 + */ + private String companyAddress; + /** + * 工作单位 + */ + private String companyName; + /** + * + */ + private Date createTime; + /** + * 申明书 + */ + private String declarationUrl; + /** + * 企业所在地 1.新经济活力区 2.交子公园金融商务区 3.高新西区 4.生物城 + */ + private String district; + /** + * 学历 + */ + private String education; + /** + * 身份证正面 + */ + private String frontUrl; + /** + * 公园城市局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ + private String gyStatus; + /** + * 房屋记录 + */ + private String homeRecordUrl; + /** + * 户口簿主页 + */ + private String homepageUrl; + /** + * 劳动合同 + */ + private String laborContractUrl; + /** + * 企业营业执照 + */ + private String licenseUrl; + /** + * 婚姻状况 1.未婚 2.已婚 3.离异 + */ + private String maritalStatus; + /** + * 婚姻证明材料 + */ + private String maritalUrl; + /** + * 国籍 + */ + private String nationality; + /** + * 手机号 + */ + private String phone; + /** + * 区域部门审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ + private String qyStatus; + /** + * 身份证背面 + */ + private String reverseUrl; + /** + * 性别 + */ + private String sex; + /** + * 社会事业局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ + private String shStatus; + /** + * 统一社会信用代码 + */ + private String socialCode; + /** + * 社保证明 + */ + private String socialSecurityUrl; + /** + * 状态 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过 + */ + private String status; + /** + * 类型 A B C D + */ + private String type; + /** + * 用户id + */ + private Long userId; + /** + * 姓名 + */ + private String userName; + /** + * + */ + private Date passTime; + /** + * + */ + private String pictureInformationUrl; + /** + * + */ + private String workAddress; + + private String processKey; + + private String processStatus; + + + private Date updateTime; + + private String version; + + private String companyId; + + @TableField(exist = false) + private String excelUserId; + + @TableField(exist = false) + private List buyHousesMemberList; + + @TableField(exist = false) + private String description; + + @TableField(exist = false) + private Long[] ids; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/HousesReviewEvent.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/HousesReviewEvent.java new file mode 100644 index 000000000..bd8288175 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/HousesReviewEvent.java @@ -0,0 +1,151 @@ +package com.ruoyi.system.domain.dto; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.system.domain.BuyHousesMember; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; +import java.util.List; + +/** + * 购房复审登记对象 houses_review + * + * @author ruoyi + * @date 2023-03-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class HousesReviewEvent extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * id + */ + @TableId(value = "id") + private Long id; + /** + * 证件类型 + */ + private String cardType; + /** + * 身份证号码 + */ + private String card; + /** + * 姓名 + */ + private String name; + /** + * 资格序号 + */ + private String qualification; + /** + * 审核时间 + */ + private String auditTime; + /** + * 预售证号 + */ + private String presellCard; + /** + * 交易类型 + */ + private String dealType; + /** + * 项目名称 + */ + private String projectName; + /** + * 项目区域 + */ + private String projectArea; + /** + * 资格确认时间 + */ + private String qualificationConfirmTime; + /** + * 资格预申请时间 + */ + private String qualificationPreApplyTime; + /** + * 家庭类型 + */ + private String familyType; + /** + * 状态 + */ + private String status; + /** + * 登记失效时间 + */ + private String registerFailureTime; + /** + * 国籍 + */ + private String nationality; + /** + * 婚姻状况 + */ + private String maritalStatus; + /** + * 单位类型 + */ + private String companyType; + /** + * 公司名称 + */ + private String companyName; + /** + * 人才类型 + */ + private String talentsType; + /** + * 统一社会信用代码 + */ + private String creditCode; + /** + * 企业所在地 + */ + private String companyAddress; + /** + * 来源 + */ + private String sourceBy; + /** + * 流程key + */ + private String processKey; + + /** + * 流程状态 + */ + private String processStatus; + + /** + * 工作单位所属区域 + */ + private String companyAddressArea; + + /** + * d类字段扩展 + */ + private String typeExtend; + + private Date passTime; + + @TableField(exist = false) + private String excelUserId; + + + @TableField(exist = false) + private String description; + + @TableField(exist = false) + private Long[] ids; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialModuleVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialModuleVo.java index 8530ff635..412cb43b8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialModuleVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialModuleVo.java @@ -64,5 +64,15 @@ public class MaterialModuleVo { private String file; + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SubscribeExportVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SubscribeExportVo.java index e0605125d..edb8f3e95 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SubscribeExportVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SubscribeExportVo.java @@ -22,7 +22,7 @@ public class SubscribeExportVo { private static final long serialVersionUID = 1L; /** - * + * */ @ExcelProperty(value = "") private Long id; @@ -39,5 +39,9 @@ public class SubscribeExportVo { @ExcelProperty(value = "申请人id") private String userId; + private String description; + + private String processKey; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java index a50283d28..d6e9a224f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SysUserExportVo.java @@ -87,5 +87,4 @@ public class SysUserExportVo implements Serializable { */ @ExcelProperty(value = "部门负责人") private String leader; - } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesService.java index 712d32b47..0272b1026 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesService.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.domain.BuyHouses; import com.ruoyi.system.domain.bo.BuyHousesBo; +import com.ruoyi.system.domain.dto.BuyHousesEvent; import com.ruoyi.system.domain.dto.DeclareListDTO; import com.ruoyi.system.domain.vo.BuyHousesVo; @@ -68,7 +69,7 @@ public interface IBuyHousesService { * @param bo * @return */ - R subscribeExport(BuyHousesBo bo) throws IOException; + R subscribeExport(BuyHousesEvent bo) throws IOException; /** * 导出excel @@ -76,4 +77,24 @@ public interface IBuyHousesService { * @param response */ void exportExcel(BuyHousesBo bo, HttpServletResponse response); + + /** + * 判读当前用户是否提交过 + * @return + */ + R checkStatus(); + + /** + * 获取当前用户日志 + * @return + */ + R getBuyHousesLogsByUserId(); + + + /** + * 下载认定通知单 + * @return + */ + R downloadInform(); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IHousesReviewService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IHousesReviewService.java index 7337558c4..a15a5ad8b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IHousesReviewService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IHousesReviewService.java @@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.system.domain.HousesReview; import com.ruoyi.system.domain.bo.HousesReviewBo; +import com.ruoyi.system.domain.dto.HousesReviewEvent; import com.ruoyi.system.domain.vo.HousesReviewVo; import javax.servlet.http.HttpServletResponse; @@ -63,7 +64,7 @@ public interface IHousesReviewService { * @param bo * @return */ - R subscribeExport(HousesReviewBo bo) throws IOException; + R subscribeExport(HousesReviewEvent bo) throws IOException; /** * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java index d4ec93fa8..1cbdd256c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/SysLoginService.java @@ -45,6 +45,7 @@ import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.time.Duration; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Supplier; @@ -341,7 +342,7 @@ public class SysLoginService { * @param password * @return */ - public String userLogin(String username, String password) { + public Map userLogin(String username, String password) { User user = loadUserByUsername(username); Date updateTime = user.getUpdateTime(); if (ObjectUtil.isNull(updateTime)){ @@ -358,7 +359,11 @@ public class SysLoginService { // 生成token LoginHelper.loginByDevice(loginUser, DeviceType.PC); recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); - return StpUtil.getTokenValue(); + HashMap map = new HashMap<>(); + String tokenValue = StpUtil.getTokenValue(); + map.put("token",tokenValue); + map.put("loginName",user.getLoginName()); + return map; } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesServiceImpl.java index 3cff49722..1d44211dd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesServiceImpl.java @@ -20,21 +20,25 @@ import com.ruoyi.common.utils.poi.DeleteFileUtil; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExportWordUtil; import com.ruoyi.common.utils.poi.ZipUtils; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.bo.BuyHousesBo; +import com.ruoyi.system.domain.dto.BuyHousesEvent; import com.ruoyi.system.domain.dto.DeclareListDTO; import com.ruoyi.system.domain.vo.BuyHousesVo; -import com.ruoyi.system.domain.vo.HousesReviewVo; import com.ruoyi.system.domain.vo.MaterialModuleVo; import com.ruoyi.system.mapper.BuyHousesMapper; import com.ruoyi.system.mapper.BuyHousesMemberMapper; import com.ruoyi.system.mapper.MaterialProofMapper; import com.ruoyi.system.mapper.SubscribeExportMapper; import com.ruoyi.system.service.IBuyHousesService; +import com.ruoyi.work.domain.AuditLog; import com.ruoyi.work.domain.vo.ProcessVo; +import com.ruoyi.work.mapper.AuditLogMapper; import com.ruoyi.work.utils.WorkComplyUtils; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -44,8 +48,13 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.*; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.stream.Collectors; /** @@ -56,7 +65,6 @@ import java.util.stream.Collectors; */ @RequiredArgsConstructor @Service -@Transactional(rollbackFor = Exception.class) public class BuyHousesServiceImpl implements IBuyHousesService { @Value("${file.template}") @@ -83,6 +91,9 @@ public class BuyHousesServiceImpl implements IBuyHousesService { private final SubscribeExportMapper subscribeExportMapper; + private final AuditLogMapper auditLogMapper; + + /** * 查询【请填写功能名称】 */ @@ -158,6 +169,7 @@ public class BuyHousesServiceImpl implements IBuyHousesService { lqw.eq(bo.getPassTime() != null, BuyHouses::getPassTime, bo.getPassTime()); lqw.eq(StringUtils.isNotBlank(bo.getPictureInformationUrl()), BuyHouses::getPictureInformationUrl, bo.getPictureInformationUrl()); lqw.eq(StringUtils.isNotBlank(bo.getWorkAddress()), BuyHouses::getWorkAddress, bo.getWorkAddress()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()), BuyHouses::getProcessStatus, bo.getProcessStatus()); return lqw; } @@ -165,6 +177,7 @@ public class BuyHousesServiceImpl implements IBuyHousesService { * 新增【请填写功能名称】 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(BuyHousesBo bo) { //验证这个身份证是否提交过 List buyHouses = baseMapper.selectList(new LambdaQueryWrapper<>(BuyHouses.class) @@ -201,6 +214,7 @@ public class BuyHousesServiceImpl implements IBuyHousesService { * 修改【请填写功能名称】 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(BuyHousesBo bo) { BuyHouses update = BeanUtil.toBean(bo, BuyHouses.class); validEntityBeforeSave(update); @@ -227,12 +241,13 @@ public class BuyHousesServiceImpl implements IBuyHousesService { //TODO 做一些数据校验,如唯一约束 //验证当前状态是否可以修改 //判断数据库中是否存在该人才通过身份证去验证 - BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class) - .eq(BuyHouses::getCardId, entity.getCardId())); + Long userId = LoginHelper.getUserId(); + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); if (!Constants.SUBMIT.equals(buyHouses.getProcessStatus()) && !Constants.FAILD.equals(buyHouses.getProcessStatus())){ throw new ServiceException("当前用户不可修改"); } //删除家庭情况信息 + buyHousesMemberMapper.delete(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId,buyHouses.getId())); //先删除家庭信息表 if (entity.getBuyHousesMemberList().size()>0) { buyHousesMemberMapper.delete( new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, entity.getId())); @@ -279,10 +294,12 @@ public class BuyHousesServiceImpl implements IBuyHousesService { /** * 先保存再执行下载 - * @param buyHousesBo + * @param bo */ @Override - public R downloadWord(BuyHousesBo buyHousesBo) { + public R downloadWord(BuyHousesBo bo) { + BuyHouses buyHousesBo = BeanUtil.toBean(bo, BuyHouses.class); + validEntityBeforeSave(buyHousesBo); LinkedHashMap map = new LinkedHashMap<>(); //判断数据库中是否存在该人才通过身份证去验证 BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class) @@ -356,8 +373,9 @@ public class BuyHousesServiceImpl implements IBuyHousesService { */ @Override public R getInfo(BuyHouses buyHouses) { + Long userId = LoginHelper.getUserId(); //先判断本地数据库是否有值 - BuyHousesVo buyHousesVo = baseMapper.selectVoOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getCardId,buyHouses.getCardId())); + BuyHousesVo buyHousesVo = baseMapper.selectVoOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId,userId)); if (ObjectUtil.isNotNull(buyHousesVo)){ LambdaQueryWrapper wrapper = new LambdaQueryWrapper() .eq(MaterialProof::getHouseId, buyHousesVo.getId()) @@ -371,10 +389,10 @@ public class BuyHousesServiceImpl implements IBuyHousesService { return R.ok(buyHousesVo); } HashMap paramMap = new HashMap<>(); - paramMap.put("cardId", buyHouses); + paramMap.put("cardId", buyHouses.getCardId()); String json = HttpUtil.get(URL, paramMap); JSONObject entrie = JSONUtil.parseObj(json); - String data = String.valueOf(entrie.get("date")); + String data = String.valueOf(entrie.get("data")); if (ObjectUtil.isNull(data)){ return R.fail("获取失败"); } @@ -385,8 +403,8 @@ public class BuyHousesServiceImpl implements IBuyHousesService { buyHousesDto.setUserName(String.valueOf(entries.get("name"))); buyHousesDto.setPhone(String.valueOf(entries.get("phone"))); buyHousesDto.setCompanyName(String.valueOf(entries.get("companyName"))); - buyHousesDto.setDistrict(String.valueOf(entries.get("district"))); buyHousesDto.setSex(String.valueOf(entries.get("sex"))); + buyHousesDto.setDistrict("1"); buyHousesDto.setProcessStatus(Constants.SUBMIT); buyHousesDto.setType(String.valueOf(entries.get("type"))); buyHousesDto.setProcessKey("apply_house"); @@ -433,11 +451,14 @@ public class BuyHousesServiceImpl implements IBuyHousesService { * @return */ @Override - public R subscribeExport(BuyHousesBo bo) throws IOException { - export(bo); + public R subscribeExport(BuyHousesEvent bo) { + Long userId = LoginHelper.getUserId(); + bo.setExcelUserId(userId.toString()); + SpringUtils.context().publishEvent(bo); return R.ok("预约成功"); } + /** *导出excel * @param bo @@ -451,13 +472,112 @@ public class BuyHousesServiceImpl implements IBuyHousesService { ExcelUtil.exportExcel(buyHousesVoList,"人才列表", BuyHousesVo.class,response); } + /** + * 判断是否申请过 + * @return + */ + @Override + public R checkStatus() { + Long userId = LoginHelper.getUserId(); + List buyHousesList = baseMapper.selectList(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + if (buyHousesList.size()>0){ + return R.ok(); + } + return R.ok(201,"未申请过",null); + } + + /** + * 获取当前登录用户日志 + * @return + */ + @Override + public R getBuyHousesLogsByUserId() { + Long userId = LoginHelper.getUserId(); + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + List auditLogList = auditLogMapper.selectList(new LambdaQueryWrapper<>(AuditLog.class).eq(AuditLog::getOtherId, buyHouses.getId()).orderByAsc(AuditLog::getCreateTime)); + if (auditLogList.size()>0){ + auditLogList.stream().forEach(a ->{ + if (ObjectUtil.isNull(a.getProcessKey())){ +// 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6.初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过 11.审定退件,12.资格取消 + switch (a.getStatus()){ + case "1":a.setStatus("待提交"); + break; + case "2":a.setStatus("受理中"); + break; + case "3":a.setStatus("受理退件"); + break; + case "4":a.setStatus("受理驳回"); + break; + case "5":a.setStatus("初审中"); + break; + case "6":a.setStatus("初审不通过"); + break; + case "7":a.setStatus("初审退件"); + break; + case "8":a.setStatus("审定中"); + break; + case "9":a.setStatus("审定不通过"); + break; + case "10":a.setStatus("审定通过"); + break; + case "11":a.setStatus("审定退件"); + break; + case "12":a.setStatus("资格取消"); + break; + } + }else { + switch (a.getStatus()){ + case "1":a.setStatus("审核失败"); + break; + case "2":a.setStatus("审核成功"); + break; + } + } + }); + } + HashMap map = new HashMap<>(); + map.put("auditLog",auditLogList); + map.put("status",buyHouses.getProcessStatus()); + map.put("id",buyHouses.getId()); + return R.ok("查询成功",map); + } + + @Override + public R downloadInform() { + Long userId = LoginHelper.getUserId(); + LinkedHashMap map = new LinkedHashMap<>(); + //判断数据库中是否存在该人才通过身份证去验证 + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class) + .eq(BuyHouses::getUserId,userId) + .eq(BuyHouses::getProcessStatus,Constants.SUCCEED)); + LinkedHashMap hashMap = new LinkedHashMap<>(); + hashMap.put("companyName",buyHouses.getCompanyName()); + hashMap.put("companyAddress",buyHouses.getCompanyAddress()); + hashMap.put("name",buyHouses.getUserName()); + hashMap.put("cardId",buyHouses.getCardId()); + hashMap.put("type",buyHouses.getType()); + hashMap.put("nationality", "中国籍".equals(buyHouses.getNationality()) ? "身份证" : "护照"); + String fileName = UUID.randomUUID().toString(); + String templatePath = fileUpload + "inform.docx"; + String word = ExportWordUtil.createWord(templatePath, filePath, fileName, hashMap); + System.out.println("word = " + word); + String file= download + prefix + "/" + fileName + ".docx"; + System.out.println("file = " + file); + map.put("file",file); + return R.ok(map); + + } + /** * 起步执行导出zip - * @param bo + * @param event * @throws IOException */ @Async - public void export(BuyHousesBo bo) throws IOException { + @EventListener + public void export(BuyHousesEvent event) throws IOException { + BuyHousesBo bo = BeanUtil.toBean(event, BuyHousesBo.class); + bo.setProcessStatus(Constants.SUCCEED); LambdaQueryWrapper lqw = buildQueryWrapper(bo); List buyHousesVoList = baseMapper.selectVoList(lqw); String title = "人才认定申请表"; @@ -472,14 +592,15 @@ public class BuyHousesServiceImpl implements IBuyHousesService { Map> buyHousesMemberMap = buyHousesMemberList.stream().collect(Collectors.groupingBy(BuyHousesMember::getBuyHousesId)); buyHousesVoList.stream().forEach(r -> { String userNameFile = path + separator + r.getUserName(); - File userFile = new File(userNameFile); - if (!userFile.exists() && !userFile.isDirectory()) { - userFile.mkdirs(); + System.out.println("userNameFile = " + userNameFile); + try { + Files.createDirectories(Paths.get(userNameFile)); + } catch (IOException e) { + throw new RuntimeException(e); } String s = userNameFile + separator + r.getUserName() + "--"; - //护照或者身份证 - if (ObjectUtil.isNotNull(r.getInsidepageUrl())){ + if (ObjectUtil.isNotEmpty(r.getInsidepageUrl())){ String insidepageUrl = r.getInsidepageUrl(); String fileName=null; if ("中国籍".equals(r.getNationality())){ @@ -490,116 +611,118 @@ public class BuyHousesServiceImpl implements IBuyHousesService { MyFileUtils.downLoadPic(insidepageUrl, fileName); } //申请表 - if (ObjectUtil.isNotNull(r.getCommitmentUrl())){ + /*if (ObjectUtil.isNotEmpty(r.getCommitmentUrl())){ String commitmentUrl = r.getCommitmentUrl(); String fileName= s + "申请表" + commitmentUrl.substring(commitmentUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(commitmentUrl, fileName); } //申明书 - if (ObjectUtil.isNotNull(r.getDeclarationUrl())){ + if (ObjectUtil.isNotEmpty(r.getDeclarationUrl())){ String declarationUrl = r.getDeclarationUrl(); String fileName= s + "申明书" + declarationUrl.substring(declarationUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(declarationUrl, fileName); } //身份证正面 - if (ObjectUtil.isNotNull(r.getFrontUrl())){ + if (ObjectUtil.isNotEmpty(r.getFrontUrl())){ String frontUrl = r.getFrontUrl(); String fileName= s + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(frontUrl, fileName); } //房屋记录 - if (ObjectUtil.isNotNull(r.getHomeRecordUrl())){ + if (ObjectUtil.isNotEmpty(r.getHomeRecordUrl())){ String homeRecordUrl = r.getHomeRecordUrl(); String fileName= s + "房屋记录" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(homeRecordUrl, fileName); } + //户口簿主页 - if (ObjectUtil.isNotNull(r.getHomepageUrl())){ + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ String homepageUrl = r.getHomepageUrl(); String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(homepageUrl, fileName); } //劳动合同 - if (ObjectUtil.isNotNull(r.getLaborContractUrl())){ + if (ObjectUtil.isNotEmpty(r.getLaborContractUrl())){ String laborContractUrl = r.getLaborContractUrl(); String fileName= s + "劳动合同" + laborContractUrl.substring(laborContractUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(laborContractUrl, fileName); } //企业营业执照 - if (ObjectUtil.isNotNull(r.getLicenseUrl())){ + if (ObjectUtil.isNotEmpty(r.getLicenseUrl())){ String licenseUrl = r.getLicenseUrl(); String fileName= s + "企业营业执照" + licenseUrl.substring(licenseUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(licenseUrl, fileName); } //户口簿主页 - if (ObjectUtil.isNotNull(r.getHomepageUrl())){ + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ String homepageUrl = r.getHomepageUrl(); String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(homepageUrl, fileName); } //婚姻证明材料 - if (ObjectUtil.isNotNull(r.getMaritalUrl())){ + if (ObjectUtil.isNotEmpty(r.getMaritalUrl())){ String maritalUrl = r.getMaritalUrl(); String fileName= s + "婚姻证明材料" + maritalUrl.substring(maritalUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(maritalUrl, fileName); } //身份证背面 - if (ObjectUtil.isNotNull(r.getReverseUrl())){ + if (ObjectUtil.isNotEmpty(r.getReverseUrl())){ String reverseUrl = r.getReverseUrl(); String fileName= s + "身份证背面" + reverseUrl.substring(reverseUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(reverseUrl, fileName); } //社保证明 - if (ObjectUtil.isNotNull(r.getSocialSecurityUrl())){ + if (ObjectUtil.isNotEmpty(r.getSocialSecurityUrl())){ String socialSecurityUrl = r.getSocialSecurityUrl(); String fileName= s + "社保证明" + socialSecurityUrl.substring(socialSecurityUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(socialSecurityUrl, fileName); } //人才影像卡 - if (ObjectUtil.isNotNull(r.getPictureInformationUrl())){ + if (ObjectUtil.isNotEmpty(r.getPictureInformationUrl())){ String pictureInformationUrl = r.getPictureInformationUrl(); String fileName= s + "人才影像卡" + pictureInformationUrl.substring(pictureInformationUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(pictureInformationUrl, fileName); - } - - List buyHousesMembers = buyHousesMemberMap.get(r.getId().toString()); - if (buyHousesMembers.size()>0) { + }*/ + //家庭信息 + /* List buyHousesMembers = buyHousesMemberMap.get(r.getId().toString()); + if (ObjectUtil.isNotNull(buyHousesMembers)) { buyHousesMembers.stream().forEach(m -> { - String userNameFile1 = path + separator + m.getName(); - if (ObjectUtil.isNotNull(m.getFrontUrl())) { + System.out.println("m = " + m); +// String userNameFile1 = path + separator + m.getName(); + if (ObjectUtil.isNotEmpty(m.getFrontUrl())) { String frontUrl = m.getFrontUrl(); - String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf("."), frontUrl.length()); + String fileName = s + m.getRelation() + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf("."), frontUrl.length()); MyFileUtils.downLoadPic(frontUrl, fileName); } - if (ObjectUtil.isNotNull(m.getInsidepageUrl())) { + if (ObjectUtil.isNotEmpty(m.getInsidepageUrl())) { String insidepageUrl = m.getInsidepageUrl(); - String fileName = userNameFile1 + separator + m.getRelation() + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf("."), insidepageUrl.length()); + String fileName = s + m.getRelation() + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf(".")); MyFileUtils.downLoadPic(insidepageUrl, fileName); } - if (ObjectUtil.isNotNull(m.getReverseUrl())) { + if (ObjectUtil.isNotEmpty(m.getReverseUrl())) { String reverseUrl = m.getReverseUrl(); - String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + reverseUrl.substring(reverseUrl.lastIndexOf("."), reverseUrl.length()); + String fileName = s + m.getRelation() + "身份证正面" + reverseUrl.substring(reverseUrl.lastIndexOf("."), reverseUrl.length()); MyFileUtils.downLoadPic(reverseUrl, fileName); } - if (ObjectUtil.isNotNull(m.getHomeRecordUrl())) { + if (ObjectUtil.isNotEmpty(m.getHomeRecordUrl())) { String homeRecordUrl = m.getHomeRecordUrl(); - String fileName = userNameFile1 + separator + m.getRelation() + "身份证正面" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf("."), homeRecordUrl.length()); + String fileName = s + m.getRelation() + "身份证正面" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf("."), homeRecordUrl.length()); MyFileUtils.downLoadPic(homeRecordUrl, fileName); } }); - } + }*/ }); String p = path + separator + title + ".xlsx"; String fo = filePath + separator + format + ".zip"; @@ -621,10 +744,13 @@ public class BuyHousesServiceImpl implements IBuyHousesService { //生成后删除文件 DeleteFileUtil.delete(path); String zip = format+".zip"; - String url =download+prefix+zip; + String url =download+prefix+"/"+zip; + System.out.println("url = " + url); SubscribeExport subscribeExport = new SubscribeExport(); subscribeExport.setPath(url); - subscribeExport.setUserId(LoginHelper.getUserId().toString()); + subscribeExport.setProcessKey(event.getProcessKey()); + subscribeExport.setDescription(event.getDescription()); + subscribeExport.setUserId(event.getExcelUserId()); subscribeExportMapper.insert(subscribeExport); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HousesReviewServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HousesReviewServiceImpl.java index 1db5c09c3..fd6504528 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HousesReviewServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HousesReviewServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; @@ -14,8 +15,10 @@ import com.ruoyi.common.utils.file.MyFileUtils; import com.ruoyi.common.utils.poi.DeleteFileUtil; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ZipUtils; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.bo.HousesReviewBo; +import com.ruoyi.system.domain.dto.HousesReviewEvent; import com.ruoyi.system.domain.vo.HousesReviewVo; import com.ruoyi.system.domain.vo.MaterialModuleVo; import com.ruoyi.system.mapper.BuyHousesReviewMemberMapper; @@ -27,6 +30,7 @@ import com.ruoyi.work.domain.vo.ProcessVo; import com.ruoyi.work.utils.WorkComplyUtils; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,7 +52,7 @@ import java.util.stream.Collectors; */ @RequiredArgsConstructor @Service -@Transactional + public class HousesReviewServiceImpl implements IHousesReviewService { private final HousesReviewMapper baseMapper; @@ -139,7 +143,7 @@ public class HousesReviewServiceImpl implements IHousesReviewService { lqw.eq(StringUtils.isNotBlank(bo.getCreditCode()), HousesReview::getCreditCode, bo.getCreditCode()); lqw.eq(StringUtils.isNotBlank(bo.getCompanyAddress()), HousesReview::getCompanyAddress, bo.getCompanyAddress()); lqw.eq(StringUtils.isNotBlank(bo.getSourceBy()), HousesReview::getSourceBy, bo.getSourceBy()); - lqw.eq(StringUtils.isNotBlank(bo.getProcessKey()), HousesReview::getProcessKey, bo.getProcessKey()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()), HousesReview::getProcessStatus, bo.getProcessStatus()); return lqw; } @@ -147,6 +151,7 @@ public class HousesReviewServiceImpl implements IHousesReviewService { * 新增购房复审登记 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean insertByBo(HousesReviewBo bo) { //先判断是否存在数据 HousesReview add = BeanUtil.toBean(bo, HousesReview.class); @@ -170,90 +175,18 @@ public class HousesReviewServiceImpl implements IHousesReviewService { * 修改购房复审登记 */ @Override + @Transactional(rollbackFor = Exception.class) public Boolean updateByBo(HousesReviewBo bo) { - bo.setProcessStatus("wait"); - //先删除存在的关系表 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(BuyHousesReviewMember::getBuyHousesId, bo.getId()); - List buyHousesReviewMembers = buyHousesReviewMemberMapper.selectList(wrapper); - if (ObjectUtil.isNotNull(buyHousesReviewMembers) && buyHousesReviewMembers.size()>0) { - List buyHousesMemberList = bo.getBuyHousesMemberList(); - //先删除minio的图片 - List list = new ArrayList<>(); - if (ObjectUtil.isNotNull(buyHousesMemberList) && buyHousesMemberList.size()>0) { - buyHousesReviewMembers.forEach(e -> { - if (ObjectUtil.isNotNull(e.getFrontUrl())){ - if (!buyHousesMemberList.stream().anyMatch(b -> e.getFrontUrl().equals(b.getFrontUrl()))){ - list.add(new Long(e.getFrontUrl())); - } - } - if (ObjectUtil.isNotNull(e.getInsidepageUrl())) { - if (!buyHousesMemberList.stream().anyMatch(b -> e.getInsidepageUrl().equals(b.getInsidepageUrl()))) { - list.add(new Long(e.getInsidepageUrl())); - } - } - if (ObjectUtil.isNotNull(e.getHomeRecordUrl())) { - if (!buyHousesMemberList.stream().anyMatch(b -> ObjectUtil.isNotNull(e.getHomeRecordUrl()) && e.getHomeRecordUrl().equals(b.getHomeRecordUrl()))) { - list.add(new Long(e.getHomeRecordUrl())); - } - } - if (ObjectUtil.isNotNull(e.getReverseUrl())) { - if (!buyHousesMemberList.stream().anyMatch(b -> ObjectUtil.isNotNull(e.getReverseUrl()) && e.getReverseUrl().equals(b.getReverseUrl()))) { - list.add(new Long(e.getReverseUrl())); - } - } - }); - }else { - List insidepageUrl = buyHousesReviewMembers.stream().filter(s ->ObjectUtil.isNotNull(s.getInsidepageUrl())).map(s -> Long.parseLong(s.getInsidepageUrl())).collect(Collectors.toList()); - if (ObjectUtil.isNotNull(insidepageUrl)&& insidepageUrl.size()>0){ - list.addAll(insidepageUrl); - } - List homeRecordUrl = buyHousesReviewMembers.stream().filter(s ->ObjectUtil.isNotNull(s.getHomeRecordUrl())).map(s -> Long.parseLong(s.getHomeRecordUrl())).collect(Collectors.toList()); - if (ObjectUtil.isNotNull(homeRecordUrl)&& homeRecordUrl.size()>0){ - list.addAll(homeRecordUrl); - } - List reverseUrl = buyHousesReviewMembers.stream().filter(s ->ObjectUtil.isNotNull(s.getReverseUrl())).map(s -> Long.parseLong(s.getReverseUrl())).collect(Collectors.toList()); - if (ObjectUtil.isNotNull(reverseUrl)&& reverseUrl.size()>0){ - list.addAll(reverseUrl); - } - List frontUrl = buyHousesReviewMembers.stream().filter(s ->ObjectUtil.isNotNull(s.getFrontUrl())).map(s -> Long.parseLong(s.getFrontUrl())).collect(Collectors.toList()); - if (ObjectUtil.isNotNull(frontUrl)&& frontUrl.size()>0){ - list.addAll(frontUrl); - } - } - if (list.size()>0){ - sysOssService.deleteWithValidByIds(list,true); - } - List collect = buyHousesReviewMembers.stream().map(BuyHousesReviewMember::getId).collect(Collectors.toList()); - if (collect.size()>0) { - buyHousesReviewMemberMapper.deleteBatchIds(collect); - } - } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(MaterialProof::getHouseId, bo.getId()); - List materialProofs = materialProofMapper.selectList(queryWrapper); - if (ObjectUtil.isNotNull(materialProofs) && materialProofs.size()>0) { - List list = new ArrayList<>(); - List materialsList = bo.getMaterialsList(); - if (ObjectUtil.isNotNull(materialsList) && materialsList.size() > 0){ - materialProofs.forEach(mp ->{ - boolean b = materialsList.stream().anyMatch(e -> ObjectUtil.isNotNull(mp.getFile()) && mp.getFile().equals(e.getFile())); - if (!b){ - Long aLong = new Long(mp.getFile()); - list.add(aLong); - } - }); - }else { - list.addAll(materialProofs.stream().filter(s ->ObjectUtil.isNotNull(s.getFile())).map(s -> Long.parseLong(s.getFile())).collect(Collectors.toList())); - } - if (list.size()>0) { - sysOssService.deleteWithValidByIds(list, true); - } - List collect = materialProofs.stream().map(MaterialProof::getId).collect(Collectors.toList()); - if (collect.size()>0) { - materialProofMapper.deleteBatchIds(collect); - } - } + bo.setProcessStatus(Constants.WAIT); + //先删除存在的家庭情况关系表 + buyHousesReviewMemberMapper.delete( new LambdaQueryWrapper() + .eq(BuyHousesReviewMember::getBuyHousesId, bo.getId())); + + //删除补充材料 + materialProofMapper.delete(new LambdaQueryWrapper() + .eq(MaterialProof::getHouseId, bo.getId()) + .eq(MaterialProof::getProcessKey,"house_review")); + if (ObjectUtil.isNotNull(bo.getBuyHousesMemberList()) && bo.getBuyHousesMemberList().size()>0){ bo.getBuyHousesMemberList().stream().forEach( e ->{ e.setBuyHousesId(bo.getId().toString()); @@ -360,8 +293,10 @@ public class HousesReviewServiceImpl implements IHousesReviewService { * @return */ @Override - public R subscribeExport(HousesReviewBo bo) throws IOException { - export(bo); + public R subscribeExport(HousesReviewEvent bo) throws IOException { + Long userId = LoginHelper.getUserId(); + bo.setExcelUserId(userId.toString()); + SpringUtils.context().publishEvent(bo); return R.ok("预约成功"); } @@ -378,7 +313,9 @@ public class HousesReviewServiceImpl implements IHousesReviewService { } @Async - public void export(HousesReviewBo bo) throws IOException { + @EventListener + public void export(HousesReviewEvent event) throws IOException { + HousesReviewBo bo = BeanUtil.toBean(event, HousesReviewBo.class); LambdaQueryWrapper lqw = buildQueryWrapper(bo); List housesReviews = baseMapper.selectList(lqw); if (housesReviews.size() > 0) { @@ -402,7 +339,6 @@ public class HousesReviewServiceImpl implements IHousesReviewService { String s = userNameFile + separator + r.getName() + "--"; String file = p.getFile(); MyFileUtils.downLoadPic(file, s + p.getDescription() + file.substring(file.lastIndexOf("."))); -// MyFileUtils.writeBytes(file, s + p.getDescription() + file.substring(file.lastIndexOf("."))); System.out.println("file = " + file); }); } @@ -427,9 +363,11 @@ public class HousesReviewServiceImpl implements IHousesReviewService { //生成后删除文件 DeleteFileUtil.delete(path); String zip = format+".zip"; - String url =download+prefix+zip; + String url =download+prefix+"/"+zip; SubscribeExport subscribeExport = new SubscribeExport(); subscribeExport.setPath(url); + subscribeExport.setDescription(event.getDescription()); + subscribeExport.setProcessKey("house_review"); subscribeExport.setUserId(LoginHelper.getUserId().toString()); subscribeExportMapper.insert(subscribeExport); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SubscribeExportServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SubscribeExportServiceImpl.java index b4fc6e36a..993ec0857 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SubscribeExportServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SubscribeExportServiceImpl.java @@ -1,13 +1,16 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.domain.PageQuery; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ruoyi.common.utils.poi.DeleteFileUtil; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import com.ruoyi.system.domain.bo.SubscribeExportBo; import com.ruoyi.system.domain.vo.SubscribeExportVo; @@ -31,6 +34,16 @@ public class SubscribeExportServiceImpl implements ISubscribeExportService { private final SubscribeExportMapper baseMapper; + + @Value("${file.path}") + private String filePath; + + @Value("${file.domain}") + private String download; + + @Value("${file.prefix}") + private String prefix; + /** * 查询预约导出 */ @@ -44,6 +57,7 @@ public class SubscribeExportServiceImpl implements ISubscribeExportService { */ @Override public TableDataInfo queryPageList(SubscribeExportBo bo, PageQuery pageQuery) { + bo.setUserId(LoginHelper.getUserId().toString()); LambdaQueryWrapper lqw = buildQueryWrapper(bo); Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); return TableDataInfo.build(result); @@ -63,6 +77,7 @@ public class SubscribeExportServiceImpl implements ISubscribeExportService { LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.eq(StringUtils.isNotBlank(bo.getPath()), SubscribeExport::getPath, bo.getPath()); lqw.eq(StringUtils.isNotBlank(bo.getUserId()), SubscribeExport::getUserId, bo.getUserId()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessKey()), SubscribeExport::getProcessKey, bo.getProcessKey()); return lqw; } @@ -104,6 +119,13 @@ public class SubscribeExportServiceImpl implements ISubscribeExportService { public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 + //删除服务器本地得资源 + List subscribeExports = baseMapper.selectBatchIds(ids); + String path = subscribeExports.get(0).getPath(); + //将地址转为路径 + String replace = path.replace(download+prefix, filePath); + System.out.println("replace = " + replace); + DeleteFileUtil.delete(replace); } return baseMapper.deleteBatchIds(ids) > 0; } diff --git a/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml index a92f40b03..7398ad815 100644 --- a/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml @@ -16,9 +16,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +