diff --git a/README.md b/README.md index 7f3782076..84badc534 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ ### 其他 + * 同步升级 RuoYi-Vue * GitHub 地址 [RuoYi-Vue-Plus-github](https://github.com/dromara/RuoYi-Vue-Plus) * 单模块 分支 [RuoYi-Vue-Plus-fast](https://gitee.com/dromara/RuoYi-Vue-Plus/tree/fast/) diff --git a/pom.xml b/pom.xml index 9184209d5..41712829b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ 1.72 2.7.0 + 1.4 1.33 @@ -118,6 +119,12 @@ lombok ${lombok.version} + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + org.apache.poi @@ -324,6 +331,12 @@ ${ruoyi-vue-plus.version} + + org.apache.commons + commons-text + 1.9 + + com.ruoyi @@ -331,6 +344,68 @@ ${ruoyi-vue-plus.version} + + + com.ruoyi + ruoyi-work + ${ruoyi-vue-plus.version} + + + + + com.ruoyi + ruoyi-file + ${ruoyi-vue-plus.version} + + + + + com.ruoyi + ruoyi-rabbitmq + ${ruoyi-vue-plus.version} + + + org.springframework.boot + spring-boot-starter-amqp + 2.7.9 + + + + + + + + + + + + io.vertx + vertx-core + 4.2.3 + + @@ -345,6 +420,11 @@ ruoyi-extend ruoyi-oss ruoyi-sms + ruoyi-work + ruoyi-file + ruoyi-rabbitmq + + pom diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 2d70db620..0541c2c16 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -78,12 +78,29 @@ ruoyi-demo + + com.ruoyi + ruoyi-work + + org.springframework.boot spring-boot-starter-test test + + com.ruoyi + ruoyi-file + + + + + + @@ -95,6 +112,11 @@ + + io.vertx + vertx-core + 4.2.3 + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index b52d32d6e..7c4156d5f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -19,6 +19,7 @@ public class RuoYiApplication { application.setApplicationStartup(new BufferingApplicationStartup(2048)); application.run(args); System.out.println("(♥◠‿◠)ノ゙ RuoYi-Vue-Plus启动成功 ლ(´ڡ`ლ)゙"); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 604b5dfa1..8f4c88dee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -4,11 +4,18 @@ import cn.dev33.satoken.annotation.SaIgnore; import cn.hutool.captcha.AbstractCaptcha; import cn.hutool.captcha.generator.CodeGenerator; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.annotation.RateLimiter; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.CaptchaType; +import com.ruoyi.common.enums.LimitType; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.user.UserException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.email.MailUtils; import com.ruoyi.common.utils.redis.RedisUtils; @@ -16,13 +23,12 @@ import com.ruoyi.common.utils.reflect.ReflectUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.config.properties.CaptchaProperties; import com.ruoyi.framework.config.properties.MailProperties; +import com.ruoyi.sms.core.TelecomSendMsg; +import com.ruoyi.sms.entity.SmsResult; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.ISysConfigService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.dromara.sms4j.api.SmsBlend; -import org.dromara.sms4j.api.entity.SmsResponse; -import org.dromara.sms4j.core.factory.SmsFactory; -import org.dromara.sms4j.provider.enumerate.SupplierType; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; @@ -33,7 +39,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.validation.constraints.NotBlank; import java.time.Duration; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.Map; /** @@ -51,28 +56,37 @@ public class CaptchaController { private final CaptchaProperties captchaProperties; private final ISysConfigService configService; private final MailProperties mailProperties; + private final SysUserMapper sysUserMapper; /** * 短信验证码 * - * @param phonenumber 用户手机号 + * @param username 用户手机号 */ @GetMapping("/captchaSms") - public R smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") String phonenumber) { - String key = CacheConstants.CAPTCHA_CODE_KEY + phonenumber; - String code = RandomUtil.randomNumbers(4); - RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); - // 验证码模板id 自行处理 (查数据库或写死均可) - String templateId = ""; - LinkedHashMap map = new LinkedHashMap<>(1); - map.put("code", code); - SmsBlend smsBlend = SmsFactory.createSmsBlend(SupplierType.ALIBABA); - SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, templateId, map); - if (!"OK".equals(smsResponse.getCode())) { - log.error("验证码短信发送异常 => {}", smsResponse); - return R.fail(smsResponse.getMessage()); + public R smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") String username) { + //判断系统中是否存在该人才 + SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper() + .select(SysUser::getPhonenumber, SysUser::getStatus) + .eq(SysUser::getPhonenumber, username)); + if (ObjectUtil.isNull(user)) { + log.info("登录用户:{} 不存在.", username); + throw new UserException("user.not.exists", username); + } else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { + log.info("登录用户:{} 已被停用.", username); + throw new UserException("user.blocked", username); } - return R.ok(); + String key = CacheConstants.CAPTCHA_CODE_KEY + username; + String code = RandomUtil.randomNumbers(6); + System.out.println("code = " + code); + RedisUtils.setCacheObject(key, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); + TelecomSendMsg smsTemplate = SpringUtils.getBean(TelecomSendMsg.class); + SmsResult result = smsTemplate.telecomSendCode(username, code, "login"); + if (!result.isSuccess()) { + log.error("验证码短信发送异常 => {}", result); + return R.fail(result.getMessage()); + } + return R.ok("发送成功"); } /** 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 new file mode 100644 index 000000000..f0cb8cf2d --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SysFileController.java @@ -0,0 +1,50 @@ +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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.Map; + +/** + * 文件请求处理 + * + * @author ruoyi*/ + + +@RestController +public class SysFileController +{ + private static final Logger log = LoggerFactory.getLogger(SysFileController.class); + + @Autowired + private ISysFileService sysFileService; + + /*文件上传请求*/ + + + @PostMapping("upload") + public R upload(MultipartFile file) + { + try{ + // 上传并返回访问地址 + String url = sysFileService.uploadFile(file); + Map map = new HashMap<>(2); + map.put("url", url); + map.put("fileName", FileUtils.getName(url)); + return R.ok(map); + } + catch (Exception e) + { + log.error("上传文件失败", e); + return R.fail(e.getMessage()); + } + } +} 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 new file mode 100644 index 000000000..fe29f3ef7 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/BuyHousesController.java @@ -0,0 +1,189 @@ +package com.ruoyi.web.controller.house; + +import java.io.IOException; +import java.text.ParseException; +import java.util.List; +import java.util.Arrays; + +import com.ruoyi.common.constant.Constants; +import com.ruoyi.system.domain.BuyHouses; +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.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.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.BuyHousesVo; +import com.ruoyi.system.domain.bo.BuyHousesBo; +import com.ruoyi.system.service.IBuyHousesService; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 一期后台接口 + * + * @author ruoyi + * @date 2023-03-27 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/system/house") +public class BuyHousesController extends BaseController { + + private final IBuyHousesService iBuyHousesService; + + /** + * 一期后台接口查询列表 + */ + @SaCheckPermission("system:houses:list") + @Log(title = "获取数据库一期数据", businessType = BusinessType.OTHER) + @GetMapping("/list") + public TableDataInfo list(BuyHousesBo bo, PageQuery pageQuery) { + return iBuyHousesService.queryPageList(bo, pageQuery); + } + + /** + * 预约导出 + * @param bo + * @return + * @throws IOException + */ + @SaCheckPermission("system:houses:subscribeExport") + @PostMapping("/subscribeExport") + public R subscribeExport(@RequestBody BuyHousesEvent bo) throws IOException { + return iBuyHousesService.subscribeExport(bo); + } + /** + * 导出excel + */ + @SaCheckPermission("system:houses:exportExcel") + @PostMapping("/exportExcel") + public void exportExcel(BuyHousesBo bo,HttpServletResponse response){ + iBuyHousesService.exportExcel(bo,response); + } + + /** + * 一期导出列表 + */ + @SaCheckPermission("system:houses:export") + @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) + @PostMapping("一期导出列表") + public void export(BuyHousesBo bo, HttpServletResponse response) { + List list = iBuyHousesService.queryList(bo); + ExcelUtil.exportExcel(list, "一期导出列表", BuyHousesVo.class, response); + } + + /** + * 获取详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("system:houses:query") + @GetMapping + public R getInfo(Long id) { + return R.ok(iBuyHousesService.queryById(id)); + } + + + /** + * 删除【请填写功能名称】 + * + * @param ids 主键串 + */ + @SaCheckPermission("system:houses:remove") + @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) + @DeleteMapping + public R remove(@NotEmpty(message = "主键不能为空")Long[] ids) { + return toAjax(iBuyHousesService.deleteWithValidByIds(Arrays.asList(ids), true)); + } + + /** + * 获取申报材料 + */ + @Log(title = "获取申报材料",businessType = BusinessType.OTHER) + @PostMapping("/review/material") + public R getMaterialInfo(@RequestBody BuyHousesBo bo){ + return iBuyHousesService.getMaterialInfo(bo); + } + + + /** + * 取消资格 + * @param buyHouses + * @return + */ + @SaCheckPermission("system:houses:edit") + @PutMapping + public RupdateBuyHouses(@RequestBody BuyHouses buyHouses){ + return iBuyHousesService.updateBuyHouses(buyHouses); + } + + /** + * 首页购房申请表展示 + */ +// @SaCheckPermission("system:houses:indexType") + @GetMapping("/indexType") + public RgetIndexType(){ + return iBuyHousesService.getIndexType(); + } + + /** + * 首页企业所在地展示 + */ +// @SaCheckPermission("system:houses:companyDistrict") + @GetMapping("/companyDistrict") + public RgetCompanyDistrict(){ + return iBuyHousesService.getCompanyDistrict(); + } + /** + * 首页国籍和婚姻状态展示 + */ +// @SaCheckPermission("system:houses:nationalityAndMarital") + @GetMapping("/nationalityAndMarital") + public RgetNationalityAndMarital(){ + return iBuyHousesService.getNationalityAndMarital(); + } + + /** + * 首页第一排基础数据 + */ +// @SaCheckPermission("system:houses:basicData") + @GetMapping("/basicData") + public R getBasicData(){ + return iBuyHousesService.getBasicData(); + } + + /** + * 复审柱状图 + */ +// @SaCheckPermission("system:houses:histogram") + @GetMapping("/histogram") + public R getHistogram(String date){ + return iBuyHousesService.getHistogram(date); + } + + /** + * 对市局系统单独推送 + */ + @GetMapping("/push") + public R push(String id) throws ParseException { + return iBuyHousesService.push(id); + } + + /** + * + * @param id + * @return + */ + @GetMapping("/out") + public R logout(String id){ + return iBuyHousesService.logout(id); + } +} 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 new file mode 100644 index 000000000..5af851c86 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/house/HousesReviewController.java @@ -0,0 +1,253 @@ +package com.ruoyi.web.controller.house; +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.core.bean.BeanUtil; +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; +import com.ruoyi.common.core.page.TableDataInfo; +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.exception.ServiceException; +import com.ruoyi.common.helper.LoginHelper; +import com.ruoyi.common.utils.DateUtils; +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; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 购房复审登记 + * + * @author ruoyi + * @date 2023-03-08 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/house") +public class HousesReviewController extends BaseController { + + private final IHousesReviewService iHousesReviewService; + private final BuyHousesMapper buyHousesMapper; + + + /** + * 购房登记录入列表 + * @param bo + * @param pageQuery + * @return + */ + @SaCheckPermission("system:review:reviewList") + @GetMapping("/review/list") + public TableDataInfo reviewList(HousesReviewBo bo, PageQuery pageQuery) { + return iHousesReviewService.queryPageList(bo, pageQuery); + } + + + /** + * 购房登记录入管理列表 + * @param bo + * @param pageQuery + * @return + */ + @SaCheckPermission("system:manager:reviewList") + @GetMapping("/manager/list") + public TableDataInfo managerReviewList(HousesReviewBo bo, PageQuery pageQuery) { + return iHousesReviewService.managerQueryPageList(bo, pageQuery); + } + + /** + * 预约导出 + * @param bo + * @return + * @throws IOException + */ + @SaCheckPermission("system:houses:subscribeExport") + @PostMapping("/subscribeExport") + public R subscribeExport(@RequestBody HousesReviewEvent bo) throws IOException { + return iHousesReviewService.subscribeExport(bo); + } + + /** + * 导出excel + */ + @SaCheckPermission("system:houses:exportExcel") + @PostMapping("/exportExcel") + public void exportExcel(HousesReviewBo bo,HttpServletResponse response){ + iHousesReviewService.exportExcel(bo,response); + } + + /** + * 查询购房复审登记列表 + */ + @SaCheckPermission("system:review:list") + @GetMapping("/registrationManagement/list") + public TableDataInfo list(HousesReviewBo bo, PageQuery pageQuery) { + boolean admin = LoginHelper.isAdmin(); + if (!admin){ + bo.setProjectName(LoginHelper.getLoginUser().getProperties()); + } + return iHousesReviewService.queryPageList(bo, pageQuery); + } + + /** + * 导出购房复审登记列表 + */ + @SaCheckPermission("system:review:export") + @Log(title = "购房复审登记", businessType = BusinessType.EXPORT) + @PostMapping("/registrationManagement/export") + public void export(HousesReviewBo bo, HttpServletResponse response) { + List list = iHousesReviewService.queryList(bo); + ExcelUtil.exportExcel(list, "购房复审登记", HousesReviewVo.class, response); + } + + /** + * 获取购房复审登记详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("system:review:edit") + @GetMapping("/registrationManagement") + public R getInfo(Long id) { + return R.ok(iHousesReviewService.queryById(id)); + } + + /** + * 新增购房复审登记 + */ + @SaCheckPermission("system:review:add") + @Log(title = "购房复审登记", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping("/registrationManagement") + public R add(@Validated(AddGroup.class) @RequestBody HousesReviewBo bo) { + return toAjax(iHousesReviewService.insertByBo(bo)); + } + + /** + * 修改购房复审登记 + */ + @SaCheckPermission("system:review:edit") + @Log(title = "购房复审登记", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/registrationManagement") + public R edit(@Validated(EditGroup.class) @RequestBody HousesReviewBo bo) { + return toAjax(iHousesReviewService.updateByBo(bo)); + } + + /** + * 删除购房复审登记 + * @param ids 主键串 + */ + @SaCheckPermission("system:review:remove") + @Log(title = "购房复审登记", businessType = BusinessType.DELETE) + @DeleteMapping("/review") + public R remove(Long[] ids) { + return toAjax(iHousesReviewService.deleteWithValidByIds(Arrays.asList(ids), true)); + } + + /** + * 导入 + * @param file + * @return + * @throws Exception + */ + @Log(title = "购房复审导入", businessType = BusinessType.IMPORT) + @SaCheckPermission("system:review:import") + @PostMapping(value = "/review/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public R importData(@RequestPart("file") MultipartFile file) throws Exception { + ExcelResult result = ExcelUtil.importExcel(file.getInputStream(), HousesReviewVo.class, true,3); + List volist = result.getList(); + //判断时间格式是否正确 + volist.stream().forEach(v ->{ + if (!DateUtils.checkDate(v.getQualificationConfirmTime(),DateUtils.YYYY_MM_DD_HH_MM_SS)){ + throw new ServiceException("资格确认时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD_HH_MM_SS); + } + if (!DateUtils.checkDate(v.getAuditTime(),DateUtils.YYYY_MM_DD)){ + throw new ServiceException("审核时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD); + } + if (!DateUtils.checkDate(v.getRegisterFailureTime(),DateUtils.YYYY_MM_DD)){ + throw new ServiceException("登记失效时间格式不正确,格式为:"+DateUtils.YYYY_MM_DD); + } + }); + + List list = BeanUtil.copyToList(volist, HousesReview.class); + //先获取到导入数据的身份证去购房一期数据库去查 + //过滤出导入表中的身份证号码 + List collect = list.stream() + .filter( e ->ObjectUtil.isNotEmpty(e.getCard())) + .map(HousesReview::getCard) + .collect(Collectors.toList()); + if (collect.size()>0 && list.size()>0) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .in(BuyHouses::getCardId, collect) + .eq(BuyHouses::getProcessStatus,Constants.SUCCEED); + //查询出导入数据中的身份证有那些是属于区级人才的 + List collect1 = buyHousesMapper.selectList(queryWrapper) + .stream() + .map(BuyHouses::getCardId) + .collect(Collectors.toList()); + for (HousesReview housesReview : list) { + housesReview.setProcessKey("house_review"); + housesReview.setProcessStatus(Constants.SUBMIT); + if ( collect1.size() > 0 && collect1.contains(housesReview.getCard()) ) { + housesReview.setSourceBy("1"); + } else { + housesReview.setSourceBy("2"); + } + } + } + iHousesReviewService.saveBatch(list); + return R.ok(result.getAnalysis()); + } + + /** + * 获取导入模板 + */ + @Log(title = "获取导入模板", businessType = BusinessType.IMPORT) + @PostMapping("/review/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", HousesReviewVo.class, response); + } + + /** + * 获取申报材料 + */ + @Log(title = "获取申报材料",businessType = BusinessType.OTHER) + @PostMapping("/review/material") + public R getMaterialInfo(@RequestBody HousesReviewBo bo){ + return iHousesReviewService.getMaterialInfo(bo); + } + + /** + * 获取审核材料 + */ + @Log(title = "审核时返回当前人材料",businessType = BusinessType.OTHER) + @GetMapping("/getMaterial") + public R getMaterialByBusinessId(Long id){ + return iHousesReviewService.getMaterialByBusinessId(id); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialModuleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialModuleController.java new file mode 100644 index 000000000..7470e3e62 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialModuleController.java @@ -0,0 +1,111 @@ +package com.ruoyi.web.controller.material; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +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.page.TableDataInfo; +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.bo.MaterialModuleBo; +import com.ruoyi.system.domain.vo.MaterialModuleVo; +import com.ruoyi.system.service.IMaterialModuleService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * 材料模块 + * + * @author ruoyi + * @date 2023-03-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/material/module") +public class MaterialModuleController extends BaseController { + + private final IMaterialModuleService iMaterialModuleService; + + /** + * 查询材料模块列表 + */ + @SaCheckPermission("material:module:list") + @GetMapping("/list") + public TableDataInfo list(MaterialModuleBo bo, PageQuery pageQuery) { + return iMaterialModuleService.queryPageList(bo, pageQuery); + } + + @SaCheckPermission("material:materialList:list") + @GetMapping("/materialList") + public R materialList(MaterialModuleBo bo) { + return iMaterialModuleService.selectMaterialList(bo); + } + + /** + * 导出材料模块列表 + */ + @SaCheckPermission("material:module:export") + @Log(title = "材料模块", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(MaterialModuleBo bo, HttpServletResponse response) { + List list = iMaterialModuleService.queryList(bo); + ExcelUtil.exportExcel(list, "材料模块", MaterialModuleVo.class, response); + } + + /** + * 获取材料模块详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("material:module:query") + @GetMapping + public R getInfo(Long id) { + return R.ok(iMaterialModuleService.queryById(id)); + } + + /** + * 新增材料模块 + */ + @SaCheckPermission("material:module:add") + @Log(title = "材料模块", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody MaterialModuleBo bo) { + return toAjax(iMaterialModuleService.insertByBo(bo)); + } + + /** + * 修改材料模块 + */ + @SaCheckPermission("material:module:edit") + @Log(title = "材料模块", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody MaterialModuleBo bo) { + return toAjax(iMaterialModuleService.updateByBo(bo)); + } + + /** + * 删除材料模块 + * + * @param ids 主键串 + */ + @SaCheckPermission("material:module:remove") + @Log(title = "材料模块", businessType = BusinessType.DELETE) + @DeleteMapping + public R remove(Long[] ids) { + return toAjax(iMaterialModuleService.deleteWithValidByIds(Arrays.asList(ids), true)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialTalentsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialTalentsController.java new file mode 100644 index 000000000..486cabe24 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/material/MaterialTalentsController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.material; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +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.bo.MaterialTalentsBo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; +import com.ruoyi.system.service.IMaterialTalentsService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.Arrays; +import java.util.List; + +/** + * 材料关系 + * + * @author ruoyi + * @date 2023-03-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/material/talents") +public class MaterialTalentsController extends BaseController { + + private final IMaterialTalentsService iMaterialTalentsService; + + /** + * 查询材料关系列表 + */ + @SaCheckPermission("material:talents:list") + @GetMapping("/list") + public R> list(MaterialTalentsBo bo) { + List list = iMaterialTalentsService.queryList(bo); + return R.ok(list); + } + + /** + * 导出材料关系列表 + */ + @SaCheckPermission("material:talents:export") + @Log(title = "材料关系", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(MaterialTalentsBo bo, HttpServletResponse response) { + List list = iMaterialTalentsService.queryList(bo); + ExcelUtil.exportExcel(list, "材料关系", MaterialTalentsVo.class, response); + } + + /** + * 获取材料关系详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("material:talents:query") + @GetMapping + public R getInfo(Long id) { + return R.ok(iMaterialTalentsService.queryById(id)); + } + + /** + * 新增材料关系 + */ + @SaCheckPermission("material:talents:add") + @Log(title = "材料关系", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody MaterialTalentsBo bo) { + return toAjax(iMaterialTalentsService.insertByBo(bo)); + } + + /** + * 修改材料关系 + */ + @SaCheckPermission("material:talents:edit") + @Log(title = "材料关系", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody MaterialTalentsBo bo) { + return toAjax(iMaterialTalentsService.updateByBo(bo)); + } + + /** + * 删除材料关系 + * + * @param ids 主键串 + */ + @SaCheckPermission("material:talents:remove") + @Log(title = "材料关系", businessType = BusinessType.DELETE) + @DeleteMapping + public R remove(Long[] ids) { + return toAjax(iMaterialTalentsService.deleteWithValidByIds(Arrays.asList(ids), true)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/RsaSecurityController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/RsaSecurityController.java new file mode 100644 index 000000000..3b61924ca --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/RsaSecurityController.java @@ -0,0 +1,108 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +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.core.validate.QueryGroup; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.RsaSecurityVo; +import com.ruoyi.system.domain.bo.RsaSecurityBo; +import com.ruoyi.system.service.IRsaSecurityService; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 请求RSA数据加解密 + * + * @author ruoyi + * @date 2023-05-17 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/system/security") +public class RsaSecurityController extends BaseController { + + private final IRsaSecurityService iRsaSecurityService; + + /** + * 查询请求RSA数据加解密列表 + */ + @SaCheckPermission("system:security:list") + @GetMapping("/list") + public TableDataInfo list(RsaSecurityBo bo, PageQuery pageQuery) { + return iRsaSecurityService.queryPageList(bo, pageQuery); + } + + /** + * 导出请求RSA数据加解密列表 + */ + @SaCheckPermission("system:security:export") + @Log(title = "请求RSA数据加解密", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(RsaSecurityBo bo, HttpServletResponse response) { + List list = iRsaSecurityService.queryList(bo); + ExcelUtil.exportExcel(list, "请求RSA数据加解密", RsaSecurityVo.class, response); + } + + /** + * 获取请求RSA数据加解密详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("system:security:query") + @GetMapping + public R getInfo(Long id) { + return R.ok(iRsaSecurityService.queryById(id)); + } + + /** + * 新增请求RSA数据加解密 + */ + @SaCheckPermission("system:security:add") + @Log(title = "请求RSA数据加解密", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody RsaSecurityBo bo) { + iRsaSecurityService.insertByBo(bo); + return toAjax(1); + } + + /** + * 修改请求RSA数据加解密 + */ + @SaCheckPermission("system:security:edit") + @Log(title = "请求RSA数据加解密", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody RsaSecurityBo bo) { + iRsaSecurityService.updateByBo(bo); + return toAjax(1); + } + + /** + * 删除请求RSA数据加解密 + * + * @param ids 主键串 + */ + @SaCheckPermission("system:security:remove") + @Log(title = "请求RSA数据加解密", businessType = BusinessType.DELETE) + @DeleteMapping + public R remove(Long[] ids) { + return toAjax(iRsaSecurityService.deleteWithValidByIds(Arrays.asList(ids), true)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SubscribeExportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SubscribeExportController.java new file mode 100644 index 000000000..5ee97cc7e --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SubscribeExportController.java @@ -0,0 +1,106 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; + +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.core.validate.QueryGroup; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.SubscribeExportVo; +import com.ruoyi.system.domain.bo.SubscribeExportBo; +import com.ruoyi.system.service.ISubscribeExportService; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 预约导出 + * + * @author ruoyi + * @date 2023-04-20 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/system/export") +public class SubscribeExportController extends BaseController { + + private final ISubscribeExportService iSubscribeExportService; + + /** + * 查询预约导出列表 + */ + @SaCheckPermission("system:export:list") + @GetMapping("/list") + public TableDataInfo list(SubscribeExportBo bo, PageQuery pageQuery) { + return iSubscribeExportService.queryPageList(bo, pageQuery); + } + + /** + * 导出预约导出列表 + */ + @SaCheckPermission("system:export:export") + @Log(title = "预约导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(SubscribeExportBo bo, HttpServletResponse response) { + List list = iSubscribeExportService.queryList(bo); + ExcelUtil.exportExcel(list, "预约导出", SubscribeExportVo.class, response); + } + + /** + * 获取预约导出详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("system:export:query") + @GetMapping + public R getInfo(Long id) { + return R.ok(iSubscribeExportService.queryById(id)); + } + + /** + * 新增预约导出 + */ + @SaCheckPermission("system:export:add") + @Log(title = "预约导出", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody SubscribeExportBo bo) { + return toAjax(iSubscribeExportService.insertByBo(bo)); + } + + /** + * 修改预约导出 + */ + @SaCheckPermission("system:export:edit") + @Log(title = "预约导出", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody SubscribeExportBo bo) { + return toAjax(iSubscribeExportService.updateByBo(bo)); + } + + /** + * 删除预约导出 + * + * @param ids 主键串 + */ + @SaCheckPermission("system:export:remove") + @Log(title = "预约导出", businessType = BusinessType.DELETE) + @DeleteMapping + public R remove(Long[] ids) { + return toAjax(iSubscribeExportService.deleteWithValidByIds(Arrays.asList(ids), true)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index f5cb2a5ee..76f0ca914 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -2,7 +2,6 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -14,7 +13,6 @@ import com.ruoyi.system.service.ISysConfigService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -57,8 +55,8 @@ public class SysConfigController extends BaseController { * @param configId 参数ID */ @SaCheckPermission("system:config:query") - @GetMapping(value = "/{configId}") - public R getInfo(@PathVariable Long configId) { + @GetMapping + public R getInfo(Long configId) { return R.ok(configService.selectConfigById(configId)); } @@ -67,8 +65,8 @@ public class SysConfigController extends BaseController { * * @param configKey 参数Key */ - @GetMapping(value = "/configKey/{configKey}") - public R getConfigKey(@PathVariable String configKey) { + @GetMapping(value = "/configKey") + public R getConfigKey(String configKey) { return R.ok(configService.selectConfigByKey(configKey)); } @@ -118,8 +116,8 @@ public class SysConfigController extends BaseController { */ @SaCheckPermission("system:config:remove") @Log(title = "参数管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{configIds}") - public R remove(@PathVariable Long[] configIds) { + @DeleteMapping + public R remove(Long[] configIds) { configService.deleteConfigByIds(configIds); return R.ok(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 512c644c4..fa72b9fdb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -45,8 +45,8 @@ public class SysDeptController extends BaseController { * @param deptId 部门ID */ @SaCheckPermission("system:dept:list") - @GetMapping("/list/exclude/{deptId}") - public R> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { + @GetMapping("/list/exclude") + public R> excludeChild(Long deptId) { List depts = deptService.selectDeptList(new SysDept()); depts.removeIf(d -> d.getDeptId().equals(deptId) || StringUtils.splitList(d.getAncestors()).contains(Convert.toStr(deptId))); @@ -59,8 +59,8 @@ public class SysDeptController extends BaseController { * @param deptId 部门ID */ @SaCheckPermission("system:dept:query") - @GetMapping(value = "/{deptId}") - public R getInfo(@PathVariable Long deptId) { + @GetMapping + public R getInfo(Long deptId) { deptService.checkDeptDataScope(deptId); return R.ok(deptService.selectDeptById(deptId)); } @@ -105,8 +105,8 @@ public class SysDeptController extends BaseController { */ @SaCheckPermission("system:dept:remove") @Log(title = "部门管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{deptId}") - public R remove(@PathVariable Long deptId) { + @DeleteMapping + public R remove(Long deptId) { if (deptService.hasChildByDeptId(deptId)) { return R.warn("存在下级部门,不允许删除"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index 01613db8b..8bddd2c7e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -60,8 +60,8 @@ public class SysDictDataController extends BaseController { * @param dictCode 字典code */ @SaCheckPermission("system:dict:query") - @GetMapping(value = "/{dictCode}") - public R getInfo(@PathVariable Long dictCode) { + @GetMapping + public R getInfo(Long dictCode) { return R.ok(dictDataService.selectDictDataById(dictCode)); } @@ -70,8 +70,8 @@ public class SysDictDataController extends BaseController { * * @param dictType 字典类型 */ - @GetMapping(value = "/type/{dictType}") - public R> dictType(@PathVariable String dictType) { + @GetMapping(value = "/type") + public R> dictType(String dictType) { List data = dictTypeService.selectDictDataByType(dictType); if (ObjectUtil.isNull(data)) { data = new ArrayList<>(); @@ -108,8 +108,8 @@ public class SysDictDataController extends BaseController { */ @SaCheckPermission("system:dict:remove") @Log(title = "字典类型", businessType = BusinessType.DELETE) - @DeleteMapping("/{dictCodes}") - public R remove(@PathVariable Long[] dictCodes) { + @DeleteMapping + public R remove(Long[] dictCodes) { dictDataService.deleteDictDataByIds(dictCodes); return R.ok(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index e6beb64ab..350c06980 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -2,7 +2,6 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -14,7 +13,6 @@ import com.ruoyi.system.service.ISysDictTypeService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -57,8 +55,8 @@ public class SysDictTypeController extends BaseController { * @param dictId 字典ID */ @SaCheckPermission("system:dict:query") - @GetMapping(value = "/{dictId}") - public R getInfo(@PathVariable Long dictId) { + @GetMapping + public R getInfo(Long dictId) { return R.ok(dictTypeService.selectDictTypeById(dictId)); } @@ -97,8 +95,8 @@ public class SysDictTypeController extends BaseController { */ @SaCheckPermission("system:dict:remove") @Log(title = "字典类型", businessType = BusinessType.DELETE) - @DeleteMapping("/{dictIds}") - public R remove(@PathVariable Long[] dictIds) { + @DeleteMapping + public R remove(Long[] dictIds) { dictTypeService.deleteDictTypeByIds(dictIds); return R.ok(); } 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 f982a5fac..c90bb4c27 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 @@ -1,6 +1,8 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaIgnore; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.entity.SysMenu; @@ -10,18 +12,20 @@ import com.ruoyi.common.core.domain.model.LoginBody; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.SmsLoginBody; import com.ruoyi.common.helper.LoginHelper; +import com.ruoyi.common.utils.StrUtils; +import com.ruoyi.common.utils.redis.RedisUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.sms.core.TelecomSendMsg; +import com.ruoyi.sms.entity.SmsResult; import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.SysLoginService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - +import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotBlank; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -40,6 +44,7 @@ public class SysLoginController { private final ISysMenuService menuService; private final ISysUserService userService; + /** * 登录方法 * @@ -48,7 +53,9 @@ public class SysLoginController { */ @SaIgnore @PostMapping("/login") - public R> login(@Validated @RequestBody LoginBody loginBody) { + public R> login( +// @Validated({LoginBody.passwordLogin.class}) + @RequestBody LoginBody loginBody) { Map ajax = new HashMap<>(); // 生成令牌 String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), @@ -57,6 +64,7 @@ public class SysLoginController { return R.ok(ajax); } + /** * 短信登录 * @@ -65,10 +73,12 @@ public class SysLoginController { */ @SaIgnore @PostMapping("/smsLogin") - public R> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) { + public R> smsLogin( + @Validated({LoginBody.smgLogin.class}) + @RequestBody SmsLoginBody smsLoginBody) { Map ajax = new HashMap<>(); // 生成令牌 - String token = loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode()); + String token = loginService.smsLogin(smsLoginBody.getUsername(), smsLoginBody.getVerificationCode()); ajax.put(Constants.TOKEN, token); return R.ok(ajax); } @@ -116,7 +126,6 @@ public class SysLoginController { /** * 获取用户信息 - * * @return 用户信息 */ @GetMapping("getInfo") @@ -141,4 +150,139 @@ public class SysLoginController { List menus = menuService.selectMenuTreeByUserId(userId); return R.ok(menuService.buildMenus(menus)); } + +//----------------------------------------------------客户端------------------------------------------------------------- + /** + * 登录方法 + * @param loginBody 登录信息 + * @return 结果 + */ + @SaIgnore + @RateLimiter(count = 2, time = 10) + @PostMapping("/userLogin") + public R userLogin( + @Validated({LoginBody.passwordLogin.class}) + @RequestBody LoginBody loginBody) { + // 生成令牌 + return R.ok("登录成功",loginService.userLogin(loginBody.getUsername(), loginBody.getPassword())); + + } + + /** + * 手机号登录 + * @param loginBody + * @return + */ + @SaIgnore +// @RateLimiter(count = 2, time = 10) + @PostMapping("/userSmsLogin") + public R> userSmsLogin(@Validated(LoginBody.smgLogin.class) @RequestBody LoginBody loginBody) { + Map ajax = new HashMap<>(); + // 生成令牌 + String token = loginService.userSmsLogin(loginBody.getUsername(), loginBody.getCode()); + ajax.put(Constants.TOKEN, token); + return R.ok(ajax); + } + + /** + * 客户端忘记密码修改 + * @param loginBody + * @return + */ + @SaIgnore + @RateLimiter(count = 1, time = 10) + @PostMapping("/userUpdatePwd") + public R userUpdatePwd(@Validated(LoginBody.forgetPasswordLogin.class) @RequestBody LoginBody loginBody) { + return loginService.userUpdatePwd(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode()); + } + + /** + * 用户注册 + * @param loginBody + * @return + */ + @SaIgnore + @RateLimiter(count = 1, time = 10) + @PostMapping("/userRegister") + public R userRegister(@Validated(LoginBody.registerUser.class) @RequestBody LoginBody loginBody) { + return loginService.userRegister(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode()); + } + + + /** + * 忘记密码发送短信Aliyun + * @param phones 电话号 + */ +// @RateLimiter(count = 1) + @SaIgnore + @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}$"); + if (!matches) { + return R.fail("手机号格式不正确"); + } + return sendMsg(phones,CacheConstants.RORGOT_PASSWORD_SEND_MSG+phones,"forgetPwd"); + } + + /** + * 注册用户发送验证码 + * @param phones + * @return + */ +// @RateLimiter(count = 1,time = 20) + @SaIgnore + @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}$"); + if (!matches) { + return R.fail("手机号格式不正确"); + } + return sendMsg(phones,CacheConstants.REGISTER_SEND_MSG+phones,"register"); + } + + /** + * 短信登录发送验证码 + * @param phones + * @return + */ +// @RateLimiter(count = 1,time = 20) + @SaIgnore + @GetMapping("/smsLoginSendAliYun") + 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) { + return R.fail("手机号格式不正确"); + } + return sendMsg(phones,CacheConstants.SMS_LOGIN_SEND_MSG+phones,"login"); + } + + public R sendMsg(String phones,String key ,String type){ + //1.获取redis中是否存在该key + Boolean aBoolean = RedisUtils.hasKey(key + phones); + if (aBoolean) { + return R.fail("当前账号验证码已发送,2分钟内有效,请勿再次点击"); + } else { + TelecomSendMsg smsTemplate = SpringUtils.getBean(TelecomSendMsg.class); + Map map = new HashMap<>(1); + String code = StrUtils.getRandomString(6); + map.put("code",code); + SmsResult send = smsTemplate.telecomSendCode(phones, code, type); + if (send.isSuccess()){ + RedisUtils.setCacheObject(key + phones, code, Duration.ofMinutes(Constants.CAPTCHA_EXPIRATION)); + return R.ok(); + } + System.out.println(code); + return R.fail(send.getMessage()); + } + } + + @SaIgnore + @RateLimiter(count = 2, time = 10) + @PostMapping("/userOpenLogin") + public R userOpenLogin( + @Validated({LoginBody.userOpenLogin.class}) + @RequestBody LoginBody loginBody) { + // 生成令牌 + return R.ok("登录成功",loginService.userOpenLogin(loginBody.getUsername(), loginBody.getApiKey())); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 1f1386156..caa931a52 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -13,7 +13,6 @@ import com.ruoyi.system.service.ISysMenuService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import java.util.HashMap; import java.util.List; import java.util.Map; @@ -47,8 +46,8 @@ public class SysMenuController extends BaseController { * @param menuId 菜单ID */ @SaCheckPermission("system:menu:query") - @GetMapping(value = "/{menuId}") - public R getInfo(@PathVariable Long menuId) { + @GetMapping + public R getInfo(Long menuId) { return R.ok(menuService.selectMenuById(menuId)); } @@ -66,8 +65,8 @@ public class SysMenuController extends BaseController { * * @param roleId 角色ID */ - @GetMapping(value = "/roleMenuTreeselect/{roleId}") - public R> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { + @GetMapping(value = "/roleMenuTreeselect") + public R> roleMenuTreeselect(Long roleId) { List menus = menuService.selectMenuList(getUserId()); Map ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); @@ -114,8 +113,8 @@ public class SysMenuController extends BaseController { */ @SaCheckPermission("system:menu:remove") @Log(title = "菜单管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{menuId}") - public R remove(@PathVariable("menuId") Long menuId) { + @DeleteMapping + public R remove(Long menuId) { if (menuService.hasChildByMenuId(menuId)) { return R.warn("存在子菜单,不允许删除"); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index 54b30d60d..95fb52c9d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -41,8 +41,8 @@ public class SysNoticeController extends BaseController { * @param noticeId 公告ID */ @SaCheckPermission("system:notice:query") - @GetMapping(value = "/{noticeId}") - public R getInfo(@PathVariable Long noticeId) { + @GetMapping + public R getInfo(Long noticeId) { return R.ok(noticeService.selectNoticeById(noticeId)); } @@ -73,8 +73,8 @@ public class SysNoticeController extends BaseController { */ @SaCheckPermission("system:notice:remove") @Log(title = "通知公告", businessType = BusinessType.DELETE) - @DeleteMapping("/{noticeIds}") - public R remove(@PathVariable Long[] noticeIds) { + @DeleteMapping + public R remove(Long[] noticeIds) { return toAjax(noticeService.deleteNoticeByIds(noticeIds)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java index 8dc4876ef..4139cc869 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java @@ -52,9 +52,8 @@ public class SysOssConfigController extends BaseController { * @param ossConfigId OSS配置ID */ @SaCheckPermission("system:oss:query") - @GetMapping("/{ossConfigId}") - public R getInfo(@NotNull(message = "主键不能为空") - @PathVariable Long ossConfigId) { + @GetMapping + public R getInfo(Long ossConfigId) { return R.ok(iSysOssConfigService.queryById(ossConfigId)); } @@ -87,9 +86,8 @@ public class SysOssConfigController extends BaseController { */ @SaCheckPermission("system:oss:remove") @Log(title = "对象存储配置", businessType = BusinessType.DELETE) - @DeleteMapping("/{ossConfigIds}") - public R remove(@NotEmpty(message = "主键不能为空") - @PathVariable Long[] ossConfigIds) { + @DeleteMapping + public R remove(Long[] ossConfigIds) { return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java index 2a7cc11cb..97fad849a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java @@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.validate.QueryGroup; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.bo.SysOssBo; import com.ruoyi.system.domain.vo.SysOssVo; import com.ruoyi.system.service.ISysOssService; @@ -18,7 +19,6 @@ import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotEmpty; import java.io.IOException; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 4036364fa..548bffec7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -2,7 +2,6 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -14,7 +13,6 @@ import com.ruoyi.system.service.ISysPostService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -57,8 +55,8 @@ public class SysPostController extends BaseController { * @param postId 岗位ID */ @SaCheckPermission("system:post:query") - @GetMapping(value = "/{postId}") - public R getInfo(@PathVariable Long postId) { + @GetMapping + public R getInfo(Long postId) { return R.ok(postService.selectPostById(postId)); } @@ -99,7 +97,7 @@ public class SysPostController extends BaseController { */ @SaCheckPermission("system:post:remove") @Log(title = "岗位管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{postIds}") + @DeleteMapping public R remove(@PathVariable Long[] postIds) { return toAjax(postService.deletePostByIds(postIds)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 9e646ec2c..869b555b7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -3,24 +3,24 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.secure.BCrypt; import cn.hutool.core.io.FileUtil; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.file.MimeTypeUtils; -import com.ruoyi.system.domain.SysOss; +import com.ruoyi.file.service.ISysFileService; import com.ruoyi.system.domain.vo.SysOssVo; import com.ruoyi.system.service.ISysOssService; import com.ruoyi.system.service.ISysUserService; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -37,7 +37,8 @@ import java.util.Map; public class SysProfileController extends BaseController { private final ISysUserService userService; - private final ISysOssService iSysOssService; +// private final ISysOssService iSysOssService; + private final ISysFileService sysFileService; /** * 个人信息 @@ -107,17 +108,18 @@ public class SysProfileController extends BaseController { */ @Log(title = "用户头像", businessType = BusinessType.UPDATE) @PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public R> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) { + public R> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) throws Exception { Map ajax = new HashMap<>(); if (!avatarfile.isEmpty()) { String extension = FileUtil.extName(avatarfile.getOriginalFilename()); if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); } - SysOssVo oss = iSysOssService.upload(avatarfile); - String avatar = oss.getUrl(); - if (userService.updateUserAvatar(getUsername(), avatar)) { - ajax.put("imgUrl", avatar); + String url = sysFileService.uploadFile(avatarfile); + /*SysOssVo oss = iSysOssService.upload(avatarfile); + String avatar = oss.getUrl();*/ + if (userService.updateUserAvatar(getUsername(), url)) { + ajax.put("imgUrl", url); return R.ok(ajax); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 97d7b3c12..b1e2b138f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -1,7 +1,12 @@ package com.ruoyi.web.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.exception.NotLoginException; +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -19,7 +24,6 @@ import com.ruoyi.system.service.SysPermissionService; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.List; @@ -40,7 +44,6 @@ public class SysRoleController extends BaseController { private final ISysUserService userService; private final ISysDeptService deptService; private final SysPermissionService permissionService; - /** * 获取角色信息列表 */ @@ -67,8 +70,8 @@ public class SysRoleController extends BaseController { * @param roleId 角色ID */ @SaCheckPermission("system:role:query") - @GetMapping(value = "/{roleId}") - public R getInfo(@PathVariable Long roleId) { + @GetMapping + public R getInfo(Long roleId) { roleService.checkRoleDataScope(roleId); return R.ok(roleService.selectRoleById(roleId)); } @@ -143,8 +146,8 @@ public class SysRoleController extends BaseController { */ @SaCheckPermission("system:role:remove") @Log(title = "角色管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{roleIds}") - public R remove(@PathVariable Long[] roleIds) { + @DeleteMapping + public R remove(Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -218,8 +221,8 @@ public class SysRoleController extends BaseController { * @param roleId 角色ID */ @SaCheckPermission("system:role:list") - @GetMapping(value = "/deptTree/{roleId}") - public R> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { + @GetMapping(value = "/deptTree") + public R> roleDeptTreeselect(Long roleId) { Map ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 0b91c50b9..e627526f2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -7,7 +7,6 @@ import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.domain.R; @@ -33,7 +32,6 @@ import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.HashMap; @@ -113,8 +111,8 @@ public class SysUserController extends BaseController { * @param userId 用户ID */ @SaCheckPermission("system:user:query") - @GetMapping(value = {"/", "/{userId}"}) - public R> getInfo(@PathVariable(value = "userId", required = false) Long userId) { + @GetMapping + public R> getInfo(Long userId) { userService.checkUserDataScope(userId); Map ajax = new HashMap<>(); List roles = roleService.selectRoleAll(); @@ -173,8 +171,8 @@ public class SysUserController extends BaseController { */ @SaCheckPermission("system:user:remove") @Log(title = "用户管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{userIds}") - public R remove(@PathVariable Long[] userIds) { + @DeleteMapping + public R remove(Long[] userIds) { if (ArrayUtil.contains(userIds, getUserId())) { return R.fail("当前用户不能删除"); } @@ -212,8 +210,8 @@ public class SysUserController extends BaseController { * @param userId 用户ID */ @SaCheckPermission("system:user:query") - @GetMapping("/authRole/{userId}") - public R> authRole(@PathVariable Long userId) { + @GetMapping("/authRole") + public R> authRole( Long userId) { SysUser user = userService.selectUserById(userId); List roles = roleService.selectRolesByUserId(userId); Map ajax = new HashMap<>(); 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 new file mode 100644 index 000000000..8710d4819 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/HouseController.java @@ -0,0 +1,137 @@ +package com.ruoyi.web.controller.user; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.dev33.satoken.annotation.SaIgnore; +import cn.hutool.core.thread.ThreadUtil; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.R; +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.system.domain.BuyHouses; +import com.ruoyi.system.domain.bo.BuyHousesBo; +import com.ruoyi.system.service.IBuyHousesService; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 客户端购房申请相关接口 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/user/house") +public class HouseController extends BaseController { + private final IBuyHousesService iBuyHousesService; + /** + * 购房申请修改 + */ + @Log(title = "【购房申请修改】", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PostMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BuyHousesBo bo) { + return toAjax(iBuyHousesService.updateByBo(bo)); + } + + /** + * 购房获取详情 + */ + @Log(title = "【购房获取详情】", businessType = BusinessType.OTHER) + @RepeatSubmit() + @PostMapping("/info") + public R getInfo(@RequestBody BuyHouses buyHouses) { + return iBuyHousesService.getInfo(buyHouses); + } + + + /** + * 下载人才认定申请表 + */ + @Log(title = "下载人才认定申请表", businessType = BusinessType.OTHER) + @PostMapping("/download") + @RateLimiter(count = 1, time = 10) + public R downloadWord(@Validated(DownloadGroup.class) @RequestBody BuyHousesBo buyHousesBo){ + return iBuyHousesService.downloadWord(buyHousesBo); + } + + /** + * 下载认定通知单 + */ + @GetMapping("/downloadInform") + public R downloadInform(){ + return iBuyHousesService.downloadInform(); + } + + /** + * 获取流程进度列表 + * @return + */ + @GetMapping("/declareList") + public R getDeclareList(){ + return R.ok(iBuyHousesService.getDeclareList()); + } + + + /** + * 通过调用高新人才判断该身份证是否具备人才资格 + */ + @Log(title = "通过调用高新人才判断该身份证是否具备人才资格", businessType = BusinessType.OTHER) + @PostMapping("/CandidatesInfo") + public R getGaoXinCandidateInfoByCardId(@RequestBody BuyHouses buyHouses){ + String cardId = buyHouses.getCardId(); + if (ObjectUtil.isNull(cardId) || ObjectUtil.isEmpty(cardId)){ + return R.fail("key.not.exist"); + } + return iBuyHousesService.getGaoXinCandidateInfoByCardId(cardId); + } + + + @GetMapping("/checkStatus") + public R checkStatus(){ + return iBuyHousesService.checkStatus(); + } + + /** + * 获取审核日志 + * @return + */ + @GetMapping("/buyHouseLogs") + public R getBuyHouseLog(){ + return iBuyHousesService.getBuyHousesLogsByUserId(); + } + + /** + * 外部推送接口 + * @param bo + * @return + * @throws InterruptedException + */ + @Log(title = "【外部推送接口】", businessType = BusinessType.OTHER) + @RepeatSubmit() + @PostMapping("/insertOpenBuyHouses") + public R insertOpenBuyHouses(@Validated(EditGroup.class)@RequestBody BuyHousesBo bo){ + bo.setApiKey("gaoxingongyuanchengshiju"); + if (ObjectUtil.isNull(bo.getUserId())){ + return R.fail("userId不可为空"); + } + return iBuyHousesService.insertOpenBuyHouses(bo); + } + + @SaIgnore + @GetMapping("/excelZip") + public void excelZip(String id){ + ThreadUtil.execAsync(() -> { + iBuyHousesService.excelZip(id); + }); + } +} 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 new file mode 100644 index 000000000..8edf628ac --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/user/UserController.java @@ -0,0 +1,179 @@ +package com.ruoyi.web.controller.user; + +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import cn.dev33.satoken.annotation.SaIgnore; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.work.domain.ActProcess; +import com.ruoyi.work.domain.TProcess; +import com.ruoyi.work.domain.vo.ProcessVo; +import com.ruoyi.work.dto.ProcessVoResultDto; +import com.ruoyi.work.mapper.ProcessMapper; +import com.ruoyi.work.utils.WorkComplyUtils; +import com.ruoyi.work.utils.WorkUtils; +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.core.validate.QueryGroup; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.UserVo; +import com.ruoyi.system.domain.bo.UserBo; +import com.ruoyi.system.service.IUserService; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 申报端用户项目 + * + * @author ruoyi + * @date 2023-04-03 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/user") +public class UserController extends BaseController { + + private final ProcessMapper processMapper; + private final IUserService iUserService; + + /** + * 查询【请填写功能名称】列表 + */ + @GetMapping("/list") + public TableDataInfo list(UserBo bo, PageQuery pageQuery) { + return iUserService.queryPageList(bo, pageQuery); + } + + /** + * 导出【请填写功能名称】列表 + */ + @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(UserBo bo, HttpServletResponse response) { + List list = iUserService.queryList(bo); + ExcelUtil.exportExcel(list, "【请填写功能名称】", UserVo.class, response); + } + + /** + * 获取【请填写功能名称】详细信息 + * + * @param id 主键 + */ + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(iUserService.queryById(id)); + } + + /** + * 新增【请填写功能名称】 + */ + @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody UserBo bo) { + return toAjax(iUserService.insertByBo(bo)); + } + + /** + * 修改【请填写功能名称】 + */ + @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody UserBo bo) { + return toAjax(iUserService.updateByBo(bo)); + } + + /** + * 删除【请填写功能名称】 + * + * @param ids 主键串 + */ + @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iUserService.deleteWithValidByIds(Arrays.asList(ids), true)); + } + + /** + * 获取当前业务进行步骤 + */ +// @SaIgnore + @Log(title = "获取当前业务运行到那一步",businessType = BusinessType.OTHER) + @PostMapping("/processPlan") + public R processPlan(@RequestBody ActProcess actProcess){ + List tProcesses = processMapper.selectList(new LambdaQueryWrapper() + .eq(TProcess::getProcessKey, actProcess.getProcessKey())); + if (tProcesses.size()==0){ + throw new ServiceException("当前流程不存在"); + } + LinkedHashMap hashMap = new LinkedHashMap<>(); + Map map = WorkUtils.getInfoToMap(tProcesses.get(0).getBean(), actProcess.getBusinessId()); + ProcessVo processVo = new ProcessVo(); + processVo.setBusinessId(actProcess.getBusinessId()); + processVo.setParams(map); + hashMap.put("status",map.get("processStatus")); + List processPlan= WorkComplyUtils.getProcessPlan(processVo); + hashMap.put("list",processPlan); + return R.ok(hashMap); + } + + @Log(title = "对外提供步骤接口",businessType = BusinessType.OTHER) + @PostMapping("/stepProcessPlan") + public R stepProcessPlan(@RequestBody ActProcess actProcess){ + actProcess.setProcessKey("apply_house"); + if (ObjectUtil.isNull(actProcess.getBusinessId())){ + return R.fail("必要参数不可为空"); + } + if (ObjectUtil.isNull(actProcess.getApiKey())){ + return R.fail("必要参数不可为空"); + } + List tProcesses = processMapper.selectList(new LambdaQueryWrapper() + .eq(TProcess::getProcessKey, actProcess.getProcessKey())); + if (tProcesses.size()==0){ + throw new ServiceException("当前流程不存在"); + } + LinkedHashMap hashMap = new LinkedHashMap<>(); + Map map = WorkUtils.getInfoToMap(tProcesses.get(0).getBean(), actProcess.getBusinessId()); + if (ObjectUtil.isNotNull(map)){ + Object apiKey = map.get("apiKey"); + if (ObjectUtil.isNull(apiKey) || !actProcess.getApiKey().equals(apiKey.toString())){ + return R.fail("无查看权限"); + } + }else { + return R.fail("数据查询失败:无此业务id"); + } + ProcessVo processVo = new ProcessVo(); + processVo.setBusinessId(actProcess.getBusinessId()); + processVo.setParams(map); + hashMap.put("status",map.get("processStatus")); + List processPlan= WorkComplyUtils.getProcessPlan(processVo); + hashMap.put("list",processPlan); + return R.ok(hashMap); + } + @SaIgnore + @GetMapping("/model") + public void module(HttpServletResponse response) throws IOException { + response.sendRedirect("https://dbxqtalents.cn/"); + } +} 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 c1cca7e9c..004783a21 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,17 +1,17 @@ --- # 监控中心配置 spring.boot.admin.client: # 增加客户端开关 - enabled: true + enabled: false url: http://localhost:9090/admin instance: service-host-type: IP - username: ruoyi - password: 123456 + username: gaoxin + password: 1234Qwer@ --- # xxl-job 配置 xxl.job: # 执行器开关 - enabled: true + enabled: false # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 admin-addresses: http://localhost:9100/xxl-job-admin # 执行器通讯TOKEN:非空时启用 @@ -49,9 +49,15 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true - username: root - password: root +# url: jdbc:mysql://182.150.40.133:3309/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&useAffectedRows=true +# username: root +# password: 1234Qwer@ + url: jdbc:mysql://182.138.107.22:3409/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true + username: gxrc + password: 45Uuq5!aADGD +# url: jdbc:mysql://localhost:3306/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true +# username: root +# password: 123456 # 从库数据源 slave: lazy: true @@ -102,17 +108,51 @@ spring: spring: redis: # 地址 - host: localhost +# host: 182.42.81.18 + host: 127.0.0.1 # 端口,默认为6379 port: 6379 - # 数据库索引 - database: 0 + # 数据库索3 + database: 5 # 密码(如没有密码请注释掉) - # password: + password: 123456 # 连接超时时间 timeout: 10s # 是否开启ssl ssl: false + #mq + rabbitmq: + host: 182.42.90.82 + port: 5672 + username: cddbxqtalents + password: 1234Qwer@ + virtual-host: / + #确认消息已发送到队列 + publisher-returns: true + #确认消息已发送到交换机 + publisher-confirm-type: correlated + template: + #交换机处理消息到路由失败,则会返回给生产者 + mandatory: true + #指定消费端消息确认方式,手动确认 + listener: + direct: + acknowledge-mode: manual + simple: + acknowledge-mode: manual + # 消费者预取1条数据到内存,默认为250条 + prefetch: 1 + #重试机制 + retry: + enabled: false + max-attempts: 5 #最大重试次数 + initial-interval: 1000 #重试间隔时间 + max-interval: 10000 #重试最大时间间隔 + # 乘子。间隔时间*乘子=下一次的间隔时间,不能超过max-interval + # 以本处为例:第一次间隔 5 秒,第二次间隔 10 秒,以此类推 + multiplier: 2 + + redisson: # redis key前缀 @@ -184,3 +224,13 @@ sms: sdkAppId: appid #地域信息默认为 ap-guangzhou 如无特殊改变可不用设置 territory: ap-guangzhou + +# 本地文件存储 +file: + domain: http://192.168.0.54:8084 + path: D:\\gaoxin\\images + prefix: /images + size: 10 + template: D:\\gaoxin\\file\\ + doc: D:\\gaoxin\\doc\\ + mapping: /doc diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index ca9072ef5..680647f59 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -4,7 +4,7 @@ spring.servlet.multipart.location: /ruoyi/server/temp --- # 监控中心配置 spring.boot.admin.client: # 增加客户端开关 - enabled: true + enabled: false url: http://localhost:9090/admin instance: service-host-type: IP @@ -14,7 +14,7 @@ spring.boot.admin.client: --- # xxl-job 配置 xxl.job: # 执行器开关 - enabled: true + enabled: false # 调度中心地址:如调度中心集群部署存在多个地址则用逗号分隔。 admin-addresses: http://localhost:9100/xxl-job-admin # 执行器通讯TOKEN:非空时启用 @@ -40,7 +40,7 @@ spring: # 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content dynamic: # 性能分析插件(有性能损耗 不建议生产环境使用) - p6spy: false + p6spy: true # 设置默认的数据源或者数据源组,默认值即为 master primary: master # 严格模式 匹配不到数据源则报错 @@ -52,9 +52,17 @@ spring: driverClassName: com.mysql.cj.jdbc.Driver # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true - username: root - password: root + #测试地址 +# url: jdbc:mysql://182.150.40.133:3309/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true + #url: jdbc:mysql://localhost:3306/ry-vue-jinniu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true +# username: root +# password: 1234Qwer@ + #正式地址 + url: jdbc:mysql://172.12.9.1:3409/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true +# url: jdbc:mysql://182.138.107.22:3409/ry-vue-house?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true + #url: jdbc:mysql://localhost:3306/ry-vue-jinniu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true + username: gxrc + password: 45Uuq5!aADGD # 从库数据源 slave: lazy: true @@ -105,13 +113,16 @@ spring: spring: redis: # 地址 - host: localhost +# host: 182.42.81.18 + host: 172.12.9.2 + # host: 127.0.0.1 # 端口,默认为6379 port: 6379 # 数据库索引 - database: 0 + database: 7 # 密码(如没有密码请注释掉) - # password: + password: N8PTRAirBO +# password: 123456 # 连接超时时间 timeout: 10s # 是否开启ssl @@ -121,9 +132,9 @@ redisson: # redis key前缀 keyPrefix: # 线程池数量 - threads: 16 + threads: 4 # Netty线程池数量 - nettyThreads: 32 + nettyThreads: 8 # 单节点配置 singleServerConfig: # 客户端名称 @@ -187,3 +198,42 @@ sms: sdkAppId: appid #地域信息默认为 ap-guangzhou 如无特殊改变可不用设置 territory: ap-guangzhou + +# 本地文件存储 +#windows +#file: +# domain: http://192.168.0.54:8080 +# path: D:\\gaoxin\\images +# prefix: /images +# size: 10 +# template: D:\\gaoxin\\template\\ +# doc: D:\\gaoxin\\doc\\ +# mapping: /doc + +#Linux dev +file: + domain: https://rcaj.cdhtgycs.cn + path: /usr/local/images + prefix: /images + size: 10 + template: /usr/local/template/ + doc: /usr/local/doc + mapping: /doc + +# domain: 192.168.0.54:8080 +# path: D:\\gaoxin\\images +# prefix: /images +# size: 10 + +#图片识别 +ocr: + clientId: eo1xM8KcB6ICi6k1kVGsmnR9 + #clientId: lUDaDgrPGRsMFN7qw21u5Cta + #clientSecret: znOBkwZwQ4G8PmeKT8ELDHoqdcPxnX4a + clientSecret: lZ9q4E6C0ftstwgL0Tt8UCroI5bOZ6YD +license: + APPID: 2d33f6f6 + API_KEY: bd1a2416dfae01a9c018bb28a28eb7cb + WEBOCR_URL: http://webapi.xfyun.cn/v1/service/v1/ocr/business_license + ENGINE_TYPE: business_license + diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 627bb79d6..fb87c2b2c 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -5,7 +5,7 @@ ruoyi: # 版本 version: ${ruoyi-vue-plus.version} # 版权年份 - copyrightYear: 2022 + copyrightYear: 2023 # 实例演示开关 demoEnabled: true # 获取ip地址开关 @@ -27,7 +27,7 @@ captcha: # 开发环境配置 server: # 服务器的HTTP端口,默认为8080 - port: 8080 + port: 8085 servlet: # 应用的访问路径 context-path: / @@ -89,6 +89,7 @@ spring: jackson: # 日期格式化 date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 serialization: # 格式化输出 indent_output: false @@ -140,6 +141,8 @@ security: # actuator 监控配置 - /actuator - /actuator/** + - #对外接口排除 + - /user/house/insertOpenBuyHouses # MyBatisPlus配置 # https://baomidou.com/config/ @@ -233,6 +236,8 @@ springdoc: packages-to-scan: com.ruoyi.web - group: 3.代码生成模块 packages-to-scan: com.ruoyi.generator + - group: 4.流程模块 + packages-to-scan: com.ruoyi.work # 防止XSS攻击 xss: diff --git a/ruoyi-admin/src/main/resources/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties index ffdd8f304..968f0432b 100644 --- a/ruoyi-admin/src/main/resources/i18n/messages.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -1,10 +1,11 @@ #错误消息 not.null=* 必须填写 user.jcaptcha.error=验证码错误 +user.jcaptcha.not.blank=验证码不可为空 user.jcaptcha.expire=验证码已失效 user.not.exists=对不起, 您的账号:{0} 不存在. user.password.not.match=用户不存在/密码错误 -user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.count=密码输入错误{0}次,剩余{1}次 user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 user.password.delete=对不起,您的账号:{0} 已被删除 user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员 @@ -41,9 +42,12 @@ no.view.permission=您没有查看数据的权限,请联系管理员添加权 repeat.submit.message=不允许重复提交,请稍候再试 rate.limiter.message=访问过于频繁,请稍候再试 sms.code.not.blank=短信验证码不能为空 -sms.code.retry.limit.count=短信验证码输入错误{0}次 +sms.code.retry.limit.count=短信验证码输入错误{0}次,剩余{1}次 sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 email.code.not.blank=邮箱验证码不能为空 -email.code.retry.limit.count=邮箱验证码输入错误{0}次 +email.code.retry.limit.count=邮箱验证码输入错误{0}次,剩余{1}次 email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟 xcx.code.not.blank=小程序code不能为空 +user.password.expired=对不起,您的账号:{0},密码已过期,请修改密码 +the.password.is.not.within.the.specified.range=密码不在指定范围(必须包含大小写字母和数字的组合,可以使用特殊字符,长度8-20位) +user.id.cannot.be.empty=用户标识不可为空 diff --git a/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties index c1ca43916..d28f307e0 100644 --- a/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages_en_US.properties @@ -47,3 +47,8 @@ email.code.not.blank=Email code cannot be blank email.code.retry.limit.count=Email code input error {0} times email.code.retry.limit.exceed=Email code input error {0} times, account locked for {1} minutes xcx.code.not.blank=Mini program code cannot be blank +user.password.expired=Password has expired +user.jcaptcha.not.blank=user jcaptcha not blank +user.id.cannot.be.empty=User ID cannot be empty +the.password.is.not.within.the.specified.range=The password is not within the specified range (it must contain a combination of uppercase and lowercase letters and numbers, special characters can be used, with a length of 8-18 digits) + diff --git a/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties index ffdd8f304..a9485d38d 100644 --- a/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages_zh_CN.properties @@ -2,9 +2,10 @@ not.null=* 必须填写 user.jcaptcha.error=验证码错误 user.jcaptcha.expire=验证码已失效 +user.jcaptcha.not.blank=验证码不可为空 user.not.exists=对不起, 您的账号:{0} 不存在. user.password.not.match=用户不存在/密码错误 -user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.count=密码输入错误{0}次,剩余{1}次 user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 user.password.delete=对不起,您的账号:{0} 已被删除 user.blocked=对不起,您的账号:{0} 已禁用,请联系管理员 @@ -41,9 +42,12 @@ no.view.permission=您没有查看数据的权限,请联系管理员添加权 repeat.submit.message=不允许重复提交,请稍候再试 rate.limiter.message=访问过于频繁,请稍候再试 sms.code.not.blank=短信验证码不能为空 -sms.code.retry.limit.count=短信验证码输入错误{0}次 +sms.code.retry.limit.count=短信验证码输入错误{0}次,剩余{1}次 sms.code.retry.limit.exceed=短信验证码输入错误{0}次,帐户锁定{1}分钟 email.code.not.blank=邮箱验证码不能为空 email.code.retry.limit.count=邮箱验证码输入错误{0}次 email.code.retry.limit.exceed=邮箱验证码输入错误{0}次,帐户锁定{1}分钟 xcx.code.not.blank=小程序code不能为空 +user.password.expired=对不起,您的账号:{0},密码已过期,请修改密码 +the.password.is.not.within.the.specified.range=密码不在指定范围(必须包含大小写字母和数字的组合,可以使用特殊字符,长度8-20位) +user.id.cannot.be.empty=用户标识不可为空 diff --git a/ruoyi-admin/src/main/resources/spy.properties b/ruoyi-admin/src/main/resources/spy.properties index abbd8931d..3490d78b2 100644 --- a/ruoyi-admin/src/main/resources/spy.properties +++ b/ruoyi-admin/src/main/resources/spy.properties @@ -7,7 +7,7 @@ appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger # 使用日志系统记录 sql #appender=com.p6spy.engine.spy.appender.Slf4JLogger # 设置 p6spy driver 代理 -#deregisterdrivers=true +deregisterdrivers=true # 取消JDBC URL前缀 useprefix=true # 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. diff --git a/ruoyi-admin/src/main/resources/templates/111.html b/ruoyi-admin/src/main/resources/templates/111.html new file mode 100644 index 000000000..1c6fb631b --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/111.html @@ -0,0 +1,14 @@ + + + + + + Page Title + + + + + + 重定向来了 + + \ No newline at end of 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 a40fd8275..77c8516bf 100644 --- a/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java +++ b/ruoyi-admin/src/test/java/com/ruoyi/test/DemoUnitTest.java @@ -1,11 +1,91 @@ package com.ruoyi.test; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.io.resource.ClassPathResource; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.crypto.Mode; +import cn.hutool.crypto.Padding; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.SmUtil; +import cn.hutool.crypto.asymmetric.KeyType; +import cn.hutool.crypto.asymmetric.SM2; +import cn.hutool.crypto.digest.MD5; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.crypto.symmetric.SM4; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import cn.hutool.http.useragent.UserAgent; +import cn.hutool.http.useragent.UserAgentUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.util.ListUtils; +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; +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.GaoXinCardInfo; +import com.ruoyi.common.helper.DataBaseHelper; +import com.ruoyi.common.utils.*; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.demo.domain.ImageDemoData; +import com.ruoyi.system.domain.*; +import com.ruoyi.system.domain.vo.HousesReviewVo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; +import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.IBuyHousesService; +import com.ruoyi.system.service.impl.BuyHousesServiceImpl; +import com.ruoyi.system.service.impl.MaterialModuleServiceImpl; +import com.ruoyi.system.service.impl.SysConfigServiceImpl; +import com.ruoyi.work.domain.ActProcess; +import com.ruoyi.work.domain.HisProcess; +import com.ruoyi.work.domain.TProcess; +import com.ruoyi.work.domain.vo.ActProcessVo; +import com.ruoyi.work.domain.vo.ProcessVo; +import com.ruoyi.work.dto.HousingConstructionBureauPushDto; +import com.ruoyi.work.mapper.ActProcessMapper; +import com.ruoyi.work.mapper.HisProcessMapper; +import com.ruoyi.work.mapper.ProcessMapper; +import com.ruoyi.work.service.impl.ProcessServiceImpl; +import com.ruoyi.work.utils.WorkComplyUtils; +import com.ruoyi.work.utils.WorkUtils; +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 org.springframework.util.StringUtils; +import sun.misc.BASE64Encoder; +import javax.crypto.*; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Method; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; /** * 单元测试案例 @@ -19,6 +99,62 @@ public class DemoUnitTest { @Autowired private RuoYiConfig ruoYiConfig; + @Autowired + ProcessServiceImpl processService; + + @Autowired + private BuyHousesMapper buyHousesMapper; + + @Autowired + HisProcessMapper hisProcessMapper; + + @Autowired + private ProcessMapper processMapper; + + @Autowired + private ActProcessMapper actProcessMapper; + + @Autowired + private HousesReviewMapper housesReviewMapper; + + @Autowired + private MaterialTalentsMapper materialTalentsMapper; + + @Autowired + private SysConfigServiceImpl sysConfigService; + + @Autowired + private MaterialModuleMapper materialModuleMapper; + + @Autowired + private MaterialProofMapper materialProofMapper; + + @Autowired + private MaterialModuleServiceImpl materialModuleService; + + @Autowired + private IBuyHousesService iBuyHousesService; + + @Autowired + private BuyHousesMemberMapper buyHousesMemberMapper; + + @Autowired + private HousingConstructionBureauPushDto housingConstructionBureauPushDto; + + /*@Autowired + private Produceras providerCustomer; + + @Autowired + private OrderService orderService; + */ + + @Autowired + private BuyHousesServiceImpl buyHousesService; + +// @Autowired +// private RabbitTemplate amqpTemplate; + + @DisplayName("测试 @SpringBootTest @Test @DisplayName 注解") @Test public void testTest() { @@ -67,4 +203,714 @@ public class DemoUnitTest { System.out.println("@AfterAll =================="); } + @Test + public void test001() throws Exception { + //方法名 + String methodName = "queryById"; + //类名 + Object beanName = SpringUtils.getBean("processServiceImpl"); + //值 + String value ="1"; + Class aClass = Long.valueOf(value).getClass(); + System.out.println("stringClass = " + aClass); + Object params; + //将数值转类型 + params=(Long.valueOf(value)); + //调用方法 + Method method = ReflectionUtils.findMethod(beanName.getClass(), methodName, aClass); + Object obj = ReflectionUtils.invokeMethod(method, beanName,params); + System.out.println("obj = " + obj.toString()); + } + + + @Test + public void test002(){ + ProcessVo processVo = new ProcessVo(); + processVo.setProcessKey("apply_house"); + processVo.setStep("1"); + BuyHouses buyHouses = buyHousesMapper.selectById("3136"); + buyHouses.setUpdateTime(DateUtils.getNowDate()); + Map map = BeanUtil.beanToMap(buyHouses); + processVo.setParams(map); + processVo.setBusinessId(buyHouses.getId().toString()); + processVo.setStartUser(buyHouses.getUserName()); + processVo.setCardId(buyHouses.getCardId()); + processVo.setCompanyName(buyHouses.getCompanyName()); + WorkComplyUtils.comply(processVo); + } + + @Test + public void test003(){ + HisProcess hisProcess = new HisProcess(); + hisProcess.setStatus("2"); + BuyHouses buyHouses = buyHousesMapper.selectById("10"); + Map map = BeanUtil.beanToMap(buyHouses); + hisProcess.setBusinessId(buyHouses.getId().toString()); + hisProcess.setParams(map); + hisProcess.setProcessKey(buyHouses.getProcessKey()); + hisProcess.setStartUser(buyHouses.getUserName()); + Map map1 = WorkComplyUtils.batchDeleted(hisProcess, null); + System.out.println("s = " + map1); + } + + @Test + public void test004(){ + /*BusinessDTO businessDTO = new BusinessDTO(); +// BuyHouses buyHouses = buyHousesMapper.selectById("1011"); + HousesReview housesReview = housesReviewMapper.selectById("1633344911078064130"); + Map map = BeanUtil.beanToMap(housesReview); + businessDTO.setParams(map); + businessDTO.setBusinessId(housesReview.getId().toString()); + WorkComplyUtils.getStep(businessDTO);*/ + + boolean validCard = IdcardUtil.isValidCard("51050319960221405X"); + System.out.println("validCard = " + validCard); + } + + @Test + public void test005(){ + String s = "1"; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.apply(ObjectUtil.isNotEmpty(s),"FIND_IN_SET('"+s+"',cc)"); + List tProcesses = processMapper.selectList(wrapper); + List collect = tProcesses.stream().map(TProcess::getId).collect(Collectors.toList()); + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.in(ActProcess::getProcessId,collect); + List actProcessVoList = actProcessMapper.selectVoList(lqw); + System.out.println("actProcessVoList = " + actProcessVoList); + System.out.println("collect = " + collect); + PageQuery pageQuery = new PageQuery(); + pageQuery.setPageNum(1); + pageQuery.setPageSize(10); + HisProcess hisProcess = new HisProcess(); + hisProcess.setUserId("2"); + hisProcess.setDeptId("103"); + hisProcess.setRoleId("1"); + Page hisProcessPage = hisProcessMapper.selectVoListPage(pageQuery.build(), hisProcess); + List records = hisProcessPage.getRecords(); + System.out.println("records = " + records); + long total = hisProcessPage.getTotal(); + System.out.println("total = " + total); + long size = hisProcessPage.getSize(); + System.out.println("size = " + size); + } + + @Test + public void test006(){ + //先获取出顶级目录 + HousesReviewVo housesReviewVo = housesReviewMapper.selectVoById("1633346490522927106"); + Map map = BeanUtil.beanToMap(housesReviewVo); + Set keys = map.keySet(); + LambdaQueryWrapper eq = new LambdaQueryWrapper() + .eq(MaterialTalents::getTalentsValue, map.get("processKey")); + MaterialTalentsVo materialTalentsVo = materialTalentsMapper.selectVoOne(eq); + //根据id获取关于他下面的所有子集 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .apply(DataBaseHelper.findInSet(materialTalentsVo.getId(), "selected")); + List materialTalents = materialTalentsMapper.selectList(wrapper); + ArrayList list = new ArrayList<>(); + for (MaterialTalents materialTalent : materialTalents) { + if (keys.contains(materialTalent.getTalentsValue())){ + //获取当前目录下的数据 + Object value = map.get(materialTalent.getTalentsValue()); + if (ObjectUtil.isNotNull(value)) { + List collect = materialTalents.stream().filter(m -> m.getTalentsValue().equals(value) && materialTalent.getId().equals(m.getParentId())).map(MaterialTalents::getMaterials).collect(Collectors.toList()); + System.out.println("collect = " + collect); + list.addAll(collect); + } + } + } + + List collect = list.stream().distinct().collect(Collectors.toList()); + System.out.println("collect2 = " + collect); + + } + + @Test + public void test0007(){ + /* String s1 = sysConfigService.selectConfigByKey("sys:preventing:hotlinking"); + System.out.println("s1 = " + s1); + List strings = Arrays.asList(s1.split(",")); + System.out.println("strings = " + strings);*/ + ActProcess actProcess = new ActProcess(); + actProcess.setProcessKey("apply_house"); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(TProcess::getProcessKey, actProcess.getProcessKey()); + List tProcesses = processMapper.selectList(wrapper); + System.out.println("tProcesses = " + tProcesses); + + + } + + @Test + public void test0008(){ + String host= "https://xyxtest.easyfees.cn/fcopen/fcsso/xyx?sfzdzc=1&qybh=XYX&yhm=8401&sign=b9831864d15add760321d2a3791e2ea7×tamp=1680154767652"; + String XYXMK ="54a321"; + String qybh="XYX"; + String account="XYX"; + String key="5ee4adfedae1458a9ca040f06b416755"; + Long timestamp=System.currentTimeMillis(); + System.out.println("timestamp = " + timestamp); + String sign = SecureUtil.md5(qybh+"0001"+key+timestamp); + System.out.println("sign = " + sign); + HashMap hashMap = new HashMap<>(); + hashMap.put("qybh",qybh); + hashMap.put("yhm","8401"); + hashMap.put("sign",sign); + hashMap.put("timestamp",timestamp); + + String s = HttpUtil.get(host, hashMap); + System.out.println("s = " + s); + } + + @Test + public void test0009(){ + String s ="buy_houses"; +// BuyHouses buyHouses = buyHousesMapper.selectById("2"); + String s1 = CaseUtils.toCamelCase(s,false,new char[]{'_'}); + System.out.println("s1 = " + s1); + String s2 = s1+"ServiceImpl"; + //类名 + Object beanName = SpringUtils.getBean(s2); + String me = "queryById"; + //调用方法 + Method method = ReflectionUtils.findMethod(beanName.getClass(), me, Long.class); + Object obj = ReflectionUtils.invokeMethod(method, beanName,2L); + System.out.println("obj = " + obj); +// Map map = BeanUtil.beanToMap(buyHouses); +// System.out.println("map = " + map); +// ProcessVo processVo = new ProcessVo(); +// processVo.setParams(map); +// processVo.setProcessKey("apply_house"); +// List processPlan = WorkComplyUtils.getProcessPlan(processVo); +// System.out.println("processPlan = " +processPlan) ; + } + +// @Test +// public void test00000(){ +// processMapper.updateCommonByBusinessId("buy_houses", Constants.FAILD,"2"); +// } + + @Test + public void tests1245545(){ + List materialModules = materialModuleMapper.selectList(); + List buyHouses = buyHousesMapper.selectList(); + ArrayList list = new ArrayList<>(); + for (BuyHouses buyHouse : buyHouses) { + Map map = BeanUtil.beanToMap(buyHouse); + for (MaterialModule materialModule : materialModules) { + if (ObjectUtil.isNotNull(map.get(materialModule.getMaterialKey()))){ + MaterialProof materialProof = new MaterialProof(); + materialProof.setHouseId(buyHouse.getId().toString()); + materialProof.setModulePathId(materialModule.getId().toString()); + materialProof.setFile( map.get(materialModule.getMaterialKey()).toString()); + materialProof.setMaterialKey(materialModule.getMaterialKey()); + materialProof.setAuditDept(materialModule.getAuditDept()); + materialProof.setMaterialName(materialModule.getMaterialName()); + materialProof.setDescription(materialModule.getDescription()); + materialProof.setProcessKey("apply_house"); + list.add(materialProof); + String o = map.get(materialModule.getMaterialKey()).toString(); + System.out.println(buyHouse.getId()+":"+materialModule.getMaterialName() +":" + o); + } + + } + } + materialProofMapper.insertBatch(list); + } + + @Test + public void tesst00000() throws Exception { + + /* String http = HttpRequest.get("https://gx.chengdutalent.cn:8010/candidates/getByCard") + .header("Cookie","security.session.id=e1eee749-70da-48a5-8390-b99c7e1749e0") + .execute() + .body();*/ +// hashMap.put("loginName", AesUtil.encryptBASE64("18716148446")); +// hashMap.put("password",AesUtil.encryptBASE64("1234Qwer")); + + /* BuyHouses buyHouses = buyHousesMapper.selectById(1011L); + Map map = BeanUtil.beanToMap(buyHouses); + 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 publicKey1 = keypair.getPublicKey(); + + 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("c368df0c094044c0648b412078c2067f84984531afebe3fd494fbce4f5e9b7bc42465855964def4f3bbdd1f61b8780f62656f63c25f8cc6c7e5caff9b0757909848577302a0a1a708d226ecc6a2b3e5c3ac6056cc74884cf5dbe80482f7edb7af59778528a12986bf671d9619c5d60ba00f44e4369aa48f5cf91ac60b9af8e144c730dd0e60330a3fc9473a80ce88fa2", 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+DxNiAUJMQyOsroIRk1ZQQI90Pz2FYt6sI1p5SAy25Rvwb4obTGcUW8EIJqbLlL58lbjDGLTLD9cWUIJZki38VsmNJHuN7u1cA3tzZ0d6PyYx0LUD38R45Tvc4iT9T56yGkKVqUPFKESFGTA3Vlm7d9Qa+g7sgt9kwfzbbpwIDAQAB"; + /**/ +// String text = "fCmglGIcXuE32Ti9BeMZKsMkXmWFAC9tE2TTYJP3pA2/hsl2VLKxvMGlMraIVLqfPveNvSR1GhH6LhcWASNSQQTgl9u3tDUJzF7x+Xy+z0/uAywl8puWw3ivzlH8rRNsIwaPMxiOlPilijCo/tXk55gyi1aRVunY82mWo3Wxu5KwT0KH2mGCNAbuQxa9hO8E71qaXbJuwm5UqYg9wBUXuj+ZKTaPDYFUn8D/pCVjGJGIxmTfmK5l8XUksDy/MMsNm18GqkQSNUIpMIjqHq8w7n+XU/gEkeXkSv/M1T30Yg/8jepaWqD92T03RANZG8yCH+JuSx0c2CmToGikBj6OkrKj2QGCcivW3QChjMBlBJHq004o685/JswAaqhgm/hUzutw3YsnWUtvuViNneN9cOfJxKmtMgSkKGNGFwpvP5qblcnOdv2WhouOgcVUDRQL8ecgdPbrYNFt69E9OsfszZembT7HZhf8pFRxLGVBaVppgUF97/18EUM/tl1LzBsDjgjLYIpzHBh+MhrSCfTswM0Ja3TKxmCQcxkuk3wlgE0j1QO9B2n8v5UhI5KkF9uvUiwAgmfIG3ac3udNJs0aq6umuVc/quOKSb7X5cydLVUcHroRGF72jm5ggLQ3FJzBDmRT86xGgnKSbRq9HXmp5345gMN1miG/v9gd1omwtpSfe/6Byxm4iGAP6zHpbS0IcvlwZkIK9NvuflpTN5zsZxNE0RX7JOqyjGnWTE/PGBIgd48YkP3HbQvUsM7bQSd+rQlgI2iSwSrtE3aoHGbV0eIH82L/aYXlfwVuAx2y3B4YlunDH3pB7m7hynYdVqqQKGqhQHa5UCvu2U6PAYiqSFgd0+ZM4zwf1f+esFFOmIeq6XLO/FkWjo7mEGbXmSeFpxmZ4pAO0hsdVMa/k3AXrUExFIEP3L1BWHxyRwczJdv6riGnDWXkcjeQc4YNr1r2GIBk8VM5LEuwyTkDNrYgLE47090upITCZLgbY55ITJZDxUoyBKxlTU/wgVMmZ7OigWAq/yKI7HfmjM4lKL0bkSb492kbsnwTQgWf2QnNA6h+IvkQnHNOyggI6MoQosyIISen/gB29uOOOBc6EAOYZJ2/X1s/+ktNVU2QzdyiGVbaScy+SltAIPH8AcSyXOKS3+17icfm/KjgrhlfdmQvM9YPpmeNNQcBaFY/mSIHjDNolhbFzjRkq2su8pkD3e2Nx6liE7g2FzQn7CB2NLaMoB2pRLuv2aaVosDOsgD7mvRxRR+w+Aq+QPwwPTCySHqzINNjDzMZB1QmJn3VqrnvlY5edbl90hEZIYVavn264n2s+aysgqHEN98yk3gdd1OM6vsA2x+6TKZjig9/XqTcE2fvO+MdMRfh5bPhKl7ATcm8FxF4PPX/bEe/P3V6ww+iSf6BMzQwcALdXZyds+jSvlFGM9+ZrmqP330ne5LyyO9opDrIWK49D/pJNqch/2DgHWTvKI0Kt82uyHm//ueRUaN89MtwRTbDxjjInmKT1281UrHxSGeAKaVItVEQfrx0ahSQ4OxnZz1lwnIEzfc4iXQJsaVbbRYZLZJfyZwsd/EpJoeV9iLV7bvGUkB7UnUjYtJCCcjTB3mKefJL63O5d/WJb3xKyuLFcFbzoJnuU5zw/671KwGy3QRZpGPDtzz1IxNdI5m7CXbNArB5SnKVdcA1uZ1MpyZhZBVgz86u7KafPIoN0QQs3bhILEYGrhOsKzHawqo9V6WhFF3bZm6IbBIYpjEbJxJw/FjPqmBmxE4On3xOLf2zIlqKRQgose48rzgrcYdX3p/DEh56iTLCoO9uLewyzFEj8rONxFIeGxgaktvIGrijQCPwhDc5Dq22x8c13uFp0/YEZK2sdBDPcTpD1d76K71enGHjWIBg51h7YqAa0FEak3+qV4+CQ4qN61shkQQ3/Bd70T2eTrzPkOuefhcoWGZFLbk5pZu33l2bxqH4TNEI85IKYD9Rij+2aqU4IZP+RC2+ym0ddLCAKMg6W5UlqZiJakVcquaoECnRcjQsxf3X45GGuZwcdbILSIgN8+TlqgokoSPDi2BVfXKR3oCkf2jKpYVhbbW7y4bTkKR3zfiZABTvmifYj7h5PST5UNC7K5gzY23F0gruiAhG1xEhhmxNb8XKYtRlX3sj1C1r2dl44Sgpfh5QXfzOtYD5p6Gkr9qyUioOJC8Tca/fCVFZnNLNtlE41x3xsSieG1CyXbIG13aat01yirqhWY2WoBw0AqbstlkCpgghjSZM3K0Y2yoEvg0pBZHDmP0mxs3IQom1lfOKcA+ogtOsWwGfYGJuk7EmYe3HJPF1sx1N6miXziHxEiyGcsHsh+Ocw/dzu0IPYBOBbYp4ulB0ogcNDUGNDazrkcSUVxSqg7UF5jAox9WLWhn61l/6mxBuWNJyGDLEKzQtxpClYHUWpn47QopIFjygg2mz/r6DnGYpwxuDWJZ2jSJULcGVUH2lUN8saryKU+XZfc8MlOodd1G/wZJYrYSsvPUt0pFFDcrtvtkgKWo+q92+90JtL4QowF6dczBHM9hKKnRZlzR+rK5/4vsoxuvaVPC/jEGsj3Ftlfuf/9J0bQZLXnGhLdHR7SWjhv2SICeEKFrRDOrZp5b9z7N+l3EPfnU7SEGvzHZ9ngIrsDUjMf1JAicv2LZv1Fz1Uww+EFt6dtqvzU1Nq+Y/+EzX9B/gHAWZYvbuEDLGidKlnUc8LWyDMQttNCqtddJPhn56fYS0zNNEZQ9WR02b6EA8sN0+VeoniixrZ8A8rMvc8DVXcwEPx5JHCIVFZayFkEJZIJDvdZjTmdlDOg34XQNFcBIVW4C3crj4rcPlRSIAqONZ8672VwXma587ZlC7DTNj8xgAm3mZMAYrbZ/T6wWqGmlpR/CGU9ROVXJpo8JKHAMWrnB/Gu+hjblVHHkJItQgU1KlqnrHI+VsETDqP+RfYXnOhxkhrM3H0aA5zeVi0MXrpr9eeUx/mSz1huVzdGtRjSA4aImsJyOQt3WCXekyroZLbjeVuh8eYqF1b3ZZ55Z7vB7F/pCPhH0ICV4PJCSJxQWOeqxF7HZ0cSuuPRQhOWJJOau+cxpWw0ayJoYiKiZEaYSqDiDMuOzbQaHhuvP4sgVVMR1ZRkjLEdcdDqhjrUA2f0hwhnrNOO3plm+O0NSyrSWbd1S0GQAqErsXU6RIoP6t4B2ncJ/q4BKGKwx4Vm1sM3mNWLwSkKuIBH5XjSngkviGuZ8pJEpplPTfAN2vBrQxfrqhkB/CVlDo3I5n16nSROo4NZ2DMNDgzRZMktRz5EM2NKEGweYF6ScoL6A3tkz330oW6s/VdX6hDMNlUpRH9AtYts/seeFxuF4WEhT8UC1I0FLFb49UI5KHJs64oHllbEp9iYe84XSdyGa4kYTwNfaPig9cgz7htzLyDrHM0A8S3AUVoJXmp6/wplWNsZXkEy8sjsgQKUxXfUH+DhRTwqWVKV3ZhtwSsHBnB2DgqnU7lEtIjf/lpP4TB81j5BXn+SLhnVolVVtE7tkAJr6XIknnFen5aWTBHVXgZgrmIiv6mX19zMhkk1jSKaHHesPs8iTBrNKfJDV35ySfPF5fBPpneLWbyfv7zY2qGhhfAMFSdVtRH64tkoE2veOuxlp+zuhGaQL7cSo022xHS5CW5V8qTwBGOz9TB7njXj0Q0pwvthZilS2lkVZtV1JNcKjGDw1heKSp1t9rY/zWXo+m6QsghC/beyvzCOVz9jCX1o2v+++uXZyqmKREfNW8T9DjiVdc8DSPPb6oyCYNIrs1aZAWx4bH722ADLn6f1246I4kFzpIEkGYjrRTch+Rrq1FPJAW/tCunR0B/JmD+Ry7QHuK8x1A7SmCOJQJGE+H0GlgXEvNoaAep00HkyPd2IkvFG902xm94f3BBureuCfUfLjJdnERICZ3UkCC+OegxSPSAuUxdAwixmq7nFnsqc61n6zOrFo+4A++5afiN5lXLqH2G+ck6j5sMVIr7HE4GGQYDwUA+czF1fVBrKsclqH48VMxL+Nh+58TbouJ/Hej+ku2/kefsm8vTOHL7xwzXbvdmjMshfO18ST5HcM7T/Nj7m7u6OyxEs8KSrStgx5uRGDYThptkpHRMCi7vO1X8yhQh1BTswFO/UrZQP+Uqr1G2dZHUU7kSC+DNON7EKM4+a3uzD9nPrwDVM2QpEzJ1GvNQsDUtGS++tVrhh5d54P0TMzQCAeOe9ECwgyUUR8XaIdko5y9e881VFh/0SFDTumIp7QX/Olw2iYfLn41j2CNg9D9o+YLVE8D4ntj/eq25XygHd+4Mwss0ZoSScEpjdp5YGvi5aBeay0xiGhy9tOIoxnTVBUJA38rcsZ+ZMpBtmgwuymoPdSrtUyHpOOb/eXhCi2AbSRHiEKfVm4JNQG8RAA3dKz7PafCWUV8PQZUZOJM0SseNkMuG/+0Yr+F94Z0bYaJMGyCsUjIYpqsrc+cnnd5QktwinjDT69NIUDD5o8WenEZj54HVEJdOVatrFf9tXGiTp08HHM0c/pxQc0A3jIvETpwPF8QVc1qSWlh+JK8T/Kt5LtYl+2s8p0vf2B9ks626LVa0FOoxh9iTguILNJhoNSgIsV20ubtieG7PQNAqQEW8yEzib+y6ZiCwNWK13o2PqYv27pAa9uUPbiXQLccFEjTXjac0lINA47Xa4McEbNZ4cS26hTA1Ipp/7ZK4Hvhgn4UULtug3vb38rYXtjJYs0DLiqgmWu0A6Mot2j4d0wuiWhqSZ+MlNmdNlN/8F9xABpYfufZk0S1nuVgCSI0JKbobja5JOrxQD0apZEXlEO7h8PtY10ykxblghhi6FBh2VQBBkllSwtZz6dRqN/T1ElSjkTwAvlWK1MsifIpXeqoZXDdLUaFENDqDE48hBZcCqmPFMZ1zumbKZEMPUUZkXQzZiJ+IlSrL0nk/t2t/eRZtDAu+jyx7vXYTM1Itu/h2pvG4dF+evhD9j5dsSn37OO8AYX5QV8ZGb3qurvqwkFTfj2UNG60oav1ss3nR5DlhP+XUUNgPITWwlrgnY8VlGyLSFYfijB244lVyJf7E0ihvUY2vHG3CwptGMHzrdpaoKniLsgpfHqh8RZ2FK3z55T8PpH5QcfJfOLdL5ZKpZfLNZeSxsW1EIF3JZI41zn4rrH1Ms8Hu8B0LRl/gwO105y0PeB5/hjZW2e93S9jaC+2lrfIR9r6PIYrSt/xAvKtpcMItJG5F0It4WIPPprx0HxFaDLEuc1ZbpUVZK99Nnz1Zj12OH7ZaOducJ4vd1IqOfYrqkN3ZaFKSox5xkmej1MMXh5qdQT2diRI7kR2Rq5HZXLjd0hbNJWGcGMyO31U1A6LBgl05/QpYJnwBg2qAkfbiwpRmTuYDhMLpjnFCh0/kNbiHrLy1wyw8lyaWRm5hXGPFFvPBuKEitl4fwM3WJhzOw8QwsJNwsZVUAsauZJ0OBV1RoMTRcaigQIOy9hNI847J9dNyalHHHhld1Jzn9h4OBiGIKcWcLvSGfmKorlMz80lj5c/OfsNgr09WUtlgjQ3i3IbVpLeBI2NEayOcFOJAIJBFiG9Q/P9X0Zn2q3Knh83Y5aH0NaBKG2PfaqrK2XgrgYY1ayrPTjPCIybZPdqEBsORX+ZSUao84QAYivw1VjZMvFzu6goTo3MMpQixnuw2DHGDJspEnM7pF/Z0y6IdY5eIDbiB+U7v9ikc79iA7qL2BeQI70vHd0B3e37mw8qjr78P8kh/E1LaGb1g8smL91S64ea2nNFPRCFqR5zRdTaOQEt/8WzHobxCORM6mgbz/ZRhI3ZQ1awOHmCPBegS782DfmLQWOVhxvc5QG5FzRNVzj7jBrZ03lcCf/oSy/dGhGja1A4v0ztUwXmSqa0vJCvqOsHdFL69MJtiSoJdnivTaobn2i38I+vIohdVlWloJzMTAtoSmUS76xDirx+HDm5UoayhBZ7Eq69CJvZxoRah3rRKTqDB7AisAV9I7D/bDeikzZ+Kz+bKM0cIDdkM2Rf/Sau2QvHyrR0Gs19wAPz2QKr4wrvFUqXPNgHX+aYA1GgHvaBBb/VwXiQzd5DOxYo+y6nJuO82JUWThAFRqoRkDWn/m+T1rEH8WtIvUMSgYI4kTs3gHDPNXkmKpNQPptRJH8VyTNX51UKGGhDJHn/mtXJa42Aiw7GNHaOZw1xmwPWtSl6qqgsapFHPJSjAWCc8R2+FilK+6HdRx01wAcAjZA0AVn/I8QNX8JtMidNAqITYDxVcxiidDZVn6PNRjtYXYz+RUztBND9aDZHU7tyFgwsOYMS5lKvfcALAVylPMt2HYs3A1yZnsKWFBg8D5xakN7vjmfVTHCw6mHO65evEdRAA9XiZmTL+MjNsD8bW8A/cBdF3taEnMuKIV1Vozo/2WFelbvIkybpNhFVlDl/RnX3V+3Aq6S6J3OcG3uUU2LkTWzMgMOgE0YFbDSaYem9apWI48GRapuxo47KMnBBkAHoRLUHl6z7KlO8TK/7o27g2r0mUTWC6MdAS2Vik90NX3q6n8dExG0p9Dd5aLDJtmzH1vYFaTfTkR+GveNn2HRMDpK77ooiTNvuDkT6hqE2xZYQlErs5rFrEJ2NzR1ydRivuZY78OjFhAijcfdI9WhL69lxUMo56snpq2cVpgrpY5Lpir2g1iFWEJkG1az7QsttA0miqiQFNj51D2f/H2hQ98wevrV1ByfA+zsH5oDNx3PnuuRdwEMyrsbMdKAZYivHfKENT1NFEZl4KQ/yeTso+nGsZM+tcAGq72CIHNs6mH2H21k154rgBgClR60pPVlzbxmoiIVrJwy8Jp2vXsqDSCRZphv6oW785aheLcGXCaNrfoghiAPqyo6FTI5ufgysjw7J1L8JUbMTL/l8D+JMX6r2wQmUvI4BzpJoc4cGbHT+K7RvpZI7OXbkGK2mblkatLbfMPvVN5Fx1VMeoePDiEL/EyvAWDImrdZVmjFhBU8gsjW+7UEY1fYVha4h/o3Uyimh7of/fxP/79nTnP9v5vzqLyLorZVnpOixeVqw21Er0+U6GRmpm6Sw5mpz/gA7ZZV7LMDB9nqfBHH77hlczlhZPF3eJvAtxQxhupeChwsRi6m21KltajGC3AD6eKqekkaoXbLwd13dZha7NO8LIqugE7aFYXzL31vZia52Uu/LLbH7Ub7oR1SneO2eTtdEC2rSfSAfhw6N0t0+EPerA1Kx21586NfSG7p0Y3AGCdiQIAaXdab4FqRfp1K+8vEjvcH19MUUUDxSVlSDXp50X2NJZiCj2VyGts2fGe0rGOQdNa0NHYKvOm/HlOs8D182beRyOuj7C5VS/4FhNBr8RIhJaoaX5xENNRF3Jj/dlLnJzFhMmluSilEuODgj/j+CMgH5uEG/VxAgiePYnvC7aUyHdvp/9a+B66W2SsNaeAzGrJmZTdoPwJHKJ2nUbQeBaz4mTcdGoQ0cJS9YfQmtUmidTXJdrJN7NOdpThsptmVId8q6zhDXyHURzloK8o+36LbVt2iC7vulZ/7VK3AbA/V//+BmWhHxgFX9bv7muG5XcxasSFzXdfw4IgOehj4SspmcFbdqhW3fe1ZTy090h2L/+R2nVrbTKVpK3mzdt5txKZ0AjNOho5IoCY4emiBaqGp911Vpfnl74PQ6irurp96aA0lihdCbVUNeife/msDD577DkZm/shy7CQ0otob89m8fclL73N4Z6jQufybTojPZWT41CLkoRTKHmROT2Ny+6giMBTXBzGmhQfbM5qGBW2vFBCOvIa7DkZz+CGPb18c1X39A1Mb9O4NGEUekVuBiHTpOza+xWdfdXvP37lxhXwgAXuAQfKGBbugWxyK8VggMqx5fEZqM40d0+Wuwa4VwzJK6mnGpoGbOQ0xq5c5YJox5y00hHDRSV6IGx/41U7SN+GNQFnkZUPGUXM67WG2vnxHWBaTZrFvXjHj4Y6YDhOW84RfWXz4bPwEtyp20FCXyVt2ynekPkvAoE/Sc5HHCtAMt0unmD+JyEIsKDQi4Z04aHc31+f9I+lDGvYge0aImp4J5mhU435K41wXbfzM5Frlb2Ek/Nvlz5bu/2aS21IMWzUJmKh70P71wCul6j6MnD9W86DoNczWMQxBRXf3CYF/sWPVTp8gaxyovub2WfMqTMEQjuxe07LLK4wIRbHJmPjloKwiM5QwaJJ86aL+ysKFpLW/cc5nf/FFRnM1n66c3zbjLRbCts6Ec1DUormlyU16JcRlj4peRXqxBf0iZyxxqBxnLv7WeESZaHwI/0JnF1Qu6bsx8LJ+KF1dsNW967yq4fUcbY4lb9hzLADdhzELPC+Krb3UtHwoIzoEJhAjEIwXUBopbyn+XzU0nQ2eNuzA4V5Qf10YOzrHsVL/9+unyKnu34fhf5V0zlwI67JyPha2QeL+dz2u8a8wnaGM9NlcmDJy9BBJOo03RaFhcfWbC+Zc96ILfqVTVhJ5U84VE1Zmm3zndAWCz3T5LXbQn8tnH9DFFlWX3DRi4NSlOGLYBi/Sj/6e7hTL9zu6quT8Ny37AIwLNgTIi7V8z1/a0nGEkq/kgUTU4adK0/0ELFh3uEt4GOqchhk+7zGIXatjUGu/RjYz+98/zltyCewYSKB0aQoOwP9FrfcIPoFO4FIECD5Ro7kva8ZctCM85opHNMQ24ilLMmk7k9H8zExzzFZ0d+ybbewPtXE+Kk/I4saZ/8b0jju7e1Hsvbh4L0poQedXBO35qy4H52qnIoiVRvQcaBz+RJz4SlNwmnEseNh6WjkstsgVCAYDu4DoiDMT0aiz2YyYYnWCHnmdLtV593MG1y/QwC0owIjqfI4/XRQ2v8orN2nhacTGx4U6Gkcgrcb4lHfb3r/qxoJ9h8n1RLCTIYTuLZL4c7hmfPunw9iAvFXRsY9TkTvc7ErxD/6snSRHjjHAKnEparO4B4KH7SVSvorrqmV53lpbRDrvqs047zOcVVSt3k7GiJYT2cxPyhQLjFm+2c/NmJP4dXWcegd6akVXlyeCW4RRmYUjEtXpoqIByMfj39i9R9glKzG5eYdKkml6Pj1XibN36rQripzZXc2/z+r/pFatHEf71VHHETSETDT/ZPrlD1/DHnJ5wL/3o1EFNUzSq45bbL+H2R94pa0qsTgHQNFZSQTb3QPfVm/e0mJcjT9D3SPgjUr8NIBUom3PpzTnLdTsTi+z9tyPSuN0/pYrMhMH7HL1FLF9XA7kpg9dIpBAttjvrieXTlm+fyPpYrNua3pBEyQOtD53K1Ob4vvsOnNUudZwoROvjqvf0zFXV9n8BEvWeWQjFN2pxBo2vETL7V1XxYUO36I7W36K5pt27qmOufqVGpKsZoKB0FFOYC5rSmagh8MRdqHIde4x+VKJx4wlXHzb+Y+L2br+EBhFtma5uhcBLwTAsajb47pWMEOH6ac9onihf57UJ3HlXuz1YmvYplQwEzgZl/xuDNkZsWZQzPs2bPzBmrvuDg+hRY3eRAHTL2JZ4r9xtOwPNtyg5z77Huum178W/GjY4yIRaX8puccHnWnuquncPNRZ3thTZTxZL2T8n7OnsrAe4ckuJJxO1RfwKTUGVoe+hzPndhWHVwkoJk1Lkl65PGLYFJekPTrfsa1c25vLdz57FSAP2FOZwOGuxbv8wjedH7DUEWaYShuQUFz3g3vL35zloGRAftxtf18pf9xznKOTIxEG0jV/Mrm+r6hhp885v3sS8pl55fRRcK9bdH1lcftb9z9o0J4yo55VQGNkpU5x1KOFGE5HSLQcciAxLMoaP8PgfLqzNzD9yMB9uhcAkuotDsPB57RUjRbYLg7AXCjfH93YdirG1WdZDZ2uFx94wpqY0tlIIQbUHYtZ8CqkBPuKcZJ54sW6fzCc+Pn+6oA/oxYdSQGIn0OtaOMYqQhrckX7UoLiI0qrGiuraAzAKQyodf7uPv2m2hGdF4bVtASCQtv69PIl+2wI7NuJo55d6uDGjBaK8e4NKNfNT+DDw1XE2h6wI7uEHUqn8atqbhAMUlz201YmhFLO3Z6FVrSXGIJESrbZNFwpZvQSVwOBy6ssneYp1KQqaL4dIWL4SdA1SqzE21lc6AkFwHbrpCv/XjSLYUydxY6HUfYkE3kfS/xbUMx0IwE94HqJ7Pqp5OXC8HoUw+EygmDSLAHMscWQWOIY6in1qLtfy8Wb6/m9kq8scEoLeVIUwh6d/EUqA0rrGT6qgMmMwh673PVCoL8erWr/fotruU9DO7pR/ahseGX4OMjIWdmPBA7cItz+UBvsNZ78uaGOtWQUuOblreGJ5RzMCrrbg1hwAIVKFK84ftzsYskFWq9PBysHatvGc83wX/1jOx6paNNs7W2wNjCUtTeGMPc85dLqBAv5LrN7lJkhw+vL5gr8bjSRDkcIKDqVzajK4cSUHb0Un4tu217IOW6SdB9zjfGxr146FNvD1+zcuz5kb/o9v/pZqaoiK3cwed03M7oQFoXDHw7LcljLuDft6TpIk22kWbBJk3a4Bb4EyJUoavpqDnWSuHV8XjOR7VTW+DdoTzOflIMeU9x/VvsxI0Pg8/NQzFGV3WewQqsHH35/onScfRd/E2cueyNhCllBTagPf4eZIydnKqprSdaIROvD4MQELjRC/dhqFHTxw8BCuChPzpc90Jz32F5cFVlBZlVY+gLlgXBC7Qk5lasLlWSG3xPDyySrMA4k/2+RONASEHlNVyauj9dUdwcUPgJIfmiy93QC3iXhNQUGpmk5PCb78FD/PMyslNKNgnugf9zcrPjjQI5AXon0HXkaQe4IizxEyKx/nBAEShCuYjtM7s54zOmxS2g5yvlI5AVVmupJyW1yWAId79mxkod0KRX7GgsDBTZST6Hd24aBSmFS7Axwjms6hSTecJ+FGgSv8RwTlI1CcjaYKWB3xnmSte9Ea001cDXgnSSqGhK8p1tq1CsJaHDVjISk5d1zZiSKqzKyEbQTuA8CFLMnxo2O/MwVRu5hYVRHzHpvQ62ZjBqWMrWTTTsbIiq9Rv7zGrGbmXVLo7Q7pRFo5V0iQhznt2YsyvNszoae3e7JavRulurTAKg56tfw3Y5UDvpWlrfrQ6bPNjebRuX6aqmJ+siPZKJ/ilMsmR0Q2EVCO2EgS8Xgkfv02oC4fxeYkVxZp4ZQQi9PiDqINfTWr6+QvYQUdK0aciy0mHvD+Tpa24VQxulyyHK7PsFcTeKKMRZdO8AfbR/GW6i/AtgLTMufXWiwPFkdXwQsBE/ZjKSQDmeVuAVZhPEc8p7pC++Gvq42PS2cZd4cIjLdPYF38v2+cYUja4tSmAYm+5WSh2V0fUAgSkBVOxqz+wUPdS6NJqooDY1G0+VrD56kGEaUj11CEXhq213cKNEmZXGpidMF3nVDIvuAT14MneT9ymS5Bm2J2POiYa1zPtydEAPLAcRWEe6k9auV6SmOSheuk9VgmvA9xbtfkQNLkPFoxc4rCSY/xhLmH0NWMss0Lg6bRW9E7ky+z8xu+RaD38W6eP6FZtOqOsG6Eey4lYSUAPd86mDwaWheIf0ijpTF+LZ8uhKTvSEdPsFp+U8nKTIkE6DTEWS6GeJn25IWr9aZQ7W/pR1tlBjhVIC3nIQOAymNKuyqfpkBQOLMRCCnxPjeQIeKO4otpmtnH1M2LEj2wPpaHh461ZGyYJIw/yGwBP9Fyf/sCcP1okOPUlGrr6Y7S8gvc2gL1oVTMhRTQtoHJa0tcXb7nHoUJSKWzNszv51CiD1dIweBuXtemGHKTj8iFqFOu5Q/sTVujcTW7U0mWHAQoSmdQfA49Eym1vjFHHXZg4m6am3Q5thjK5cILOXV1DHNdPfNfJIkYktv+psEthJ2VScd005N6fP6tVwXgGBvo6qj/+fY3SCLgJkbKiHlNkstB6S/CE7+BOrbfwgDVTJIxTub1s0tuKxKuZj+0zyMoYXdAGFKIYkAQyoduoRoYBZbQAwi+n3SqWoDg4URXLyBEcOZ9I2sMv9ZxZlxMUlbhTuav+cpYB6n5A/z1qPUHeUmT4oEWoS+r+0CydiBBYwVUDcdylHPqr/wg6fgIECmrLu3lnsq/+6RdNZeXfMEQKmah5skFpp5TUfD/MTiT7NUGsrOzgCSnXXKn/66WB6of1uV+lvKDg2t0wEXgRQ79DYtMrmIbwn/XCfJsa2CySVP2jqaVmn5lVxuQkxRKzbyiRixweyKztbqorMGkWqCwdpFEL+A+KEHhxrZznJzuHke7kXvtTNXsVxWB1x/07aQikFn///6N6Z3JM66p9Qaex7y4XAACsEQ0f19PGfqYnKcpA2bauUsMhlECBtuqwKFICY4IkeLanIKBOM5ETJPeQ8pIUPYDRX3yfngGHvIj6NCwsS4GOAkgMd4DvCgfCm2XKp3bg6jTVKnMi1hn2xrJchDki8er+713LgjF/U1htLYdfBE2a90YKXtifl0Phy8b7JYlf4RyUp6pKSfQeDw0knMjriPQXeTzNarHQOpZHwFk/7OuH1aojnfsKnP86UFIh3x/PSYz7q+gxvtEE62e44i9BSz8Bj8HTWcvjslE/vHPK/efOJfy4ielCZunq/CpW66+w5NNSeUJpgukJRJUHTE9GoImrM/ag1RqA4MluZ3LjPIfT+Z/L00t9hOKtSX5pTC7vC84yMDO0k47dXj4hTKI5bf99X9LXxd5YsXgwN8fppjs+Z8fIF0upqFn0SpAhbuaPI+0MyoW6uhrQUC2W/4kVxM1y3NgziK49HcVuhO84+MP28KCwhb0vTrLKxrgHR37SbjpAJgDMroKJ4hlg7IT9I2WkygoSIgSwIY5Df5Tea+WCn5N08PQFLvGKlgS11qHl6Wd+YWyNY7j24iZpd+VFetWDrC0m3eJU8ZLsRcV7RS3pBctAOACi81JRi0qmemqnIchOtocqSDfWl9YI+qCEl/IIXdNCOcS/EBERbDiO32nQt1UI9UWnBiBgC27NJvV95p+/6Sd9brNJ3A+9aJ1qG5YFglLf1aoGXSb6h/XMoHe6Gb3uLwbkAxbXpbLuNoCCtwOgAThqZ7TJM+lG90XyJxf8lfnQj8wpNuq46qi66h3fbuwj9ikAFHJE8KUpp7rpV5akfDKqNBCGnZFWemK9lmZXtVybm7O9oKqUgzjnonTS5fpq4iXElg2mMsMga9YCjtWf3OpeJi2DKt2+hEdagF6K4SVl3iv+zTNqRaagHVu52PlopaSDOKZuoIQA2BOw8CzDvNdjG6ZRa6cmDNCI8jIjcqGxf5Q7e1iul54a3XMWTqZIHIY6crfRv25n96MiD+9BldXehVn0lhvNMwX+hurEpOyuFtF55bsg4YdS4I+Z4Ih+BJaReJjeRKHGQ4IvqEHiCQys2uLXVpKG+EFa7zAL+ITRI3omZuG/ZPdJ2mJRKz3+GKJY+imkTOFX+2K6cpsli/s3/zXTuPTuiYoO+1Mnpv0hDdsFfpskxguRZMNwNJZqOVdoaCVufK2gn/WyZiP2UEcILiiKRkhr4SYPrAqWNGAvE1z8O6aV2GW2wzoxwGfqwuPenaymqkCBSNmeTJW1E/aOJ/ZKmuVa/4iFFQiIly0suJbVIh4bCY/CbyY9dYOz9d45yPtVR1zaMYhdH1H5pw+P+bXE93YVCVYpRxcUCKSEpsfHLC+GaAfd5WTZtCNJlEXn5E52n6wFE2w1fLSk6RIhXohcx8diidE6N2FPAf9RVLJIgrQqptP89DVxmWnHG6hORiPkyxkPS0/xRjTrHt3Nh5iEFqVBnlR0HEb7C/3hrIku3IfSq9oMHW9/vqJViykkttbiKn9KcSyTUqDW6BkoFZ57MKIWDyYYv3l7MNJj507ekNlnHKogyWdTibtYUneVDaDwna314fUV5v1GFstxuVljRxUVh99XRaef0bZVSkZMTdHcTsRWHzBLsD7ed7pDGqLSvVzmbyvFu/OiR0B5+hZnO0ZjWm1ffbu+Gjw1zfak7uFUqCbXVDVOWisPK5YRu5iQ/3Vv2EyJ3rrN7ue76FbE/GibRk5MjXneGsqZZ2aZi2axrAulv7K05U1Qjmv6Xde4Pc/8xOOcOdOdKLxgRia00iZc0U+ZzmrtJCfKVA0o/GIiMwGh/Ppuh6jl10Y9gjsuzxtc3vzCJFuh/828PhLHDZlR9v0Gz0YK/bCxMO3rfu1BTuj27/VzwGyzRfSyq13Zl8Lp0d+nX2M4oHIhv4xmkyGGDwbGnnj2SloNPlGkY03EA48sf3HsdD87Vw75s3SkUwjOc4hcqwC/nBfNwi4uLvNhUpMLSWCl6/uvYXV3uTB49halhjRNxqKFAlu5Q6yMfJqgkx9nPw39niNaq48oVYUZ3yqJeMOOjgtbnAI37p0gv9g8DhV2iPZWqq7PsVE5cR2qlshJ7qNimN5xGk2ARktOi3zId32t7lesMAy1Csr+HgJtHpspwZYmaL3lpJDJgq7DBRSzBejjTyJHg+CeE0luo061JeA4InAyWns/PnZB+SDc/VKvSh5v9A78DKUPdEYG4zhf37+BJaBjCpgcnjUjqiyps6aXQzEVX2ZOd8Cvpos8QPcyToKF5Jp6LhFZwsbbND2q8oHnavyZYFDWdzdPZVxghw/rt9L5IV0Wrrnp06jEjmnjA4X2zIk+pbdPqI3T1ATcCb77qsItk3gjTUrffQBcX2wIN5hcjH8w9Ypq/JMgtrDJeoaUk/MQbrQcTrsnc/W+NhM95wUyxrvhNVxqRA6cij2T2GCLxN3GG4O68uncyYRhQVwb/p+FE22Z1YJQ0Q87LJ/N0wIKdNELhtFtGTinWnMS+vZZ0G0YqU6TsgZAIs1KE3vykU2jdfXIQomgMjBVM6Q+pEUaiBkZPOZBc0+WWWOZQJlBOjAFvyP/87plYvwCR2fmab/dI5jkPr4hsXvAT/1Whkni/uoPMHb53hm38B5OoDXpaAOb6biGMS22mVI5hjt5F8sYVn75u6e9MRI3ShWuG/DDLTfIlKbgxDRIs3cr/x+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); + } + + @Test + public void test021231(){ + String publicKey="0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; + String privateKey="9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e"; + + BuyHouses buyHouses = buyHousesMapper.selectById("41"); + Map map = BeanUtil.beanToMap(buyHouses); + String virtualcode = String.valueOf(map.get("virtualcode")); + map.put("virtualcode", virtualcode == "3" ? "010" : "009"); + String cardType = String.valueOf(map.get("cardType")); + map.put("cardType", "中国籍".equals(cardType) ? 1 : 4); + map.put("qyStatus", "4"); + map.put("gyStatus", "4"); + map.put("shStatus", "4"); + map.put("buyHousesMemberList", "null"); + map.put("buyHousesLogList", "null"); + map.put("buyHousesLogList", "null"); + String prettyStr = JSONUtil.toJsonPrettyStr(map); + System.out.println("prettyStr = " + prettyStr); + List buyHousesMembers = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, buyHouses.getId())); + buyHouses.setBuyHousesMemberList(buyHousesMembers); + String s = JSONUtil.toJsonPrettyStr(buyHouses); + + String doEncrypt = Sm2.doEncrypt(s, publicKey); +// System.out.println("doEncrypt = " + doEncrypt); + String doDecrypt = Sm2.doDecrypt(doEncrypt, privateKey); +// System.out.println("doDecrypt = " + doDecrypt); + String result2 = HttpRequest.post("http://192.168.0.54:8084/user/house/insertOpenBuyHouses") + .header("Referer","http://192.168.0.54:8084") + .header("path","/user/house/insertOpenBuyHouses") + .header("method","POST") + .body(doEncrypt,"application/json") + .execute().body(); + System.out.println("result2 = " + result2); + } + + //String privateKey="9cefdfcb925a32e10206d3a693ba204632c59e5f9a171faebb814885191dd35e"; + @Test + public void test0212311123123(){ + String publicKey="0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; + HashMap map = new HashMap<>(); + map.put("username","o6Jx05A8ze3Icr6KC59n8I0DBp14"); + map.put("apiKey","gaoxingongyuanchengshiju"); + String s = JSONUtil.toJsonPrettyStr(map); + String doEncrypt = Sm2.doEncrypt(s, publicKey); + String result2 = HttpRequest.post("https://rcaj.cdhtgycs.cn/gx-api/userOpenLogin") + .header("Referer","https://rcaj.cdhtgycs.cn") + .header("path","/userOpenLogin") + .header("targe","weixin") + .header("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJhcHBfdXNlcjo0Mzc4OSIsInJuU3RyIjoiV05XZFFnaHpHYlRRRU5ObVpwbmhaaFp6MmtKaWtSR0MiLCJ1c2VySWQiOjQzNzg5fQ.QCsN3iIFk38dzTvXITGx2wV5c9kdPdvWZs7gjf6dFzc") + .header("method","POST") + .body(doEncrypt,"application/json") + .execute().body(); + System.out.println("result2 = " + result2); + } + + /** + * 查看日志接口 + */ + @Test + public void test0002(){ + String publicKey="0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; +// String publicKey="04eea960591fff39b445b289faf56f755a1c895de57dfa3ca6ab2c84d2b5429cad1444809d941e4a0ed168bd226d0bf28a016389f26ea8506039da5db6a93a79f6"; + HashMap map = new HashMap<>(); + map.put("businessId","2819");//用户标识符 + map.put("apiKey","gaoxingongyuanchengshiju");//使用方唯一key + String s = JSONUtil.toJsonPrettyStr(map); + String doEncrypt = Sm2.doEncrypt(s, publicKey); +// String result2 = HttpRequest.post("https://dbxqtalents.cn/gx-api/user/stepProcessPlan") + String result2 = HttpRequest.post("http://127.0.0.1:8084/user/stepProcessPlan") + .header("Referer","https://dbxqtalents.cn/gx-api") + .header("path","/user/stepProcessPlan") + .header("targe","weixin") + .header("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJzeXNfdXNlcjoxIiwicm5TdHIiOiJUNjZNSjBIckwzcjF1YkFsQlFTem4yNTdjdDhTc2l2cyIsInVzZXJJZCI6MX0.qbEbSQ7ZElegj_1-BKs3xzDfBuZHBItQzJkNaMv0Lrs") + .header("method","POST") + .body(doEncrypt,"application/json") + .execute().body(); + System.out.println("result2 = " + result2); + } + + /** + * 新增或者修改接口 + */ + @Test + public void test0003(){ + String publicKey="0435661bb2d13bba88f47af0bbe243fcded8f27ac298932661787f88ea283c2b31fe427e1aa8410826a963e9114fe5ffab4ad278aeeb7f1f161e735d1f50570e78"; + HashMap map = new HashMap<>(); + map.put("username","15808234569"); + map.put("apiKey","gaoxingongyuanchengshiju"); + String s = JSONUtil.toJsonPrettyStr(map); + String doEncrypt = Sm2.doEncrypt(s, publicKey); +// String result2 = HttpRequest.post("https://dbxqtalents.cn/gx-api/userOpenLogin") +// String result2 = HttpRequest.post("http://192.168.0.54:8084/userOpenLogin") + String result2 = HttpRequest.post("http://ljlcom.gnway.cc/userOpenLogin") + .header("Referer","https://dbxqtalents.cn/gx-api") + .header("path","/userOpenLogin") + .header("targe","weixin") + .header("Authorization","Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJhcHBfdXNlcjo0Mzc4OSIsInJuU3RyIjoiV05XZFFnaHpHYlRRRU5ObVpwbmhaaFp6MmtKaWtSR0MiLCJ1c2VySWQiOjQzNzg5fQ.QCsN3iIFk38dzTvXITGx2wV5c9kdPdvWZs7gjf6dFzc") + .header("method","POST") + .body(doEncrypt,"application/json") + .execute().body(); + System.out.println("result2 = " + result2); + } + + /** + * 图片导出 + *

+ * 1. 创建excel对应的实体对象 参照{@link ImageDemoData} + *

+ * 2. 直接写即可 + */ + @Test + public void imageWrite() throws Exception { + String fileName = "E:\\"+ System.currentTimeMillis() + ".xlsx"; + + // 这里注意下 所有的图片都会放到内存 暂时没有很好的解法,大量图片的情况下建议 2选1: + // 1. 将图片上传到oss 或者其他存储网站: https://www.aliyun.com/product/oss ,然后直接放链接 + // 2. 使用: https://github.com/coobird/thumbnailator 或者其他工具压缩图片 + String imagePath = "https://gx.chengdutalent.cn:8010/upload/GXTalents/images/f264ec41dcfb47b9b6ef231441d3123b.png"; + try { + List list = ListUtils.newArrayList(); + ImageDemoData imageDemoData = new ImageDemoData(); + list.add(imageDemoData); + // 放入五种类型的图片 实际使用只要选一种即可 +// imageDemoData.setByteArray(FileUtils.readFileToByteArray(new File(imagePath))); +// imageDemoData.setFile(new File(imagePath)); +// imageDemoData.setString(imagePath); +// imageDemoData.setInputStream(inputStream); + imageDemoData.setUrl(new URL( + "https://gx.chengdutalent.cn:8010/upload/GXTalents/images/f264ec41dcfb47b9b6ef231441d3123b.png")); + + // 这里演示 + // 需要额外放入文字 + // 而且需要放入2个图片 + // 第一个图片靠左 + // 第二个靠右 而且要额外的占用他后面的单元格 + /*WriteCellData writeCellData = new WriteCellData<>(); + imageDemoData.setWriteCellDataFile(writeCellData); + // 这里可以设置为 EMPTY 则代表不需要其他数据了 + writeCellData.setType(CellDataTypeEnum.STRING); + writeCellData.setStringValue("额外的放一些文字");*/ + + /*// 可以放入多个图片 + List imageDataList = new ArrayList<>(); + ImageData imageData = new ImageData(); + imageDataList.add(imageData); + writeCellData.setImageDataList(imageDataList); + // 放入2进制图片 + imageData.setImage(FileUtils.readFileToByteArray(new File(imagePath))); + // 图片类型 + imageData.setImageType(ImageData.ImageType.PICTURE_TYPE_PNG); + // 上 右 下 左 需要留空 + // 这个类似于 css 的 margin + // 这里实测 不能设置太大 超过单元格原始大小后 打开会提示修复。暂时未找到很好的解法。 + imageData.setTop(5); + imageData.setRight(40); + imageData.setBottom(5); + imageData.setLeft(5); + + // 放入第二个图片 + imageData = new ImageData(); + imageDataList.add(imageData); + writeCellData.setImageDataList(imageDataList); + imageData.setImage(FileUtils.readFileToByteArray(new File(imagePath))); + imageData.setImageType(ImageData.ImageType.PICTURE_TYPE_PNG); + imageData.setTop(5); + imageData.setRight(5); + imageData.setBottom(5); + imageData.setLeft(50); + // 设置图片的位置 假设 现在目标 是 覆盖 当前单元格 和当前单元格右边的单元格 + // 起点相对于当前单元格为0 当然可以不写 + imageData.setRelativeFirstRowIndex(0); + imageData.setRelativeFirstColumnIndex(0); + imageData.setRelativeLastRowIndex(0); + // 前面3个可以不写 下面这个需要写 也就是 结尾 需要相对当前单元格 往右移动一格 + // 也就是说 这个图片会覆盖当前单元格和 后面的那一格 + imageData.setRelativeLastColumnIndex(1);*/ + + // 写入数据 + EasyExcel.write(fileName, ImageDemoData.class).sheet().doWrite(list); + }catch (Exception e){ + throw new RuntimeException(e); + } + } + + @Test + public void test0121123(){ + HashMap hashMap = new HashMap<>(); + hashMap.put("id","3212"); + hashMap.put("status","00D"); + hashMap.put("description","测试"); + hashMap.put("auditDepartName","数字经济局功能区建设推进处"); + housingConstructionBureauPushDto.send3(hashMap,"https://www.cdhtrct.com/route/open/api/anju/openBuyHousesCallback"); + } + + @Test + public void test15234523(){ +// providerCustomer.sendDelayMsg("延迟队列测试",3); + String msg ="我来了"; + /* MessageProperties messageProperties = new MessageProperties(); + messageProperties.setHeader("x-delay",5000);//延迟5秒被删除 + Message message = new Message(msg.getBytes(), messageProperties); + amqpTemplate.convertAndSend("PLUGIN_DELAY_EXCHANGE","delay","123132");//交换机和路由键必须和配置文件类中保持一致 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + System.out.println("消息发送成功【" + sdf.format(new Date()) + "】");*/ +// orderService.makeOrder(); + } + + @Test + public void testt12333(){ + double div = NumberUtil.div(28, 3000); + System.out.println("div = " + div); + String s = NumberUtil.decimalFormat("#.##%", div); + System.out.println("s = " + s); + //获取二期认定通过人才数 + /*List housesReviewList = housesReviewMapper.selectList(new LambdaQueryWrapper<>(HousesReview.class) + .eq(HousesReview::getProcessStatus, Constants.SUCCEED)); + //获取本月复审通过数 + Date date = DateUtil.date(); + //获得月份,从0开始计数 + int month = DateUtil.month(date); + housesReviewList.forEach(h ->{ + int month1 = h.getPassTime().getMonth(); + System.out.println("month1 = " + month1); + String s = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, h.getPassTime()); + System.out.println("s = " + s); + });*/ +// List collect = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == month).collect(Collectors.toList()); +// System.out.println("collect = " + collect); + } + + /** + * 获取公钥和私钥 + */ + @Test + public void test0004(){ + /*Keypair keypair = Sm2.generateKeyPairHex(); + String publicKey = keypair.getPublicKey(); + System.out.println("publicKey = " + publicKey); + + String privateKey = keypair.getPrivateKey(); + System.out.println("privateKey = " + privateKey);*/ +// String substring = DesensitizedUtil.idCardNum("510503199602214055", 4, 0).substring(0, 9); +// System.out.println("card = " + substring); + + String str ="https://gx.chengdutalent.cn:8010/upload/GXTalents/images/a6b742bc7843405da406b0159179dcfd.jpg"; + String substring = str.substring(str.lastIndexOf("/") + 1); + + String txt ="https://rcaj.cdhtgycs.cn/images/2023/07/01/"+substring; + buyHousesService.excelZip(""); + System.out.println("txt = " + txt); + + } + + @Test + public void TestMessageAck() throws UnsupportedEncodingException { + + String msg="A 类"; + String trim = StringUtils.trimAllWhitespace(msg); + int length = trim.length(); + System.out.println("length = " + length); +// Message build = MessageBuilder.withBody(msg.getBytes()).build(); +// build.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT); +// build.getMessageProperties().setDelay(50000); +// amqpTemplate.convertAndSend(TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_EXCHANGE,TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_KEY,build); + } + + @Test + public void testPush() throws ParseException { + Map map = WorkUtils.getInfoToMap("buy_houses","3218"); + String virtualcode = String.valueOf(map.get("virtualcode")); + map.put("virtualcode", virtualcode == "3" ? "010" : "009"); + String cardType = String.valueOf(map.get("nationality")); + map.put("cardType", "中国籍".equals(cardType) ? 1 : 4); + Object createTime = map.get("createTime"); + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); + DateFormat cst = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date format = sdf.parse(createTime.toString()); + String dateString = cst.format(format); + map.put("qyStatus", "4"); + map.put("creatTime",dateString); + map.put("gyStatus", "4"); + map.put("shStatus", "4"); + map.put("buyHousesMemberList", "null"); + map.put("buyHousesLogList", "null"); + String s = housingConstructionBureauPushDto.openUrl("https://171.221.172.13:8088/CCSRegistryCenter/rest", map, "253"); + } + @Test + public void testOut(){ + BuyHouses buyHouses = buyHousesMapper.selectById(3218); + Map map = new HashMap<>(); + map.put("id",buyHouses.getId()); + map.put("reason","人才主动提交");//原因 + map.put("userName",buyHouses.getUserName()); + map.put("cardId",buyHouses.getCardId()); + map.put("cancelTime", DateUtils.dateTime("yyyy-MM-dd HH:mm:ss")); + map.put("note","人才主动撤销");//备注 + map.put("status", "00N"); + System.out.println("JSONUtil.toJsonPrettyStr(map) = " + JSONUtil.toJsonPrettyStr(map)); + housingConstructionBureauPushDto.openUrl("https://jcfw.cdzjryb.com/CCSRegistryCenter/rest",map,"254");//正式 + } + + @Test + public void paChon() throws Exception { +// R rInfo = OpenUtils.getGaoXinCardInfo("510503199602214055"); +// System.out.println("rInfo = " + rInfo); + String s = com.ruoyi.common.utils.StringUtils.toUpperCase("510503199602214055l"); + System.out.println("s = " + s); +// buyHousesService.logout("3184"); + +// R gaoXinCardInfo = OpenUtils.getGaoXinCardInfo("510503199602214055"); +// System.out.println("JSONUtil.toJsonPrettyStr(gaoXinCardInfo) = " + JSONUtil.toJsonPrettyStr(gaoXinCardInfo)); + /* String appsecret ="JXYB7KpXlH9i0CL6"; + String aesKey = "74242EAFE97F18BFAE9D2682590B6614"; + String iv = "74242EAFE97F18BF"; + String id="2023062804031"; + String url ="http://162.14.100.54:9010/index.php/Api/renju/get_user_info"; + AES aes = new AES(Mode.CBC, Padding.PKCS5Padding,aesKey.getBytes(),iv.getBytes()); + String param=aes.encryptBase64( + new JSONObject() + .set("id_card","510503199602214056") + .toStringPretty()); + MD5 md5 = SecureUtil.md5(); + String content=id+param+appsecret; + String sign=md5.digestHex(content); + JSONObject jsonObject = new JSONObject() + .set("id",id) + .set("param",param) + .set("sign",sign); + String listContent = HttpRequest.post(url) + .body(jsonObject.toStringPretty()) + .execute() + .body(); + System.out.println("listContent = " + listContent);*/ + + } + + @Test + public void test45656() { + HttpRequest.get("https://rcaj.cdhtgycs.cn/gx-api/user/house/excelZip?id=3136") + .header("Referer", "https://rcaj.cdhtgycs.cn") + .execute() + .body(); + } + + @Test + public void testtttt(HttpServletResponse response) throws IOException { + response.sendRedirect("https://dbxqtalents.cn/111.html"); + + } } + diff --git a/ruoyi-admin/src/test/java/com/ruoyi/test/HttpReq.java b/ruoyi-admin/src/test/java/com/ruoyi/test/HttpReq.java new file mode 100644 index 000000000..4f871b9a3 --- /dev/null +++ b/ruoyi-admin/src/test/java/com/ruoyi/test/HttpReq.java @@ -0,0 +1,179 @@ +package com.ruoyi.test; + +import cn.hutool.http.HttpUtil; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Node; +import org.jsoup.select.Elements; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class HttpReq { + + //private OkHttpClient client = new OkHttpClient(); + private final Request.Builder builder = new Request.Builder(); + private final OkHttpClient client = new OkHttpClient.Builder() + .readTimeout(30, TimeUnit.SECONDS) + .connectTimeout(30, TimeUnit.SECONDS) + .writeTimeout(30, TimeUnit.SECONDS) + .build(); //设置各种超时时间 + + /** + @param isAddXuexinHeader 是否加入学信网header到请求头 + */ + public HttpReq(boolean isAddXuexinHeader){ + if (isAddXuexinHeader == true){ + builder.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); + builder.addHeader("Accept-Encoding","gzip, deflate, sdch, br"); + builder.addHeader("Accept-Language","zh-CN,zh;q=0.8"); + builder.addHeader("Cache-Control","max-age=0"); + builder.addHeader("Connection","keep-alive"); + builder.addHeader("Host","my.chsi.com.cn"); + builder.addHeader("If-Modified-Since","Tue, 13 Mar 2018 10:14:31 GMT"); + builder.addHeader("Upgrade-Insecure-Requests","1"); + builder.addHeader( "User-Agent","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36"); + } + } + + /** + @param cookie 加入cookie到请求头 + */ + public void addCookieToHeader(String cookie){ + builder.addHeader("cookie",cookie); + } + + /** + @param url get请求的url + */ + public String get(String url) { + builder.url(url); + final Request request = builder.build(); + try (Response response = client.newCall(request).execute()) { + return response.body().string(); + }catch (Exception e){ + e.printStackTrace(); + return ""; + } + } + + /** + @param url 图片的地址 + * */ + public void savePicture(String url) { + builder.url(url); + final Request request = builder.build(); + try (Response response = client.newCall(request).execute()) { + byte[] bt = response.body().bytes(); + byte2image(bt, "./xueji.png"); + }catch (Exception e){ + e.printStackTrace(); + } + } + + private void byte2image(byte[] data,String path){ + try { + File file = new File(path); + FileOutputStream fos = new FileOutputStream(file); + fos.write(data, 0, data.length); + fos.flush(); + fos.close(); + System.out.println("保存图片成功。。"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + public static void testBaidu(){ + HttpReq baiduHttp = new HttpReq(false); + String respStr = baiduHttp.get("http://www.baidu.com"); + System.out.println(respStr); + } + + public static void main(String[] args) { + // testBaidu(); +// HttpReq xuexinHttp = new HttpReq(true); +// xuexinHttp.addCookieToHeader("aliyungf_tc=a44cd76725072e97c6625bc216dcf07870bb8f59efdab8e85142cd2903f45841; acw_tc=707c9f7216885291604143483e1ffdbde1d42ca14b99ec2b9ec8d2c48e0eb1; JSESSIONID=92648EE2F4820DEDD6FB627E7F9DFABE; CHSICC_CLIENTFLAGCHSI=d6d1556d12784a270db64720aa7652f7; goaYXsyEWlxdO=60.I6m8rZy8fEGYpPmjsxJzcQD7H_fstonBF3XyGvvyhDh1_7c_JIFFrAfHsmKk6KtOVWbM2ztenFjMrPRSWIm1a; Hm_lvt_9c8767bf2ffaff9d16e0e409bd28017b=1688529126; zg_did=%7B%22did%22%3A%20%22189242dc17d992-0d47d539a4c70c-3d267449-144000-189242dc17e9f3%22%7D; _gid=GA1.3.678250233.1688529126; CHSICC01=!bLuJc+pYd0Ah1bvzYxYLahOzddj6Y5Wo66QcNq34LuAZUVPejROt5X6Oa37p4b53SrFxCblP8+yMsQ==; zg_14e129856fe4458eb91a735923550aa6=%7B%22sid%22%3A%201688529125761%2C%22updated%22%3A%201688529387258%2C%22info%22%3A%201688529125764%2C%22superProperty%22%3A%20%22%7B%7D%22%2C%22platform%22%3A%20%22%7B%7D%22%2C%22utm%22%3A%20%22%7B%7D%22%2C%22referrerDomain%22%3A%20%22%22%7D; Hm_lpvt_9c8767bf2ffaff9d16e0e409bd28017b=1688529387; _gat_gtag_UA_100524_1=1; _ga_8YMQD1TE48=GS1.1.1688529126.1.1.1688529387.0.0.0; _ga=GA1.1.2127309674.1688529126; goaYXsyEWlxdP=0jBX.aMEoAQAFi9Gmc9MppqIgDOlO8y_aQsmwyuvCdpbPOREblHy3rBYZ3akqvFSvw4wcAomCzMD_pFYl8MVkZ2D23rBjUNOxrqv.5iDjY66XvY1Pna6naF2xfKgvnvDTi5eOmrfSMgXiCW0EXcoGodkTJzbf6zmAqNcyw9aqpiBX980BsYj_Cgp5dDZvXxPK6yti7dHIQ_Oc7fWCOHPmjc7fRt.Xb0WxDqaQ7nQHckj9in8oSZf6uK6M5cjzp804QvVOiUoBq07KdCj_jVLIJndVclyF8iiT5Y5ytnCRogjhcgk_iGonLzXlugXQ7gfCbLlgqtmvJCIkhX99I0PwWYJ_Y5xuQuDhUM7kfwqBJSxm6MrozS7XHgvpKxTtg7pwg07awfezZWbh4ZCNidpXf5E90ppv4hFizfKH7ZUgQ0a"); //由webview执行js返回。 +// xuexinHttp.savePicture("https://www.chsi.com.cn/xlcx/bg.do?vcode=AA33TE9X16WA202D&srcid=bgcx"); //由webview执行js返回。 + String s = HttpUtil.get("https://www.chsi.com.cn/xlcx/bg.do?vcode=AA33TE9X16WA202D&srcid=bgcx"); + parseXueJi(s); + + } + + /** + * 学籍解析 + */ + private static void parseXueJi(String strHtml) { + Document doc = Jsoup.parse(strHtml, "UTF-8"); + Elements eleDiv2 = doc.getElementsByClass("report-info"); + if (eleDiv2 != null && !eleDiv2.isEmpty()) { + Elements eleTd = eleDiv2.get(0).getElementsByTag("div"); + String text = eleTd.get(4).text(); + /* if (eleTd != null && !eleTd.isEmpty()) { + StuInfo stuInfo = new StuInfo(); + // 姓名是图片,调用腾讯API实现ocr识别 + String nameImg = eleTd.get(1).getElementsByTag("img").get(0).attr("src"); + stuInfo.setName(aiOcr(nameImg)); + stuInfo.setGender(eleTd.get(4).text()); + stuInfo.setIdCard(eleTd.get(6).text()); + stuInfo.setNation(eleTd.get(8).text()); + stuInfo.setBirthDay(eleTd.get(10).text()); + stuInfo.setUniversity(eleTd.get(12).text()); + stuInfo.setLevel(eleTd.get(14).text()); + stuInfo.setDepartment(eleTd.get(16).text()); + stuInfo.setSClass(eleTd.get(18).text()); + stuInfo.setDomain(eleTd.get(20).text()); + stuInfo.setStuNum(eleTd.get(22).text()); + stuInfo.setForm(eleTd.get(24).text()); + stuInfo.setEntranceDate(eleTd.get(26).text()); + stuInfo.setLenOfSchooling(eleTd.get(28).text()); + stuInfo.setType(eleTd.get(30).text()); + String[] status = eleTd.get(32).text().split("\\("); + stuInfo.setStatus(status[0]); + stuInfo.setGraduationDate(status[1].substring(0, status[1].length() - 1));*/ +// return stuInfo; +// } + } +// return null; + } + + /** + * 学历解析 + */ + /*private static StuInfo parseXueLi(String strHtml) { + Document doc = Jsoup.parse(strHtml, "UTF-8"); + Elements eleDiv2 = doc.getElementsByClass("div2"); + if (eleDiv2 != null && !eleDiv2.isEmpty()) { + Elements eleTd = eleDiv2.get(0).getElementsByTag("td"); + if (eleTd != null && !eleTd.isEmpty()) { + StuInfo stuInfo = new StuInfo(); + // 姓名是图片,调用腾讯API实现ocr识别 + String nameImg = eleTd.get(0).getElementsByTag("img").get(0).attr("src"); + stuInfo.setName(aiOcr(nameImg)); + stuInfo.setGender(eleTd.get(2).text()); + stuInfo.setBirthDay(eleTd.get(3).text()); + stuInfo.setEntranceDate(eleTd.get(4).text()); + stuInfo.setGraduationDate(eleTd.get(5).text()); + stuInfo.setType(eleTd.get(6).text()); + stuInfo.setLevel(eleTd.get(7).text()); + stuInfo.setUniversity(eleTd.get(8).text()); + stuInfo.setLenOfSchooling(eleTd.get(9).text()); + stuInfo.setDomain(eleTd.get(10).text()); + stuInfo.setForm(eleTd.get(11).text()); + stuInfo.setCertificateNum(eleTd.get(12).text()); + // 状态是图片,调用腾讯API实现ocr识别 + String statusImg = eleTd.get(13).getElementsByTag("img").get(0).attr("src"); + stuInfo.setStatus(aiOcr(statusImg)); + stuInfo.setPresident(eleTd.get(14).text()); + return stuInfo; + } + } + return null; + }*/ +} diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index b1ae8c99c..477d9088b 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -165,6 +165,62 @@ ip2region + + commons-fileupload + commons-fileupload + + + + commons-io + commons-io + 2.11.0 + + + + + com.deepoove + poi-tl + 1.12.1 + + + + + com.antherd + sm-crypto + 0.3.2 + + + + + org.jsoup + jsoup + 1.15.4 + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/advice/DecodeRequestBodyAdvice.java b/ruoyi-common/src/main/java/com/ruoyi/common/advice/DecodeRequestBodyAdvice.java new file mode 100644 index 000000000..4c26b5bc5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/advice/DecodeRequestBodyAdvice.java @@ -0,0 +1,151 @@ +package com.ruoyi.common.advice; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.http.useragent.Platform; +import cn.hutool.http.useragent.UserAgent; +import cn.hutool.http.useragent.UserAgentUtil; +import com.ruoyi.common.core.domain.RsaSecurity; +import com.ruoyi.common.core.service.ConfigService; +import com.ruoyi.common.core.service.IRsaSecurityService2; +import com.ruoyi.common.utils.RSAUtil; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +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 +public class DecodeRequestBodyAdvice implements RequestBodyAdvice { + + private static final Logger logger = LoggerFactory.getLogger(DecodeRequestBodyAdvice.class); + private static final IRsaSecurityService2 rsaSecurityService= SpringUtils.getBean(IRsaSecurityService2.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 { + String path = inputMessage.getHeaders().getFirst("path"); + String method = inputMessage.getHeaders().getFirst("method"); + if (ObjectUtil.isNotNull(path)) { + RsaSecurity info = rsaSecurityService.getInfo(path, StringUtils.toRootUpperCase(method)); + if (ObjectUtil.isNotNull(info)) { + if ("1".equals(info.getRestricted())){ + throw new ServerException("接口已限制请求"); + } + if ("1".equals(info.getInDecode())) { + return new RsaHttpInputMessage(inputMessage, info.getPrivateKey()); + } + + } + } + /*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,String privateKey ) 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,privateKey)); + } + + @Override + public InputStream getBody() { + return body; + } + + @Override + public HttpHeaders getHeaders() { + return headers; + } + + public String easpString(String requestData,String targe,String privateKey) throws IOException { + if (requestData != null && !requestData.equals("")) { + if (StringUtils.isEmpty(requestData)) { + throw new RuntimeException("参数【requestData】缺失异常!"); + } else { + String content = null; + try { + logger.info("解密密文:"+requestData); + String substring1 = StringUtils.substring(requestData, 0, 1); + if ("\"".equals(substring1)){ + String data1 = requestData.substring(1); + String substring = requestData.substring(1, data1.length()); + content = RSAUtil.privateKeyDecryptStr(substring,privateKey); + }else { + content = RSAUtil.privateKeyDecryptStr(requestData,privateKey); + } + 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-common/src/main/java/com/ruoyi/common/advice/EncodeResponseBodyAdvice.java b/ruoyi-common/src/main/java/com/ruoyi/common/advice/EncodeResponseBodyAdvice.java new file mode 100644 index 000000000..210ba539e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/advice/EncodeResponseBodyAdvice.java @@ -0,0 +1,95 @@ +package com.ruoyi.common.advice; +import cn.hutool.core.util.ObjectUtil; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.RsaSecurity; +import com.ruoyi.common.core.service.IRsaSecurityService2; +import com.ruoyi.common.utils.JsonUtils; +import com.ruoyi.common.utils.RSAUtil; +import com.ruoyi.common.utils.spring.SpringUtils; +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; + +/** + * @author monkey + * @desc 返回数据加密 + * @date 2018/10/25 20:17 + */ +@ControllerAdvice +public class EncodeResponseBodyAdvice implements ResponseBodyAdvice { + private final static Logger logger = LoggerFactory.getLogger(EncodeResponseBodyAdvice.class); + private static final IRsaSecurityService2 rsaSecurityService=SpringUtils.getBean(IRsaSecurityService2.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) { + // 此处要用反射将字段中的注解解析出来 + String method = serverHttpRequest.getMethod().name(); + String path = serverHttpRequest.getURI().getPath(); + RsaSecurity info = rsaSecurityService.getInfo(path,method); + if (ObjectUtil.isNotNull(info)) { + if ("1".equals(info.getRestricted())){ + return R.fail("接口已限制请求"); + } + if ("1".equals(info.getOutEncode())) { + serverHttpResponse.getHeaders().add("isRsaencrypt","true"); + return encodeRsa(methodParameter, body, info.getPublicKey()); + } + } + serverHttpResponse.getHeaders().add("isRsaencrypt","false"); + return body; + /*if (methodParameter.getMethod().isAnnotationPresent(RsaSecurityParameter.class)) { + //获取注解配置的包含和去除字段 + RsaSecurityParameter serializedField = methodParameter.getMethodAnnotation(RsaSecurityParameter.class); + //出参是否需要加密 + if (serializedField.outEncode()) { + return encodeRsa(methodParameter, body,serializedField.outPublicKey()); + } + } + 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,String outPublicKey) { + try { + String result = JsonUtils.toJsonString(body); + logger.info("对返回数据 :【" + result + "】进行加密"); + String s = RSAUtil.publicKeyEncryptBase64(result,outPublicKey); + logger.info("加密之后密文:"+s); + return s; + } catch (Exception e) { + e.printStackTrace(); + logger.error("对方法method :【" + methodParameter.getMethod().getName() + "】返回数据进行加密出现异常:" + e.getMessage()); + } + return body; + } +} + + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index 0fb2c3f97..d3ae94864 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -41,4 +41,20 @@ public interface CacheConstants { * 登录账户密码错误次数 redis key */ String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; + + + /** + * 注册发送验证码 + */ + String REGISTER_SEND_MSG = "register_send_msg:"; + + /** + * 忘记密码发送验证码 + */ + String RORGOT_PASSWORD_SEND_MSG = "rorgot_password_send_msg:"; + + /** + * 短信登录发送验证码 + */ + String SMS_LOGIN_SEND_MSG = "sms_login_send_msg:"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheNames.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheNames.java index 1396b6d18..ed249987c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheNames.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheNames.java @@ -30,6 +30,9 @@ public interface CacheNames { */ String SYS_DICT = "sys_dict"; + + String RSA_SECURITY = "rsa_security"; + /** * 用户账户 */ 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 e634ed297..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 @@ -72,5 +72,46 @@ public interface Constants { */ String TOKEN = "token"; + /** + * 待提交 + */ + String SUBMIT = "0"; + + /** + * 审核等待中 + */ + String WAIT = "1"; + + /** + * 审核失败 + */ + String FAILD = "2"; + + + /** + * 公式中 + */ + String PUBLICS = "3"; + + /** + * 公式失败 + */ + String PUBLICSFail = "4"; + + /** + * 审核成功 + */ + String SUCCEED = "5"; + + /** + * 取消资格 + */ + String CANCEL = "6"; + + /** + * 数据不存在 + */ + String NONENTITY = "nonentity"; + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index 569c5dafa..6c01ae842 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -121,8 +121,9 @@ public interface UserConstants { /** * 密码长度限制 */ - int PASSWORD_MIN_LENGTH = 5; + int PASSWORD_MIN_LENGTH = 8; int PASSWORD_MAX_LENGTH = 20; + String PASSWORD_Pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).{8,18}$"; /** * 管理员ID 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..6a66d1b0a 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",timezone = "GMT+8") private Date createTime; /** @@ -51,6 +53,7 @@ public class BaseEntity implements Serializable { * 更新时间 */ @TableField(fill = FieldFill.INSERT_UPDATE) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date updateTime; /** 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/core/domain/RsaSecurity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/RsaSecurity.java new file mode 100644 index 000000000..0e33a0e2d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/RsaSecurity.java @@ -0,0 +1,61 @@ +package com.ruoyi.common.core.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 com.ruoyi.common.core.domain.BaseEntity; + +/** + * 请求RSA数据加解密对象 rsa_security + * + * @author ruoyi + * @date 2023-05-17 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("rsa_security") +public class RsaSecurity extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 需要加密的接口 + */ + private String path; + /** + * 入参是否解密,默认不解密 + */ + private String inDecode; + /** + * 出参是否加密,默认加密 + */ + private String outEncode; + /** + * 公钥 + */ + private String publicKey; + /** + * 私钥 + */ + private String privateKey; + + /** + * 请求方式 + */ + private String method; + + /** + * 接口限制请求 + */ + private String restricted; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/GaoXinCardInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/GaoXinCardInfo.java new file mode 100644 index 000000000..cdc77614b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/GaoXinCardInfo.java @@ -0,0 +1,85 @@ +package com.ruoyi.common.core.domain.entity; + +import cn.hutool.core.util.ObjectUtil; +import com.ruoyi.common.exception.ServiceException; +import lombok.Data; +import org.springframework.util.StringUtils; + +import java.io.Serializable; + +/** + * @author Administrator + * 高新人才接口返回所需 + */ + +@Data +public class GaoXinCardInfo implements Serializable { + + /** + * 身份证 + */ + private String card_id; + /** + * 国籍 + */ + private String nationality; + /** + * 姓名 + */ + private String name; + /** + * 手机号 + */ + private String phone; + /** + * 公司名称 + */ + private String company_name; + /** + * 性别 + */ + private String sex; + /** + * 公司所在区域 + */ + private String district; + /** + * 人才类型 + */ + private String type; + /** + * 学历 + */ + private String education; + + + public String getType() { + return type; + } + + public void setType(String type) { + if (ObjectUtil.isNotNull(type) && ObjectUtil.isNotEmpty(type)) { + type = StringUtils.trimAllWhitespace(type); + if (type.length() == 1) { + this.type = type + "类"; + }else { + this.type = type; + } + } + } + + public String getNationality() { + return nationality; + } + + public void setNationality(String nationality) { + if (ObjectUtil.isNotNull(nationality) && ObjectUtil.isNotEmpty(nationality)) { + nationality = StringUtils.trimAllWhitespace(nationality); + if ("中国".equals(nationality)) { + this.nationality = nationality + "籍"; + }else { + this.nationality = nationality; + } + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/StuInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/StuInfo.java new file mode 100644 index 000000000..ae5fba34c --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/StuInfo.java @@ -0,0 +1,95 @@ +package com.ruoyi.common.core.domain.entity; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class StuInfo implements Serializable { + + /** + * 头像 + */ + private String headImg; + + /** + * 姓名 + */ + private String userName; + + /** + * 性别 + */ + private String sex; + + /** + * 证件号码 + */ + private String idCard; + /** + * 民族 + */ + private String nation; + /** + * 出生日期 + */ + private String birthDay; + /** + * 院校 + */ + private String university; + /** + * 院系 + */ + private String department; + /** + * 专业 + */ + private String domain; + /** + * 层次,如本科 + */ + private String level; + /** + * 班级 + */ + private String sClass; + /** + * 学号 + */ + private String stuNum; + /** + * 形式 + */ + private String form; + /** + * 入学时间 + */ + private String entranceDate; + /** + * 学制 + */ + private String lenOfSchooling; + /** + * 类型 + */ + private String type; + /** + * 学籍状态 + */ + private String status; + /** + * 毕业时间 + */ + private String graduationDate; + /** + * 学历证书编号 + */ + private String certificateNum; + /** + * 校长 + */ + private String president; + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index ba4a382c7..99ee336be 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,5 +1,6 @@ package com.ruoyi.common.core.domain.entity; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableName; @@ -27,7 +28,7 @@ public class SysDept extends TreeEntity { /** * 部门ID */ - @TableId(value = "dept_id") + @TableId(value = "dept_id",type = IdType.AUTO) private Long deptId; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java index 4ed2c5483..e050740e4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain.entity; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; @@ -30,7 +31,7 @@ public class SysDictData extends BaseEntity { * 字典编码 */ @ExcelProperty(value = "字典编码") - @TableId(value = "dict_code") + @TableId(value = "dict_code",type = IdType.AUTO) private Long dictCode; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java index 76c20e102..035757cfa 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -2,6 +2,7 @@ package com.ruoyi.common.core.domain.entity; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; @@ -30,7 +31,7 @@ public class SysDictType extends BaseEntity { * 字典主键 */ @ExcelProperty(value = "字典主键") - @TableId(value = "dict_id") + @TableId(value = "dict_id",type = IdType.AUTO) private Long dictId; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index 38bd93659..c29373406 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -1,5 +1,6 @@ package com.ruoyi.common.core.domain.entity; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonInclude; @@ -25,7 +26,7 @@ public class SysMenu extends TreeEntity { /** * 菜单ID */ - @TableId(value = "menu_id") + @TableId(value = "menu_id",type = IdType.AUTO) private Long menuId; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 594956998..8d2b34137 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -2,10 +2,7 @@ package com.ruoyi.common.core.domain.entity; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.ruoyi.common.annotation.ExcelDictFormat; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.convert.ExcelDictConvert; @@ -35,7 +32,7 @@ public class SysRole extends BaseEntity { * 角色ID */ @ExcelProperty(value = "角色序号") - @TableId(value = "role_id") + @TableId(value = "role_id",type = IdType.AUTO) private Long roleId; /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 3196e9ecf..f16acc237 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -33,7 +33,7 @@ public class SysUser extends BaseEntity { /** * 用户ID */ - @TableId(value = "user_id") + @TableId(value = "user_id",type = IdType.AUTO) private Long userId; /** @@ -128,6 +128,11 @@ public class SysUser extends BaseEntity { */ private String remark; + /** + * 楼盘 + */ + private String properties; + /** * 部门对象 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/event/PushLogEvent.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/event/PushLogEvent.java new file mode 100644 index 000000000..2552c8fb1 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/event/PushLogEvent.java @@ -0,0 +1,37 @@ +package com.ruoyi.common.core.domain.event; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 推送日志对象 push_log + * + * @author ruoyi + * @date 2023-07-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("push_log") +public class PushLogEvent extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 推送数据 + */ + private String pushData; + /** + * 返回结果 + */ + private String resultData; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java index 4a4cfb518..21bc4dff4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java @@ -5,6 +5,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; /** * 用户登录对象 @@ -18,20 +19,22 @@ public class LoginBody { /** * 用户名 */ - @NotBlank(message = "{user.username.not.blank}") - @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") + @NotBlank(message = "{user.username.not.blank}",groups = {passwordLogin.class,smgLogin.class,forgetPasswordLogin.class,registerUser.class,userOpenLogin.class}) + @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}",groups = {passwordLogin.class,smgLogin.class,forgetPasswordLogin.class,registerUser.class}) private String username; /** * 用户密码 */ - @NotBlank(message = "{user.password.not.blank}") - @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") + @NotBlank(message = "{user.password.not.blank}",groups = {passwordLogin.class,forgetPasswordLogin.class,registerUser.class}) + @Pattern(regexp = UserConstants.PASSWORD_Pattern,message = "{the.password.is.not.within.the.specified.range}",groups = {passwordLogin.class,forgetPasswordLogin.class,registerUser.class}) + @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}",groups = {passwordLogin.class,forgetPasswordLogin.class,registerUser.class}) private String password; /** * 验证码 */ + @NotBlank(message = "{user.jcaptcha.not.blank}",groups = {smgLogin.class,forgetPasswordLogin.class,registerUser.class}) private String code; /** @@ -39,4 +42,37 @@ public class LoginBody { */ private String uuid; + + /** + * 外部用户标识key + */ + @NotBlank(message = "user.id.cannot.be.empty",groups ={userOpenLogin.class}) + private String apiKey; + + + /** + * 账号登录验证 + */ + public interface passwordLogin {} + + /** + * 短信登录验证 + */ + public interface smgLogin {} + + /** + * 忘记密码验证 + */ + public interface forgetPasswordLogin {} + + /** + * 注册验证 + */ + public interface registerUser {} + + public interface userOpenLogin {} + + + } + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java index 83fcf9fe8..09258d8e5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -90,6 +90,17 @@ public class LoginUser implements Serializable { */ private String username; + private String nickName; + + private String companyId; + + /** + * 楼盘 + */ + private String properties; + + + /** * 角色对象 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/SmsLoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/SmsLoginBody.java index b12e74c14..0477a1d57 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/SmsLoginBody.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/SmsLoginBody.java @@ -17,12 +17,12 @@ public class SmsLoginBody { * 手机号 */ @NotBlank(message = "{user.phonenumber.not.blank}") - private String phonenumber; + private String username; /** * 短信code */ @NotBlank(message = "{sms.code.not.blank}") - private String smsCode; + private String verificationCode; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/UserLoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/UserLoginBody.java new file mode 100644 index 000000000..5a40662ca --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/UserLoginBody.java @@ -0,0 +1,45 @@ +package com.ruoyi.common.core.domain.model; + +import com.ruoyi.common.constant.UserConstants; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; + +/** + * 用户登录对象 + * + * @author Lion Li + */ + +@Data +public class UserLoginBody { + + /** + * 用户名 + */ + @NotBlank(message = "{user.username.not.blank}") + @Length(min = UserConstants.USERNAME_MIN_LENGTH, max = UserConstants.USERNAME_MAX_LENGTH, message = "{user.username.length.valid}") + private String username; + + /** + * 用户密码 + */ + @NotBlank(message = "{user.password.not.blank}") + @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") + private String password; + + /** + * 验证码 + */ + @NotBlank(message = "{user.code.not.blank}") + private String code; + + /** + * 唯一标识 + */ + @NotBlank(message = "{user.password.not.blank}") + @Length(min = UserConstants.PASSWORD_MIN_LENGTH, max = UserConstants.PASSWORD_MAX_LENGTH, message = "{user.password.length.valid}") + private String twoPassword; + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/ConfigService.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/ConfigService.java index c6badf65c..fa02e268c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/ConfigService.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/ConfigService.java @@ -1,5 +1,8 @@ package com.ruoyi.common.core.service; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + /** * 通用 参数配置服务 * @@ -15,4 +18,11 @@ public interface ConfigService { */ String getConfigValue(String configKey); + /** + * 根据key获取数据 + * @param configKey + * @return + */ + void selectConfigByConfigKey(String configKey); + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/service/IRsaSecurityService2.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/IRsaSecurityService2.java new file mode 100644 index 000000000..3141d1399 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/service/IRsaSecurityService2.java @@ -0,0 +1,9 @@ +package com.ruoyi.common.core.service; + + +import com.ruoyi.common.core.domain.RsaSecurity; + +public interface IRsaSecurityService2 { + + RsaSecurity getInfo(String path,String method); +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/validate/DownloadGroup.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/validate/DownloadGroup.java new file mode 100644 index 000000000..db1a7d4e7 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/validate/DownloadGroup.java @@ -0,0 +1,4 @@ +package com.ruoyi.common.core.validate; + +public interface DownloadGroup { +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java index 897f7068f..1d9783fae 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java @@ -1,24 +1,30 @@ -package com.ruoyi.common.enums; - -/** - * 限流类型 - * - * @author ruoyi - */ - -public enum LimitType { - /** - * 默认策略全局限流 - */ - DEFAULT, - - /** - * 根据请求者IP进行限流 - */ - IP, - - /** - * 实例限流(集群多后端实例) - */ - CLUSTER -} +package com.ruoyi.common.enums; + +/** + * 限流类型 + * + * @author ruoyi + */ + +public enum LimitType { + /** + * 默认策略全局限流 + */ + DEFAULT, + + /** + * 根据请求者IP进行限流 + */ + IP, + + /** + * 用户id + */ + USERID, + + + /** + * 实例限流(集群多后端实例) + */ + CLUSTER +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java index 875e4762e..c3103b2d5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LoginType.java @@ -41,4 +41,5 @@ public enum LoginType { * 登录重试限制计数提示 */ final String retryLimitCount; + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java new file mode 100644 index 000000000..38ef24856 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java @@ -0,0 +1,83 @@ +package com.ruoyi.common.exception.file; + +import org.apache.commons.fileupload.FileUploadException; + +import java.util.Arrays; + +/* + * 文件上传 误异常类 + * + * @author ruoyi + */ + +public class InvalidExtensionException extends FileUploadException +{ + private static final long serialVersionUID = 1L; + + private String[] allowedExtension; + private String extension; + private String filename; + + public InvalidExtensionException(String[] allowedExtension, String extension, String filename) + { + super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); + this.allowedExtension = allowedExtension; + this.extension = extension; + this.filename = filename; + } + + public String[] getAllowedExtension() + { + return allowedExtension; + } + + public String getExtension() + { + return extension; + } + + public String getFilename() + { + return filename; + } + + public static class InvalidImageExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidFlashExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidMediaExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } + + public static class InvalidVideoExtensionException extends InvalidExtensionException + { + private static final long serialVersionUID = 1L; + + public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) + { + super(allowedExtension, extension, filename); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java index 8927366e0..3e9b8997d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java @@ -1,11 +1,22 @@ package com.ruoyi.common.filter; +import cn.hutool.core.util.ObjectUtil; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.common.core.service.ConfigService; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * Repeatable 过滤器 @@ -13,9 +24,9 @@ import java.io.IOException; * @author ruoyi */ public class RepeatableFilter implements Filter { + @Override public void init(FilterConfig filterConfig) throws ServletException { - } @Override @@ -23,9 +34,13 @@ public class RepeatableFilter implements Filter { throws IOException, ServletException { ServletRequest requestWrapper = null; if (request instanceof HttpServletRequest - && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) { + && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE) ) { requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); } + if (!isSafe((HttpServletRequest) request,(HttpServletResponse) response)) { + ((HttpServletResponse) response).setStatus(403); + return; + } if (null == requestWrapper) { chain.doFilter(request, response); } else { @@ -37,4 +52,59 @@ public class RepeatableFilter implements Filter { public void destroy() { } + + /** + * 判断请求是正确 + * + * @param request + * @return + */ + private boolean isSafe(HttpServletRequest request,HttpServletResponse response) { + ConfigService sysConfigService = SpringUtils.getBean(ConfigService.class); + String configValue = sysConfigService.getConfigValue("sys:preventing:hotlinking"); + List strings = Arrays.asList(configValue.split(",")); + if (ObjectUtil.isEmpty(configValue)) { + // 未设置任何链接,表示所有来源都可以访问 + return true; + } + String referer = request.getHeader("referer"); + if (referer == null || "".equals(referer)) { + // 获取不到防盗链头部信息 -> 拦截 + System.out.println("referer为空进行拦截"); + return true; + } + for (String white : strings) { + if (white.contains("*.")) { + // 这里处理*.xxx.com,表示xxx.com下的所有二级域名均可访问,所以就截取掉'*.'符号 + white = white.replace("*.", ""); + } + // 这里就简单的判断referer请求头中的链接是否包含我们白名单中的域名 + if (referer.contains(white)) { + return true; + } + } + return false; + } + + /** + * 处理相应数据 + * + * @param response + */ + public void handleResponse(HttpServletResponse response) { + // 访问链接有问题 + try { + Map resultMsg = new HashMap<>(); + resultMsg.put("code", String.valueOf(HttpStatus.FORBIDDEN)); + resultMsg.put("msg", "资源不允许"); + ObjectMapper objectMapper = new ObjectMapper(); + String msg = objectMapper.writeValueAsString(resultMsg); + response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); + response.setStatus(403); + response.getWriter().write(msg); + } catch (IOException e) { + System.out.println("防盗链过滤器处理response失败"); + } + } + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CardsUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CardsUtil.java new file mode 100644 index 000000000..9704ce182 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CardsUtil.java @@ -0,0 +1,199 @@ +package com.ruoyi.common.utils; + +import jodd.util.StringUtil; + +/** + * @Description 各证件卡号校验类 + * @author longwei + * @date 2020/7/23 14:17 + */ +public class CardsUtil { + + /** 正则表达式:验证身份证 */ + public static final String REGEX_ID_CARD = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|" + + "(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"; + + /** 正则表达式:验证户口簿 9位数字 */ + public static final String REGEX_HUKOU_CARD = "\\d{9}"; + + /** 正则表达式:验证护照 数字+字母,共9位 */ + public static final String REGEX_PASSPORT_CARD = "^([a-zA-z]|[0-9]){9}$"; + + /** 正则表达式:验证军官证 汉字+8位数字 */ + public static final String REGEX_OFFICER_CARD = "^[\\u4E00-\\u9FA5](字第)([0-9a-zA-Z]{4,8})(号?)$"; + + /** 正则表达式:验证驾驶证 12位数字 */ + public static final String REGEX_DRIVE_CARD = "\\d{12}$"; + + /** 正则表达式:验证港澳居民通行证 H/M + 10位或8位数字 */ + public static final String REGEX_HK_CARD = "^[HMhm]{1}([0-9]{10}|[0-9]{8})$"; + + /** 正则表达式:验证台湾居民通行证 新版8位或18位数字,旧版10位数字 + 英文字母 */ + public static final String REGEX_TW_CARD = "^\\d{8}|^[a-zA-Z0-9]{10}|^\\d{18}$"; + + /** + * 校验身份证 + * + * @param idCardNo 身份证号 + * @return 校验通过返回true,否则返回false + * @by https://blog.csdn.net/u011106915/article/details/76066985 + */ + public static boolean isIDCard(String idCardNo) { + //校验非空 + if (StringUtil.isEmpty(idCardNo)) { + return false; + } + //校验长度 + int idCardLength = idCardNo.length(); + if (idCardLength != 18 && idCardLength != 15 && idCardLength != 9) { + return false; + } + if (idCardLength==9){ + return idCardNo.matches(REGEX_PASSPORT_CARD); + } + // 定义判别用户身份证号的正则表达式(15位或者18位,最后一位可以为字母) + //假设18位身份证号码:41000119910101123X 410001 19910101 123X + //^开头 + //[1-9] 第一位1-9中的一个 4 + //\\d{5} 五位数字 10001(前六位省市县地区) + //(18|19|20) 19(现阶段可能取值范围18xx-20xx年) + //\\d{2} 91(年份) + //((0[1-9])|(10|11|12)) 01(月份) + //(([0-2][1-9])|10|20|30|31)01(日期) + //\\d{3} 三位数字 123(第十七位奇数代表男,偶数代表女) + //[0-9Xx] 0123456789Xx其中的一个 X(第十八位为校验值) + //$结尾 + + //假设15位身份证号码:410001910101123 410001 910101 123 + //^开头 + //[1-9] 第一位1-9中的一个 4 + //\\d{5} 五位数字 10001(前六位省市县地区) + //\\d{2} 91(年份) + //((0[1-9])|(10|11|12)) 01(月份) + //(([0-2][1-9])|10|20|30|31)01(日期) + //\\d{3} 三位数字 123(第十五位奇数代表男,偶数代表女),15位身份证不含X + //$结尾 + + boolean matches = idCardNo.matches(REGEX_ID_CARD); + + //判断第18位校验值 + if (matches) { + + //如是15位身份证,不做更多校验,直接返回合法 + if (idCardLength == 15) { + return true; + } + + if (idCardLength == 18) { + try { + char[] charArray = idCardNo.toCharArray(); + //前十七位加权因子 + int[] idCardWi = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; + //这是除以11后,可能产生的11位余数对应的验证码 + String[] idCardY = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}; + int sum = 0; + for (int i = 0; i < idCardWi.length; i++) { + int current = Integer.parseInt(String.valueOf(charArray[i])); + int count = current * idCardWi[i]; + sum += count; + } + char idCardLast = charArray[17]; + int idCardMod = sum % 11; + return idCardY[idCardMod].toUpperCase().equals(String.valueOf(idCardLast).toUpperCase()); + + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + } + return matches; + } + + /** + * 校验户口簿 + * + * @param huKouNo 户口簿号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isHuKouCard(String huKouNo) { + //校验非空 校验长度 + if (StringUtils.isEmpty(huKouNo) || huKouNo.length() != 9 ) { + return false; + } + return huKouNo.matches(REGEX_HUKOU_CARD); + } + + /** + * 校验护照 + * + * @param passPortNo 护照号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isPassPortCard(String passPortNo) { + //校验非空 + if (StringUtil.isEmpty(passPortNo)) { + return false; + } + return passPortNo.matches(REGEX_PASSPORT_CARD); + } + + /** + * 校验军官证 + * 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号" + * 样本: 军字第2001988号, 士字第P011816X号 + * @param officerNo 军官证号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isofficerCard(String officerNo) { + //校验非空 + if (StringUtil.isEmpty(officerNo)) { + return false; + } + return officerNo.matches(REGEX_OFFICER_CARD); + } + + /** + * 校验驾驶证 + * + * @param driveNo 驾驶证号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isDriveCard(String driveNo) { + //校验非空 校验长度 + if (StringUtil.isEmpty(driveNo) || driveNo.length() != 12 ) { + return false; + } + return driveNo.matches(REGEX_DRIVE_CARD); + } + + /** + * 校验港澳通行证 + * + * @param HMNo 港澳通行证号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isHMCard(String HMNo) { + //校验非空 + if (StringUtil.isEmpty(HMNo)) { + return false; + } + return HMNo.matches(REGEX_HK_CARD); + } + + /** + * 校验台湾通行证 + * 规则 新版8位或18位数字,旧版10位数字 + 英文字母 + * @param TWNo 台湾通行证号 + * @return 校验通过返回true,否则返回false + */ + public static boolean isTWCard(String TWNo) { + //校验非空 + if (StringUtil.isEmpty(TWNo)) { + return false; + } + return TWNo.matches(REGEX_TW_CARD); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateHolidayUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateHolidayUtils.java new file mode 100644 index 000000000..db7547a9f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateHolidayUtils.java @@ -0,0 +1,769 @@ +package com.ruoyi.common.utils; + +import java.math.BigDecimal; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +/** + * @Description 时间日期工具类 封装工作中常用的一些时间日期计算方法等,还可以提供更多的重载方法,用于时间的转化等 + * @author + * @Date + */ +public class DateHolidayUtils { + private DateHolidayUtils() { + + } + + /** + * hhmmFormat="HH:mm" + */ + public static final String hhmmFormat = "HH:mm"; + /** + * MMddFormat="MM-dd" + */ + public static final String MMddFormat = "MM-dd"; + /** + * yyyyFormat="yyyy" + */ + public static final String yyyyFormat = "yyyy"; + /** + * yyyyFormat="yyyy-MM" + */ + public static final String yyyyMMFormat = "yyyy-MM"; + /** + * yyyyChineseFormat="yyyy年" + */ + public static final String yyyyChineseFormat = "yyyy年"; + /** + * yyyyMMddFormat="yyyy-MM-dd" + */ + public static final String yyyyMMddFormat = "yyyy-MM-dd"; + /** + * fullFormat="yyyy-MM-dd HH:mm:ss" + */ + public static final String fullFormat = "yyyy-MM-dd HH:mm:ss"; + /** + * yyyyMMddHHmmss="yyyyMMddHHmmss" + */ + public static final String yyyyMMddHHmmss = "yyyyMMddHHmmss"; + /** + * strFormat="yyyy/MM/dd HH:mm:ss" + */ + public static final String strFormat = "yyyy/MM/dd HH:mm:ss"; + /** + * MMddChineseFormat="MM月dd日" + */ + public static final String MMddChineseFormat = "MM月dd日"; + /** + * yyyyMMddChineseFormat="yyyy年MM月dd日" + */ + public static final String yyyyMMddChineseFormat = "yyyy年MM月dd日"; + /** + * yyyyMMddChineseFormat="yyyy年MM月" + */ + public static final String yyyyMMChineseFormat = "yyyy年MM月"; + /** + * fullChineseFormat="yyyy年MM月dd日HH时mm分ss秒" + */ + public static final String fullChineseFormat = "yyyy年MM月dd日HH时mm分ss秒"; + /** + * WEEKS={"星期日","星期一","星期二","星期三","星期四","星期五","星期六"} + */ + public static final String[] WEEKS = { "星期日", "星期一", "星期二", "星期三", "星期四", + "星期五", "星期六" }; + + /** + * 得到指定时间的时间日期格式 + * + * @param date + * 指定的时间 + * @param format + * 时间日期格式 + * @return + */ + public static String getFormatDateTime(Date date, String format) { + if(date == null){return "";} + DateFormat df = new SimpleDateFormat(format); + return df.format(date); + } + /** + * 得到指定时间的时间日期格式(返回date) + * + * @param date + * 指定的时间 + * @param format + * 时间日期格式 + * @return + */ + public static Date getDateFormatDateTime(Date date, String format) { + DateFormat df = new SimpleDateFormat(format); + String s=df.format(date); + try { + return df.parse(s); + } catch (ParseException e) { }; + return date; + } + + public static String getFormatDateToday(String format) { + return getFormatDateTime(new Date(), format); + } + + /** + * 判断是否是润年 + * + * @param date + * 指定的时间 + * @return true:是润年,false:不是润年 + */ + public static boolean isLeapYear(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return isLeapYear(cal.get(Calendar.YEAR)); + } + + /** + * 判断是否是润年 + * + * @param year + * 指定的年 + * @return true:是润年,false:不是润年 + */ + public static boolean isLeapYear(int year) { + GregorianCalendar calendar = new GregorianCalendar(); + return calendar.isLeapYear(year); + } + + /** + * 判断指定的时间是否是今天 + * + * @param date + * 指定的时间 + * @return true:是今天,false:非今天 + */ + public static boolean isInToday(Date date) { + boolean flag = false; + Date now = new Date(); + String fullFormat = getFormatDateTime(now, DateHolidayUtils.yyyyMMddFormat); + String beginString = fullFormat + " 00:00:00"; + String endString = fullFormat + " 23:59:59"; + DateFormat df = new SimpleDateFormat(DateHolidayUtils.fullFormat); + try { + Date beginTime = df.parse(beginString); + Date endTime = df.parse(endString); + flag = date.before(endTime) && date.after(beginTime); + } catch (ParseException e) { + e.printStackTrace(); + } + return flag; + } + + /** + * 判断两时间是否是同一天 + * + * @param from + * 第一个时间点 + * @param to + * 第二个时间点 + * @return true:是同一天,false:非同一天 + */ + public static boolean isSameDay(Date from, Date to) { + boolean isSameDay = false; + DateFormat df = new SimpleDateFormat(DateHolidayUtils.yyyyMMddFormat); + String firstDate = df.format(from); + String secondDate = df.format(to); + isSameDay = firstDate.equals(secondDate); + return isSameDay; + } + + /** + * 方法描述: 判断两时间是否是同一时间,精确到秒 作者:zhanglei 时间:2013-11-2下午04:22:33 + * + * @param from + * 第一个时间点 + * @param to + * 第二个时间点 + * @return true:是,false:非 + */ + public static boolean isSameTime(Date from, Date to) { + boolean isSameDay = false; + DateFormat df = new SimpleDateFormat(DateHolidayUtils.yyyyMMddHHmmss); + String firstDate = df.format(from); + String secondDate = df.format(to); + isSameDay = firstDate.equals(secondDate); + return isSameDay; + } + + /** + * 求出指定的时间那天是星期几 + * + * @param date + * 指定的时间 + * @return 星期X + */ + public static String getWeekString(Date date) { + return DateHolidayUtils.WEEKS[getWeek(date) - 1]; + } + + /** + * 求出指定时间那天是星期几 + * + * @param date + * 指定的时间 + * @return 0-6 分别代表星期日-星期六 + */ + public static int getWeekDay(Date date) { + int week = getWeek(date); + return week-1; + } + + /** + * 求出指定时间那天是星期几 + * + * @param date + * 指定的时间 + * @return 1-7 + */ + public static int getWeek(Date date) { + int week = 0; + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + week = cal.get(Calendar.DAY_OF_WEEK); + return week; + } + + /** + * 取得指定时间离现在是多少时间以前,如:3秒前,2小时前等 注意:此计算方法不是精确的 + * + * @param date + * 已有的指定时间 + * @return 时间段描述 + */ + public static String getAgoTimeString(Date date) { + Date now = new Date(); + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + Date agoTime = cal.getTime(); + long mtime = now.getTime() - agoTime.getTime(); + String str = ""; + long stime = mtime / 1000; + long minute = 60; + long hour = 60 * 60; + long day = 24 * 60 * 60; + long weeks = 7 * 24 * 60 * 60; + long months = 100 * 24 * 60 * 60; + if (stime < minute) { + long time_value = stime; + if (time_value <= 0) { + time_value = 1; + } + str = time_value + "秒前"; + } else if (stime >= minute && stime < hour) { + long time_value = stime / minute; + if (time_value <= 0) { + time_value = 1; + } + str = time_value + "分前"; + } else if (stime >= hour && stime < day) { + long time_value = stime / hour; + if (time_value <= 0) { + time_value = 1; + } + str = time_value + "小时前"; + } else if (stime >= day && stime < weeks) { + long time_value = stime / day; + if (time_value <= 0) { + time_value = 1; + } + str = time_value + "天前"; + } else if (stime >= weeks && stime < months) { + DateFormat df = new SimpleDateFormat(DateHolidayUtils.MMddFormat); + str = df.format(date); + } else { + DateFormat df = new SimpleDateFormat(DateHolidayUtils.yyyyMMddFormat); + str = df.format(date); + } + return str; + } + + /** + * 判断指定时间是否是周末 + * + * @param date + * 指定的时间 + * @return true:是周末,false:非周末 + */ + public static boolean isWeeks(Date date) { + boolean isWeek = false; + isWeek = (getWeek(date) - 1 == 0 || getWeek(date) - 1 == 6); + return isWeek; + } + + /** + * 得到今天的最开始时间 + * + * @return 今天的最开始时间 + */ + public static Date getTodayBeginTime() { + Date beginTime = new Date(); + beginTime = getBeginTime(beginTime); + return beginTime; + } + + /** + * 得到指定日期的最开始时间 + * + * @return 今天的最开始时间 + */ + public static Date getBeginTime(Date date) { + Date beginTime = date; + String beginString = getFormatDateTime(beginTime, DateHolidayUtils.yyyyMMddFormat) + " 00:00:00"; + beginTime = str2Date(beginString, DateHolidayUtils.fullFormat); + return beginTime; + } + + public static Long getBeginTimeStamp(Long timeStamp) { + Date beginTime = new Date(timeStamp); + String beginString = getFormatDateTime(beginTime, DateHolidayUtils.yyyyMMddFormat) + " 00:00:00"; + beginTime = str2Date(beginString, DateHolidayUtils.fullFormat); + return beginTime.getTime(); + } + + public static String getBeginTimeStr(Date date) { + Date beginTime = date; + String beginString = getFormatDateTime(beginTime, DateHolidayUtils.yyyyMMddFormat) + " 00:00:00"; + return beginString; + } + + + /** + * 得到今天的最后结束时间 + * + * @return 今天的最后时间 + */ + public static Date getTodayEndTime() { + Date endTime = new Date(); + endTime = getEndTime(endTime); + return endTime; + } + + /** + * 得到指定日期的最后结束时间 + * + * @return 今天的最后时间 + */ + public static Date getEndTime(Date date) { + + Date endTime = date; + String beginString = getFormatDateTime(endTime, DateHolidayUtils.yyyyMMddFormat) + " 23:59:59"; + endTime = str2Date(beginString, DateHolidayUtils.fullFormat); + return endTime; + } + + /** + * 得到指定日期的最后结束时间 + * + * @return 今天的最后时间 + */ + public static Date getCalEndTime(Date date) { + + Date endTime = addDays(date, 1); + String beginString = getFormatDateTime(endTime, DateHolidayUtils.yyyyMMddFormat) + " 00:00:00"; + endTime = str2Date(beginString, DateHolidayUtils.fullFormat); + return endTime; + } + + public static String getEndTimeStr(Date date) { + + Date endTime = date; + String endString = getFormatDateTime(endTime, DateHolidayUtils.yyyyMMddFormat) + " 23:59:59"; + return endString; + } + + + /** + * 取得本周的开始时间 + * + * @return 本周的开始时间 + */ + public static Date getThisWeekBeginTime() { + Date beginTime = null; + Calendar cal = Calendar.getInstance(); + int week = getWeek(cal.getTime()); + week = week - 1; + int days = 0; + if (week == 0) { + days = 6; + } else { + days = week - 1; + } + cal.add(Calendar.DAY_OF_MONTH, -days); + beginTime = cal.getTime(); + return beginTime; + } + + /** + * 取得指定日期所在周的开始时间 + * + * @return 本周的开始时间 + */ + public static Date getThisWeekBeginTime(Date date) { + Date beginTime = null; + int week = getWeek(date); + week = week - 1; + int days = 0; + if (week == 0) { + days = 6; + } else { + days = week - 1; + } + beginTime = addDays(date,-days); + return beginTime; + } + + /** + * 取得本周的开始日期 + * + * @param format + * 时间的格式 + * @return 指定格式的本周最开始时间 + */ + public static String getThisWeekBeginTimeString(String format) { + DateFormat df = new SimpleDateFormat(format); + return df.format(getThisWeekBeginTime()); + } + + /** + * 取得本周的结束时间 + * + * @return 本周的结束时间 + */ + public static Date getThisWeekEndTime() { + Date endTime = null; + Calendar cal = Calendar.getInstance(); + int week = getWeek(cal.getTime()); + week = week - 1; + int days = 0; + if (week != 0) { + days = 7 - week; + } + cal.add(Calendar.DAY_OF_MONTH, days); + endTime = cal.getTime(); + return endTime; + } + + /** + * 取得指定日期所在周的结束时间 + * + * @return 本周的结束时间 + */ + public static Date getThisWeekEndTime(Date date) { + Date endTime = null; + int week = getWeek(date); + week = week - 1; + int days = 0; + if (week != 0) { + days = 7 - week; + } + endTime = addDays(date, days); + return endTime; + } + + /** + * 取得本周的结束日期 + * + * @param format + * 时间的格式 + * @return 指定格式的本周结束时间 + */ + public static String getThisWeekEndTimeString(String format) { + DateFormat df = new SimpleDateFormat(format); + return df.format(getThisWeekEndTime()); + } + + /** + * 取得两时间相差的天数 + * + * @param from + * 第一个时间 + * @param to + * 第二个时间 + * @return 相差的天数 + */ + public static long getBetweenDays(Date from, Date to) { + long days = 0; + long dayTime = 24 * 60 * 60 * 1000; + long fromTime = from.getTime(); + long toTime = to.getTime(); +// long times = Math.abs(fromTime - toTime); + Long times = fromTime - toTime; + days = times / dayTime; + return days; + } + + /** + * 获取时间相隔年份 + * @author zhanglei 2017-10-20 下午2:51:10 + * @param from + * @param to + * @return + */ + public static long getBetweenYears(Date from, Date to) { + Calendar cal = Calendar.getInstance(); + cal.setTime(from); + int year = cal.get(Calendar.YEAR); + cal.setTime(to); + int year2 = cal.get(Calendar.YEAR); + long years = Math.abs(year2 - year); + return years; + } + + /** + * 取得两时间相差的小时数 + * + * @param from + * 第一个时间 + * @param to + * 第二个时间 + * @return 相差的小时数 + */ + public static BigDecimal getBetweenHours(Date from, Date to) { + long hours = 0; + long hourTime = 60 * 60 * 1000; + long fromTime = from.getTime(); + long toTime = to.getTime(); + long times = Math.abs(fromTime - toTime); + return BigDecimal.valueOf(times).divide(BigDecimal.valueOf(hourTime), 2, BigDecimal.ROUND_DOWN); + } + + /** + * 取得两时间相差的分钟数 + * + * @param from + * 第一个时间 + * @param to + * 第二个时间 + * @return 相差的分钟数 + */ + public static long getBetweenMinutes(Date from, Date to) { + long m = 0; + long mTime = 60 * 1000; + long fromTime = from.getTime(); + long toTime = to.getTime(); + long times = Math.abs(fromTime - toTime); + m = times / mTime; + return m; + } + + /** + * 取得两时间相差的秒数 + * + * @param from + * 第一个时间 + * @param to + * 第二个时间 + * @return 相差的秒数 + */ + public static long getBetweenSeconds(Date from, Date to) { + long s = 0; + long sTime = 1000; + long fromTime = from.getTime(); + long toTime = to.getTime(); + long times = Math.abs(fromTime - toTime); + s = times / sTime; + return s; + } + + /** + * 取得在指定时间上加减 minute 分钟后的时间 + * @author zhanglei 2015 三月 24 10:15:21 + * @param date + * @param minute + * @return + */ + public static Date addMinutes(Date date, int minute) { + Date time = null; + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.MINUTE, minute); + time = cal.getTime(); + return time; + } + + + /** + * 取得在指定时间上加减days天后的时间 + * + * @param date + * 指定的时间 + * @param days + * 天数,正为加,负为减 + * @return 在指定时间上加减days天后的时间 + */ + public static Date addDays(Date date, int days) { + Date time = null; + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.DAY_OF_MONTH, days); + time = cal.getTime(); + return time; + } + + /** + * 取得在指定时间上加减months月后的时间 + * + * @param date + * 指定时间 + * @param months + * 月数,正为加,负为减 + * @return 在指定时间上加减months月后的时间 + */ + public static Date addMonths(Date date, int months) { + Date time = null; + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.MONTH, months); + time = cal.getTime(); + return time; + } + + /** + * 取得在指定时间上加减years年后的时间 + * + * @param date + * 指定时间 + * @param years + * 年数,正为加,负为减 + * @return 在指定时间上加减years年后的时间 + */ + public static Date addYears(Date date, int years) { + Date time = null; + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.add(Calendar.YEAR, years); + time = cal.getTime(); + return time; + } + + /** + * 方法说明:"yyyyMMddHHmmss"格式的字符串转成日期 + * + * @author zhanglei + * @createDate 2013-10-24 上午01:35:15 + * @param str_date + * @return date + */ + public static Date str2Date(String str_date, String format) { + Date date = null; + DateFormat df = new SimpleDateFormat(format == null ? DateHolidayUtils.yyyyMMddHHmmss:format); + try { + date = df.parse(str_date); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + /** + * 获取当前年度 + * + * @return + */ + public static String getCurYear() { + Calendar calendar = Calendar.getInstance(); + int yearInt = calendar.get(Calendar.YEAR); + return String.valueOf(yearInt); + } + + public static Date getFirstDayOfYear(String year) { + Calendar calendar = Calendar.getInstance(); + if (year != null && !year.isEmpty()) { + int yearInt = Integer.valueOf(year); + calendar.set(Calendar.YEAR, yearInt); + } + calendar.set(Calendar.MONTH, 0); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + return calendar.getTime(); + } + public static Date getLastDayOfYear(String year) { + Calendar calendar = Calendar.getInstance(); + if (year != null && !year.isEmpty()) { + int yearInt = Integer.valueOf(year); + calendar.set(Calendar.YEAR, yearInt); + } + calendar.set(Calendar.MONTH, 11); + calendar.set(Calendar.DAY_OF_MONTH, 31); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + return calendar.getTime(); + } + + public static Date getLastDayOfQuarter(String year, int quarter) { + Calendar calendar = Calendar.getInstance(); + if (year != null && !year.isEmpty()) { + int yearInt = Integer.valueOf(year); + calendar.set(Calendar.YEAR, yearInt); + } + if (quarter == 1) { + calendar.set(Calendar.MONTH, 2); + calendar.set(Calendar.DAY_OF_MONTH, 31); + } else if (quarter == 2) { + calendar.set(Calendar.MONTH, 5); + calendar.set(Calendar.DAY_OF_MONTH, 30); + } else if (quarter == 3) { + calendar.set(Calendar.MONTH, 8); + calendar.set(Calendar.DAY_OF_MONTH, 30); + } else if (quarter == 4) { + calendar.set(Calendar.MONTH, 11); + calendar.set(Calendar.DAY_OF_MONTH, 31); + } + return calendar.getTime(); + } + + /** + * 获取一个月的第一天 + * @param dateStr + * @return + * @throws ParseException + */ + public static Date getMonthFirstDate(String dateStr) throws ParseException { + DateFormat df = new SimpleDateFormat(yyyyMMFormat); + Date data= df.parse(dateStr); + return data; + } + + /** + * 获取一个月的最后一天 + * + * @param dateStr + * yyyy-MM + * @return + * @throws ParseException + */ + public static Date getMonthLastDate(String dateStr) throws ParseException { + DateFormat df = new SimpleDateFormat(yyyyMMFormat); + Date data = df.parse(dateStr); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(data); + int value = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + calendar.set(Calendar.DAY_OF_MONTH, value); + return calendar.getTime(); + } + + public static void main(String[] args) { + System.out.println(DateHolidayUtils.str2Date("2020年10月28日", DateHolidayUtils.yyyyMMddChineseFormat)); + System.out.println(new Date(1595174400000L)); + // 2022-11-2 14:0:0 + // 2022-11-2 23:59:59 + System.out.println(getBetweenHours(new Date(1667368800000L), getEndTime(new Date(1667368800000L)))); + System.out.println(getBetweenHours(new Date(1667368800000L), new Date(1667404799000L))); + System.out.println(getBetweenHours(new Date(1667368800000L), new Date(1667404800000L))); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java index c64f1f8a1..1e1954b8f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java @@ -1,10 +1,12 @@ package com.ruoyi.common.utils; +import cn.hutool.core.util.ObjectUtil; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.commons.lang3.time.DateFormatUtils; import java.lang.management.ManagementFactory; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -99,6 +101,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return DateFormatUtils.format(now, "yyyyMMdd"); } + public static String dateTime(String format) { + Date now = new Date(); + return DateFormatUtils.format(now, format); + } + /** * 日期型字符串转化为日期 格式 */ @@ -165,4 +172,24 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } + + /** + * 校验是否符合时间格式 + * @param sDate + * @param format + * @return + */ + public static boolean checkDate(String sDate,String format){ + int legalLen = sDate.length(); + if (ObjectUtil.isNull(legalLen) || legalLen==0){ + return false; + } + DateFormat formatter = new SimpleDateFormat(format); + try { + Date date = formatter.parse(sDate); + return sDate.equals(formatter.format(date)); + } catch (Exception e) { + return false; + } + } } 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/MySerializerUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MySerializerUtils.java new file mode 100644 index 000000000..822fac5e5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MySerializerUtils.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.utils; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class MySerializerUtils extends JsonSerializer { + @Override + public void serialize(Long id, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { + String statusStr = String.valueOf(id); + jsonGenerator.writeString(statusStr); + } + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/OpenUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/OpenUtils.java new file mode 100644 index 000000000..e7bae18df --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/OpenUtils.java @@ -0,0 +1,92 @@ +package com.ruoyi.common.utils; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.crypto.Mode; +import cn.hutool.crypto.Padding; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.digest.MD5; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.entity.GaoXinCardInfo; +import com.ruoyi.common.exception.ServiceException; + +/** + * @author Administrator + * 对外所需要的工具类 + */ + + +public class OpenUtils { + private static final String appsecret ="JXYB7KpXlH9i0CL6"; + private static final String aesKey = "74242EAFE97F18BFAE9D2682590B6614"; + private static final String iv = "74242EAFE97F18BF"; + private static final String id="2023062804031"; +// private static final String url ="http://162.14.100.54:9010/index.php/Api/renju/get_user_info";//测试 + private static final String url ="http://118.122.86.24:8016/index.php/Api/renju/get_user_info";// 正式地址 + + public static R getGaoXinCardInfo(String cardId){ + AES aes = new AES(Mode.CBC, Padding.PKCS5Padding,aesKey.getBytes(),iv.getBytes()); + String param=aes.encryptBase64( + new JSONObject() + .set("id_card",cardId) + .toStringPretty()); + MD5 md5 = SecureUtil.md5(); + String sign=md5.digestHex(id+param+appsecret); + JSONObject jsonObject = new JSONObject() + .set("id",id) + .set("param",param) + .set("sign",sign); + try { + String content = HttpRequest.post(url) + .timeout(5000) + .body(jsonObject.toStringPretty()) + .execute() + .body(); + System.out.println("content = " + content); + JSONObject jsonObject1 = JSONUtil.parseObj(content); + Integer code = jsonObject1.getInt("code"); + Object data = jsonObject1.get("data"); + String message = jsonObject1.getStr("message"); + if (code==200){ + if (ObjectUtil.isNull(data) || ObjectUtil.isEmpty(data)){ + return R.fail("暂未获取到当前"+cardId+"人才认定信息,如有疑问请联系客服人员! 电话:19940594954"); + }else { + GaoXinCardInfo gaoXinCardInfo = JsonUtils.parseObject(JSONUtil.toJsonPrettyStr(data), GaoXinCardInfo.class); + //判断值是否为空 + if (ObjectUtil.isEmpty(gaoXinCardInfo.getName())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:姓名为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getCard_id())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:身份证为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getSex())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:性别为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getNationality())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:国籍为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getEducation())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:学历为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getDistrict())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:单位区域为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getPhone())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:手机号为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getCompany_name())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:公司名称为空!请联系客服人员! 电话:19940594954"); + }else if (ObjectUtil.isEmpty(gaoXinCardInfo.getType())){ + return R.fail("获取人才认定数据接口返回异常,异常信息:人才类型为空!请联系客服人员! 电话:19940594954"); + } + gaoXinCardInfo.setType(gaoXinCardInfo.getType()); + gaoXinCardInfo.setNationality(gaoXinCardInfo.getNationality()); + return R.ok(gaoXinCardInfo); + } + }else if (code==400){ + return R.fail("获取人才认定数据接口返回异常,异常信息:"+message+"请联系客服人员! 电话:19940594954"); + }else { + return R.fail("人才认定接口请求未知异常"); + } + } catch (Exception e) { + throw new RuntimeException("人才认定接口请求错误"); + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAUtil.java new file mode 100644 index 000000000..5f8ac3c2d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAUtil.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.utils; + +import cn.hutool.core.util.ObjectUtil; +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 String publicKeyEncryptBase64(String data,String outPublicKey){ + if (ObjectUtil.isNotEmpty(outPublicKey)){ + return Sm2.doEncrypt(data, outPublicKey); + } + return Sm2.doEncrypt(data, VUE_PUBLIC_KEY); + } + + /** + * 私钥解密 + */ + public static String privateKeyDecryptStr(String data,String privateKey){ + if (ObjectUtil.isNotEmpty(privateKey)){ + return Sm2.doDecrypt(data, privateKey); + } + return Sm2.doDecrypt(data,PRIVATE_KEY); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StrUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StrUtils.java new file mode 100644 index 000000000..13a8479d4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StrUtils.java @@ -0,0 +1,96 @@ +package com.ruoyi.common.utils; + +import java.security.SecureRandom; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +/** + * @author yaohuaipeng + * @date 2018/10/26-16:16 + */ +public class StrUtils { + /** + * 把逗号分隔的字符串转换字符串数组 + * + * @param str + * @return + */ + public static String[] splitStr2StrArr(String str,String split) { + if (str != null && !str.equals("")) { + return str.split(split); + } + return null; + } + + + /** + * 把逗号分隔字符串转换List的Long + * + * @param str + * @return + */ + public static List splitStr2LongArr(String str) { + String[] strings = splitStr2StrArr(str,","); + if (strings == null) return null; + + List result = new ArrayList<>(); + for (String string : strings) { + result.add(Long.parseLong(string)); + } + + return result; + } + /** + * 把逗号分隔字符串转换List的Long + * + * @param str + * @return + */ + public static List splitStr2LongArr(String str,String split) { + String[] strings = splitStr2StrArr(str,split); + if (strings == null) return null; + + List result = new ArrayList<>(); + for (String string : strings) { + result.add(Long.parseLong(string)); + } + + return result; + } + + public static String getRandomString(int length) { + String str = "0123456789"; + Random random = new Random(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(10); + sb.append(str.charAt(number)); + } + return sb.toString(); + + } + + public static String getComplexRandomString(int length) { + String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + SecureRandom random = new SecureRandom(); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(62); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + + public static String convertPropertiesToHtml(String properties){ + //1:容量:6:32GB_4:样式:12:塑料壳 + StringBuilder sBuilder = new StringBuilder(); + String[] propArr = properties.split("_"); + for (String props : propArr) { + String[] valueArr = props.split(":"); + sBuilder.append(valueArr[1]).append(":").append(valueArr[3]).append("
"); + } + return sBuilder.toString(); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java index 2a5bd488b..ca152405a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java @@ -171,6 +171,15 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { return StrUtil.toUnderlineCase(str); } + /** + * 字母转大写 + * @param str + * @return + */ + public static String toUpperCase(String str) { + return str.toUpperCase(); + } + /** * 是否包含字符串 * @@ -322,4 +331,17 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils { .collect(Collectors.toList()); } + /** + * @param str + * @function 判断输入的数据是否是大于等于零的整数 + */ + public static boolean isNumeric(String str) { + for (int i = str.length(); --i >= 0;) { + if (!Character.isDigit(str.charAt(i))) { + return false; + } + } + return true; + } + } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/XuexinUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/XuexinUtils.java new file mode 100644 index 000000000..caded7d0f --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/XuexinUtils.java @@ -0,0 +1,4 @@ +package com.ruoyi.common.utils; + +public class XuexinUtils { +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java new file mode 100644 index 000000000..85f1a27e6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java @@ -0,0 +1,95 @@ +package com.ruoyi.common.utils.file; + +import java.io.File; +import java.util.Objects; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +/** + * 文件类型工具类 + * + * @author ruoyi + */ +public class FileTypeUtils +{ + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param file 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(File file) + { + if (null == file) + { + return StringUtils.EMPTY; + } + return getFileType(file.getName()); + } + + /** + * 获取文件类型 + *

+ * 例如: ruoyi.txt, 返回: txt + * + * @param fileName 文件名 + * @return 后缀(不含".") + */ + public static String getFileType(String fileName) + { + int separatorIndex = fileName.lastIndexOf("."); + if (separatorIndex < 0) + { + return ""; + } + return fileName.substring(separatorIndex + 1).toLowerCase(); + } + + /** + * 获取文件名的后缀 + * + * @param file 表单文件 + * @return 后缀名 + */ + public static final String getExtension(MultipartFile file) + { + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (StringUtils.isEmpty(extension)) + { + extension = MimeTypeUtils.getExtension(Objects.requireNonNull(file.getContentType())); + } + return extension; + } + + /** + * 获取文件类型 + * + * @param photoByte 文件字节码 + * @return 后缀(不含".") + */ + public static String getFileExtendName(byte[] photoByte) + { + String strFileExtendName = "JPG"; + if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56) + && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97)) + { + strFileExtendName = "GIF"; + } + else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70)) + { + strFileExtendName = "JPG"; + } + else if ((photoByte[0] == 66) && (photoByte[1] == 77)) + { + strFileExtendName = "BMP"; + } + else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71)) + { + strFileExtendName = "PNG"; + } + return strFileExtendName; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java index 6ca97fe60..e3cf52e01 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java @@ -37,4 +37,23 @@ public class MimeTypeUtils { // pdf "pdf"}; + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } + } 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 new file mode 100644 index 000000000..190e04ae4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MyFileUtils.java @@ -0,0 +1,435 @@ +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; +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +/** + * 文件处理工具类 + * + * @author ruoyi + */ +public class MyFileUtils extends FileUtils +{ + /** 字符常量:斜杠 {@code '/'} */ + public static final char SLASH = '/'; + + /** 字符常量:反斜杠 {@code '\\'} */ + public static final char BACKSLASH = '\\'; + + public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + + /** + * 输出指定文件的byte数组 + * + * @param filePath 文件路径 + * @param fileName 文件名字 + * @return + */ + public static void writeBytes(String filePath, String fileName) throws IOException + { + FileInputStream fis = null; + FileOutputStream os = null; + try + { + File file = new File(filePath); + os = new FileOutputStream(fileName); + if (!file.exists()) + { + throw new FileNotFoundException(filePath); + } + fis = new FileInputStream(file); + + byte[] b = new byte[1024]; + int length; + while ((length = fis.read(b)) > 0) + { + os.write(b, 0, length); + } + } + catch (IOException e) + { + //不抛异常 + e.printStackTrace(); +// throw e; + } + finally + { + if (os != null) + { + try + { + os.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + if (fis != null) + { + try + { + fis.close(); + } + catch (IOException e1) + { + e1.printStackTrace(); + } + } + } + } + + public static void downLoadPic(String str,String fileName) { + // 完成从网络上下载图片的功能 + try { + // 建立连接 + URL url = new URL(str); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET");//POST + //防止屏蔽程序抓取而返回403错误 + conn.setRequestProperty("User-Agent", "Mozilla/5.0 (compatible; MSIE 5.0; Windows NT; DigExt)"); + conn.setRequestProperty("Referer","https://rcaj.cdhtgycs.cn"); + 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 (responseCode==200) { + 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(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /** + * 对中文字符进行UTF-8编码 + * @param source 要转义的字符串 + * @return + * @throws UnsupportedEncodingException + */ + public static String tranformStyle(String source) throws UnsupportedEncodingException + { + char[] arr = source.toCharArray(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i < arr.length; i++) + { + char temp = arr[i]; + if(isChinese(temp)) + { + sb.append(URLEncoder.encode("" + temp, "UTF-8")); + continue; + } + sb.append(arr[i]); + } + return sb.toString(); + } + + /** + * 获取字符的编码值 + * @param s + * @return + * @throws UnsupportedEncodingException + */ + public static int getValue(char s) throws UnsupportedEncodingException + { + String temp = (URLEncoder.encode("" + s, "GBK")).replace("%", ""); + if(temp.equals(s + "")) + { + return 0; + } + char[] arr = temp.toCharArray(); + int total = 0; + for(int i = 0; i < arr.length; i++) + { + try + { + int t = Integer.parseInt((arr[i] + ""), 16); + total = total * 16 + t; + } + catch(NumberFormatException e) + { + e.printStackTrace(); + return 0; + } + } + return total; + } + + /** + * 判断是不是中文字符 + * @param c + * @return + */ + public static boolean isChinese(char c) + { + + Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); + + if(ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS + + || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS + + || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A + + || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION + + || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION + + || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) + { + + return true; + + } + + return false; + + } + + /** + * 删除文件 + * + * @param filePath 文件 + * @return + */ + public static boolean deleteFile(String filePath) + { + boolean flag = false; + File file = new File(filePath); + // 路径为文件且不为空则进行删除 + if (file.isFile() && file.exists()) + { + file.delete(); + flag = true; + } + return flag; + } + + /** + * 文件名称验证 + * + * @param filename 文件名称 + * @return true 正常 false 非法 + */ + public static boolean isValidFilename(String filename) + { + return filename.matches(FILENAME_PATTERN); + } + + /* public static void main(String[] args) { + boolean b = checkAllowDownload("C:\\Users\\vimdr\\Pictures\\Camera Roll\\Snipaste_2021-06-03_15-11-34.png"); + System.out.println(b); + }*/ + + /** + * 检查文件是否可下载 + * + * @param resource 需要下载的文件 + * @return true 正常 false 非法 + */ + public static boolean checkAllowDownload(String resource) + { + // 禁止目录上跳级别 + if (StringUtils.contains(resource, "..")) + { + return false; + } + + // 检查允许下载的文件规则 + if (ArrayUtils.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource))) + { + return true; + } + + // 不在允许下载的文件规则 + return false; + } + + /** + * 下载文件名重新编码 + * + * @param request 请求对象 + * @param fileName 文件名 + * @return 编码后的文件名 + */ + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException + { + final String agent = request.getHeader("USER-AGENT"); + String filename = fileName; + if (agent.contains("MSIE")) + { + // IE浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + filename = filename.replace("+", " "); + } + else if (agent.contains("Firefox")) + { + // 火狐浏览器 + filename = new String(fileName.getBytes(), "ISO8859-1"); + } + else if (agent.contains("Chrome")) + { + // google浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + else + { + // 其它浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + return filename; + } + + /** + * 返回文件名 + * + * @param filePath 文件 + * @return 文件名 + */ + public static String getName(String filePath) + { + if (null == filePath) + { + return null; + } + int len = filePath.length(); + if (0 == len) + { + return filePath; + } + if (isFileSeparator(filePath.charAt(len - 1))) + { + // 以分隔符结尾的去掉结尾分隔符 + len--; + } + + int begin = 0; + char c; + for (int i = len - 1; i > -1; i--) + { + c = filePath.charAt(i); + if (isFileSeparator(c)) + { + // 查找最后一个路径分隔符(/或者\) + begin = i + 1; + break; + } + } + + return filePath.substring(begin, len); + } + + /** + * 是否为Windows或者Linux(Unix)文件分隔符
+ * Windows平台下分隔符为\,Linux(Unix)为/ + * + * @param c 字符 + * @return 是否为Windows或者Linux(Unix)文件分隔符 + */ + public static boolean isFileSeparator(char c) + { + return SLASH == c || BACKSLASH == c; + } + + /** + * 下载文件名重新编码 + * + * @param response 响应对象 + * @param realFileName 真实文件名 + * @return + */ + public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException + { + String percentEncodedFileName = percentEncode(realFileName); + + StringBuilder contentDispositionValue = new StringBuilder(); + contentDispositionValue.append("attachment; filename=") + .append(percentEncodedFileName) + .append(";") + .append("filename*=") + .append("utf-8''") + .append(percentEncodedFileName); + + response.setHeader("Content-disposition", contentDispositionValue.toString()); + } + + /** + * 百分号编码工具方法 + * + * @param s 需要百分号编码的字符串 + * @return 百分号编码后的字符串 + */ + public static String percentEncode(String s) throws UnsupportedEncodingException + { + String encode = URLEncoder.encode(s, StandardCharsets.UTF_8.toString()); + return encode.replaceAll("\\+", "%20"); + } + + /** + * 将本地图片进行Base64位编码 + * + * @param + * @return + */ + public static String encodeImgageToBase64(File imageFile) { + // 将图片文件转化为字节数组字符串,并对其进行Base64编码处理 + // 其进行Base64编码处理 + byte[] data = null; + // 读取图片字节数组 + try { + InputStream in = new FileInputStream(imageFile); + data = new byte[in.available()]; + in.read(data); + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // 对字节数组Base64编码 +// BASE64Encoder encoder = new BASE64Encoder(); + return Base64.encodeBase64String(data); +// return encoder.encode(data);// 返回Base64编码过的字节数组字符串 + } + + + public static File MultipartFileToFile(MultipartFile multipartFile) { + // 获取文件名 + String fileName = multipartFile.getOriginalFilename(); + // 获取文件后缀 + String suffix = fileName.substring(fileName.lastIndexOf(".")); + try { + File file = File.createTempFile(System.currentTimeMillis() + "", suffix); + //multipartFile.transferTo(file); + FileUtils.copyInputStreamToFile(multipartFile.getInputStream(), file); + return file; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/DeleteFileUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/DeleteFileUtil.java new file mode 100644 index 000000000..ccea03b4e --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/DeleteFileUtil.java @@ -0,0 +1,122 @@ +package com.ruoyi.common.utils.poi; + +/** + * Created by shuaibin_yang on 2019/5/9 0009. + */ +import java.io.File; + +/** + * 删除文件和目录 + * + */ +public class DeleteFileUtil { + + /** + * 删除文件,可以是文件或文件夹 + * + * @param fileName + * 要删除的文件名 + * @return 删除成功返回true,否则返回false + */ + public static boolean delete(String fileName) { + File file = new File(fileName); + if (!file.exists()) { + System.out.println("删除文件失败:" + fileName + "不存在!"); + return false; + } else { + if (file.isFile()) + return deleteFile(fileName); + else + return deleteDirectory(fileName); + } + } + + /** + * 删除单个文件 + * + * @param fileName + * 要删除的文件的文件名 + * @return 单个文件删除成功返回true,否则返回false + */ + public static boolean deleteFile(String fileName) { + File file = new File(fileName); + // 如果文件路径所对应的文件存在,并且是一个文件,则直接删除 + if (file.exists() && file.isFile()) { + if (file.delete()) { + System.out.println("删除单个文件" + fileName + "成功!"); + return true; + } else { + System.out.println("删除单个文件" + fileName + "失败!"); + return false; + } + } else { + System.out.println("删除单个文件失败:" + fileName + "不存在!"); + return false; + } + } + + /** + * 删除目录及目录下的文件 + * + * @param dir + * 要删除的目录的文件路径 + * @return 目录删除成功返回true,否则返回false + */ + public static boolean deleteDirectory(String dir) { + // 如果dir不以文件分隔符结尾,自动添加文件分隔符 + if (!dir.endsWith(File.separator)) + dir = dir + File.separator; + File dirFile = new File(dir); + // 如果dir对应的文件不存在,或者不是一个目录,则退出 + if ((!dirFile.exists()) || (!dirFile.isDirectory())) { + System.out.println("删除目录失败:" + dir + "不存在!"); + return false; + } + boolean flag = true; + // 删除文件夹中的所有文件包括子目录 + File[] files = dirFile.listFiles(); + for (int i = 0; i < files.length; i++) { + // 删除子文件 + if (files[i].isFile()) { + flag = DeleteFileUtil.deleteFile(files[i].getAbsolutePath()); + if (!flag) + break; + } + // 删除子目录 + else if (files[i].isDirectory()) { + flag = DeleteFileUtil.deleteDirectory(files[i] + .getAbsolutePath()); + if (!flag) + break; + } + } + if (!flag) { + System.out.println("删除目录失败!"); + return false; + } + // 删除当前目录 + if (dirFile.delete()) { + System.out.println("删除目录" + dir + "成功!"); + return true; + } else { + return false; + } + } + +/* public static void main(String[] args) { +// // 删除单个文件 +// String file = "c:/test/test.txt"; +// DeleteFileUtil.deleteFile(file); +// System.out.println(); + // 删除一个目录 + String dir = "E:/template/20190509222628.zip"; +// DeleteFileUtil.deleteDirectory(dir); + deleteFile(dir); +// System.out.println(); +// // 删除文件 +// dir = "c:/test/test0"; +// DeleteFileUtil.delete(dir); + + }*/ + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 8459e1478..c4d25e480 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -54,9 +54,9 @@ public class ExcelUtil { * @param isValidate 是否 Validator 检验 默认为是 * @return 转换后集合 */ - public static ExcelResult importExcel(InputStream is, Class clazz, boolean isValidate) { + public static ExcelResult importExcel(InputStream is, Class clazz, boolean isValidate,Integer num) { DefaultExcelListener listener = new DefaultExcelListener<>(isValidate); - EasyExcel.read(is, clazz, listener).sheet().doRead(); + EasyExcel.read(is, clazz, listener).sheet().headRowNumber(num).doRead(); return listener.getExcelResult(); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExportWordUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExportWordUtil.java new file mode 100644 index 000000000..c61404002 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExportWordUtil.java @@ -0,0 +1,138 @@ +package com.ruoyi.common.utils.poi; + +import com.deepoove.poi.XWPFTemplate; +import com.deepoove.poi.config.Configure; +import com.deepoove.poi.util.PoitlIOUtils; +import org.springframework.util.Assert; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.OutputStream; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * word模板导出 + * @author ljl + */ +public class ExportWordUtil { + private ExportWordUtil() { + } + + /** + * 1.compile 编译模板 + * 2.render 渲染数据 + * 3.输出到流 + * @param hashMap + */ + public static String createWord(String templatePath, String fileDir, String fileName, Map hashMap ){ + Assert.notNull(templatePath, "word模板文件路径不能为空"); + Assert.notNull(fileDir, "生成的文件存放地址不能为空"); + Assert.notNull(fileName, "生成的文件名不能为空"); + + // 生成的word格式 + String formatSuffix = ".docx"; + // 拼接后的文件名 + fileName = fileName + formatSuffix; + + // 生成的文件的存放路径 + if (!fileDir.endsWith("/")) { + fileDir = fileDir + File.separator; + } + + File dir = new File(fileDir); + if (!dir.exists()) { + System.out.println("生成word数据时存储文件目录{}不存在,为您创建文件夹!"); + dir.mkdirs(); + } + + String filePath = fileDir + fileName; + // 读取模板templatePath并将paramMap的内容填充进模板,即编辑模板+渲染数据 + XWPFTemplate template = XWPFTemplate.compile(templatePath).render(hashMap); + try { + // 将填充之后的模板写入filePath + template.writeToFile(filePath); + template.close(); + } catch (Exception e) { + System.out.println("生成word异常"); + e.printStackTrace(); + return ""; + } + return filePath; + } + + /** + * 输出到网络中 + * @param response + * @param templatePath + * @param fileName + * @param hashMap + * @return + */ + public static String createWord(HttpServletResponse response, String templatePath, String fileName, Map hashMap){ + Assert.notNull(templatePath, "word模板文件路径不能为空"); + //Assert.notNull(fileDir, "生成的文件存放地址不能为空"); + Assert.notNull(fileName, "生成的文件名不能为空"); + // 生成的word格式 + String formatSuffix = ".docx"; + // 拼接后的文件名 +// fileName = fileName + formatSuffix; + // 读取模板templatePath并将paramMap的内容填充进模板,即编辑模板+渲染数据 + XWPFTemplate template = XWPFTemplate.compile(templatePath).render(hashMap); + try { + response.reset(); + response.setCharacterEncoding("UTF-8"); +// response.setContentType("application/msword"); + response.setContentType("application/octet-stream"); + response.setHeader("Content-disposition","attachment;filename="+new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1)); + OutputStream out = response.getOutputStream(); + // 将填充之后的模板写入filePath +// template.write(out); +// out.flush(); +// template.close(); + // HttpServletResponse response + BufferedOutputStream bos = new BufferedOutputStream(out); + + template.write(bos); + bos.flush(); + out.flush(); + PoitlIOUtils.closeQuietlyMulti(template, bos, out); + } catch (Exception e) { + System.out.println("生成word异常"); + e.printStackTrace(); + return ""; + } + return fileName; + } + + + public static String createWord1(HttpServletResponse response, HttpServletRequest request, String templatePath, String fileName, Map hashMap, Configure configure){ + Assert.notNull(templatePath, "word模板文件路径不能为空"); + //Assert.notNull(fileDir, "生成的文件存放地址不能为空"); + Assert.notNull(fileName, "生成的文件名不能为空"); + // 生成的word格式 + String formatSuffix = ".docx"; + // 拼接后的文件名 + //fileName = fileName + formatSuffix; + // 读取模板templatePath并将paramMap的内容填充进模板,即编辑模板+渲染数据 + XWPFTemplate template = XWPFTemplate.compile(templatePath,configure).render(hashMap); + try { + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/octet-stream"); + response.setHeader("Content-disposition","attachment;filename="+new String(fileName.getBytes(StandardCharsets.UTF_8),StandardCharsets.ISO_8859_1)); + //OutputStream out = response.getOutputStream(); + OutputStream out = response.getOutputStream(); + //BufferedOutputStream bos = new BufferedOutputStream(out); + // 将填充之后的模板写入filePath + template.write(out); + template.close(); + } catch (Exception e) { + System.out.println("生成word异常"); + e.printStackTrace(); + return ""; + } + return fileName; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ZipUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ZipUtils.java new file mode 100644 index 000000000..73ed2d377 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ZipUtils.java @@ -0,0 +1,132 @@ +package com.ruoyi.common.utils.poi; + +import java.io.*; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + + +public class ZipUtils { + private static final int BUFFER_SIZE = 2 * 1024; + + + public static void toZip(String srcDir, String out, boolean KeepDirStructure) + throws RuntimeException { + long start = System.currentTimeMillis(); + ZipOutputStream zos = null; + try { + FileOutputStream fos1 = new FileOutputStream(new File(out)); + zos = new ZipOutputStream(fos1); + File sourceFile = new File(srcDir); + compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure); + long end = System.currentTimeMillis(); + System.out.println("压缩完成,耗时:" + (end - start) + " ms"); + } catch (Exception e) { + throw new RuntimeException("zip error from ZipUtils", e); + } finally { + if (zos != null) { + try { + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + } + + + public static void toZip(List srcFiles, OutputStream out) throws RuntimeException { + long start = System.currentTimeMillis(); + ZipOutputStream zos = null; + try { + zos = new ZipOutputStream(out); + for (File srcFile : srcFiles) { + byte[] buf = new byte[BUFFER_SIZE]; + zos.putNextEntry(new ZipEntry(srcFile.getName())); + int len; + FileInputStream in = new FileInputStream(srcFile); + while ((len = in.read(buf)) != -1) { + zos.write(buf, 0, len); + } + zos.closeEntry(); + in.close(); + } + long end = System.currentTimeMillis(); + System.out.println("压缩完成,耗时:" + (end - start) + " ms"); + } catch (Exception e) { + throw new RuntimeException("zip error from ZipUtils", e); + } finally { + if (zos != null) { + try { + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + + + public static void compress(File sourceFile, ZipOutputStream zos, String name, + boolean KeepDirStructure) throws Exception { + byte[] buf = new byte[BUFFER_SIZE]; + if (sourceFile.isFile()) { + // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字 + zos.putNextEntry(new ZipEntry(name)); + // copy文件到zip输出流中 + int len; + FileInputStream in = new FileInputStream(sourceFile); + while ((len = in.read(buf)) != -1) { + zos.write(buf, 0, len); + } + zos.closeEntry(); + in.close(); + } else { + File[] listFiles = sourceFile.listFiles(); + if (listFiles == null || listFiles.length == 0) { + // 需要保留原来的文件结构时,需要对空文件夹进行处理 + if (KeepDirStructure) { + // 空文件夹的处理 + zos.putNextEntry(new ZipEntry(name + "/")); + // 没有文件,不需要文件的copy + zos.closeEntry(); + } + } else { + for (File file : listFiles) { + // 判断是否需要保留原来的文件结构 + if (KeepDirStructure) { + // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠, + // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了 + compress(file, zos, name + "/" + file.getName(), KeepDirStructure); + } else { + compress(file, zos, file.getName(), KeepDirStructure); + } + } + } + } + } + + + public static void main(String[] args) throws Exception { + +// FileOutputStream fos1 = new FileOutputStream(new File("H:/mytest01.zip")); +// ZipUtils.toZip("H:/a", fos1, true); + +// List fileList = new ArrayList<>(); +//// fileList.add(new File("H:/1.png")); +// fileList.add(new File("E:/a")); +// FileOutputStream fos2 = new FileOutputStream(new File("H:/123.zip")); +// ZipUtils.toZip(fileList, fos2); +// DocumentHandler documentHandler = new DocumentHandler(); +// String str = "http://192.168.0.66:8090/file/d4d076edcfc34415ae0e4296fd8dc035.png"; +//// String[] split = str.split("."); +// String n1=str.substring(str.lastIndexOf(".")); +// System.out.println(n1); +//// documentHandler.download(str, "aaaa"+split[split.length - 1]); + + } + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java new file mode 100644 index 000000000..8ddc4089d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/Seq.java @@ -0,0 +1,86 @@ +package com.ruoyi.common.utils.uuid; + +import java.util.concurrent.atomic.AtomicInteger; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * @author ruoyi 序列生成类 + */ +public class Seq +{ + // 通用序列类型 + public static final String commSeqType = "COMMON"; + + // 上传序列类型 + public static final String uploadSeqType = "UPLOAD"; + + // 通用接口序列数 + private static AtomicInteger commSeq = new AtomicInteger(1); + + // 上传接口序列数 + private static AtomicInteger uploadSeq = new AtomicInteger(1); + + // 机器标识 + private static final String machineCode = "A"; + + /** + * 获取通用序列号 + * + * @return 序列值 + */ + public static String getId() + { + return getId(commSeqType); + } + + /** + * 默认16位序列号 yyMMddHHmmss + 一位机器标识 + 3长度循环递增字符串 + * + * @return 序列值 + */ + public static String getId(String type) + { + AtomicInteger atomicInt = commSeq; + if (uploadSeqType.equals(type)) + { + atomicInt = uploadSeq; + } + return getId(atomicInt, 3); + } + + /** + * 通用接口序列号 yyMMddHHmmss + 一位机器标识 + length长度循环递增字符串 + * + * @param atomicInt 序列数 + * @param length 数值长度 + * @return 序列值 + */ + public static String getId(AtomicInteger atomicInt, int length) + { + String result = DateUtils.dateTimeNow(); + result += machineCode; + result += getSeq(atomicInt, length); + return result; + } + + /** + * 序列循环递增字符串[1, 10 的 (length)幂次方), 用0左补齐length位数 + * + * @return 序列值 + */ + private synchronized static String getSeq(AtomicInteger atomicInt, int length) + { + // 先取值再+1 + int value = atomicInt.getAndIncrement(); + + // 如果更新后值>=10 的 (length)幂次方则重置为1 + int maxSeq = (int) Math.pow(10, length); + if (atomicInt.get() >= maxSeq) + { + atomicInt.set(1); + } + // 转字符串,用0左补齐 + return StringUtils.padl(value, length); + } +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java index 873facc3b..ea3a0d3d3 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java @@ -74,7 +74,7 @@ public class TestDemoController extends BaseController { @SaCheckPermission("demo:demo:import") @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R importData(@RequestPart("file") MultipartFile file) throws Exception { - ExcelResult excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); + ExcelResult excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true,0); List volist = excelResult.getList(); List list = BeanUtil.copyToList(volist, TestDemo.class); iTestDemoService.saveBatch(list); diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ImageDemoData.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ImageDemoData.java new file mode 100644 index 000000000..5554aa95b --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/ImageDemoData.java @@ -0,0 +1,43 @@ +package com.ruoyi.demo.domain; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.annotation.write.style.ContentRowHeight; +import com.alibaba.excel.converters.string.StringImageConverter; +import com.alibaba.excel.metadata.data.WriteCellData; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +import java.io.File; +import java.io.InputStream; +import java.net.URL; + +@Getter +@Setter +@EqualsAndHashCode +@ContentRowHeight(100) +@ColumnWidth(100 / 8) +public class ImageDemoData { + private File file; + private InputStream inputStream; + /** + * 如果string类型 必须指定转换器,string默认转换成string + */ + @ExcelProperty(converter = StringImageConverter.class) + private String string; + private byte[] byteArray; + /** + * 根据url导出 + * + * @since 2.1.1 + */ + private URL url; + + /** + * 根据文件导出 并设置导出的位置。 + * + * @since 3.0.0-beta1 + */ + private WriteCellData writeCellDataFile; +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java index dc19ce2c7..c9f3f81b4 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestDemo.java @@ -22,7 +22,7 @@ public class TestDemo extends BaseEntity { /** * 主键 */ - @TableId(value = "id") + @TableId(value = "id",type = IdType.AUTO) private Long id; /** diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java index b480aa0c1..bd056fdf8 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/domain/TestTree.java @@ -1,9 +1,6 @@ package com.ruoyi.demo.domain; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.Version; +import com.baomidou.mybatisplus.annotation.*; import com.ruoyi.common.core.domain.TreeEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -25,7 +22,7 @@ public class TestTree extends TreeEntity { /** * 主键 */ - @TableId(value = "id") + @TableId(value = "id",type = IdType.AUTO) private Long id; /** diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueHandle.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueHandle.java new file mode 100644 index 000000000..9dd3268ca --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueHandle.java @@ -0,0 +1,11 @@ +package com.ruoyi.demo.init; + +/** + * 延迟队列执行器 + * Created by LPB on 2021/04/20. + */ +public interface RedisDelayQueueHandle { + + void execute(T t); + +} diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueRunner.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueRunner.java new file mode 100644 index 000000000..99dc87d56 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayQueueRunner.java @@ -0,0 +1,57 @@ +package com.ruoyi.demo.init;/* +package cn.dbtalents.checktalents.init; +import cn.dbtalents.checktalents.enums.RedisDelayQueueEnum; +import cn.dbtalents.checktalents.handle.RedisDelayQueueHandle; +import cn.dbtalents.checktalents.util.RedisDelayQueueUtil; +import cn.hutool.extra.spring.SpringUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +*/ +/** + * 启动延迟队列 + *//* + +@Slf4j +@Component +public class RedisDelayQueueRunner implements CommandLineRunner { + + @Autowired + private RedisDelayQueueUtil redisDelayQueueUtil; + */ +/* @Autowired + private ThreadPoolTaskExecutor threadPool; + ThreadPoolExecutor executorService = new ThreadPoolExecutor(10, 50, 30, TimeUnit.SECONDS, + new LinkedBlockingQueue(1000), Executors.defaultThreadFactory());*//* + + @Override + public void run(String... args) { + */ +/* threadPool.execute(() -> { + while (true){*//* + + try { + RedisDelayQueueEnum[] queueEnums = RedisDelayQueueEnum.values(); + for (RedisDelayQueueEnum queueEnum : queueEnums) { + Object value = redisDelayQueueUtil.getDelayQueue(queueEnum.getCode()); + if (value != null) { + RedisDelayQueueHandle redisDelayQueueHandle = SpringUtil.getBean(queueEnum.getBeanId()); + redisDelayQueueHandle.execute(value); + } + } + } catch (InterruptedException e) { + log.error("(Redis延迟队列异常中断) {}", e.getMessage()); + } +// } +// }); + log.info("(Redis延迟队列启动成功)"); + } +} +*/ diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayedQueueInit.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayedQueueInit.java new file mode 100644 index 000000000..51a7242d8 --- /dev/null +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/init/RedisDelayedQueueInit.java @@ -0,0 +1,60 @@ +package com.ruoyi.demo.init; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RBlockingQueue; +import org.redisson.api.RedissonClient; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; +import java.util.Map; + +/** + * redis 延时队列初始化 + */ +@Component +@Slf4j +public class RedisDelayedQueueInit implements ApplicationContextAware { + + @Autowired + private RedissonClient redissonClient; + + /** + * 获取应用上下文并获取相应的接口实现类 + * @param applicationContext + * @throws BeansException + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + Map map = applicationContext.getBeansOfType(RedisDelayQueueHandle.class); + for (Map.Entry taskEventListenerEntry : map.entrySet()) { + String listenerName = taskEventListenerEntry.getValue().getClass().getName(); + startThread(listenerName, taskEventListenerEntry.getValue()); + } + } + + /** + * 启动线程获取队列 + * @param queueName 队列名称 + * @param redisDelayedQueueListener 任务回调监听 + */ + private void startThread(String queueName, RedisDelayQueueHandle redisDelayedQueueListener) { + RBlockingQueue blockingFairQueue = redissonClient.getBlockingQueue(queueName); + //由于此线程需要常驻,可以新建线程,不用交给线程池管理 + Thread thread = new Thread(() -> { + log.info("启动监听队列线程" + queueName); + while (true) { + try { + T t = blockingFairQueue.take(); + log.info("监听队列线程{},获取到值:{}", queueName, t); + redisDelayedQueueListener.execute(t); + } catch (Exception e) { + log.info("监听队列线程错误,", e); + } + } + }); + thread.setName(queueName); + thread.start(); + log.info("(Redis延迟队列启动成功)"); + } +} diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml index 1b729ef1b..a66dada79 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml @@ -41,5 +41,5 @@ spring.boot.admin.client: url: http://localhost:9090/admin instance: service-host-type: IP - username: ruoyi - password: 123456 + username: gaoxin + password: 1234Qwer@ diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java index 0be6ba663..7bacf3080 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java @@ -25,4 +25,4 @@ public class WebMvcConfig implements WebMvcConfigurer { registry.addInterceptor(cookieInterceptor).addPathPatterns("/**"); } -} \ No newline at end of file +} diff --git a/ruoyi-file/pom.xml b/ruoyi-file/pom.xml new file mode 100644 index 000000000..6a99cc729 --- /dev/null +++ b/ruoyi-file/pom.xml @@ -0,0 +1,35 @@ + + + + ruoyi-vue-plus + com.ruoyi + 4.8.0 + + 4.0.0 + + ruoyi-file + + + 文件存放模块 + + + + + + + com.ruoyi + ruoyi-common + + + + + + + + diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/config/MinioConfig.java b/ruoyi-file/src/main/java/com/ruoyi/file/config/MinioConfig.java new file mode 100644 index 000000000..51009defa --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/config/MinioConfig.java @@ -0,0 +1,94 @@ +/* +package com.ruoyi.file.config; + +import io.minio.MinioClient; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +*/ +/** + * Minio 配置信息 + * + * @author ruoyi + *//* + +@Configuration +@ConfigurationProperties(prefix = "minio") +public class MinioConfig +{ + */ +/** + * 服务地址 + *//* + + private String url; + + */ +/** + * 用户名 + *//* + + private String accessKey; + + */ +/** + * 密码 + *//* + + private String secretKey; + + */ +/** + * 存储桶名称 + *//* + + private String bucketName; + + public String getUrl() + { + return url; + } + + public void setUrl(String url) + { + this.url = url; + } + + public String getAccessKey() + { + return accessKey; + } + + public void setAccessKey(String accessKey) + { + this.accessKey = accessKey; + } + + public String getSecretKey() + { + return secretKey; + } + + public void setSecretKey(String secretKey) + { + this.secretKey = secretKey; + } + + public String getBucketName() + { + return bucketName; + } + + public void setBucketName(String bucketName) + { + this.bucketName = bucketName; + } + + @Bean + public MinioClient getMinioClient() + { + return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); + } +} +*/ diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java b/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java new file mode 100644 index 000000000..b4e99f4c7 --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/config/ResourcesConfig.java @@ -0,0 +1,62 @@ +/* +package com.ruoyi.file.config; + +import java.io.File; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +*/ +/** + * 通用映射配置 + * + * @author ruoyi + *//* + +@Configuration +public class ResourcesConfig implements WebMvcConfigurer +{ + */ +/** + * 上传文件存储在本地的根路径 + *//* + + @Value("${file.path}") + private String localFilePath; + + */ +/** + * 资源映射路径 前缀 + *//* + + @Value("${file.prefix}") + public String localFilePrefix; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + */ +/** 本地文件上传路径 *//* + + registry.addResourceHandler(localFilePrefix + "/**") + .addResourceLocations("file:" + localFilePath + File.separator); + } + + */ +/** + * 开启跨域 + *//* + + @Override + public void addCorsMappings(CorsRegistry registry) { + // 设置允许跨域的路由 + registry.addMapping(localFilePrefix + "/**") + // 设置允许跨域请求的域名 + .allowedOrigins("*") + // 设置允许的方法 + .allowedMethods("GET"); + } +} +*/ diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java new file mode 100644 index 000000000..9743cf374 --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java @@ -0,0 +1,53 @@ +/* +package com.ruoyi.file.service; + +import java.io.InputStream; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import com.github.tobato.fastdfs.domain.fdfs.StorePath; +import com.github.tobato.fastdfs.service.FastFileStorageClient; +import com.ruoyi.common.core.utils.file.FileTypeUtils; + +*/ +/** + * FastDFS 文件存储 + * + * @author ruoyi + *//* + +@Service +public class FastDfsSysFileServiceImpl implements ISysFileService +{ + */ +/** + * 域名或本机访问地址 + *//* + + @Value("${fdfs.domain}") + public String domain; + + @Autowired + private FastFileStorageClient storageClient; + + */ +/** + * FastDfs文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + *//* + + @Override + public String uploadFile(MultipartFile file) throws Exception + { + InputStream inputStream = file.getInputStream(); + StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), + FileTypeUtils.getExtension(file), null); + inputStream.close(); + return domain + "/" + storePath.getFullPath(); + } +} +*/ diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/ISysFileService.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/ISysFileService.java new file mode 100644 index 000000000..472ad5b40 --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/ISysFileService.java @@ -0,0 +1,20 @@ +package com.ruoyi.file.service; + +import org.springframework.web.multipart.MultipartFile; + +/** + * 文件上传接口 + * + * @author ruoyi + */ +public interface ISysFileService +{ + /** + * 文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + public String uploadFile(MultipartFile file) throws Exception; +} diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/LocalSysFileServiceImpl.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/LocalSysFileServiceImpl.java new file mode 100644 index 000000000..1a2fe2104 --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/LocalSysFileServiceImpl.java @@ -0,0 +1,53 @@ +package com.ruoyi.file.service; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.file.utils.FileUploadUtils; + +/** + * 本地文件存储 + * + * @author ruoyi + */ +@Primary +@Service +public class LocalSysFileServiceImpl implements ISysFileService +{ + + /** + * 资源映射路径 前缀 + */ + @Value("${file.prefix}") + public String localFilePrefix; + + /** + * 域名或本机访问地址 + */ + @Value("${file.domain}") + public String domain; + + /** + * 上传文件存储在本地的根路径 + */ + @Value("${file.path}") + private String localFilePath; + + + + /** + * 本地文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + */ + @Override + public String uploadFile(MultipartFile file) throws Exception + { + String name = FileUploadUtils.upload(localFilePath, file); + String url = domain + localFilePrefix + name; + return url; + } +} diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/MinioSysFileServiceImpl.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/MinioSysFileServiceImpl.java new file mode 100644 index 000000000..33e3b3c39 --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/MinioSysFileServiceImpl.java @@ -0,0 +1,54 @@ +/* +package com.ruoyi.file.service; + +import java.io.InputStream; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import com.ruoyi.file.config.MinioConfig; +import com.ruoyi.file.utils.FileUploadUtils; +import io.minio.MinioClient; +import io.minio.PutObjectArgs; + +*/ +/** + * Minio 文件存储 + * + * @author ruoyi + *//* + +@Service +public class MinioSysFileServiceImpl implements ISysFileService +{ + @Autowired + private MinioConfig minioConfig; + + @Autowired + private MinioClient client; + + */ +/** + * Minio文件上传接口 + * + * @param file 上传的文件 + * @return 访问地址 + * @throws Exception + *//* + + @Override + public String uploadFile(MultipartFile file) throws Exception + { + String fileName = FileUploadUtils.extractFilename(file); + InputStream inputStream = file.getInputStream(); + PutObjectArgs args = PutObjectArgs.builder() + .bucket(minioConfig.getBucketName()) + .object(fileName) + .stream(inputStream, file.getSize(), -1) + .contentType(file.getContentType()) + .build(); + client.putObject(args); + inputStream.close(); + return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; + } +} +*/ 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 new file mode 100644 index 000000000..c5aa14c7a --- /dev/null +++ b/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java @@ -0,0 +1,183 @@ +package com.ruoyi.file.utils; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Objects; + +import com.ruoyi.common.exception.file.FileException; +import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; +import com.ruoyi.common.exception.file.FileSizeLimitExceededException; +import com.ruoyi.common.exception.file.InvalidExtensionException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileTypeUtils; +import com.ruoyi.common.utils.file.MimeTypeUtils; +import com.ruoyi.common.utils.uuid.Seq; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; + +/** + * 文件上传工具类 + * + * @author ruoyi + */ +public class FileUploadUtils +{ + /** + * 默认大小 50M + */ + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + + /** + * 默认的文件名最大长度 100 + */ + public static final int DEFAULT_FILE_NAME_LENGTH = 100; + + /** + * 根据文件路径上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @return 文件名称 + * @throws IOException + */ + public static final String upload(String baseDir, MultipartFile file) throws IOException + { + try + { + return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + } + catch (FileException fe) + { + throw new IOException(fe.getDefaultMessage(), fe); + } + catch (Exception e) + { + throw new IOException(e.getMessage(), e); + } + } + + /** + * 文件上传 + * + * @param baseDir 相对应用的基目录 + * @param file 上传的文件 + * @param allowedExtension 上传文件类型 + * @return 返回上传成功的文件名 + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws FileNameLengthLimitExceededException 文件名太长 + * @throws IOException 比如读写文件出错时 + * @throws + */ + public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, InvalidExtensionException { + int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + + assertAllowed(file, allowedExtension); + + String fileName = extractFilename(file); + + String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); + file.transferTo(Paths.get(absPath)); + return getPathFileName(fileName); + } + + /** + * 编码文件名 + */ + public static final String extractFilename(MultipartFile file) + { + return StringUtils.format("{}/{}.{}", DateUtils.datePath(), + Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file)); + } + + private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException + { + File desc = new File(uploadDir + File.separator + fileName); + + if (!desc.exists()) + { + if (!desc.getParentFile().exists()) + { + desc.getParentFile().mkdirs(); + } + } + return desc.isAbsolute() ? desc : desc.getAbsoluteFile(); + } + + private static final String getPathFileName(String fileName) throws IOException + { + String pathFileName = "/" + fileName; + return pathFileName; + } + + /** + * 文件大小校验 + * + * @param file 上传的文件 + * @throws FileSizeLimitExceededException 如果超出最大大小 + * @throws InvalidExtensionException 文件校验异常 + */ + public static final void assertAllowed(MultipartFile file, String[] allowedExtension) + throws FileSizeLimitExceededException, InvalidExtensionException { + long size = file.getSize(); + if (size > DEFAULT_MAX_SIZE) + { + throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); + } + + String fileName = file.getOriginalFilename(); + String extension = FileTypeUtils.getExtension(file); + if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) + { + if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) + { + throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) + { + throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) + { + throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, + fileName); + } + else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) + { + throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, + fileName); + } + else + { + throw new InvalidExtensionException(allowedExtension, extension, fileName); + } + } + } + + /** + * 判断MIME类型是否是允许的MIME类型 + * + * @param extension 上传文件类型 + * @param allowedExtension 允许上传文件类型 + * @return true/false + */ + public static final boolean isAllowedExtension(String extension, String[] allowedExtension) + { + for (String str : allowedExtension) + { + if (str.equalsIgnoreCase(extension)) + { + return true; + } + } + return false; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java index a9d61fb60..f365e6344 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java @@ -5,6 +5,7 @@ import com.ruoyi.common.annotation.RateLimiter; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.enums.LimitType; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; @@ -120,7 +121,10 @@ public class RateLimiterAspect { if (rateLimiter.limitType() == LimitType.IP) { // 获取请求ip stringBuffer.append(ServletUtils.getClientIP()).append(":"); - } else if (rateLimiter.limitType() == LimitType.CLUSTER) { + }else if (rateLimiter.limitType() == LimitType.USERID){ + // 获取用户ID + stringBuffer.append(String.valueOf(LoginHelper.getUserId())).append(":"); + }else if (rateLimiter.limitType() == LimitType.CLUSTER) { // 获取客户端实例id stringBuffer.append(RedisUtils.getClient().getId()).append(":"); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index ea83338ba..ceb1de4fb 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -1,15 +1,20 @@ package com.ruoyi.framework.config; import com.ruoyi.framework.interceptor.PlusWebInvokeTimeInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.io.File; + /** * 通用配置 * @@ -18,15 +23,22 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class ResourcesConfig implements WebMvcConfigurer { + @Value("${file.path}") + private String localFilePath; + + /** + * 资源映射路径 前缀 + */ + @Value("${file.prefix}") + public String localFilePrefix; + + @Override public void addInterceptors(InterceptorRegistry registry) { // 全局访问性能拦截 registry.addInterceptor(new PlusWebInvokeTimeInterceptor()); } - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - } /** * 跨域配置 @@ -49,4 +61,29 @@ public class ResourcesConfig implements WebMvcConfigurer { // 返回新的CorsFilter return new CorsFilter(source); } + /** + * 上传文件存储在本地的根路径 + */ + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) + { + /** 本地文件上传路径 */ + registry.addResourceHandler(localFilePrefix + "/**") + .addResourceLocations("file:" + localFilePath + File.separator); + } + + /** + * 开启跨域 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + // 设置允许跨域的路由 + registry.addMapping(localFilePrefix + "/**") + .allowedOrigins("*") + .allowCredentials(true) + .maxAge(3000) + // 设置允许的方法 + .allowedMethods("GET"); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusWebInvokeTimeInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusWebInvokeTimeInterceptor.java index 78bffab4f..71498ed14 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusWebInvokeTimeInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/PlusWebInvokeTimeInterceptor.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.interceptor; import cn.hutool.core.io.IoUtil; import cn.hutool.core.map.MapUtil; import com.alibaba.ttl.TransmittableThreadLocal; +import com.ruoyi.common.core.service.ConfigService; import com.ruoyi.common.filter.RepeatedlyRequestWrapper; import com.ruoyi.common.utils.JsonUtils; import com.ruoyi.common.utils.StringUtils; @@ -34,6 +35,7 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { +// response.sendRedirect("https://dbxqtalents.cn/"); if (!prodProfile.equals(SpringUtils.getActiveProfile())) { String url = request.getMethod() + " " + request.getRequestURI(); @@ -59,6 +61,10 @@ public class PlusWebInvokeTimeInterceptor implements HandlerInterceptor { invokeTimeTL.set(stopWatch); stopWatch.start(); } + //判断系统是否在维护中 + ConfigService sysConfigService = SpringUtils.getBean(ConfigService.class); + //系统升级提示 + sysConfigService.selectConfigByConfigKey("system:maintenance:prompt"); return true; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/UserActionListener.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/UserActionListener.java index a9de17e60..8ad8828bd 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/UserActionListener.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/listener/UserActionListener.java @@ -58,6 +58,23 @@ public class UserActionListener implements SaTokenListener { log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue); } else if (userType == UserType.APP_USER) { // app端 自行根据业务编写 + UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent")); + String ip = ServletUtils.getClientIP(); + LoginUser user = LoginHelper.getLoginUser(); + UserOnlineDTO dto = new UserOnlineDTO(); + dto.setIpaddr(ip); + dto.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + dto.setBrowser(userAgent.getBrowser().getName()); + dto.setOs(userAgent.getOs().getName()); + dto.setLoginTime(System.currentTimeMillis()); + dto.setTokenId(tokenValue); + dto.setUserName(user.getUsername()); + if(tokenConfig.getTimeout() == -1) { + RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto); + } else { + RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto, Duration.ofSeconds(tokenConfig.getTimeout())); + } + log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue); } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 45e9168e5..fdde2f247 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -26,7 +26,7 @@ public class GenTable extends BaseEntity { /** * 编号 */ - @TableId(value = "table_id") + @TableId(value = "table_id",type = IdType.AUTO) private Long tableId; /** diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java index f6dbcaaf4..7ade87ae1 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java @@ -1,9 +1,6 @@ package com.ruoyi.generator.domain; -import com.baomidou.mybatisplus.annotation.FieldStrategy; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.utils.StringUtils; import lombok.Data; @@ -26,7 +23,7 @@ public class GenTableColumn extends BaseEntity { /** * 编号 */ - @TableId(value = "column_id") + @TableId(value = "column_id",type = IdType.AUTO) private Long columnId; /** diff --git a/ruoyi-job/src/main/java/com/ruoyi/job/config/XxlJobConfig.java b/ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobConfig.java similarity index 94% rename from ruoyi-job/src/main/java/com/ruoyi/job/config/XxlJobConfig.java rename to ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobConfig.java index e051ff0d4..19b25179c 100644 --- a/ruoyi-job/src/main/java/com/ruoyi/job/config/XxlJobConfig.java +++ b/ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobConfig.java @@ -1,6 +1,5 @@ -package com.ruoyi.job.config; +package com.ruoyi.mq.config; -import com.ruoyi.job.config.properties.XxlJobProperties; import com.xxl.job.core.executor.impl.XxlJobSpringExecutor; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/ruoyi-job/src/main/java/com/ruoyi/job/config/properties/XxlJobProperties.java b/ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobProperties.java similarity index 94% rename from ruoyi-job/src/main/java/com/ruoyi/job/config/properties/XxlJobProperties.java rename to ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobProperties.java index f2c755a15..173d3132f 100644 --- a/ruoyi-job/src/main/java/com/ruoyi/job/config/properties/XxlJobProperties.java +++ b/ruoyi-job/src/main/java/com/ruoyi/mq/config/XxlJobProperties.java @@ -1,4 +1,4 @@ -package com.ruoyi.job.config.properties; +package com.ruoyi.mq.config; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/ruoyi-job/src/main/java/com/ruoyi/job/service/SampleService.java b/ruoyi-job/src/main/java/com/ruoyi/mq/service/SampleService.java similarity index 99% rename from ruoyi-job/src/main/java/com/ruoyi/job/service/SampleService.java rename to ruoyi-job/src/main/java/com/ruoyi/mq/service/SampleService.java index 4ca170be7..36aa37419 100644 --- a/ruoyi-job/src/main/java/com/ruoyi/job/service/SampleService.java +++ b/ruoyi-job/src/main/java/com/ruoyi/mq/service/SampleService.java @@ -1,4 +1,4 @@ -package com.ruoyi.job.service; +package com.ruoyi.mq.service; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; diff --git a/ruoyi-oss/pom.xml b/ruoyi-oss/pom.xml index 715eef5c5..8a614fa64 100644 --- a/ruoyi-oss/pom.xml +++ b/ruoyi-oss/pom.xml @@ -26,6 +26,12 @@ com.amazonaws aws-java-sdk-s3 + + + com.google.code.gson + gson + + diff --git a/ruoyi-rabbitmq/pom.xml b/ruoyi-rabbitmq/pom.xml new file mode 100644 index 000000000..917346d38 --- /dev/null +++ b/ruoyi-rabbitmq/pom.xml @@ -0,0 +1,34 @@ + + + + ruoyi-vue-plus + com.ruoyi + 4.8.0 + + 4.0.0 + jar + ruoyi-rabbitmq + + + 消息队列 + + + + + + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + + diff --git a/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/PluginDelayRabbitConfig.java b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/PluginDelayRabbitConfig.java new file mode 100644 index 000000000..881e3659b --- /dev/null +++ b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/PluginDelayRabbitConfig.java @@ -0,0 +1,44 @@ +package com.ruoyi.mq.config; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.CustomExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.HashMap; +import java.util.Map; + +@Configuration +public class PluginDelayRabbitConfig { + + public static final String PLUGIN_DELAY_EXCHANGE = "pluginDelayExchange"; + public static final String PLUGIN_DELAY_QUEUE = "pluginDelayQueue"; + public static final String PLUGIN_DELAY_KEY_TALENTS = "pluginDelayKeyTalents"; + + @Bean(PLUGIN_DELAY_EXCHANGE) + public CustomExchange pluginDelayExchange() { + Map argMap = new HashMap<>(); + argMap.put("x-delayed-type", "direct");//必须要配置这个类型,可以是direct,topic和fanout + //第二个参数必须为x-delayed-message + return new CustomExchange(PLUGIN_DELAY_EXCHANGE,"x-delayed-message",true, false, argMap); + } + + @Bean(PLUGIN_DELAY_QUEUE) + public Queue pluginDelayQueue(){ + return new Queue(PLUGIN_DELAY_QUEUE,true,false,false); + } + + //使用下 ImmediateRequeueMessageRecoverer 重新排队在RabbitMQConfiguration中配置 + /*@Bean + public MessageRecoverer messageRecoverer(RabbitTemplate rabbitTemplate) { + return new RepublishMessageRecoverer(rabbitTemplate,"test_dead_letter_exchange","test_dead_letter_key"); + }*/ + + @Bean("pluginDelayBinding") + public Binding pluginDelayBinding(@Qualifier(PLUGIN_DELAY_QUEUE) Queue queue, @Qualifier(PLUGIN_DELAY_EXCHANGE) CustomExchange customExchange){ + return BindingBuilder.bind(queue).to(customExchange).with(PLUGIN_DELAY_KEY_TALENTS).noargs(); + } +} diff --git a/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/RabbitConfig.java b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/RabbitConfig.java new file mode 100644 index 000000000..98c8acde1 --- /dev/null +++ b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/RabbitConfig.java @@ -0,0 +1,50 @@ +package com.ruoyi.mq.config; + +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.connection.ConnectionFactory; +import org.springframework.amqp.rabbit.connection.CorrelationData; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +/** + * @Author : JCccc + * @CreateTime : 2019/9/3 + * @Description : + +**/ + +@Configuration +public class RabbitConfig { + + @Bean + public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory){ + RabbitTemplate rabbitTemplate = new RabbitTemplate(); + rabbitTemplate.setConnectionFactory(connectionFactory); + //设置开启Mandatory,才能触发回调函数,无论消息推送结果怎么样都强制调用回调函数 + rabbitTemplate.setMandatory(true); + + rabbitTemplate.setConfirmCallback(new RabbitTemplate.ConfirmCallback() { + @Override + public void confirm(CorrelationData correlationData, boolean ack, String cause) { + System.out.println("ConfirmCallback: "+"相关数据:"+correlationData); + System.out.println("ConfirmCallback: "+"确认情况:"+ack); + System.out.println("ConfirmCallback: "+"原因:"+cause); + } + }); + + rabbitTemplate.setReturnCallback(new RabbitTemplate.ReturnCallback() { + @Override + public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) { + System.out.println("ReturnCallback: "+"消息:"+message); + System.out.println("ReturnCallback: "+"回应码:"+replyCode); + System.out.println("ReturnCallback: "+"回应信息:"+replyText); + System.out.println("ReturnCallback: "+"交换机:"+exchange); + System.out.println("ReturnCallback: "+"路由键:"+routingKey); + } + }); + return rabbitTemplate; + } + +} diff --git a/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/TalentsDelayRabbitConfig.java b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/TalentsDelayRabbitConfig.java new file mode 100644 index 000000000..015305f03 --- /dev/null +++ b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/config/TalentsDelayRabbitConfig.java @@ -0,0 +1,46 @@ +package com.ruoyi.mq.config; + +import org.springframework.amqp.core.Binding; +import org.springframework.amqp.core.BindingBuilder; +import org.springframework.amqp.core.CustomExchange; +import org.springframework.amqp.core.Queue; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.HashMap; +import java.util.Map; + +/** + * 人才认定消息配置 + */ +@Configuration +public class TalentsDelayRabbitConfig { + public static final String TALENTS_PLUGIN_DELAY_EXCHANGE = "talentsPluginDelayExchange"; + public static final String TALENTS_PLUGIN_DELAY_QUEUE = "talentsPluginDelayQueue"; + public static final String TALENTS_PLUGIN_DELAY_KEY = "talentsPluginDelayKey"; + + @Bean(TALENTS_PLUGIN_DELAY_EXCHANGE) + public CustomExchange talentsPluginDelayExchange() { + Map argMap = new HashMap<>(); + argMap.put("x-delayed-type", "direct");//必须要配置这个类型,可以是direct,topic和fanout + //第二个参数必须为x-delayed-message + return new CustomExchange(TALENTS_PLUGIN_DELAY_EXCHANGE,"x-delayed-message",true, false, argMap); + } + + @Bean(TALENTS_PLUGIN_DELAY_QUEUE) + public Queue talentsPluginDelayQueue(){ + return new Queue(TALENTS_PLUGIN_DELAY_QUEUE,true,false,false); + } + + //使用下 ImmediateRequeueMessageRecoverer 重新排队在RabbitMQConfiguration中配置 + /*@Bean + public MessageRecoverer messageRecoverer(RabbitTemplate rabbitTemplate) { + return new RepublishMessageRecoverer(rabbitTemplate,"test_dead_letter_exchange","test_dead_letter_key"); + }*/ + + @Bean + public Binding talentsPluginDelayBinding(@Qualifier(TALENTS_PLUGIN_DELAY_QUEUE) Queue queue, @Qualifier(TALENTS_PLUGIN_DELAY_EXCHANGE) CustomExchange customExchange){ + return BindingBuilder.bind(queue).to(customExchange).with(TALENTS_PLUGIN_DELAY_KEY).noargs(); + } +} diff --git a/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/DirectReceiver.java b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/DirectReceiver.java new file mode 100644 index 000000000..4b965e492 --- /dev/null +++ b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/DirectReceiver.java @@ -0,0 +1,27 @@ +package com.ruoyi.mq.service; + +import com.rabbitmq.client.Channel; +import com.ruoyi.mq.config.TalentsDelayRabbitConfig; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.rabbit.annotation.*; +import org.springframework.stereotype.Component; + +import java.io.IOException; + +@Component +public class DirectReceiver { + + @RabbitListener(queues = TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_QUEUE)//监听的队列名称 TestDirectQueue + public void processs(Message message,Channel channel) throws IOException { + String msg = new String(message.getBody(), "UTF-8"); + System.out.println("msg = " + msg); + channel.basicAck(message.getMessageProperties().getDeliveryTag(), false); + + // 重新发送消息到队尾 + // 参数:Exchange、routingKey、额外的设置属性、消息字节数组 + /*channel.basicPublish(message.getMessageProperties().getReceivedExchange(), + message.getMessageProperties().getReceivedRoutingKey(), + null,msg.getBytes());*/ + } + +} diff --git a/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/SendTalentsTemplate.java b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/SendTalentsTemplate.java new file mode 100644 index 000000000..4d015241b --- /dev/null +++ b/ruoyi-rabbitmq/src/main/java/com/ruoyi/mq/service/SendTalentsTemplate.java @@ -0,0 +1,27 @@ +package com.ruoyi.mq.service; + +import com.ruoyi.mq.config.TalentsDelayRabbitConfig; +import org.springframework.amqp.core.Message; +import org.springframework.amqp.core.MessageBuilder; +import org.springframework.amqp.core.MessageDeliveryMode; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 发送人才认定延时模板 + */ +@Component +public class SendTalentsTemplate { + + @Autowired + private RabbitTemplate amqpTemplate; + + public void sendDelayTalentsMsgStr(String msg){ +// 5*24=120小时=120*60分钟=7200分=7200*60秒=432000秒=432000*1000=432000000毫秒 + Message build = MessageBuilder.withBody(msg.getBytes()).build(); + build.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT); + build.getMessageProperties().setDelay(259200000); + amqpTemplate.convertAndSend(TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_EXCHANGE,TalentsDelayRabbitConfig.TALENTS_PLUGIN_DELAY_KEY,build); + } +} diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/SmsTemplate.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/SmsTemplate.java new file mode 100644 index 000000000..e69de29bb diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TelecomSendMsg.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TelecomSendMsg.java new file mode 100644 index 000000000..1251e41d2 --- /dev/null +++ b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TelecomSendMsg.java @@ -0,0 +1,159 @@ +package com.ruoyi.sms.core; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.http.HttpRequest; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.sms.entity.SmsResult; +import org.springframework.stereotype.Service; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.HashMap; + +/** + * @author Administrator + */ +@Service +public class TelecomSendMsg{ + private final String url ="https://msg.cdht.org.cn:8082/apigbk/BatchSend2"; + private final String CorpID ="jxxc"; + private final String Pwd ="ULul@2023"; + + /** + * 发送短信验证码 + * @param phones + * @param content + * @return + */ + public SmsResult telecomSendCode(String phones, String content,String type) { + try { + HashMap paramMap = new HashMap<>(); + paramMap.put("CorpID",CorpID); + paramMap.put("Pwd",Pwd); + paramMap.put("Mobile",phones); + String gbk = null; + if ("register".equals(type)){ + gbk = URLEncoder.encode("尊敬的用户,您正在办理用户注册操作,我们不会向您索要此验证码,切勿告知他人。本次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟,本次验证码为:"+content+"【成都高新人才安居资格认定】", "GBK"); + }else if ("login".equals(type)){ + gbk = URLEncoder.encode("尊敬的用户,您正在办理用户登录操作,我们不会向您索要此验证码,切勿告知他人。本次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟,本次验证码为:"+content+"【成都高新人才安居资格认定】", "GBK"); + }else if ("forgetPwd".equals(type)){ + gbk = URLEncoder.encode("尊敬的用户,您正在办理用户忘记密码操作,我们不会向您索要此验证码,切勿告知他人。本次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟,本次验证码为:"+content+"【成都高新人才安居资格认定】", "GBK"); + }else if("updatePwd".equals(type)){ + gbk = URLEncoder.encode("尊敬的用户,您正在办理用户修改密码,我们不会向您索要此验证码,切勿告知他人。本次验证码有效性为:"+ Constants.CAPTCHA_EXPIRATION +"分钟,本次验证码为:"+content+"【成都高新人才安居资格认定】", "GBK"); + }else if ("updatePhone".equals(type)){ + + } + paramMap.put("Content",gbk); + String result = HttpRequest.get(url) + .form(paramMap)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + if (returnStatus(result)){ + return SmsResult.builder() + .isSuccess(true) + .build(); + } + throw new ServiceException("未知异常"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + + /** + * 发送短信通知 + * @param phones + * @param content + * @return + */ + public SmsResult telecomSendNotice(String phones, String content) { + try { +// String url ="https://msg.cdht.org.cn:8082/apigbk/BatchSend2"; + HashMap paramMap = new HashMap<>(); + paramMap.put("CorpID","jxxc"); + paramMap.put("Pwd","ULul@2023"); + paramMap.put("Mobile",phones); + String gbk = null; + gbk = URLEncoder.encode(content+"【成都高新人才安居资格认定】", "GBK"); + paramMap.put("Content",gbk); + String result = HttpRequest.get(url) + .form(paramMap)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + if (returnStatus(result)){ + return SmsResult.builder() + .isSuccess(true) + .build(); + } + System.out.println("result2 = " + result); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + return null; + } + + + /** + * 状态返回值 + * @param number + * @return + */ + private boolean returnStatus(String number){ + if (!StringUtils.isNumeric(number)) { + switch (number) { + case "-1": + throw new ServiceException("账户或密码错误,未获取到用户信息"); + case "-2": + throw new ServiceException("其他错误(未知错误,网络波动,请稍后再试)"); + case "-3": + throw new ServiceException("账户配置不正确"); + case "-4": + throw new ServiceException("在禁止发送的时间段"); + case "-5": + throw new ServiceException("余额不足,请充值"); + case "-6": + throw new ServiceException("定时发送时间不是有效的时间格式"); + case "-7": + throw new ServiceException("提交信息末尾未签名,请添加中文的企业签名【 】或内容乱码"); + case "-8": + throw new ServiceException("发送号码数量超出系统限制"); + case "-9": + throw new ServiceException("发送字数超出系统限制长度"); + case "-10": + throw new ServiceException("产品不存在"); + case "-11": + throw new ServiceException("内容不能再存在签名"); + case "-12": + throw new ServiceException("传入参数不正确!"); + case "-13": + throw new ServiceException("手机号校验不正确"); + case "-14": + throw new ServiceException("内容中存在黑字典关键字"); + case "-15": + throw new ServiceException("定时时间格式错误"); + case "-16": + throw new ServiceException("扩展号格式不正确"); + case "-17": + throw new ServiceException("子号池全被占用,请等待释放后再操作"); + case "-18": + throw new ServiceException("该扩展号被投票问卷占用,请使用其他的扩展"); + case "-19": + throw new ServiceException("SendSms计费类型选择不正确"); + case "-100": + throw new ServiceException("发送失败"); + case "-101": + throw new ServiceException("调用频率过快"); + case "-103": + throw new ServiceException("IP未导白"); + case "-111": + throw new ServiceException("个性短信入口错误"); + case "-200": + throw new ServiceException("网络连接失败"); + case "-401": + throw new ServiceException("账号没有调用接口权限,请联系客服专员"); + } + } + return true; + } +} diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java new file mode 100644 index 000000000..89c39b403 --- /dev/null +++ b/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java @@ -0,0 +1,31 @@ +package com.ruoyi.sms.entity; + +import lombok.Builder; +import lombok.Data; + +/** + * 上传返回体 + * + * @author Lion Li + */ +@Data +@Builder +public class SmsResult { + + /** + * 是否成功 + */ + private boolean isSuccess; + + /** + * 响应消息 + */ + private String message; + + /** + * 实际响应体 + *

+ * 可自行转换为 SDK 对应的 SendSmsResponse + */ + private String response; +} diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 7db3a02a0..c99ea1b9a 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -28,13 +28,15 @@ com.ruoyi ruoyi-oss - com.ruoyi ruoyi-sms - + + com.ruoyi + ruoyi-work + 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 new file mode 100644 index 000000000..69a32a93c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/common/WorkBusinessRule.java @@ -0,0 +1,50 @@ +package com.ruoyi.system.common; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.BuyHouseCheck; +import com.ruoyi.system.domain.HousesReview; +import com.ruoyi.system.domain.MaterialModule; +import com.ruoyi.system.domain.vo.BuyHouseCheckVo; +import com.ruoyi.system.domain.vo.MaterialModuleVo; +import com.ruoyi.system.mapper.BuyHouseCheckMapper; +import com.ruoyi.system.mapper.HousesReviewMapper; +import com.ruoyi.system.service.impl.MaterialModuleServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Component +@RequiredArgsConstructor +public class WorkBusinessRule { + + private static final BuyHouseCheckMapper buyHouseCheckMapper= SpringUtils.getBean(BuyHouseCheckMapper.class); + + private static final HousesReviewMapper housesReviewMapper = SpringUtils.getBean(HousesReviewMapper.class); + private static final MaterialModuleServiceImpl materialModuleService = SpringUtils.getBean(MaterialModuleServiceImpl.class); + + public String getDistrict(String district,String step){ + //先获取业务数据 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("crux_key","buy_house_audit"); + qw.eq("other_key",district); + qw.eq("step",step); + BuyHouseCheckVo buyHouseCheckVo = buyHouseCheckMapper.selectVoOne(qw); + return buyHouseCheckVo.getPerson(); + } + + public List getCheckDept(Long id){ + HousesReview housesReview = housesReviewMapper.selectById(id); + Map map = BeanUtil.beanToMap(housesReview); + List materialInfo = materialModuleService.getMaterialInfo(map); + List collect = materialInfo.stream().map(MaterialModuleVo::getAuditDept) + .filter(c -> ObjectUtil.isNotNull(c) && ObjectUtil.isNotEmpty(c)).collect(Collectors.toList()); + return collect; + } +} + diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouseCheck.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouseCheck.java new file mode 100644 index 000000000..89b2e5192 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouseCheck.java @@ -0,0 +1,45 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * 购房审核人员不同类型需要的审核人员名单对象 buy_house_check + * + * @author ruoyi + * @date 2023-02-24 + */ +@Data +@TableName("buy_house_check") +public class BuyHouseCheck{ + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 描述 + */ + private String remark; + + /** + * 人员 + */ + private String person; + /** + * 需要关联的key + */ + private String otherKey; + /** + * 关键key + */ + private String cruxKey; + + private String step; + +} 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 new file mode 100644 index 000000000..39bccbac7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHouses.java @@ -0,0 +1,182 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +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; + +/** + * 【请填写功能名称】对象 buy_houses + * + * @author ruoyi + * @date 2023-02-24 + */ +@Data +@TableName("buy_houses") +public class BuyHouses extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + 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 List buyHousesMemberList=new ArrayList<>(); + + private String apiKey; + + @TableField(exist = false) + private String reply; + + private String step; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesMember.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesMember.java new file mode 100644 index 000000000..adb343bb2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesMember.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 购房家属关系对象 buy_houses_member + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("buy_houses_member") +public class BuyHousesMember extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 户口簿内页 + */ + private String insidepageUrl; + /** + * 购房申报id + */ + private String buyHousesId; + /** + * 身份证正面 + */ + private String frontUrl; + /** + * 关系 + */ + private String relation; + /** + * 身份证背面 + */ + private String reverseUrl; + /** + * 房屋记录 + */ + private String homeRecordUrl; + /** + * 证件号 + */ + private String cardId; + /** + * 姓名 + */ + private String name; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesReviewMember.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesReviewMember.java new file mode 100644 index 000000000..2ed907837 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BuyHousesReviewMember.java @@ -0,0 +1,63 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 购房复审家属关系对象 buy_houses_review_member + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("buy_houses_review_member") +public class BuyHousesReviewMember extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 户口簿内页 + */ + private String insidepageUrl; + /** + * 购房申报id + */ + private String buyHousesId; + /** + * 身份证正面 + */ + private String frontUrl; + /** + * 关系 + */ + private String relation; + /** + * 身份证背面 + */ + private String reverseUrl; + /** + * 房屋记录 + */ + private String homeRecordUrl; + /** + * 证件号 + */ + private String cardId; + /** + * 姓名 + */ + private String name; + + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/HousesReview.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/HousesReview.java new file mode 100644 index 000000000..3e55accd3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/HousesReview.java @@ -0,0 +1,144 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 购房复审登记对象 houses_review + * + * @author ruoyi + * @date 2023-03-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("houses_review") +public class HousesReview extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * id + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 证件类型 + */ + private String cardType; + + private String step; + /** + * 身份证号码 + */ + 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; + /** + * 来源区级:1,市级:2 + */ + private String sourceBy; + /** + * 流程key + */ + private String processKey; + + /** + * 流程状态 + */ + private String processStatus; + + /** + * 工作单位所属区域 + */ + private String companyAddressArea; + + /** + * d类字段扩展 + */ + private String typeExtend; + + private Date passTime; + +} 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 new file mode 100644 index 000000000..2653ea822 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialModule.java @@ -0,0 +1,76 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +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 lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 材料模块对象 material_module + * + * @author ruoyi + * @date 2023-03-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("material_module") +public class MaterialModule extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 材料名称 + */ + private String materialName; + /** + * 材料key + */ + private String materialKey; + /** + * 审核部门 + */ + private String auditDept; + /** + * 描述 + */ + private String description; + /** + * 排序 + */ + private Long sort; + /** + * 是否必填 + */ + private String isMust; + + @TableField(exist = false) + private String file; + + + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + + @TableField(exist = false) + private Long[] auditDeptArr=new Long[]{}; + + /** + * 按钮显示名称 + */ + private String interfaceName; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialProof.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialProof.java new file mode 100644 index 000000000..6bf728508 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialProof.java @@ -0,0 +1,67 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 材料对象 material_proof + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("material_proof") +public class MaterialProof extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 关联申请id + */ + private String houseId; + /** + * 0待审核,1审核失败,2审核成功 + */ + private Long status; + /** + * 所对应材料的id + */ + private String modulePathId; + /** + * 数据 + */ + private String file; + /** + * 对应module_paht的字段 + */ + private String materialKey; + /** + * 对应module_path的描述 + */ + private String description; + /** + * 审核人 + */ + private String auditDept; + /** + * 审核人类型 + */ + private String checkType; + + private String materialName; + + private String processKey; + + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialTalents.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialTalents.java new file mode 100644 index 000000000..cc52ac185 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/MaterialTalents.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 材料关系对象 material_talents + * + * @author ruoyi + * @date 2023-03-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("material_talents") +public class MaterialTalents extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 主键 + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 父id + */ + private Long parentId; + /** + * 值 + */ + private String talentsValue; + /** + * 节点名称 + */ + private String talentsName; + /** + * 版本 + */ + @Version + private Long version; + /** + * 删除标志 + */ + @TableLogic + private Long delFlag; + /** + * 是否选中 + */ + private String selected; + /** + * 对应的材料 + */ + private String materials; + + @TableField(exist = false) + private Integer[] materialList; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/PushLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/PushLog.java new file mode 100644 index 000000000..ca4cad2d5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/PushLog.java @@ -0,0 +1,39 @@ +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 com.ruoyi.common.core.domain.BaseEntity; + +/** + * 推送日志对象 push_log + * + * @author ruoyi + * @date 2023-07-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("push_log") +public class PushLog extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 推送数据 + */ + private String pushData; + /** + * 返回结果 + */ + private String resultData; + +} 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 new file mode 100644 index 000000000..bc3c8d72f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SubscribeExport.java @@ -0,0 +1,45 @@ +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 com.ruoyi.common.core.domain.BaseEntity; + +/** + * 预约导出对象 subscribe_export + * + * @author ruoyi + * @date 2023-04-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("subscribe_export") +public class SubscribeExport extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 路径 + */ + private String path; + /** + * 申请人id + */ + private String userId; + + private String description; + + private String processKey; + + private String exportStatus; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index ca9a77ce3..ae1b358ed 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -2,6 +2,7 @@ package com.ruoyi.system.domain; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.annotation.ExcelDictFormat; @@ -29,7 +30,7 @@ public class SysConfig extends BaseEntity { * 参数主键 */ @ExcelProperty(value = "参数主键") - @TableId(value = "config_id") + @TableId(value = "config_id",type = IdType.AUTO) private Long configId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java index f95b332e7..5de8c3033 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java @@ -2,6 +2,7 @@ package com.ruoyi.system.domain; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -30,7 +31,7 @@ public class SysLogininfor implements Serializable { * ID */ @ExcelProperty(value = "序号") - @TableId(value = "info_id") + @TableId(value = "info_id",type = IdType.AUTO) private Long infoId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java index dec401e3e..5032eb13f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.core.domain.BaseEntity; @@ -24,7 +25,7 @@ public class SysNotice extends BaseEntity { /** * 公告ID */ - @TableId(value = "notice_id") + @TableId(value = "notice_id",type = IdType.AUTO) private Long noticeId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 84af07b91..ba07ce3a8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -2,6 +2,7 @@ package com.ruoyi.system.domain; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -31,7 +32,7 @@ public class SysOperLog implements Serializable { * 日志主键 */ @ExcelProperty(value = "日志主键") - @TableId(value = "oper_id") + @TableId(value = "oper_id",type = IdType.AUTO) private Long operId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java index 968304bb4..4338e7305 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOss.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.core.domain.BaseEntity; @@ -19,7 +20,7 @@ public class SysOss extends BaseEntity { /** * 对象存储主键 */ - @TableId(value = "oss_id") + @TableId(value = "oss_id",type = IdType.AUTO) private Long ossId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOssConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOssConfig.java index ac5e5a3ac..f4ccf0dd8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOssConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOssConfig.java @@ -1,5 +1,6 @@ package com.ruoyi.system.domain; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.core.domain.BaseEntity; @@ -19,7 +20,7 @@ public class SysOssConfig extends BaseEntity { /** * 主建 */ - @TableId(value = "oss_config_id") + @TableId(value = "oss_config_id",type = IdType.AUTO) private Long ossConfigId; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index ecb84f4b4..ab5deac7c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -2,6 +2,7 @@ package com.ruoyi.system.domain; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -31,7 +32,7 @@ public class SysPost extends BaseEntity { * 岗位序号 */ @ExcelProperty(value = "岗位序号") - @TableId(value = "post_id") + @TableId(value = "post_id",type = IdType.AUTO) private Long postId; /** 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 new file mode 100644 index 000000000..4297da45a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java @@ -0,0 +1,101 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 【请填写功能名称】对象 user + * + * @author ruoyi + * @date 2023-04-03 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("user") +public class User extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * + */ + @TableId(value = "id",type = IdType.AUTO) + private Long id; + /** + * 用户账号状态 1,未认定 2,认定中 ,3 未发卡,4 已发卡 + */ + private Long status; + /** + * 用户名 + */ + private String loginName; + /** + * 登陆密码 + */ + private String password; + /** + * 卡号 + */ + private String cardNumber; + /** + * 认定类型 + */ + private String type; + /** + * 卡有效期 + */ + private String validityDate; + /** + * 微信token + */ + private String wxToken; + /** + * 登陆次数 + */ + private Long enterNumber; + /** + * 用户名称 + */ + private String userName; + /** + * + */ + private Date lastTime; + /** + * 方向 + */ + private Long direction; + /** + * 用户限制 1,正常 2,禁用 + */ + private Long jurisdiction; + /** + * 求职意向 + */ + private String jobWanted; + /** + * + */ + private Date registerTime; + /** + * 申报的微信token + */ + private String wxToken1; + /** + * 身份证 + */ + private String cardId; + + /** + * 用户类型 + */ + private String userType; + + private String companyId; + + private String apiKey; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesBo.java new file mode 100644 index 000000000..5e6890d2b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesBo.java @@ -0,0 +1,252 @@ +package com.ruoyi.system.domain.bo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.DownloadGroup; +import com.ruoyi.common.core.validate.EditGroup; +import com.ruoyi.system.domain.BuyHousesMember; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * 【请填写功能名称】业务对象 buy_houses + * + * @author ruoyi + * @date 2023-02-24 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class BuyHousesBo extends BaseEntity { + + /** + * + */ +// @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 户口簿内页/护照内页 + */ + @NotBlank(message = "户口簿内页/护照内页不能为空", groups = { AddGroup.class, EditGroup.class }) + private String insidepageUrl; + + /** + * 身份证/护照 + */ + @NotBlank(message = "身份证/护照不能为空", groups = { AddGroup.class, EditGroup.class ,DownloadGroup.class}) + private String cardId; + + /** + * 承诺书 + */ + @NotBlank(message = "承诺书不能为空", groups = { AddGroup.class, EditGroup.class }) + private String commitmentUrl; + + /** + * 单位地址 + */ + @NotBlank(message = "单位地址不能为空", groups = { AddGroup.class, EditGroup.class, DownloadGroup.class }) + private String companyAddress; + + /** + * 工作单位 + */ + @NotBlank(message = "工作单位不能为空", groups = { AddGroup.class, EditGroup.class , DownloadGroup.class}) + private String companyName; + + /** + * + */ +// @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date createTime; + + /** + * 申明书 + */ + @NotBlank(message = "申明书不能为空", groups = { AddGroup.class, EditGroup.class }) + private String declarationUrl; + + /** + * 企业所在地 1.新经济活力区 2.交子公园金融商务区 3.高新西区 4.生物城 + */ + @NotBlank(message = "企业所在地 1.新经济活力区 2.交子公园金融商务区 3.高新西区 4.生物城不能为空", groups = { AddGroup.class, EditGroup.class }) + private String district; + + /** + * 学历 + */ + @NotBlank(message = "学历不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String education; + + /** + * 身份证正面 + */ +// @NotBlank(message = "身份证正面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String frontUrl; + + /** + * 公园城市局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @NotBlank(message = "公园城市局审核状态 1.待审核 2.退件 3.不通过 4.通过不能为空", groups = { AddGroup.class, EditGroup.class }) + private String gyStatus; + + /** + * 房屋记录 + */ + @NotBlank(message = "房屋记录不能为空", groups = { AddGroup.class, EditGroup.class }) + private String homeRecordUrl; + + /** + * 户口簿主页 + */ +// @NotBlank(message = "户口簿主页不能为空", groups = { AddGroup.class, EditGroup.class }) + private String homepageUrl; + + /** + * 劳动合同 + */ + @NotBlank(message = "劳动合同不能为空", groups = { AddGroup.class, EditGroup.class }) + private String laborContractUrl; + + /** + * 企业营业执照 + */ + @NotBlank(message = "企业营业执照不能为空", groups = { AddGroup.class, EditGroup.class }) + private String licenseUrl; + + /** + * 婚姻状况 1.未婚 2.已婚 3.离异 + */ + @NotBlank(message = "婚姻状况 1.未婚 2.已婚 3.离异不能为空", groups = { AddGroup.class, EditGroup.class }) + private String maritalStatus; + + /** + * 婚姻证明材料 + */ + @NotBlank(message = "婚姻证明材料不能为空", groups = { AddGroup.class, EditGroup.class }) + private String maritalUrl; + + /** + * 国籍 + */ + @NotBlank(message = "国籍不能为空", groups = { AddGroup.class, EditGroup.class }) + private String nationality; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String phone; + + /** + * 区域部门审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @NotBlank(message = "区域部门审核状态 1.待审核 2.退件 3.不通过 4.通过不能为空", groups = { AddGroup.class, EditGroup.class }) + private String qyStatus; + + /** + * 身份证背面 + */ +// @NotBlank(message = "身份证背面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String reverseUrl; + + /** + * 性别 + */ + @NotBlank(message = "性别不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String sex; + + /** + * 社会事业局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @NotBlank(message = "社会事业局审核状态 1.待审核 2.退件 3.不通过 4.通过不能为空", groups = { AddGroup.class, EditGroup.class }) + private String shStatus; + + /** + * 统一社会信用代码 + */ + @NotBlank(message = "统一社会信用代码不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String socialCode; + + /** + * 社保证明 + */ + @NotBlank(message = "社保证明不能为空", groups = { AddGroup.class, EditGroup.class }) + private String socialSecurityUrl; + + /** + * 状态 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过 + */ +// @NotBlank(message = "状态 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过不能为空", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 类型 A B C D + */ + @NotBlank(message = "类型 A B C D不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String type; + + /** + * 用户id + */ +// @NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long userId; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class }) + private String userName; + + /** + * + */ +// @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date passTime; + + /** + *人才影像卡 + */ +// @NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private String pictureInformationUrl; + + /** + *工作地址 + */ + @NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private String workAddress; + + /** + * 流程key + */ + private String processKey; + + /** + * 流程状态 + */ + @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String processStatus; + + @TableField(exist = false) + private List buyHousesMemberList; + + + private String version; + + private String companyId; + + @TableField(exist = false) + private Long[] ids; + + private String apiKey; + + private String step; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesMemberBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesMemberBo.java new file mode 100644 index 000000000..bcd894a20 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesMemberBo.java @@ -0,0 +1,78 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 购房家属关系业务对象 buy_houses_member + * + * @author ruoyi + * @date 2023-03-15 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class BuyHousesMemberBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 户口簿内页 + */ + @NotBlank(message = "户口簿内页不能为空", groups = { AddGroup.class, EditGroup.class }) + private String insidepageUrl; + + /** + * 购房申报id + */ + @NotNull(message = "购房申报id不能为空", groups = { AddGroup.class, EditGroup.class }) + private String buyHousesId; + + /** + * 身份证正面 + */ + @NotBlank(message = "身份证正面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String frontUrl; + + /** + * 关系 + */ + @NotBlank(message = "关系不能为空", groups = { AddGroup.class, EditGroup.class }) + private String relation; + + /** + * 身份证背面 + */ + @NotBlank(message = "身份证背面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String reverseUrl; + + /** + * 房屋记录 + */ + @NotBlank(message = "房屋记录不能为空", groups = { AddGroup.class, EditGroup.class }) + private String homeRecordUrl; + + /** + * 证件号 + */ + @NotBlank(message = "证件号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String cardId; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class }) + private String name; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesReviewMemberBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesReviewMemberBo.java new file mode 100644 index 000000000..7458cb625 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/BuyHousesReviewMemberBo.java @@ -0,0 +1,79 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 购房复审家属关系业务对象 buy_houses_review_member + * + * @author ruoyi + * @date 2023-03-15 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class BuyHousesReviewMemberBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 户口簿内页 + */ + @NotBlank(message = "户口簿内页不能为空", groups = { AddGroup.class, EditGroup.class }) + private String insidepageUrl; + + /** + * 购房申报id + */ + @NotNull(message = "购房申报id不能为空", groups = { AddGroup.class, EditGroup.class }) + private String buyHousesId; + + /** + * 身份证正面 + */ + @NotBlank(message = "身份证正面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String frontUrl; + + /** + * 关系 + */ + @NotBlank(message = "关系不能为空", groups = { AddGroup.class, EditGroup.class }) + private String relation; + + /** + * 身份证背面 + */ + @NotBlank(message = "身份证背面不能为空", groups = { AddGroup.class, EditGroup.class }) + private String reverseUrl; + + /** + * 房屋记录 + */ + @NotBlank(message = "房屋记录不能为空", groups = { AddGroup.class, EditGroup.class }) + private String homeRecordUrl; + + /** + * 证件号 + */ + @NotBlank(message = "证件号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String cardId; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class }) + private String name; + + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/HousesReviewBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/HousesReviewBo.java new file mode 100644 index 000000000..854717bbd --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/HousesReviewBo.java @@ -0,0 +1,197 @@ +package com.ruoyi.system.domain.bo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import com.ruoyi.system.domain.BuyHousesReviewMember; +import com.ruoyi.system.domain.MaterialModule; +import com.ruoyi.system.domain.MaterialProof; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; +import java.util.List; + +/** + * 购房复审登记业务对象 houses_review + * + * @author ruoyi + * @date 2023-03-08 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class HousesReviewBo extends BaseEntity { + + /** + * id + */ + @NotNull(message = "id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 证件类型 + */ + @NotBlank(message = "证件类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String cardType; + + + private String step; + /** + * 身份证号码 + */ + @NotBlank(message = "身份证号码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String card; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class }) + private String name; + + /** + * 资格序号 + */ + @NotBlank(message = "资格序号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String qualification; + + /** + * 审核时间 + */ + @NotBlank(message = "审核时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditTime; + + /** + * 预售证号 + */ + @NotBlank(message = "预售证号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String presellCard; + + /** + * 交易类型 + */ + @NotBlank(message = "交易类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String dealType; + + /** + * 项目名称 + */ + @NotBlank(message = "项目名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String projectName; + + /** + * 项目区域 + */ + @NotBlank(message = "项目区域不能为空", groups = { AddGroup.class, EditGroup.class }) + private String projectArea; + + /** + * 资格确认时间 + */ + @NotBlank(message = "资格确认时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private String qualificationConfirmTime; + + /** + * 资格预申请时间 + */ +// @NotBlank(message = "资格预申请时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private String qualificationPreApplyTime; + + /** + * 家庭类型 + */ + @NotBlank(message = "家庭类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String familyType; + + /** + * 状态 + */ +// @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 登记失效时间 + */ + @NotBlank(message = "登记失效时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private String registerFailureTime; + + /** + * 国籍 + */ + @NotBlank(message = "国籍不能为空", groups = { AddGroup.class, EditGroup.class }) + private String nationality; + + /** + * 婚姻状况 + */ + @NotBlank(message = "婚姻状况不能为空", groups = { AddGroup.class, EditGroup.class }) + private String maritalStatus; + + /** + * 单位类型 + */ +// @NotBlank(message = "单位类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String companyType; + + /** + * 公司名称 + */ + @NotBlank(message = "公司名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String companyName; + + /** + * 人才类型 + */ + @NotBlank(message = "人才类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String talentsType; + + /** + * 统一社会信用代码 + */ + @NotBlank(message = "统一社会信用代码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String creditCode; + + /** + * 企业所在地 + */ + @NotBlank(message = "企业所在地不能为空", groups = { AddGroup.class, EditGroup.class }) + private String companyAddress; + + /** + * 来源 + */ + @NotBlank(message = "来源不能为空", groups = { AddGroup.class, EditGroup.class }) + private String sourceBy; + + /** + * 流程key + */ + @NotBlank(message = "流程key不能为空", groups = { AddGroup.class, EditGroup.class }) + private String processKey; + + private String processStatus; + + private String companyAddressArea; + + private List buyHousesMemberList; + + private List materialsList; + + private List materialProofList; + + /** + * d类字段扩展 + */ + private String typeExtend; + + @TableField(exist = false) + private Long[] ids; + + private Date passTime; + +} 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 new file mode 100644 index 000000000..2105c3266 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialModuleBo.java @@ -0,0 +1,83 @@ +package com.ruoyi.system.domain.bo; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 材料模块业务对象 material_module + * + * @author ruoyi + * @date 2023-03-09 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class MaterialModuleBo extends BaseEntity { + + /** + * + */ + private Long id; + + /** + * 材料名称 + */ + @NotBlank(message = "材料名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialName; + + /** + * 材料key + */ + @NotBlank(message = "材料key不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialKey; + + /** + * 审核部门 + */ +// @NotBlank(message = "审核部门不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditDept; + + @TableField(exist = false) + private Long[] auditDeptArr =new Long[]{}; + + /** + * 描述 + */ + private String description; + + /** + * 排序 + */ + @NotNull(message = "排序不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long sort; + + /** + * 是否必填 + */ + @NotNull(message = "是否必填不能为空", groups = { AddGroup.class, EditGroup.class }) + private String isMust; + + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + + /** + * 按钮显示名称 + */ + private String interfaceName; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialProofBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialProofBo.java new file mode 100644 index 000000000..75844645c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialProofBo.java @@ -0,0 +1,91 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Date; + +/** + * 材料业务对象 material_proof + * + * @author ruoyi + * @date 2023-03-15 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class MaterialProofBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 关联申请id + */ + @NotBlank(message = "关联申请id不能为空", groups = { AddGroup.class, EditGroup.class }) + private String houseId; + + /** + * 创建时间 + */ + @NotNull(message = "创建时间不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date createTime; + + /** + * 0待审核,1审核失败,2审核成功 + */ + @NotNull(message = "0待审核,1审核失败,2审核成功不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long status; + + /** + * 所对应材料的id + */ + @NotBlank(message = "所对应材料的id不能为空", groups = { AddGroup.class, EditGroup.class }) + private String modulePathId; + + /** + * 数据 + */ + @NotBlank(message = "数据不能为空", groups = { AddGroup.class, EditGroup.class }) + private String file; + + /** + * 对应module_paht的字段 + */ + @NotBlank(message = "对应module_paht的字段不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materialKey; + + /** + * 对应module_path的描述 + */ + @NotBlank(message = "对应module_path的描述不能为空", groups = { AddGroup.class, EditGroup.class }) + private String description; + + /** + * 审核人 + */ + @NotBlank(message = "审核人不能为空", groups = { AddGroup.class, EditGroup.class }) + private String auditDept; + + /** + * 审核人类型 + */ + @NotBlank(message = "审核人类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String checkType; + + private String materialName; + + /** + * 次数 + */ + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialTalentsBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialTalentsBo.java new file mode 100644 index 000000000..bd85f6dc7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/MaterialTalentsBo.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 材料关系业务对象 material_talents + * + * @author ruoyi + * @date 2023-03-09 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class MaterialTalentsBo extends BaseEntity { + + /** + * 主键 + */ + private Long id; + + /** + * 父id + */ + @NotNull(message = "父id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long parentId; + + /** + * 值 + */ + @NotNull(message = "值不能为空", groups = { AddGroup.class, EditGroup.class }) + private String talentsValue; + + /** + * 节点名称 + */ + @NotBlank(message = "节点名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String talentsName; + + /** + * 是否选中 + */ +// @NotBlank(message = "是否选中不能为空", groups = { AddGroup.class, EditGroup.class }) + private String selected; + + /** + * 对应的材料 + */ +// @NotBlank(message = "对应的材料不能为空", groups = { AddGroup.class, EditGroup.class }) + private String materials; + + private Integer[] materialList; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/PushLogBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/PushLogBo.java new file mode 100644 index 000000000..fcc31f4c1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/PushLogBo.java @@ -0,0 +1,43 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 推送日志业务对象 push_log + * + * @author ruoyi + * @date 2023-07-20 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class PushLogBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 推送数据 + */ + @NotBlank(message = "推送数据不能为空", groups = { AddGroup.class, EditGroup.class }) + private String pushData; + + /** + * 返回结果 + */ + @NotBlank(message = "返回结果不能为空", groups = { AddGroup.class, EditGroup.class }) + private String resultData; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/RsaSecurityBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/RsaSecurityBo.java new file mode 100644 index 000000000..d9d2dae42 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/RsaSecurityBo.java @@ -0,0 +1,68 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 请求RSA数据加解密业务对象 rsa_security + * + * @author ruoyi + * @date 2023-05-17 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class RsaSecurityBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + /** + * 需要加密的接口 + */ + @NotBlank(message = "需要加密的接口不能为空", groups = { AddGroup.class, EditGroup.class }) + private String path; + + /** + * 入参是否解密,默认不解密 + */ + @NotNull(message = "入参是否解密,默认不解密不能为空", groups = { AddGroup.class, EditGroup.class }) + private String inDecode; + + /** + * 出参是否加密,默认加密 + */ + @NotNull(message = "出参是否加密,默认加密不能为空", groups = { AddGroup.class, EditGroup.class }) + private String outEncode; + + /** + * 公钥 + */ + private String publicKey; + + /** + * 私钥 + */ + private String privateKey; + + /** + * 请求方式 + */ + private String method; + + /** + * 接口限制请求 + */ + private String restricted; + + +} 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 new file mode 100644 index 000000000..c1e888cf7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/SubscribeExportBo.java @@ -0,0 +1,49 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 预约导出业务对象 subscribe_export + * + * @author ruoyi + * @date 2023-04-20 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class SubscribeExportBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 路径 + */ + @NotBlank(message = "路径不能为空", groups = { AddGroup.class, EditGroup.class }) + private String path; + + /** + * 申请人id + */ + @NotBlank(message = "申请人id不能为空", groups = { AddGroup.class, EditGroup.class }) + private String userId; + + private String description; + + private String processKey; + + private String exportStatus; + + +} 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 new file mode 100644 index 000000000..8105f52e1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/UserBo.java @@ -0,0 +1,134 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 【请填写功能名称】业务对象 user + * + * @author ruoyi + * @date 2023-04-03 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class UserBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 用户账号状态 1,未认定 2,认定中 ,3 未发卡,4 已发卡 + */ + @NotNull(message = "用户账号状态 1,未认定 2,认定中 ,3 未发卡,4 已发卡不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long status; + + /** + * 用户名 + */ + @NotBlank(message = "用户名不能为空", groups = { AddGroup.class, EditGroup.class }) + private String loginName; + + /** + * 登陆密码 + */ + @NotBlank(message = "登陆密码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String password; + + /** + * 卡号 + */ + @NotBlank(message = "卡号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String cardNumber; + + /** + * 认定类型 + */ + @NotBlank(message = "认定类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String type; + + /** + * 卡有效期 + */ + @NotBlank(message = "卡有效期不能为空", groups = { AddGroup.class, EditGroup.class }) + private String validityDate; + + /** + * 微信token + */ + @NotBlank(message = "微信token不能为空", groups = { AddGroup.class, EditGroup.class }) + private String wxToken; + + /** + * 登陆次数 + */ + @NotNull(message = "登陆次数不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long enterNumber; + + /** + * 用户名称 + */ + @NotBlank(message = "用户名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String userName; + + /** + * + */ + @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date lastTime; + + /** + * 方向 + */ + @NotNull(message = "方向不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long direction; + + /** + * 用户限制 1,正常 2,禁用 + */ + @NotNull(message = "用户限制 1,正常 2,禁用不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long jurisdiction; + + /** + * 求职意向 + */ + @NotBlank(message = "求职意向不能为空", groups = { AddGroup.class, EditGroup.class }) + private String jobWanted; + + /** + * + */ + @NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class }) + private Date registerTime; + + /** + * 申报的微信token + */ + @NotBlank(message = "申报的微信token不能为空", groups = { AddGroup.class, EditGroup.class }) + private String wxToken1; + + /** + * 身份证 + */ + @NotBlank(message = "身份证不能为空", groups = { AddGroup.class, EditGroup.class }) + private String cardId; + + /** + * 用户类型 + */ + private String userType; + + private String companyId; + + +} 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..48fc52239 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BuyHousesEvent.java @@ -0,0 +1,183 @@ +package com.ruoyi.system.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +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",type = IdType.AUTO) + 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 Long excelId; + + @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/DeclareListDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeclareListDTO.java new file mode 100644 index 000000000..87d41d306 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/DeclareListDTO.java @@ -0,0 +1,43 @@ +package com.ruoyi.system.domain.dto; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import lombok.Data; + +import java.util.Date; + +@Data +@ExcelIgnoreUnannotated +public class DeclareListDTO { + /** + * 项目名称 + */ + private String projectName; + + /** + * 提交时间 + */ + private Date createTime; + + /** + * 状态 + */ + private String processStatus; + + /** + * 业务id + */ + private String businessId; + + /** + * 申请人 + */ + private String userName; + + /** + * 流程key + */ + private String processKey; + + private String cardId; + +} 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..42f40f647 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/HousesReviewEvent.java @@ -0,0 +1,152 @@ +package com.ruoyi.system.domain.dto; + +import com.baomidou.mybatisplus.annotation.IdType; +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",type = IdType.AUTO) + 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 Long excelId; + + + @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/BuyHouseCheckVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHouseCheckVo.java new file mode 100644 index 000000000..d1127420e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHouseCheckVo.java @@ -0,0 +1,54 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + + +/** + * 购房审核人员不同类型需要的审核人员名单视图对象 buy_house_check + * + * @author ruoyi + * @date 2023-02-24 + */ +@Data +@ExcelIgnoreUnannotated +public class BuyHouseCheckVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 描述 + */ + @ExcelProperty(value = "描述") + private String remark; + + + /** + * 人员 + */ + @ExcelProperty(value = "人员") + private String person; + + /** + * 需要关联的key + */ + @ExcelProperty(value = "需要关联的key") + private String otherKey; + + /** + * 关键key + */ + @ExcelProperty(value = "关键key") + private String cruxKey; + + private String step; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesMemberVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesMemberVo.java new file mode 100644 index 000000000..459dcc154 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesMemberVo.java @@ -0,0 +1,75 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + + +/** + * 购房家属关系视图对象 buy_houses_member + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@ExcelIgnoreUnannotated +public class BuyHousesMemberVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 户口簿内页 + */ + @ExcelProperty(value = "户口簿内页") + private String insidepageUrl; + + /** + * 购房申报id + */ + @ExcelProperty(value = "购房申报id") + private String buyHousesId; + + /** + * 身份证正面 + */ + @ExcelProperty(value = "身份证正面") + private String frontUrl; + + /** + * 关系 + */ + @ExcelProperty(value = "关系") + private String relation; + + /** + * 身份证背面 + */ + @ExcelProperty(value = "身份证背面") + private String reverseUrl; + + /** + * 房屋记录 + */ + @ExcelProperty(value = "房屋记录") + private String homeRecordUrl; + + /** + * 证件号 + */ + @ExcelProperty(value = "证件号") + private String cardId; + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + private String name; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesReviewMemberVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesReviewMemberVo.java new file mode 100644 index 000000000..b51954716 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesReviewMemberVo.java @@ -0,0 +1,76 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + + +/** + * 购房复审家属关系视图对象 buy_houses_review_member + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@ExcelIgnoreUnannotated +public class BuyHousesReviewMemberVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 户口簿内页 + */ + @ExcelProperty(value = "户口簿内页") + private String insidepageUrl; + + /** + * 购房申报id + */ + @ExcelProperty(value = "购房申报id") + private String buyHousesId; + + /** + * 身份证正面 + */ + @ExcelProperty(value = "身份证正面") + private String frontUrl; + + /** + * 关系 + */ + @ExcelProperty(value = "关系") + private String relation; + + /** + * 身份证背面 + */ + @ExcelProperty(value = "身份证背面") + private String reverseUrl; + + /** + * 房屋记录 + */ + @ExcelProperty(value = "房屋记录") + private String homeRecordUrl; + + /** + * 证件号 + */ + @ExcelProperty(value = "证件号") + private String cardId; + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + private String name; + + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesVo.java new file mode 100644 index 000000000..0d05dfb14 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/BuyHousesVo.java @@ -0,0 +1,257 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.alibaba.excel.converters.date.DateStringConverter; +import com.alibaba.excel.converters.url.UrlImageConverter; +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.system.domain.BuyHousesMember; +import com.ruoyi.system.domain.MaterialProof; +import lombok.Data; + +import java.net.URL; +import java.util.Date; +import java.util.List; + + +/** + * 【请填写功能名称】视图对象 buy_houses + * + * @author ruoyi + * @date 2023-02-24 + */ +@Data +@ExcelIgnoreUnannotated +public class BuyHousesVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ +// @ExcelProperty(value = "") + private Long id; + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + private String userName; + + /** + * 户口簿内页/护照内页 + */ +// @ExcelProperty(value = "户口簿内页/护照内页") + private String insidepageUrl; + + /** + * 身份证/护照 + */ + @ExcelProperty(value = "证件号码") + private String cardId; + + /** + * 承诺书 + */ +// @ExcelProperty(value = "承诺书") + private String commitmentUrl; + + /** + * 单位地址 + */ + @ExcelProperty(value = "单位地址") + private String companyAddress; + + /** + * 工作单位 + */ + @ExcelProperty(value = "工作单位") + private String companyName; + + + + /** + * 申明书 + */ +// @ExcelProperty(value = "申明书") + private String declarationUrl; + + /** + * 企业所在地 1.新经济活力区 2.交子公园金融商务区 3.高新西区 4.生物城 + */ + @ExcelProperty(value = "企业所在地",converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "company_address_area") + private String district; + + /** + * 学历 + */ + @ExcelProperty(value = "学历") + private String education; + + /** + * 身份证正面 + */ +// @ExcelProperty(value = "身份证正面") + private String frontUrl; + + /** + * 公园城市局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @ExcelProperty(value = "公园城市局审核状态 1.待审核 2.退件 3.不通过 4.通过") + private String gyStatus; + + /** + * 房屋记录 + */ +// @ExcelProperty(value = "房屋记录") + private String homeRecordUrl; + + /** + * 户口簿主页 + */ +// @ExcelProperty(value = "户口簿主页") + private String homepageUrl; + + /** + * 劳动合同 + */ +// @ExcelProperty(value = "劳动合同") + private String laborContractUrl; + + /** + * 企业营业执照 + */ +// @ExcelProperty(value = "企业营业执照") + private String licenseUrl; + + /** + * 婚姻状况 1.未婚 2.已婚 3.离异 + */ + @ExcelProperty(value = "婚姻状况",converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "marital_status") + private String maritalStatus; + + /** + * 婚姻证明材料 + */ +// @ExcelProperty(value = "婚姻证明材料") + private String maritalUrl; + + /** + * 国籍 + */ + @ExcelProperty(value = "国籍") + private String nationality; + + /** + * 手机号 + */ + @ExcelProperty(value = "手机号") + private String phone; + + /** + * 区域部门审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @ExcelProperty(value = "区域部门审核状态 1.待审核 2.退件 3.不通过 4.通过") + private String qyStatus; + + /** + * 身份证背面 + */ +// @ExcelProperty(value = "身份证背面") + private String reverseUrl; + + /** + * 性别 + */ + @ExcelProperty(value = "性别") + private String sex; + + /** + * 社会事业局审核状态 1.待审核 2.退件 3.不通过 4.通过 + */ +// @ExcelProperty(value = "社会事业局审核状态 1.待审核 2.退件 3.不通过 4.通过") + private String shStatus; + + /** + * 统一社会信用代码 + */ + @ExcelProperty(value = "统一社会信用代码") + private String socialCode; + + /** + * 社保证明 + */ +// @ExcelProperty(value = "社保证明") + private String socialSecurityUrl; + + /** + * 状态 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过 + */ +// @ExcelProperty(value = "状态 1.待提交 2.受理中 3.受理退件 4.受理驳回 5.初审中 6初审不通过 7.初审退件 8.审定中 9.审定不通过 10.审定通过") + private String status; + + /** + * 类型 A B C D + */ + @ExcelProperty(value = "类型") + private String type; + + /** + * 用户id + */ +// @ExcelProperty(value = "用户id") + private Long userId; + + /** + * + */ + @ExcelProperty(value = "创建时间",converter = DateStringConverter.class) + private Date createTime; + + @ExcelProperty(value = "修改时间",converter = DateStringConverter.class) + private Date updateTime; + + /** + * + */ + @ExcelProperty(value = "审核通过时间",converter = DateStringConverter.class) + private Date passTime; + + /** + * + */ +// @ExcelProperty(value = "人才影像卡") + private String pictureInformationUrl; + + /** + * + */ +// @ExcelProperty(value = "") + private String workAddress; + + private String processKey; + + private String processStatus; + + @TableField(exist = false) + private List buyHousesMemberList; + + private String version; + + @TableField(exist = false) + private List materialProofList; + + + private String companyId; + + private String apiKey; + + private String step; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/HousesReviewVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/HousesReviewVo.java new file mode 100644 index 000000000..4295e8a8f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/HousesReviewVo.java @@ -0,0 +1,212 @@ +package com.ruoyi.system.domain.vo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.alibaba.excel.converters.date.DateDateConverter; +import com.alibaba.excel.converters.date.DateStringConverter; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import com.ruoyi.common.utils.MySerializerUtils; +import com.ruoyi.system.domain.BuyHousesReviewMember; +import lombok.Data; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 购房复审登记视图对象 houses_review + * + * @author ruoyi + * @date 2023-03-08 + */ +@Data +@ExcelIgnoreUnannotated +public class HousesReviewVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ +// @ExcelProperty(value = "id") +// @JsonSerialize(using = ToStringSerializer.class) +// @JsonSerialize(using = MySerializerUtils.class) + private Long id; + + private String step; + + @ExcelProperty(value = "序号") + private String number; + /** + * 证件类型 + */ + @ExcelProperty(value = "证件类型") + @NotNull(message = "证件类型不可为空") + private String cardType; + + /** + * 身份证号码 + */ + @ExcelProperty(value = "证件号码") + private String card; + + /** + * 姓名 + */ + @ExcelProperty(value = "姓名") + private String name; + + /** + * 资格序号 + */ + @ExcelProperty(value = "资格序号") + private String qualification; + + /** + * 审核时间 + */ + @ExcelProperty(value = "审核时间") + @DateTimeFormat("yyyy-MM-dd") + private String auditTime; + + /** + * 预售证号 + */ + @ExcelProperty(value = "预售证号") + private String presellCard; + + /** + * 交易类型 + */ + @ExcelProperty(value = "交易类型") + private String dealType; + + /** + * 项目名称 + */ + @ExcelProperty(value = "项目名称") + private String projectName; + + /** + * 项目区域 + */ + @ExcelProperty(value = "项目区域") + private String projectArea; + + /** + * 资格确认时间 + */ + @ExcelProperty(value = "资格确认时间") + private String qualificationConfirmTime; + + /** + * 资格预申请时间 + */ + @ExcelProperty(value = "资格预申请时间") + private String qualificationPreApplyTime; + + /** + * 家庭类型 + */ + @ExcelProperty(value = "家庭类型") + private String familyType; + + /** + * 状态 + */ +// @ExcelProperty(value = "状态") + private String status; + + /** + * 登记失效时间 + */ + @ExcelProperty(value = "登记失效时间") + private String registerFailureTime; + + /** + * 国籍 + */ + @ExcelProperty(value = "国籍", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "nationality_type") + private String nationality; + + /** + * 婚姻状况 + */ + @ExcelProperty(value = "婚姻状况",converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "marital_status") + private String maritalStatus; + + /** + * 单位类型 + */ + @ExcelProperty(value = "单位类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "company_type") + private String companyType; + + /** + * 公司名称 + */ + @ExcelProperty(value = "公司名称") + private String companyName; + + /** + * 人才类型 + */ + @ExcelProperty(value = "人才类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "talents_type") + private String talentsType; + + /** + * 统一社会信用代码 + */ +// @ExcelProperty(value = "统一社会信用代码") + private String creditCode; + + /** + * 企业所在地 + */ + @ExcelProperty(value = "企业所在地") + private String companyAddress; + + /** + * 来源 + */ + @ExcelProperty(value = "来源", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "source_by") + private String sourceBy; + + /** + * 流程key + */ + + private String processKey; + + private String processStatus; + + private String companyAddressArea; + + @TableField(exist = false) + private List buyHousesMemberList; + + private Date updateTime; + + /** + * d类字段扩展 + */ + private String typeExtend; + + /** + * 审核通过时间 + */ + @ExcelProperty(value = "审核通过时间",converter = DateStringConverter.class) + @DateTimeFormat("yyyy-MM-dd HH:mm:ss") + private Date passTime; + +} + + 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 new file mode 100644 index 000000000..aa0214a2d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialModuleVo.java @@ -0,0 +1,92 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.baomidou.mybatisplus.annotation.TableField; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; + +import java.util.ArrayList; + + +/** + * 材料模块视图对象 material_module + * + * @author ruoyi + * @date 2023-03-09 + */ +@Data +@ExcelIgnoreUnannotated +public class MaterialModuleVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 材料名称 + */ + @ExcelProperty(value = "材料名称") + private String materialName; + + /** + * 材料key + */ + @ExcelProperty(value = "材料key") + private String materialKey; + + /** + * 审核部门 + */ + @ExcelProperty(value = "审核部门") + private String auditDept; + + /** + * 描述 + */ + @ExcelProperty(value = "描述") + private String description; + + /** + * 排序 + */ + @ExcelProperty(value = "排序") + private Long sort; + + /** + * 是否必填 + */ + @ExcelProperty(value = "是否必填", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_yes_no") + private String isMust; + + /** + * 上传材料 + */ + private String file; + + /** + * 接口或者全路径地址 + */ + private String interfacePath; + + /** + * 1是接口,2是路径 + */ + private String interfaceType; + + + @TableField(exist = false) + private Long[] auditDeptArr = new Long[]{}; + + /** + * 按钮显示名称 + */ + private String interfaceName; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialProofVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialProofVo.java new file mode 100644 index 000000000..dcf4701af --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialProofVo.java @@ -0,0 +1,86 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + + +/** + * 材料视图对象 material_proof + * + * @author ruoyi + * @date 2023-03-15 + */ +@Data +@ExcelIgnoreUnannotated +public class MaterialProofVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 关联申请id + */ + @ExcelProperty(value = "关联申请id") + private String houseId; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + /** + * 0待审核,1审核失败,2审核成功 + */ + @ExcelProperty(value = "0待审核,1审核失败,2审核成功") + private Long status; + + /** + * 所对应材料的id + */ + @ExcelProperty(value = "所对应材料的id") + private String modulePathId; + + /** + * 数据 + */ + @ExcelProperty(value = "数据") + private String file; + + /** + * 对应module_paht的字段 + */ + @ExcelProperty(value = "对应module_paht的字段") + private String materialKey; + + /** + * 对应module_path的描述 + */ + @ExcelProperty(value = "对应module_path的描述") + private String description; + + /** + * 审核人 + */ + @ExcelProperty(value = "审核人") + private String auditDept; + + /** + * 审核人类型 + */ + @ExcelProperty(value = "审核人类型") + private String checkType; + + private String materialName; + + private Integer number; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialTalentsVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialTalentsVo.java new file mode 100644 index 000000000..5c3a9bc1e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MaterialTalentsVo.java @@ -0,0 +1,59 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + + +/** + * 材料关系视图对象 material_talents + * + * @author ruoyi + * @date 2023-03-09 + */ +@Data +@ExcelIgnoreUnannotated +public class MaterialTalentsVo { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ExcelProperty(value = "主键") + private Long id; + + /** + * 父id + */ + @ExcelProperty(value = "父id") + private Long parentId; + + /** + * 值 + */ + @ExcelProperty(value = "值") + private String talentsValue; + + /** + * 节点名称 + */ + @ExcelProperty(value = "节点名称") + private String talentsName; + + /** + * 是否选中 + */ + @ExcelProperty(value = "是否选中") + private String selected; + + /** + * 对应的材料 + */ + @ExcelProperty(value = "对应的材料") + private String materials; + + private Integer[] materialList; + + private String step; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/PushLogVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/PushLogVo.java new file mode 100644 index 000000000..22f189071 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/PushLogVo.java @@ -0,0 +1,37 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; +import java.util.Date; + + + +/** + * 推送日志视图对象 push_log + * + * @author ruoyi + * @date 2023-07-20 + */ +@Data +@ExcelIgnoreUnannotated +public class PushLogVo { + + private static final long serialVersionUID = 1L; + + /** + * 推送数据 + */ + @ExcelProperty(value = "推送数据") + private String pushData; + + /** + * 返回结果 + */ + @ExcelProperty(value = "返回结果") + private String resultData; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RsaSecurityVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RsaSecurityVo.java new file mode 100644 index 000000000..1e4a8bdb7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RsaSecurityVo.java @@ -0,0 +1,71 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; +import java.util.Date; + + + +/** + * 请求RSA数据加解密视图对象 rsa_security + * + * @author ruoyi + * @date 2023-05-17 + */ +@Data +@ExcelIgnoreUnannotated +public class RsaSecurityVo { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ExcelProperty(value = "主键") + private Long id; + + /** + * 需要加密的接口 + */ + @ExcelProperty(value = "需要加密的接口") + private String path; + + /** + * 入参是否解密,默认不解密 + */ + @ExcelProperty(value = "入参是否解密,默认不解密", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_yes_no") + private String inDecode; + + /** + * 出参是否加密,默认加密 + */ + @ExcelProperty(value = "出参是否加密,默认加密") + private String outEncode; + + /** + * 公钥 + */ + @ExcelProperty(value = "公钥") + private String publicKey; + + /** + * 私钥 + */ + @ExcelProperty(value = "私钥") + private String privateKey; + + /** + * 请求方式 + */ + private String method; + + /** + * 接口限制请求 + */ + private String restricted; + +} 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 new file mode 100644 index 000000000..edb8f3e95 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/SubscribeExportVo.java @@ -0,0 +1,47 @@ +package com.ruoyi.system.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; +import java.util.Date; + + + +/** + * 预约导出视图对象 subscribe_export + * + * @author ruoyi + * @date 2023-04-20 + */ +@Data +@ExcelIgnoreUnannotated +public class SubscribeExportVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 路径 + */ + @ExcelProperty(value = "路径") + private String path; + + /** + * 申请人id + */ + @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/domain/vo/UserVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserVo.java new file mode 100644 index 000000000..c4a02a642 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserVo.java @@ -0,0 +1,135 @@ +package com.ruoyi.system.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; +import java.util.Date; + + + +/** + * 【请填写功能名称】视图对象 user + * + * @author ruoyi + * @date 2023-04-03 + */ +@Data +@ExcelIgnoreUnannotated +public class UserVo { + + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 用户账号状态 1,未认定 2,认定中 ,3 未发卡,4 已发卡 + */ + @ExcelProperty(value = "用户账号状态 1,未认定 2,认定中 ,3 未发卡,4 已发卡") + private Long status; + + /** + * 用户名 + */ + @ExcelProperty(value = "用户名") + private String loginName; + + /** + * 登陆密码 + */ + @ExcelProperty(value = "登陆密码") + private String password; + + /** + * 卡号 + */ + @ExcelProperty(value = "卡号") + private String cardNumber; + + /** + * 认定类型 + */ + @ExcelProperty(value = "认定类型") + private String type; + + /** + * 卡有效期 + */ + @ExcelProperty(value = "卡有效期") + private String validityDate; + + /** + * 微信token + */ + @ExcelProperty(value = "微信token") + private String wxToken; + + /** + * 登陆次数 + */ + @ExcelProperty(value = "登陆次数") + private Long enterNumber; + + /** + * 用户名称 + */ + @ExcelProperty(value = "用户名称") + private String userName; + + /** + * + */ + @ExcelProperty(value = "") + private Date lastTime; + + /** + * 方向 + */ + @ExcelProperty(value = "方向") + private Long direction; + + /** + * 用户限制 1,正常 2,禁用 + */ + @ExcelProperty(value = "用户限制 1,正常 2,禁用") + private Long jurisdiction; + + /** + * 求职意向 + */ + @ExcelProperty(value = "求职意向") + private String jobWanted; + + /** + * + */ + @ExcelProperty(value = "") + private Date registerTime; + + /** + * 申报的微信token + */ + @ExcelProperty(value = "申报的微信token") + private String wxToken1; + + /** + * 身份证 + */ + @ExcelProperty(value = "身份证") + private String cardId; + + /** + * 用户类型 + */ + private String userType; + + private String companyId; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHouseCheckMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHouseCheckMapper.java new file mode 100644 index 000000000..2ebbc7c2e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHouseCheckMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.BuyHouseCheck; +import com.ruoyi.system.domain.vo.BuyHouseCheckVo; + +/** + * 购房审核人员不同类型需要的审核人员名单Mapper接口 + * + * @author ruoyi + * @date 2023-02-24 + */ +public interface BuyHouseCheckMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMapper.java new file mode 100644 index 000000000..f4744a018 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMapper.java @@ -0,0 +1,27 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.BuyHouses; +import com.ruoyi.system.domain.vo.BuyHousesVo; + +import java.util.List; +import java.util.Map; + +/** + * 【请填写功能名称】Mapper接口 + * + * @author ruoyi + * @date 2023-02-24 + */ +public interface BuyHousesMapper extends BaseMapperPlus { + + List getIndexType(); + + List getActProcessList(); + + List getCompanyDistrict(); + + List getNationality(); + + List getMaritalStatus(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMemberMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMemberMapper.java new file mode 100644 index 000000000..e8b21d97c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesMemberMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.BuyHousesMember; +import com.ruoyi.system.domain.vo.BuyHousesMemberVo; + +/** + * 购房家属关系Mapper接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface BuyHousesMemberMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesReviewMemberMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesReviewMemberMapper.java new file mode 100644 index 000000000..c6d605f1c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BuyHousesReviewMemberMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.BuyHousesReviewMember; +import com.ruoyi.system.domain.vo.BuyHousesReviewMemberVo; + +/** + * 购房复审家属关系Mapper接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface BuyHousesReviewMemberMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/HousesReviewMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/HousesReviewMapper.java new file mode 100644 index 000000000..a376a439b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/HousesReviewMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.HousesReview; +import com.ruoyi.system.domain.vo.HousesReviewVo; + +/** + * 购房复审登记Mapper接口 + * + * @author ruoyi + * @date 2023-03-08 + */ +public interface HousesReviewMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialModuleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialModuleMapper.java new file mode 100644 index 000000000..46c866083 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialModuleMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.system.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.MaterialModule; +import com.ruoyi.system.domain.vo.MaterialModuleVo; +import org.apache.ibatis.annotations.Param; + +/** + * 材料模块Mapper接口 + * + * @author ruoyi + * @date 2023-03-09 + */ +public interface MaterialModuleMapper extends BaseMapperPlus { + + Page selectVoPageList(@Param("page") Page page, @Param(Constants.WRAPPER) Wrapper queryWrapper); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialProofMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialProofMapper.java new file mode 100644 index 000000000..26f55dde8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialProofMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.MaterialProof; +import com.ruoyi.system.domain.vo.MaterialProofVo; + +/** + * 材料Mapper接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface MaterialProofMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialTalentsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialTalentsMapper.java new file mode 100644 index 000000000..9cf8ab515 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MaterialTalentsMapper.java @@ -0,0 +1,19 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.mapper.BaseMapperPlus; +import com.ruoyi.system.domain.MaterialTalents; +import com.ruoyi.system.domain.bo.MaterialTalentsBo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; + +import java.util.List; + +/** + * 材料关系Mapper接口 + * + * @author ruoyi + * @date 2023-03-09 + */ +public interface MaterialTalentsMapper extends BaseMapperPlus { + + List selectVoListSpecial(MaterialTalentsBo materialTalents); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/PushLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/PushLogMapper.java new file mode 100644 index 000000000..83ff1ca2d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/PushLogMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.PushLog; +import com.ruoyi.system.domain.vo.PushLogVo; +import com.ruoyi.common.core.mapper.BaseMapperPlus; + +/** + * 推送日志Mapper接口 + * + * @author ruoyi + * @date 2023-07-20 + */ +public interface PushLogMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RsaSecurityMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RsaSecurityMapper.java new file mode 100644 index 000000000..b703edbc7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/RsaSecurityMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.common.core.domain.RsaSecurity; +import com.ruoyi.system.domain.vo.RsaSecurityVo; +import com.ruoyi.common.core.mapper.BaseMapperPlus; + +/** + * 请求RSA数据加解密Mapper接口 + * + * @author ruoyi + * @date 2023-05-17 + */ +public interface RsaSecurityMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SubscribeExportMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SubscribeExportMapper.java new file mode 100644 index 000000000..6bd860065 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SubscribeExportMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.SubscribeExport; +import com.ruoyi.system.domain.vo.SubscribeExportVo; +import com.ruoyi.common.core.mapper.BaseMapperPlus; + +/** + * 预约导出Mapper接口 + * + * @author ruoyi + * @date 2023-04-20 + */ +public interface SubscribeExportMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java new file mode 100644 index 000000000..bf67854f3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.User; +import com.ruoyi.system.domain.vo.UserVo; +import com.ruoyi.common.core.mapper.BaseMapperPlus; + +/** + * 【请填写功能名称】Mapper接口 + * + * @author ruoyi + * @date 2023-04-03 + */ +public interface UserMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/runner/SystemApplicationRunner.java b/ruoyi-system/src/main/java/com/ruoyi/system/runner/SystemApplicationRunner.java index e9ad6ee15..82143a848 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/runner/SystemApplicationRunner.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/runner/SystemApplicationRunner.java @@ -1,6 +1,7 @@ package com.ruoyi.system.runner; import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.system.service.IRsaSecurityService; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysOssConfigService; @@ -25,6 +26,8 @@ public class SystemApplicationRunner implements ApplicationRunner { private final ISysDictTypeService dictTypeService; private final ISysOssConfigService ossConfigService; + private final IRsaSecurityService rsaSecurityService; + @Override public void run(ApplicationArguments args) throws Exception { ossConfigService.init(); @@ -36,6 +39,11 @@ public class SystemApplicationRunner implements ApplicationRunner { log.info("加载参数缓存数据成功"); dictTypeService.loadingDictCache(); log.info("加载字典缓存数据成功"); + rsaSecurityService.loadingRsaSecurityCache(); + log.info("加载加解密缓存数据成功"); + + +// log.info("通道: {} 监听中......", queueName); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesMemberService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesMemberService.java new file mode 100644 index 000000000..bffb35583 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesMemberService.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.bo.BuyHousesMemberBo; +import com.ruoyi.system.domain.vo.BuyHousesMemberVo; + +import java.util.Collection; +import java.util.List; + +/** + * 购房家属关系Service接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface IBuyHousesMemberService { + + /** + * 查询购房家属关系 + */ + BuyHousesMemberVo queryById(Long id); + + /** + * 查询购房家属关系列表 + */ + TableDataInfo queryPageList(BuyHousesMemberBo bo, PageQuery pageQuery); + + /** + * 查询购房家属关系列表 + */ + List queryList(BuyHousesMemberBo bo); + + /** + * 新增购房家属关系 + */ + Boolean insertByBo(BuyHousesMemberBo bo); + + /** + * 修改购房家属关系 + */ + Boolean updateByBo(BuyHousesMemberBo bo); + + /** + * 校验并批量删除购房家属关系信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesReviewMemberService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesReviewMemberService.java new file mode 100644 index 000000000..fea479694 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesReviewMemberService.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.bo.BuyHousesReviewMemberBo; +import com.ruoyi.system.domain.vo.BuyHousesReviewMemberVo; + +import java.util.Collection; +import java.util.List; + +/** + * 购房复审家属关系Service接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface IBuyHousesReviewMemberService { + + /** + * 查询购房复审家属关系 + */ + BuyHousesReviewMemberVo queryById(Long id); + + /** + * 查询购房复审家属关系列表 + */ + TableDataInfo queryPageList(BuyHousesReviewMemberBo bo, PageQuery pageQuery); + + /** + * 查询购房复审家属关系列表 + */ + List queryList(BuyHousesReviewMemberBo bo); + + /** + * 新增购房复审家属关系 + */ + Boolean insertByBo(BuyHousesReviewMemberBo bo); + + /** + * 修改购房复审家属关系 + */ + Boolean updateByBo(BuyHousesReviewMemberBo bo); + + /** + * 校验并批量删除购房复审家属关系信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} 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 new file mode 100644 index 000000000..5ae78cf48 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBuyHousesService.java @@ -0,0 +1,133 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +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; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.ParseException; +import java.util.Collection; +import java.util.List; + +/** + * 【请填写功能名称】Service接口 + * + * @author ruoyi + * @date 2023-02-24 + */ +public interface IBuyHousesService { + + /** + * 查询【请填写功能名称】 + */ + BuyHousesVo queryById(Long id); + + /** + * 查询【请填写功能名称】列表 + */ + TableDataInfo queryPageList(BuyHousesBo bo, PageQuery pageQuery); + + /** + * 查询【请填写功能名称】列表 + */ + List queryList(BuyHousesBo bo); + + /** + * 新增【请填写功能名称】 + */ + Boolean insertByBo(BuyHousesBo bo); + + /** + * 修改【请填写功能名称】 + */ + Boolean updateByBo(BuyHousesBo bo); + + /** + * 校验并批量删除【请填写功能名称】信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + R getMaterialInfo(BuyHousesBo bo); + + BuyHouses getBuyHousesByCardId(String cardId); + + R downloadWord(BuyHousesBo buyHouses); + + List getDeclareList(); + + R getInfo(BuyHouses buyHouses); + + R getGaoXinCandidateInfoByCardId(String cardId); + + /** + * 导出列表 + * @param bo + * @return + */ + R subscribeExport(BuyHousesEvent bo) throws IOException; + + /** + * 导出excel + * @param bo + * @param response + */ + void exportExcel(BuyHousesBo bo, HttpServletResponse response); + + /** + * 判读当前用户是否提交过 + * @return + */ + R checkStatus(); + + /** + * 获取当前用户日志 + * @return + */ + R getBuyHousesLogsByUserId(); + + + /** + * 下载认定通知单 + * @return + */ + R downloadInform(); + + /*** + * 修改数据 + * @param buyHouses + * @return + */ + R updateBuyHouses(BuyHouses buyHouses); + + + /** + * 对外接口提交 + * @param buyHouses + * @return + */ + R insertOpenBuyHouses(BuyHousesBo buyHouses); + + R getIndexType(); + + + R getCompanyDistrict(); + + R getNationalityAndMarital(); + + + R getBasicData(); + + R getHistogram(String date); + + void excelZip(String id); + + R push(String id) throws ParseException; + + R logout(String id); +} 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 new file mode 100644 index 000000000..f18ad39f2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IHousesReviewService.java @@ -0,0 +1,76 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +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; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +/** + * 购房复审登记Service接口 + * + * @author ruoyi + * @date 2023-03-08 + */ +public interface IHousesReviewService { + + /** + * 查询购房复审登记 + */ + HousesReviewVo queryById(Long id); + + /** + * 查询购房复审登记列表 + */ + TableDataInfo queryPageList(HousesReviewBo bo, PageQuery pageQuery); + + /** + * 查询购房复审登记列表 + */ + List queryList(HousesReviewBo bo); + + /** + * 新增购房复审登记 + */ + Boolean insertByBo(HousesReviewBo bo); + + /** + * 修改购房复审登记 + */ + Boolean updateByBo(HousesReviewBo bo); + + /** + * 校验并批量删除购房复审登记信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + Boolean saveBatch(List list); + + R getMaterialInfo(HousesReviewBo bo); + + HousesReviewVo queryByIdOne(Long id); + + R getMaterialByBusinessId(Long id); + + /** + * 预约导出 + * @param bo + * @return + */ + R subscribeExport(HousesReviewEvent bo) throws IOException; + + /** + * + * @param bo + */ + void exportExcel(HousesReviewBo bo, HttpServletResponse response); + + TableDataInfo managerQueryPageList(HousesReviewBo bo, PageQuery pageQuery); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialModuleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialModuleService.java new file mode 100644 index 000000000..ed8f3fc4f --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialModuleService.java @@ -0,0 +1,51 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.bo.MaterialModuleBo; +import com.ruoyi.system.domain.vo.MaterialModuleVo; + +import java.util.Collection; +import java.util.List; + +/** + * 材料模块Service接口 + * + * @author ruoyi + * @date 2023-03-09 + */ +public interface IMaterialModuleService { + + /** + * 查询材料模块 + */ + MaterialModuleVo queryById(Long id); + + /** + * 查询材料模块列表 + */ + TableDataInfo queryPageList(MaterialModuleBo bo, PageQuery pageQuery); + + /** + * 查询材料模块列表 + */ + List queryList(MaterialModuleBo bo); + + /** + * 新增材料模块 + */ + Boolean insertByBo(MaterialModuleBo bo); + + /** + * 修改材料模块 + */ + Boolean updateByBo(MaterialModuleBo bo); + + /** + * 校验并批量删除材料模块信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + R selectMaterialList(MaterialModuleBo bo); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialProofService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialProofService.java new file mode 100644 index 000000000..c098b49ba --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialProofService.java @@ -0,0 +1,48 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.bo.MaterialProofBo; +import com.ruoyi.system.domain.vo.MaterialProofVo; + +import java.util.Collection; +import java.util.List; + +/** + * 材料Service接口 + * + * @author ruoyi + * @date 2023-03-15 + */ +public interface IMaterialProofService { + + /** + * 查询材料 + */ + MaterialProofVo queryById(Long id); + + /** + * 查询材料列表 + */ + TableDataInfo queryPageList(MaterialProofBo bo, PageQuery pageQuery); + + /** + * 查询材料列表 + */ + List queryList(MaterialProofBo bo); + + /** + * 新增材料 + */ + Boolean insertByBo(MaterialProofBo bo); + + /** + * 修改材料 + */ + Boolean updateByBo(MaterialProofBo bo); + + /** + * 校验并批量删除材料信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialTalentsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialTalentsService.java new file mode 100644 index 000000000..bcd5afce2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IMaterialTalentsService.java @@ -0,0 +1,42 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.bo.MaterialTalentsBo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; + +import java.util.Collection; +import java.util.List; + +/** + * 材料关系Service接口 + * + * @author ruoyi + * @date 2023-03-09 + */ +public interface IMaterialTalentsService { + + /** + * 查询材料关系 + */ + MaterialTalentsVo queryById(Long id); + + + /** + * 查询材料关系列表 + */ + List queryList(MaterialTalentsBo bo); + + /** + * 新增材料关系 + */ + Boolean insertByBo(MaterialTalentsBo bo); + + /** + * 修改材料关系 + */ + Boolean updateByBo(MaterialTalentsBo bo); + + /** + * 校验并批量删除材料关系信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IPushLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IPushLogService.java new file mode 100644 index 000000000..9b953475c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IPushLogService.java @@ -0,0 +1,45 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.event.PushLogEvent; +import com.ruoyi.system.domain.vo.PushLogVo; +import com.ruoyi.system.domain.bo.PushLogBo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 推送日志Service接口 + * + * @author ruoyi + * @date 2023-07-20 + */ +public interface IPushLogService { + + /** + * 查询推送日志 + */ + PushLogVo queryById(Long id); + + /** + * 查询推送日志列表 + */ + TableDataInfo queryPageList(PushLogBo bo, PageQuery pageQuery); + + /** + * 查询推送日志列表 + */ + List queryList(PushLogBo bo); + + + /** + * 修改推送日志 + */ + Boolean updateByBo(PushLogBo bo); + + /** + * 校验并批量删除推送日志信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IRsaSecurityService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IRsaSecurityService.java new file mode 100644 index 000000000..dcdc28d3b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IRsaSecurityService.java @@ -0,0 +1,54 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.RsaSecurity; +import com.ruoyi.system.domain.vo.RsaSecurityVo; +import com.ruoyi.system.domain.bo.RsaSecurityBo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 请求RSA数据加解密Service接口 + * + * @author ruoyi + * @date 2023-05-17 + */ +public interface IRsaSecurityService { + + /** + * 查询请求RSA数据加解密 + */ + RsaSecurityVo queryById(Long id); + + /** + * 查询请求RSA数据加解密列表 + */ + TableDataInfo queryPageList(RsaSecurityBo bo, PageQuery pageQuery); + + /** + * 查询请求RSA数据加解密列表 + */ + List queryList(RsaSecurityBo bo); + + /** + * 新增请求RSA数据加解密 + */ + RsaSecurity insertByBo(RsaSecurityBo bo); + + /** + * 修改请求RSA数据加解密 + */ + RsaSecurity updateByBo(RsaSecurityBo bo); + + /** + * 校验并批量删除请求RSA数据加解密信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 初始化获取加解密的接口 + */ + void loadingRsaSecurityCache(); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISubscribeExportService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISubscribeExportService.java new file mode 100644 index 000000000..3397c680d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISubscribeExportService.java @@ -0,0 +1,49 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.SubscribeExport; +import com.ruoyi.system.domain.vo.SubscribeExportVo; +import com.ruoyi.system.domain.bo.SubscribeExportBo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 预约导出Service接口 + * + * @author ruoyi + * @date 2023-04-20 + */ +public interface ISubscribeExportService { + + /** + * 查询预约导出 + */ + SubscribeExportVo queryById(Long id); + + /** + * 查询预约导出列表 + */ + TableDataInfo queryPageList(SubscribeExportBo bo, PageQuery pageQuery); + + /** + * 查询预约导出列表 + */ + List queryList(SubscribeExportBo bo); + + /** + * 新增预约导出 + */ + Boolean insertByBo(SubscribeExportBo bo); + + /** + * 修改预约导出 + */ + Boolean updateByBo(SubscribeExportBo bo); + + /** + * 校验并批量删除预约导出信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUserService.java new file mode 100644 index 000000000..b09d966b0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IUserService.java @@ -0,0 +1,60 @@ +package com.ruoyi.system.service; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.domain.User; +import com.ruoyi.system.domain.vo.UserVo; +import com.ruoyi.system.domain.bo.UserBo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 【请填写功能名称】Service接口 + * + * @author ruoyi + * @date 2023-04-03 + */ +public interface IUserService { + + /** + * 查询【请填写功能名称】 + */ + UserVo queryById(Long id); + + /** + * 查询【请填写功能名称】列表 + */ + TableDataInfo queryPageList(UserBo bo, PageQuery pageQuery); + + /** + * 查询【请填写功能名称】列表 + */ + List queryList(UserBo bo); + + /** + * 新增【请填写功能名称】 + */ + Boolean insertByBo(UserBo bo); + + /** + * 修改【请填写功能名称】 + */ + Boolean updateByBo(UserBo bo); + + /** + * 校验并批量删除【请填写功能名称】信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + int resetUserPwd(String userName, String password); + +} 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 c2627445b..d25e783e7 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 @@ -4,10 +4,16 @@ import cn.dev33.satoken.exception.NotLoginException; import cn.dev33.satoken.secure.BCrypt; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.event.LogininforEvent; import com.ruoyi.common.core.domain.dto.RoleDTO; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.event.LogininforEvent; @@ -16,6 +22,7 @@ import com.ruoyi.common.core.domain.model.XcxLoginUser; import com.ruoyi.common.enums.DeviceType; import com.ruoyi.common.enums.LoginType; import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaExpireException; import com.ruoyi.common.exception.user.UserException; @@ -26,14 +33,21 @@ import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.redis.RedisUtils; import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.system.domain.BuyHouses; +import com.ruoyi.system.domain.User; +import com.ruoyi.system.domain.dto.DeclareListDTO; import com.ruoyi.system.mapper.SysUserMapper; +import com.ruoyi.system.mapper.UserMapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; 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; /** @@ -46,10 +60,14 @@ import java.util.function.Supplier; @Service public class SysLoginService { - private final SysUserMapper userMapper; + private final IBuyHousesService iBuyHousesService; + + private final SysUserMapper sysUserMapper; private final ISysConfigService configService; private final SysPermissionService permissionService; + private final UserMapper userMapper; + @Value("${user.password.maxRetryCount}") private Integer maxRetryCount; @@ -72,10 +90,10 @@ public class SysLoginService { validateCaptcha(username, code, uuid); } // 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可 - SysUser user = loadUserByUsername(username); + SysUser user = loadSysUserByUsername(username); checkLogin(LoginType.PASSWORD, username, () -> !BCrypt.checkpw(password, user.getPassword())); // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 - LoginUser loginUser = buildLoginUser(user); + LoginUser loginUser = buildLoginSysUser(user); // 生成token LoginHelper.loginByDevice(loginUser, DeviceType.PC); @@ -87,10 +105,9 @@ public class SysLoginService { public String smsLogin(String phonenumber, String smsCode) { // 通过手机号查找用户 SysUser user = loadUserByPhonenumber(phonenumber); - - checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode)); - // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 - LoginUser loginUser = buildLoginUser(user); + checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode,CacheConstants.CAPTCHA_CODE_KEY)); + // 此处可根据登录用户的数据不同 自行创建 loginUser + LoginUser loginUser = buildLoginSysUser(user); // 生成token LoginHelper.loginByDevice(loginUser, DeviceType.APP); @@ -104,8 +121,8 @@ public class SysLoginService { SysUser user = loadUserByEmail(email); checkLogin(LoginType.EMAIL, user.getUserName(), () -> !validateEmailCode(email, emailCode)); - // 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了 - LoginUser loginUser = buildLoginUser(user); + // 此处可根据登录用户的数据不同 自行创建 loginUser + LoginUser loginUser = buildLoginSysUser(user); // 生成token LoginHelper.loginByDevice(loginUser, DeviceType.APP); @@ -172,8 +189,8 @@ public class SysLoginService { /** * 校验短信验证码 */ - private boolean validateSmsCode(String phonenumber, String smsCode) { - String code = RedisUtils.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + phonenumber); + private boolean validateSmsCode(String phonenumber, String smsCode,String key) { + String code = RedisUtils.getCacheObject(key + phonenumber); if (StringUtils.isBlank(code)) { recordLogininfor(phonenumber, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")); throw new CaptchaExpireException(); @@ -214,9 +231,8 @@ public class SysLoginService { } } - private SysUser loadUserByUsername(String username) { - SysUser user = userMapper.selectOne(new LambdaQueryWrapper() - .select(SysUser::getUserName, SysUser::getStatus) + private SysUser loadSysUserByUsername(String username) { + SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper() .eq(SysUser::getUserName, username)); if (ObjectUtil.isNull(user)) { log.info("登录用户:{} 不存在.", username); @@ -225,12 +241,11 @@ public class SysLoginService { log.info("登录用户:{} 已被停用.", username); throw new UserException("user.blocked", username); } - return userMapper.selectUserByUserName(username); + return sysUserMapper.selectUserByUserName(username); } private SysUser loadUserByPhonenumber(String phonenumber) { - SysUser user = userMapper.selectOne(new LambdaQueryWrapper() - .select(SysUser::getPhonenumber, SysUser::getStatus) + SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper() .eq(SysUser::getPhonenumber, phonenumber)); if (ObjectUtil.isNull(user)) { log.info("登录用户:{} 不存在.", phonenumber); @@ -239,11 +254,11 @@ public class SysLoginService { log.info("登录用户:{} 已被停用.", phonenumber); throw new UserException("user.blocked", phonenumber); } - return userMapper.selectUserByPhonenumber(phonenumber); + return sysUserMapper.selectUserByPhonenumber(phonenumber); } private SysUser loadUserByEmail(String email) { - SysUser user = userMapper.selectOne(new LambdaQueryWrapper() + SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper() .select(SysUser::getPhonenumber, SysUser::getStatus) .eq(SysUser::getEmail, email)); if (ObjectUtil.isNull(user)) { @@ -253,7 +268,7 @@ public class SysLoginService { log.info("登录用户:{} 已被停用.", email); throw new UserException("user.blocked", email); } - return userMapper.selectUserByEmail(email); + return sysUserMapper.selectUserByEmail(email); } private SysUser loadUserByOpenid(String openid) { @@ -273,12 +288,14 @@ public class SysLoginService { /** * 构建登录用户 */ - private LoginUser buildLoginUser(SysUser user) { + private LoginUser buildLoginSysUser(SysUser user) { LoginUser loginUser = new LoginUser(); loginUser.setUserId(user.getUserId()); loginUser.setDeptId(user.getDeptId()); loginUser.setUsername(user.getUserName()); loginUser.setUserType(user.getUserType()); + loginUser.setNickName(user.getNickName()); + loginUser.setProperties(user.getProperties()); loginUser.setMenuPermission(permissionService.getMenuPermission(user)); loginUser.setRolePermission(permissionService.getRolePermission(user)); loginUser.setDeptName(ObjectUtil.isNull(user.getDept()) ? "" : user.getDept().getDeptName()); @@ -287,6 +304,18 @@ public class SysLoginService { return loginUser; } + /** + * 构建登录用户 + */ + private LoginUser buildLoginUser(User user) { + LoginUser loginUser = new LoginUser(); + loginUser.setUserId(user.getId()); + loginUser.setUsername(user.getLoginName()); + loginUser.setCompanyId(user.getCompanyId()); + loginUser.setUserType(user.getUserType()); + return loginUser; + } + /** * 记录登录信息 * @@ -298,7 +327,7 @@ public class SysLoginService { sysUser.setLoginIp(ServletUtils.getClientIP()); sysUser.setLoginDate(DateUtils.getNowDate()); sysUser.setUpdateBy(username); - userMapper.updateById(sysUser); + sysUserMapper.updateById(sysUser); } /** @@ -327,11 +356,187 @@ public class SysLoginService { } else { // 未达到规定错误次数 recordLogininfor(username, loginFail, MessageUtils.message(loginType.getRetryLimitCount(), errorNumber)); - throw new UserException(loginType.getRetryLimitCount(), errorNumber); + throw new UserException(loginType.getRetryLimitCount(), errorNumber,maxRetryCount-errorNumber); } } - // 登录成功 清空错误次数 RedisUtils.deleteObject(errorKey); } +//------------------------------------------------------------------------------------------------------------------------ + private User loadUserByUsername(String username) { + User user = userMapper.selectOne(new LambdaQueryWrapper() + .eq(User::getLoginName, username)); + if (ObjectUtil.isNull(user)) { + log.info("登录用户:{} 不存在.", username); + throw new UserException("user.not.exists", username); + } else if (user.getJurisdiction().equals(2L)) { + log.info("登录用户:{} 已被停用.", username); + throw new UserException("user.blocked", username); + } + return user; + } + + + /** + * 客户端用户登录 + * @param username + * @param password + * @return + */ + public Map userLogin(String username, String password) { + User user = loadUserByUsername(username); + Date updateTime = user.getUpdateTime(); + if (ObjectUtil.isNull(updateTime)){ + log.info("登录用户:{},密码已过期", username); + throw new UserException("user.password.expired",username); + }else if (DateUtil.date().getTime()>DateUtil.offsetMonth(updateTime, 3).getTime()){ + log.info("登录用户:{},密码已过期", username); + throw new UserException("user.password.expired",username); + } + //检验登录 + checkLogin(LoginType.PASSWORD, username, () -> !BCrypt.checkpw(password, user.getPassword())); + // 此处可根据登录用户的数据不同 自行创建 loginUser + LoginUser loginUser = buildLoginUser(user); + // 生成token + LoginHelper.loginByDevice(loginUser, DeviceType.PC); + recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + HashMap map = new HashMap<>(); + String tokenValue = StpUtil.getTokenValue(); + map.put("token",tokenValue); + map.put("loginName",user.getLoginName()); + return map; + } + + /** + * 忘记密码 + * @param username + * @param password + * @param code + * @return + */ + public R userUpdatePwd(String username, String password, String code) { + String key = CacheConstants.RORGOT_PASSWORD_SEND_MSG+username; + boolean matches = username.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) { + throw new ServiceException("手机号格式不正确"); + } + if (!validateSmsCode(username, code,key)){ + throw new UserException("user.jcaptcha.error"); + } + //修改密码 + User user = loadUserByUsername(username); + if (ObjectUtil.isNull(user)){ + return R.fail("当前用户"+username+"不存在"); + } + user.setPassword(BCrypt.hashpw(password)); + user.setUpdateTime(DateUtils.getNowDate()); + user.setUpdateBy(username); + if (userMapper.updateById(user)>0){ + RedisUtils.deleteObject(key); + return R.ok("修改成功"); + } + return R.fail("忘记密码修改异常"); + } + + /** + * 用户注册 + * @param username + * @param password + * @param code + * @return + */ + public R userRegister(String username, String password, String code) { + String key =CacheConstants.REGISTER_SEND_MSG+username; + boolean matches = username.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) { + throw new ServiceException("手机号格式不正确"); + } + if (!validateSmsCode(username, code,key)){ + throw new UserException("user.jcaptcha.error"); + } + //判断当前账号是否存在 + List userList = userMapper.selectList(new LambdaQueryWrapper() + .eq(User::getLoginName, username)); + if (userList.size()>0){ + return R.fail("当前用户已存在"); + } + User user1 = new User(); + user1.setPassword(BCrypt.hashpw(password)); + user1.setUserType("app_user"); + user1.setLoginName(username); + user1.setJurisdiction(1L); + if (userMapper.insert(user1)>0){ + //删除验证码 + RedisUtils.deleteObject(key); + return R.ok("注册成功"); + } + return R.fail("注册异常"); + } + + + /** + * 用户短信登录 + * @param username + * @param code + * @return + */ + public String userSmsLogin(String username, String code) { + // 通过手机号查找用户 + User user = loadUserByUsername(username); + checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(username, code,CacheConstants.SMS_LOGIN_SEND_MSG)); + // 此处可根据登录用户的数据不同 自行创建 loginUser + LoginUser loginUser = buildLoginUser(user); + // 生成token + LoginHelper.loginByDevice(loginUser, DeviceType.APP); + + recordLogininfor(user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + return StpUtil.getTokenValue(); + + } + + /** + * 公开登录接口 + * @param username + * @param apiKey + * @return + */ + public String userOpenLogin(String username, String apiKey) { + //1.根据用户账号和key获取用户信息 + User user = userMapper.selectOne(new LambdaQueryWrapper() + .eq(User::getLoginName, username) + .eq(User::getApiKey,apiKey)); + //2.如果不存在就新增,反之构造用户信息并返回一个token + if (ObjectUtil.isNull(user)){ + User user1 = new User(); + user1.setUserType("app_user"); + user1.setLoginName(username); + user1.setApiKey(apiKey); + user1.setCreateTime(new Date()); + user1.setUpdateTime(new Date()); + user1.setUpdateBy(username); + user1.setCreateBy(username); + user1.setWxToken(username); + user1.setJurisdiction(1L); + int insert = userMapper.insert(user1); + if (insert==0){ + throw new ServiceException("用户操作失败"); + } + LoginUser loginUser = buildLoginUser(user1); + // 生成token + LoginHelper.loginByDevice(loginUser, DeviceType.PC); + recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + String tokenValue = StpUtil.getTokenValue(); + return tokenValue; + } + if (user.getJurisdiction().equals(2L)) { + log.info("登录用户:{} 已被停用.", username); + throw new UserException("user.blocked", username); + } + LoginUser loginUser = buildLoginUser(user); + // 生成token + LoginHelper.loginByDevice(loginUser, DeviceType.PC); + recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + String tokenValue = StpUtil.getTokenValue(); + return tokenValue; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesMemberServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesMemberServiceImpl.java new file mode 100644 index 000000000..00e5c7c50 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesMemberServiceImpl.java @@ -0,0 +1,116 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +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.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.BuyHousesMember; +import com.ruoyi.system.domain.bo.BuyHousesMemberBo; +import com.ruoyi.system.domain.vo.BuyHousesMemberVo; +import com.ruoyi.system.mapper.BuyHousesMemberMapper; +import com.ruoyi.system.service.IBuyHousesMemberService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 购房家属关系Service业务层处理 + * + * @author ruoyi + * @date 2023-03-15 + */ +@RequiredArgsConstructor +@Service +public class BuyHousesMemberServiceImpl implements IBuyHousesMemberService { + + private final BuyHousesMemberMapper baseMapper; + + /** + * 查询购房家属关系 + */ + @Override + public BuyHousesMemberVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询购房家属关系列表 + */ + @Override + public TableDataInfo queryPageList(BuyHousesMemberBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询购房家属关系列表 + */ + @Override + public List queryList(BuyHousesMemberBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BuyHousesMemberBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHousesMember::getInsidepageUrl, bo.getInsidepageUrl()); + lqw.eq(bo.getBuyHousesId() != null, BuyHousesMember::getBuyHousesId, bo.getBuyHousesId()); + lqw.eq(StringUtils.isNotBlank(bo.getFrontUrl()), BuyHousesMember::getFrontUrl, bo.getFrontUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getRelation()), BuyHousesMember::getRelation, bo.getRelation()); + lqw.eq(StringUtils.isNotBlank(bo.getReverseUrl()), BuyHousesMember::getReverseUrl, bo.getReverseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getHomeRecordUrl()), BuyHousesMember::getHomeRecordUrl, bo.getHomeRecordUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHousesMember::getCardId, bo.getCardId()); + lqw.like(StringUtils.isNotBlank(bo.getName()), BuyHousesMember::getName, bo.getName()); + return lqw; + } + + /** + * 新增购房家属关系 + */ + @Override + public Boolean insertByBo(BuyHousesMemberBo bo) { + BuyHousesMember add = BeanUtil.toBean(bo, BuyHousesMember.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改购房家属关系 + */ + @Override + public Boolean updateByBo(BuyHousesMemberBo bo) { + BuyHousesMember update = BeanUtil.toBean(bo, BuyHousesMember.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BuyHousesMember entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除购房家属关系 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesReviewMemberServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesReviewMemberServiceImpl.java new file mode 100644 index 000000000..c3d6c8e0a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesReviewMemberServiceImpl.java @@ -0,0 +1,116 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +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.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.BuyHousesReviewMember; +import com.ruoyi.system.domain.bo.BuyHousesReviewMemberBo; +import com.ruoyi.system.domain.vo.BuyHousesReviewMemberVo; +import com.ruoyi.system.mapper.BuyHousesReviewMemberMapper; +import com.ruoyi.system.service.IBuyHousesReviewMemberService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 购房复审家属关系Service业务层处理 + * + * @author ruoyi + * @date 2023-03-15 + */ +@RequiredArgsConstructor +@Service +public class BuyHousesReviewMemberServiceImpl implements IBuyHousesReviewMemberService { + + private final BuyHousesReviewMemberMapper baseMapper; + + /** + * 查询购房复审家属关系 + */ + @Override + public BuyHousesReviewMemberVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询购房复审家属关系列表 + */ + @Override + public TableDataInfo queryPageList(BuyHousesReviewMemberBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询购房复审家属关系列表 + */ + @Override + public List queryList(BuyHousesReviewMemberBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BuyHousesReviewMemberBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHousesReviewMember::getInsidepageUrl, bo.getInsidepageUrl()); + lqw.eq(bo.getBuyHousesId() != null, BuyHousesReviewMember::getBuyHousesId, bo.getBuyHousesId()); + lqw.eq(StringUtils.isNotBlank(bo.getFrontUrl()), BuyHousesReviewMember::getFrontUrl, bo.getFrontUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getRelation()), BuyHousesReviewMember::getRelation, bo.getRelation()); + lqw.eq(StringUtils.isNotBlank(bo.getReverseUrl()), BuyHousesReviewMember::getReverseUrl, bo.getReverseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getHomeRecordUrl()), BuyHousesReviewMember::getHomeRecordUrl, bo.getHomeRecordUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHousesReviewMember::getCardId, bo.getCardId()); + lqw.like(StringUtils.isNotBlank(bo.getName()), BuyHousesReviewMember::getName, bo.getName()); + return lqw; + } + + /** + * 新增购房复审家属关系 + */ + @Override + public Boolean insertByBo(BuyHousesReviewMemberBo bo) { + BuyHousesReviewMember add = BeanUtil.toBean(bo, BuyHousesReviewMember.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改购房复审家属关系 + */ + @Override + public Boolean updateByBo(BuyHousesReviewMemberBo bo) { + BuyHousesReviewMember update = BeanUtil.toBean(bo, BuyHousesReviewMember.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BuyHousesReviewMember entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除购房复审家属关系 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} 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 new file mode 100644 index 000000000..223bb7527 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BuyHousesServiceImpl.java @@ -0,0 +1,1475 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.CreditCodeUtil; +import cn.hutool.core.util.IdcardUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.domain.entity.GaoXinCardInfo; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.helper.LoginHelper; +import com.ruoyi.common.utils.*; +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.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.MaterialModuleVo; +import com.ruoyi.system.mapper.*; +import com.ruoyi.system.service.IBuyHousesService; +import com.ruoyi.work.domain.AuditLog; +import com.ruoyi.work.domain.vo.ProcessVo; +import com.ruoyi.work.dto.HousingConstructionBureauPushDto; +import com.ruoyi.work.mapper.AuditLogMapper; +import com.ruoyi.work.utils.WorkComplyUtils; +import com.ruoyi.work.utils.WorkUtils; +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; +import org.springframework.web.bind.annotation.GetMapping; + +import javax.servlet.http.HttpServletResponse; +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.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 【请填写功能名称】Service业务层处理 + * + * @author ruoyi + * @date 2023-02-24 + */ +@RequiredArgsConstructor +@Service +@Transactional(rollbackFor = Exception.class) +public class BuyHousesServiceImpl implements IBuyHousesService { + + @Value("${file.template}") + private String fileUpload; + + @Value("${file.path}") + private String filePath; + + @Value("${file.domain}") + private String download; + + @Value("${file.prefix}") + private String prefix; + + @Value("${file.doc}") + private String doc; + + @Value("${file.mapping}") + private String mapping; + + private final BuyHousesMapper baseMapper; + + private final BuyHousesMemberMapper buyHousesMemberMapper; + + private final MaterialProofMapper materialProofMapper; + + private final MaterialModuleServiceImpl materialModuleService; + + private final SubscribeExportMapper subscribeExportMapper; + + private final AuditLogMapper auditLogMapper; + + private final HousingConstructionBureauPushDto housingConstructionBureauPushDto; + + private final HousesReviewMapper housesReviewMapper; + + + /** + * 查询【请填写功能名称】 + */ + @Override + public BuyHousesVo queryById(Long id){ + BuyHousesVo buyHousesVo = baseMapper.selectVoById(id); + if (ObjectUtil.isNull(buyHousesVo)){ + throw new ServiceException("数据查询为空"); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialProof::getHouseId, buyHousesVo.getId()) + .eq(MaterialProof::getProcessKey, buyHousesVo.getProcessKey()); + List materialProofs = materialProofMapper.selectList(wrapper); + buyHousesVo.setMaterialProofList(materialProofs); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(BuyHousesMember::getBuyHousesId, id); + List buyHousesMembers = buyHousesMemberMapper.selectList(queryWrapper); + buyHousesVo.setBuyHousesMemberList(buyHousesMembers); + return buyHousesVo; + } + + /** + * 查询【请填写功能名称】列表 + */ + @Override + public TableDataInfo queryPageList(BuyHousesBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper2(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询【请填写功能名称】列表 + */ + @Override + public List queryList(BuyHousesBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(BuyHousesBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(bo.getIds()) && bo.getIds().length>0){ + lqw.in(BuyHouses::getId,bo.getIds()); + } + lqw.eq(ObjectUtil.isNotNull(bo.getId()), BuyHouses::getId, bo.getId()); + lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHouses::getInsidepageUrl, bo.getInsidepageUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHouses::getCardId, bo.getCardId()); + lqw.eq(StringUtils.isNotBlank(bo.getCommitmentUrl()), BuyHouses::getCommitmentUrl, bo.getCommitmentUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCompanyAddress()), BuyHouses::getCompanyAddress, bo.getCompanyAddress()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), BuyHouses::getCompanyName, bo.getCompanyName()); + lqw.eq(bo.getCreateTime() != null, BuyHouses::getCreateTime, bo.getCreateTime()); + lqw.eq(StringUtils.isNotBlank(bo.getDeclarationUrl()), BuyHouses::getDeclarationUrl, bo.getDeclarationUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getDistrict()), BuyHouses::getDistrict, bo.getDistrict()); + lqw.eq(StringUtils.isNotBlank(bo.getEducation()), BuyHouses::getEducation, bo.getEducation()); + lqw.eq(StringUtils.isNotBlank(bo.getFrontUrl()), BuyHouses::getFrontUrl, bo.getFrontUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getGyStatus()), BuyHouses::getGyStatus, bo.getGyStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getHomeRecordUrl()), BuyHouses::getHomeRecordUrl, bo.getHomeRecordUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getHomepageUrl()), BuyHouses::getHomepageUrl, bo.getHomepageUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getLaborContractUrl()), BuyHouses::getLaborContractUrl, bo.getLaborContractUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getLicenseUrl()), BuyHouses::getLicenseUrl, bo.getLicenseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), BuyHouses::getMaritalStatus, bo.getMaritalStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalUrl()), BuyHouses::getMaritalUrl, bo.getMaritalUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getNationality()), BuyHouses::getNationality, bo.getNationality()); + lqw.eq(StringUtils.isNotBlank(bo.getPhone()), BuyHouses::getPhone, bo.getPhone()); + lqw.eq(StringUtils.isNotBlank(bo.getQyStatus()), BuyHouses::getQyStatus, bo.getQyStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getReverseUrl()), BuyHouses::getReverseUrl, bo.getReverseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getSex()), BuyHouses::getSex, bo.getSex()); + lqw.eq(StringUtils.isNotBlank(bo.getShStatus()), BuyHouses::getShStatus, bo.getShStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getSocialCode()), BuyHouses::getSocialCode, bo.getSocialCode()); + lqw.eq(StringUtils.isNotBlank(bo.getSocialSecurityUrl()), BuyHouses::getSocialSecurityUrl, bo.getSocialSecurityUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), BuyHouses::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getType()), BuyHouses::getType, bo.getType()); + lqw.eq(bo.getUserId() != null, BuyHouses::getUserId, bo.getUserId()); + lqw.like(StringUtils.isNotBlank(bo.getUserName()), BuyHouses::getUserName, bo.getUserName()); + 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; + } + + private LambdaQueryWrapper buildQueryWrapper2(BuyHousesBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(bo.getIds())){ + lqw.in(BuyHouses::getId,bo.getIds()); + } + lqw.eq(StringUtils.isNotBlank(bo.getInsidepageUrl()), BuyHouses::getInsidepageUrl, bo.getInsidepageUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCardId()), BuyHouses::getCardId, bo.getCardId()); + lqw.eq(StringUtils.isNotBlank(bo.getCommitmentUrl()), BuyHouses::getCommitmentUrl, bo.getCommitmentUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getCompanyAddress()), BuyHouses::getCompanyAddress, bo.getCompanyAddress()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), BuyHouses::getCompanyName, bo.getCompanyName()); + lqw.eq(bo.getCreateTime() != null, BuyHouses::getCreateTime, bo.getCreateTime()); + lqw.eq(StringUtils.isNotBlank(bo.getDeclarationUrl()), BuyHouses::getDeclarationUrl, bo.getDeclarationUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getEducation()), BuyHouses::getEducation, bo.getEducation()); + lqw.eq(StringUtils.isNotBlank(bo.getFrontUrl()), BuyHouses::getFrontUrl, bo.getFrontUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getGyStatus()), BuyHouses::getGyStatus, bo.getGyStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getHomeRecordUrl()), BuyHouses::getHomeRecordUrl, bo.getHomeRecordUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getHomepageUrl()), BuyHouses::getHomepageUrl, bo.getHomepageUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getLaborContractUrl()), BuyHouses::getLaborContractUrl, bo.getLaborContractUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getLicenseUrl()), BuyHouses::getLicenseUrl, bo.getLicenseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), BuyHouses::getMaritalStatus, bo.getMaritalStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalUrl()), BuyHouses::getMaritalUrl, bo.getMaritalUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getNationality()), BuyHouses::getNationality, bo.getNationality()); + lqw.eq(StringUtils.isNotBlank(bo.getQyStatus()), BuyHouses::getQyStatus, bo.getQyStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getReverseUrl()), BuyHouses::getReverseUrl, bo.getReverseUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getSex()), BuyHouses::getSex, bo.getSex()); + lqw.eq(StringUtils.isNotBlank(bo.getShStatus()), BuyHouses::getShStatus, bo.getShStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getSocialCode()), BuyHouses::getSocialCode, bo.getSocialCode()); + lqw.eq(StringUtils.isNotBlank(bo.getSocialSecurityUrl()), BuyHouses::getSocialSecurityUrl, bo.getSocialSecurityUrl()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), BuyHouses::getStatus, bo.getStatus()); + lqw.eq(bo.getUserId() != null, BuyHouses::getUserId, bo.getUserId()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()),BuyHouses::getProcessStatus,bo.getProcessStatus()); + lqw.ge(StringUtils.isBlank(bo.getProcessStatus()),BuyHouses::getProcessStatus,Constants.SUCCEED); + lqw.and(StringUtils.isNotBlank(bo.getUserName()),t -> + t.like(BuyHouses::getUserName,bo.getUserName()) + .or().like(BuyHouses::getPhone,bo.getUserName()) + .or().like(BuyHouses::getCardId,bo.getUserName())); + lqw.eq(StringUtils.isNotBlank(bo.getDistrict()),BuyHouses::getDistrict,bo.getDistrict()); + lqw.like(StringUtils.isNotBlank(bo.getType()),BuyHouses::getType,bo.getType()); + + 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()); + return lqw; + } + + /** + * 新增【请填写功能名称】 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertByBo(BuyHousesBo bo) { + Long userId = LoginHelper.getUserId(); + bo.setUserId(userId); + //验证这个身份证是否提交过 + List buyHouses = baseMapper.selectList(new LambdaQueryWrapper<>(BuyHouses.class) + .eq(BuyHouses::getCardId, bo.getCardId())); + if (buyHouses.size()>0){ + throw new ServiceException("当前人才已提交申请"); + } + bo.setStep("1"); + bo.setProcessStatus(Constants.WAIT); + BuyHouses add = BeanUtil.toBean(bo, BuyHouses.class); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + //先删除家庭信息表 + if (bo.getBuyHousesMemberList().size()>0) { + buyHousesMemberMapper.delete( new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, add.getId())); + //添加家庭信息 + bo.getBuyHousesMemberList().stream().forEach(e ->e.setBuyHousesId(String.valueOf(add.getId()))); + buyHousesMemberMapper.insertBatch(bo.getBuyHousesMemberList()); + } + //将数据添加到流程中 + ProcessVo processVo = new ProcessVo(); + processVo.setProcessKey("apply_house"); + processVo.setStep("1"); + Map map = BeanUtil.beanToMap(bo); + processVo.setParams(map); + processVo.setBusinessId(bo.getId().toString()); + processVo.setStartUser(bo.getUserName()); + processVo.setCardId(bo.getCardId()); + processVo.setCompanyName(bo.getCompanyName()); + WorkComplyUtils.comply(processVo); + } + return flag; + } + + /** + * 修改【请填写功能名称】 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean updateByBo(BuyHousesBo bo) { + Long userId = LoginHelper.getUserId(); + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + if (ObjectUtil.isNull(buyHouses)){ + throw new ServiceException("请先下载申请表"); + } + bo.setUserId(userId); + BuyHouses update = BeanUtil.toBean(bo, BuyHouses.class); + validEntityBeforeSave(update); + update.setProcessStatus(Constants.WAIT); + update.setStep("1"); + Boolean flag = baseMapper.updateById(update) > 0; + if (flag){ + //将数据添加到流程中 + ProcessVo processVo = new ProcessVo(); + processVo.setProcessKey("apply_house"); + processVo.setStep("1"); + Map map = BeanUtil.beanToMap(bo); + processVo.setParams(map); + processVo.setBusinessId(bo.getId().toString()); + processVo.setStartUser(bo.getUserName()); + processVo.setCardId(bo.getCardId()); + processVo.setCompanyName(bo.getCompanyName()); + WorkComplyUtils.comply(processVo); + } + return flag; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BuyHouses entity){ + //TODO 做一些数据校验,如唯一约束 + //数据校验 + if (!CardsUtil.isIDCard(entity.getCardId())){ + throw new ServiceException("证件号码格式不正确"); + } + if (!CreditCodeUtil.isCreditCode(entity.getSocialCode())){ + throw new ServiceException("社会统一社会信用代码格式不正确"); + } + //验证当前状态是否可以修改 + //判断数据库中是否存在该人才通过身份证去验证 + Long userId = LoginHelper.getUserId(); + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + if (ObjectUtil.isNotNull(buyHouses)) { + if (!Constants.SUBMIT.equals(buyHouses.getProcessStatus()) + && !Constants.FAILD.equals(buyHouses.getProcessStatus()) +// && !Constants.CANCEL.equals(buyHouses.getProcessStatus()) + ) { + throw new ServiceException("当前用户不可修改"); + } + //先删除家庭信息表 + if (entity.getBuyHousesMemberList().size() > 0) { + buyHousesMemberMapper.delete(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, entity.getId())); + //添加家庭信息 + entity.getBuyHousesMemberList().stream().forEach(e -> { + e.setBuyHousesId(String.valueOf(entity.getId())); + e.setId(null); + }); + buyHousesMemberMapper.insertBatch(entity.getBuyHousesMemberList()); + } + } + } + + /** + * 批量删除【请填写功能名称】 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } + + @Override + public R getMaterialInfo(BuyHousesBo bo) { + Map map = BeanUtil.beanToMap(bo); + List materialInfo = materialModuleService.getMaterialInfo(map); + return R.ok(materialInfo); + } + + @Override + public BuyHouses getBuyHousesByCardId(String cardId) { + //验证当前人是否哦申请过购房信息 + List buyHouses = baseMapper.selectList( + new LambdaQueryWrapper() + .eq(BuyHouses::getCardId, cardId)); + if (buyHouses.size()>0){ + BuyHouses buyHouses1 = buyHouses.get(0); + List buyHousesMembers = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class) + .eq(BuyHousesMember::getBuyHousesId, buyHouses1.getId())); + buyHouses1.setBuyHousesMemberList(buyHousesMembers); + return buyHouses1; + } + return null; + } + + /** + * 先保存再执行下载 + * @param bo + */ + @Override + public R downloadWord(BuyHousesBo bo) { + bo.setUserId(LoginHelper.getUserId()); + BuyHouses buyHousesBo = BeanUtil.toBean(bo, BuyHouses.class); + buyHousesBo.setStep("1"); + validEntityBeforeSave(buyHousesBo); + LinkedHashMap map = new LinkedHashMap<>(); + //判断数据库中是否存在该人才通过身份证去验证 + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class) + .eq(BuyHouses::getCardId, buyHousesBo.getCardId())); + //当前用户没提交过 + if (ObjectUtil.isNull(buyHouses)){ + buyHousesBo.setProcessStatus(Constants.SUBMIT); + buyHousesBo.setUpdateTime(new Date()); + buyHousesBo.setCreateTime(new Date()); + BuyHouses toBean = BeanUtil.toBean(buyHousesBo, BuyHouses.class); + baseMapper.insert(toBean); + map.put("buyHouses",toBean); + }else { + //如果不是待提交或者 + if (Constants.SUBMIT.equals(buyHouses.getProcessStatus()) || Constants.FAILD.equals(buyHouses.getProcessStatus())){ + //执行修改操作 + buyHousesBo.setUpdateTime(new Date()); + buyHousesBo.setId(buyHouses.getId()); + BuyHouses toBean = BeanUtil.toBean(buyHousesBo, BuyHouses.class); + baseMapper.updateById(toBean); + map.put("buyHouses",toBean); + } + } + LinkedHashMap hashMap = new LinkedHashMap<>(); + hashMap.put("companyName",buyHousesBo.getCompanyName()); + hashMap.put("socialCode",buyHousesBo.getSocialCode()); + hashMap.put("phone",buyHousesBo.getPhone()); + hashMap.put("companyAddress",buyHousesBo.getCompanyAddress()); + hashMap.put("name",buyHousesBo.getUserName()); + hashMap.put("cardId",buyHousesBo.getCardId()); + hashMap.put("education",buyHousesBo.getEducation()); + hashMap.put("type",buyHousesBo.getType()); + String fileName = UUID.randomUUID().toString(); + String templatePath = fileUpload + "Houses_template.docx"; + String word = ExportWordUtil.createWord(templatePath, doc, fileName, hashMap); + System.out.println("word = " + word); + String file= download + mapping + "/" + fileName + ".docx"; + map.put("file",file); + return R.ok(map); + } + + /** + * 获取进度列表 + * @return + */ + @Override + public List getDeclareList() { + ArrayList list = new ArrayList<>(); + //查询购房信息 + Long userId = LoginHelper.getUserId(); + List buyHouses = baseMapper.selectList(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + if (buyHouses.size()>0) { + buyHouses.stream().forEach(e -> { + DeclareListDTO declareListDTO = new DeclareListDTO(); + declareListDTO.setProjectName("人才安居"); + declareListDTO.setProcessStatus(e.getProcessStatus()); + declareListDTO.setCreateTime(e.getCreateTime()); + declareListDTO.setUserName(e.getUserName()); + declareListDTO.setProcessKey(e.getProcessKey()); + declareListDTO.setBusinessId(e.getId().toString()); + declareListDTO.setCardId(e.getCardId()); + list.add(declareListDTO); + }); + } + return list; + } + + /** + * 根据身份证或者用户信息 + * @param buyHouses + * @return + */ + @Override + public R getInfo(BuyHouses buyHouses) { + Long userId = LoginHelper.getUserId(); + //先判断本地数据库是否有值 + 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()) + .eq(MaterialProof::getProcessKey, buyHousesVo.getProcessKey()); + List materialProofs = materialProofMapper.selectList(wrapper); + buyHousesVo.setMaterialProofList(materialProofs); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(BuyHousesMember::getBuyHousesId, buyHousesVo.getId()); + List buyHousesMembers = buyHousesMemberMapper.selectList(queryWrapper); + buyHousesVo.setBuyHousesMemberList(buyHousesMembers); + return R.ok(buyHousesVo); + } + R rInfo = OpenUtils.getGaoXinCardInfo(buyHouses.getCardId()); + GaoXinCardInfo gaoXinCardInfo = JsonUtils.parseObject(JSONUtil.toJsonPrettyStr(rInfo.getData()), GaoXinCardInfo.class); + BuyHouses buyHousesDto = new BuyHouses(); + buyHousesDto.setCardId(StringUtils.toUpperCase(gaoXinCardInfo.getCard_id())); + String nationality = gaoXinCardInfo.getNationality(); + if ("中国".contains(nationality)){ + buyHousesDto.setNationality("中国籍"); + }else { + buyHousesDto.setNationality("外籍"); + } + buyHousesDto.setUserName(gaoXinCardInfo.getName()); + buyHousesDto.setPhone(gaoXinCardInfo.getPhone()); + buyHousesDto.setCompanyName(gaoXinCardInfo.getCompany_name()); + buyHousesDto.setSex(gaoXinCardInfo.getSex()); + buyHousesDto.setEducation(gaoXinCardInfo.getEducation()); + buyHousesDto.setDistrict("1"); + buyHousesDto.setProcessStatus(Constants.SUBMIT); + buyHousesDto.setType(gaoXinCardInfo.getType()); + buyHousesDto.setWorkAddress(gaoXinCardInfo.getDistrict()); + buyHousesDto.setProcessKey("apply_house"); + return R.ok(buyHousesDto); + } + + /** + * 验证是否具有人才资格 + * @param cardId + * @return + */ + @Override + public R getGaoXinCandidateInfoByCardId(String cardId) { + LinkedHashMap hashMap = new LinkedHashMap<>(3); + R rInfo = OpenUtils.getGaoXinCardInfo(cardId); + if (rInfo.getCode()!=200){ + return R.fail(rInfo.getMsg()); + } + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getCardId, cardId)); + if (ObjectUtil.isNotNull(buyHouses)){ + hashMap.put("status",buyHouses.getProcessStatus()); + hashMap.put("processKey",buyHouses.getProcessKey()); + hashMap.put("businessId",buyHouses.getId()); + return R.ok("获取成功",hashMap); + } + hashMap.put("status",Constants.SUBMIT); + hashMap.put("processKey","apply_house"); + hashMap.put("businessId",null); + return R.ok("获取成功",hashMap); + } + + /** + * 预约导出列表 + * @param bo + * @return + */ + @Override + public R subscribeExport(BuyHousesEvent bo) { + Long userId = LoginHelper.getUserId(); + //判断是否存在正在导出记录 + SubscribeExport subscribeExport1 = subscribeExportMapper.selectOne(new LambdaQueryWrapper<>(SubscribeExport.class) + .eq(SubscribeExport::getUserId, userId) + .eq(SubscribeExport::getExportStatus, "0")); + if (ObjectUtil.isNotNull(subscribeExport1)){ + return R.fail("您已存在一条正在导出数据,请等待前一条导出之后再执行"); + } + //添加导出记录 + SubscribeExport subscribeExport = new SubscribeExport(); + subscribeExport.setProcessKey(bo.getProcessKey()); + subscribeExport.setDescription(bo.getDescription()); + subscribeExport.setUserId(userId.toString()); + subscribeExport.setExportStatus("0"); + subscribeExportMapper.insert(subscribeExport); + bo.setExcelId(subscribeExport.getId()); + SpringUtils.context().publishEvent(bo); + return R.ok("预约成功"); + } + + + /** + *导出excel + * @param bo + * @param response + */ + + @Override + public void exportExcel(BuyHousesBo bo, HttpServletResponse response) { + bo.setProcessStatus(Constants.SUCCEED); + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + List buyHousesVoList = baseMapper.selectVoList(lqw); + 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(); + HashMap map = new HashMap<>(); + BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getUserId, userId)); + if (ObjectUtil.isNotNull(buyHouses)) { + 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; + } + } + }); + } + + map.put("auditLog", auditLogList); + map.put("status", buyHouses.getProcessStatus()); + map.put("id", buyHouses.getId()); + return R.ok("查询成功",map); + } + return R.fail("当前身份证与登录信息不匹配"); + + } + + @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)); + if (ObjectUtil.isNull(buyHouses)){ + return R.fail("没有查询到该人才,请确保该人才已通过审核"); + } + 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, doc, fileName, hashMap); + System.out.println("word = " + word); + String file= download + mapping + "/" + fileName + ".docx"; + System.out.println("file = " + file); + map.put("file",file); + return R.ok(map); + + } + + @Override + public R updateBuyHouses(BuyHouses buyHouses) { + BuyHouses houses = baseMapper.selectById(buyHouses.getId()); + LoginUser loginUser = LoginHelper.getLoginUser(); + //添加取消资格日志 + AuditLog auditLog = new AuditLog(); + auditLog.setOtherId(String.valueOf(buyHouses.getId()));//业务id + auditLog.setProcessKey("apply_house");//流程key + auditLog.setAuditId(loginUser.getUserId().toString());//审核人id + auditLog.setReply(buyHouses.getReply()); + auditLog.setAuditType("2");//审核类型 + auditLog.setStatus("1");//审核状态 + auditLog.setAudit(loginUser.getUserId().toString()); + auditLog.setAdminUserName(loginUser.getUsername()); + auditLog.setCreateTime(new Date()); + auditLog.setUpdateTime(new Date()); + auditLog.setStep("3"); + auditLogMapper.insert(auditLog); + buyHouses.setProcessStatus(Constants.CANCEL); + int i = baseMapper.updateById(buyHouses); + if (i>0){ + if ("apply_house".equals(houses.getProcessKey())){ + //todo 推送 + Map map = new HashMap<>(); + map.put("id",buyHouses.getId()); + map.put("reason",buyHouses.getReply());//原因 + map.put("userName",houses.getUserName()); + map.put("cardId",houses.getCardId()); + map.put("cancelTime", DateUtils.dateTime("yyyy-MM-dd HH:mm:ss")); + map.put("note",buyHouses.getReply());//备注 + map.put("status", "00N"); + map.put("description",buyHouses.getReply()); + System.out.println("JSONUtil.toJsonPrettyStr(map) = " + JSONUtil.toJsonPrettyStr(map)); + housingConstructionBureauPushDto.openUrl("https://jcfw.cdzjryb.com/CCSRegistryCenter/rest",map,"254");//正式 +// housingConstructionBureauPushDto.openUrl("https://171.221.172.13:8088/CCSRegistryCenter/rest", map, "254");//测试 + if (ObjectUtil.isNotNull(houses.getApiKey()) && String.valueOf(houses.getApiKey()).equals("gaoxingongyuanchengshiju")) { +// housingConstructionBureauPushDto.send3(map, "http://218.89.220.30:9200/rctopen/api/anju/openBuyHousesCallback");//测试 + housingConstructionBureauPushDto.send3(map, "https://www.cdhtrct.com/route/open/api/anju/openBuyHousesCallback");//正式 + } + } + return R.ok(); + } + return R.fail(); + } + + /** + * 对外推送接口 + * @param bo + * @return + */ + @Override + public R insertOpenBuyHouses(BuyHousesBo bo) { + BuyHouses buyHouses = BeanUtil.toBean(bo, BuyHouses.class); + buyHouses.setStep("1"); + buyHouses.setVersion("2"); + BuyHouses buyHouses1 = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getCardId, buyHouses.getCardId())); + //判断该人才是否存在 + if (ObjectUtil.isNotNull(buyHouses1) && (ObjectUtil.isEmpty(buyHouses1.getApiKey()) || !buyHouses1.getUserId().equals(buyHouses.getUserId()))){ + throw new ServiceException("当前用户已在系统存在"); + } + if (ObjectUtil.isNull(buyHouses1)){ + //新增 + buyHouses.setId(null); + buyHouses.setProcessStatus(Constants.WAIT); + buyHouses.setProcessKey("apply_house"); + buyHouses.setCreateTime(new Date()); + buyHouses.setUpdateTime(new Date()); + int insert = baseMapper.insert(buyHouses); + if (insert==0){ + throw new ServiceException("新增失败"); +// return R.fail("新增失败"); + } + //创建关系材料表 + List buyHousesMemberList = buyHouses.getBuyHousesMemberList(); + if (buyHousesMemberList.size()>0){ + buyHousesMemberList.stream().forEach(b ->{ + b.setBuyHousesId(String.valueOf(buyHouses.getId())); + }); + } + buyHousesMemberMapper.insertBatch(buyHousesMemberList); + }else { + //判断状态是否在可执行范围 + if (!Constants.WAIT.equals(buyHouses.getProcessStatus()) + && !Constants.SUBMIT.equals(buyHouses.getProcessStatus()) + && ! Constants.FAILD.equals(buyHouses.getProcessStatus())){ + throw new ServiceException("当前状态不在修改范围"); +// return R.fail("当前状态不在修改范围"); + } + buyHouses.setId(buyHouses1.getId()); + + //判断当前是否可以提交 + if (Constants.WAIT.equals(buyHouses1.getProcessStatus()) + ||Constants.SUCCEED.equals(buyHouses1.getProcessStatus())){ + throw new ServiceException("当前状态不允许修改"); +// return R.fail("当前状态不允许修改"); + } + buyHouses.setUpdateTime(new Date()); + //删除关系表中得数据 + buyHousesMemberMapper.delete(new LambdaQueryWrapper<>(BuyHousesMember.class).eq(BuyHousesMember::getBuyHousesId, buyHouses.getId())); + //修改数据 + int i = baseMapper.updateById(buyHouses); + if (Constants.WAIT.equals(buyHouses.getProcessStatus()) && i==0){ + throw new ServiceException("修改失败"); +// return R.fail("修改失败"); + } + //修改材料表中得数据 + List buyHousesMemberList = buyHouses.getBuyHousesMemberList(); + if (buyHousesMemberList.size()>0){ + buyHousesMemberList.stream().forEach(b ->{ + b.setBuyHousesId(buyHouses.getId().toString()); + b.setId(null); + }); + } + buyHousesMemberMapper.insertBatch(buyHousesMemberList); + } + if (Constants.WAIT.equals(buyHouses.getProcessStatus())){ + //创建流程 + //将数据添加到流程中 + ProcessVo processVo = new ProcessVo(); + processVo.setProcessKey("apply_house"); + processVo.setStep("1"); + Map map = BeanUtil.beanToMap(buyHouses); + processVo.setParams(map); + processVo.setBusinessId(buyHouses.getId().toString()); + processVo.setStartUser(buyHouses.getUserName()); + processVo.setCardId(buyHouses.getCardId()); + processVo.setCompanyName(buyHouses.getCompanyName()); + WorkComplyUtils.comply(processVo); + } + return R.ok(buyHouses.getId()); + } + + @Override + public R getIndexType() { + HashMap map = new HashMap<>(); + List mapList = baseMapper.getIndexType(); + map.put("type",mapList); + AtomicReference sum = new AtomicReference<>(0); + mapList.stream().forEach(m ->{ + Object num = m.get("value"); + if (ObjectUtil.isNotNull(num)){ + sum.updateAndGet(v -> v + Integer.valueOf(String.valueOf(num))); + } + }); + map.put("sum",sum); + List actMapList = baseMapper.getActProcessList(); + map.put("step",actMapList); + return R.ok(map); + } + + /** + * 首页企业所在地展示 + * @return + */ + @Override + public R getCompanyDistrict() { + HashMap map = new HashMap<>(); + List list = baseMapper.getCompanyDistrict(); + AtomicReference sum = new AtomicReference<>(0); + list.stream().forEach(m ->{ + Object num = m.get("value"); + if (ObjectUtil.isNotNull(num)){ + sum.updateAndGet(v -> v + Integer.valueOf(String.valueOf(num))); + } + }); + map.put("sum",sum); + map.put("district",list); + return R.ok(map); + } + + @Override + public R getNationalityAndMarital() { + HashMap map = new HashMap<>(); + List mapList= baseMapper.getNationality(); + AtomicReference nationalitySum = new AtomicReference<>(0); + mapList.stream().forEach(m ->{ + Object num = m.get("value"); + if (ObjectUtil.isNotNull(num)){ + nationalitySum.updateAndGet(v -> v + Integer.valueOf(String.valueOf(num))); + } + }); + map.put("nationalitySum",nationalitySum); + map.put("nationality",mapList); + List maritalList = baseMapper.getMaritalStatus(); + AtomicReference maritalSum = new AtomicReference<>(0); + maritalList.stream().forEach(m ->{ + Object num = m.get("value"); + if (ObjectUtil.isNotNull(num)){ + maritalSum.updateAndGet(v -> v + Integer.valueOf(String.valueOf(num))); + } + }); + map.put("maritalSum",maritalSum); + map.put("marital",maritalList); + return R.ok(map); + } + + /** + * 首页第一排基础数据展示 + * @return + */ + @Override + public R getBasicData() { + //获取一期认定通过人才数 + HashMap map = new HashMap<>(); + Long aLong = baseMapper.selectCount(new LambdaQueryWrapper<>(BuyHouses.class) + .eq(BuyHouses::getProcessStatus, Constants.SUCCEED)); + map.put("oneSum",aLong); + //获取二期认定通过人才数 + List housesReviewList = housesReviewMapper.selectList(new LambdaQueryWrapper<>(HousesReview.class) + .eq(HousesReview::getProcessStatus, Constants.SUCCEED)); + map.put("twoSum",housesReviewList.size()); + //获取二期市级和区级比例 + //市级 + int twoMunicipal = housesReviewList.stream().filter(f -> f.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + if (housesReviewList.size()>0) { + double div2 = NumberUtil.div(twoMunicipal, housesReviewList.size()); + String twoMunicipalDecimalFormat = NumberUtil.decimalFormat("#.##%", div2); + map.put("twoMunicipal", twoMunicipalDecimalFormat); + //区级 + int twoDistrict = housesReviewList.stream().filter(f -> f.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + double div1 = NumberUtil.div(twoDistrict,housesReviewList.size()); + String twoDistrictDecimalFormat = NumberUtil.decimalFormat("#.##%", div1); + map.put("twoDistrict",twoDistrictDecimalFormat); + }else{ + map.put("twoMunicipal", 0); + map.put("twoDistrict",0); + } + + //获取本月复审通过数 + Date date = DateUtil.date(); + //获得月份,从0开始计数 + int month = DateUtil.month(date); + List housesReviewStream = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == month).collect(Collectors.toList()); + map.put("monthSum",housesReviewStream.size()); + //筛选区级人才数 + int size = housesReviewList.stream().filter(h -> h.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + double div = NumberUtil.div(size,aLong.intValue()); + String decimalFormat = NumberUtil.decimalFormat("#.##%", div); + //获取复审占比 + map.put("decimalFormat",decimalFormat); + return R.ok(map); + } + + + /** + * 复审柱状图统计图 + * @param date + * @return + */ + @Override + public R getHistogram(String date) { + //查询出所有的数据 + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (ObjectUtil.isNull(date)){ + queryWrapper.eq(ObjectUtil.isNotNull(date),"DATE_FORMAT(create_time,'%Y')", DateUtils.getDate()); + }else { + queryWrapper.eq("DATE_FORMAT(create_time,'%Y')", date); + } + queryWrapper.eq("process_status",Constants.SUCCEED); + List housesReviewList = housesReviewMapper.selectList(queryWrapper); + //区级 + List districtList = new ArrayList<>(); + //市级 + List municipalList = new ArrayList<>(); + //获取第一个月的数据 + List collect = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 0).collect(Collectors.toList()); + if (collect.size()>0){ + //区分区级还是市级 + int size = collect.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect1 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 1).collect(Collectors.toList()); + if (collect1.size()>0){ + //区分区级还是市级 + int size = collect1.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect1.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect2 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 2).collect(Collectors.toList()); + if (collect2.size()>0){ + //区分区级还是市级 + int size = collect2.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect2.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect3 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 3).collect(Collectors.toList()); + if (collect3.size()>0){ + //区分区级还是市级 + int size = collect3.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect3.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect4 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 4).collect(Collectors.toList()); + if (collect4.size()>0){ + //区分区级还是市级 + int size = collect4.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect4.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect5 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 5).collect(Collectors.toList()); + if (collect5.size()>0){ + //区分区级还是市级 + int size = collect5.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect5.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect6 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 6).collect(Collectors.toList()); + if (collect6.size()>0){ + //区分区级还是市级 + int size = collect6.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect6.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + }//获取第一个月的数据 + List collect7 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 7).collect(Collectors.toList()); + if (collect7.size()>0){ + //区分区级还是市级 + int size = collect7.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect7.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + }//获取第一个月的数据 + List collect8 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 8).collect(Collectors.toList()); + if (collect8.size()>0){ + //区分区级还是市级 + int size = collect8.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect8.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect9 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 9).collect(Collectors.toList()); + if (collect9.size()>0){ + //区分区级还是市级 + int size = collect9.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect9.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect10 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 10).collect(Collectors.toList()); + if (collect10.size()>0){ + //区分区级还是市级 + int size = collect10.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect10.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + //获取第一个月的数据 + List collect11 = housesReviewList.stream().filter(h -> h.getPassTime().getMonth() == 11).collect(Collectors.toList()); + if (collect11.size()>0){ + //区分区级还是市级 + int size = collect11.stream().filter(c -> c.getSourceBy().equals("1")).collect(Collectors.toList()).size(); + int size1 = collect11.stream().filter(c -> c.getSourceBy().equals("2")).collect(Collectors.toList()).size(); + districtList.add(size); + municipalList.add(size1); + }else { + districtList.add(0); + municipalList.add(0); + } + HashMap map = new HashMap<>(); + map.put("district",districtList); + map.put("municipal",municipalList); + map.put("sum",housesReviewList.size()); + return R.ok(map); + + + } + + /** + * 起步执行导出zip + * @param event + * @throws IOException + */ + @Async + @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 = "人才认定申请表"; + String separator = File.separator; + String format = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); + String path = filePath + separator + format; + if (buyHousesVoList.size() > 0) { + //查询家庭附件 + List collect = buyHousesVoList.stream().map(BuyHousesVo::getId).collect(Collectors.toList()); + List buyHousesMemberList = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).in(BuyHousesMember::getBuyHousesId, collect)); + //对每一个HouseId分组 + Map> buyHousesMemberMap = buyHousesMemberList.stream().collect(Collectors.groupingBy(BuyHousesMember::getBuyHousesId)); + buyHousesVoList.stream().forEach(r -> { + String userNameFile = path + separator + r.getUserName(); + 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.isNotEmpty(r.getInsidepageUrl())){ + String insidepageUrl = r.getInsidepageUrl(); + String fileName=null; + if ("中国籍".equals(r.getNationality())){ + fileName = s + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf(".")); + }else { + fileName = s + "护照内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf(".")); + } + MyFileUtils.downLoadPic(insidepageUrl, fileName); + } + //申请表 + if (ObjectUtil.isNotEmpty(r.getCommitmentUrl())){ + String commitmentUrl = r.getCommitmentUrl(); + String fileName= s + "申请表" + commitmentUrl.substring(commitmentUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(commitmentUrl, fileName); + } + + //申明书 + if (ObjectUtil.isNotEmpty(r.getDeclarationUrl())){ + String declarationUrl = r.getDeclarationUrl(); + String fileName= s + "申明书" + declarationUrl.substring(declarationUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(declarationUrl, fileName); + } + + //身份证正面 + if (ObjectUtil.isNotEmpty(r.getFrontUrl())){ + String frontUrl = r.getFrontUrl(); + String fileName= s + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(frontUrl, fileName); + } + + //房屋记录 + if (ObjectUtil.isNotEmpty(r.getHomeRecordUrl())){ + String homeRecordUrl = r.getHomeRecordUrl(); + String fileName= s + "房屋记录" + homeRecordUrl.substring(homeRecordUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(homeRecordUrl, fileName); + } + + + //户口簿主页 + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ + String homepageUrl = r.getHomepageUrl(); + String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(homepageUrl, fileName); + } + + //劳动合同 + if (ObjectUtil.isNotEmpty(r.getLaborContractUrl())){ + String laborContractUrl = r.getLaborContractUrl(); + String fileName= s + "劳动合同" + laborContractUrl.substring(laborContractUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(laborContractUrl, fileName); + } + + //企业营业执照 + if (ObjectUtil.isNotEmpty(r.getLicenseUrl())){ + String licenseUrl = r.getLicenseUrl(); + String fileName= s + "企业营业执照" + licenseUrl.substring(licenseUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(licenseUrl, fileName); + } + + //户口簿主页 + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ + String homepageUrl = r.getHomepageUrl(); + String fileName= s + "户口簿主页" + homepageUrl.substring(homepageUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(homepageUrl, fileName); + } + + //婚姻证明材料 + if (ObjectUtil.isNotEmpty(r.getMaritalUrl())){ + String maritalUrl = r.getMaritalUrl(); + String fileName= s + "婚姻证明材料" + maritalUrl.substring(maritalUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(maritalUrl, fileName); + } + + //身份证背面 + if (ObjectUtil.isNotEmpty(r.getReverseUrl())){ + String reverseUrl = r.getReverseUrl(); + String fileName= s + "身份证背面" + reverseUrl.substring(reverseUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(reverseUrl, fileName); + } + + //社保证明 + if (ObjectUtil.isNotEmpty(r.getSocialSecurityUrl())){ + String socialSecurityUrl = r.getSocialSecurityUrl(); + String fileName= s + "社保证明" + socialSecurityUrl.substring(socialSecurityUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(socialSecurityUrl, fileName); + } + + //人才影像卡 + 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 (ObjectUtil.isNotNull(buyHousesMembers)) { + buyHousesMembers.stream().forEach(m -> { + System.out.println("m = " + m); +// String userNameFile1 = path + separator + m.getName(); + if (ObjectUtil.isNotEmpty(m.getFrontUrl())) { + String frontUrl = m.getFrontUrl(); + String fileName = s + m.getRelation() + "身份证正面" + frontUrl.substring(frontUrl.lastIndexOf("."), frontUrl.length()); + MyFileUtils.downLoadPic(frontUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getInsidepageUrl())) { + String insidepageUrl = m.getInsidepageUrl(); + String fileName = s + m.getRelation() + "户口簿内页" + insidepageUrl.substring(insidepageUrl.lastIndexOf(".")); + MyFileUtils.downLoadPic(insidepageUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getReverseUrl())) { + String reverseUrl = m.getReverseUrl(); + String fileName = s + m.getRelation() + "身份证正面" + reverseUrl.substring(reverseUrl.lastIndexOf("."), reverseUrl.length()); + MyFileUtils.downLoadPic(reverseUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getHomeRecordUrl())) { + String homeRecordUrl = m.getHomeRecordUrl(); + 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"; + File file = new File(p); + //获取父目录 + File fileParent = file.getParentFile(); + //判断是否存在 + if (!fileParent.exists()) { + //创建父目录文件 + fileParent.mkdirs(); + } + file.createNewFile(); + OutputStream outXlsx = new FileOutputStream(p); + ExcelUtil.exportExcel(buyHousesVoList,"111",BuyHousesVo.class,outXlsx); + outXlsx.close(); + ZipUtils.toZip(path, fo, true); + System.out.println("path = " + path); + System.out.println("fo = " + fo); + //生成后删除文件 + DeleteFileUtil.delete(path); + String zip = format+".zip"; + String url =download+prefix+"/"+zip; + System.out.println("url = " + url); + SubscribeExport subscribeExport = new SubscribeExport(); + subscribeExport.setPath(url); + subscribeExport.setId(event.getExcelId()); + subscribeExport.setExportStatus("1"); + subscribeExportMapper.updateById(subscribeExport); + } + } + + public void excelZip(String id){ + BuyHousesBo bo =new BuyHousesBo(); + if (ObjectUtil.isNotNull(id)){ + bo.setId(Long.valueOf(id)); + } + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + List buyHousesVoList = baseMapper.selectVoList(lqw); + if (buyHousesVoList.size() > 0) { + //查询家庭附件 + List collect = buyHousesVoList.stream().map(BuyHousesVo::getId).collect(Collectors.toList()); + List buyHousesMemberList = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class).in(BuyHousesMember::getBuyHousesId, collect)); + //对每一个HouseId分组 + Map> buyHousesMemberMap = buyHousesMemberList.stream().collect(Collectors.groupingBy(BuyHousesMember::getBuyHousesId)); + buyHousesVoList.stream().forEach(r -> { + String dir="/usr/local/images/2023/07/01/"; +// String dir="D:\\gaoxin\\images\\"; + //护照或者身份证 + if (ObjectUtil.isNotEmpty(r.getInsidepageUrl())){ + String insidepageUrl = r.getInsidepageUrl(); + String fileName =dir+insidepageUrl.substring(insidepageUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(insidepageUrl, fileName); + } + //申请表 + if (ObjectUtil.isNotEmpty(r.getCommitmentUrl())){ + String commitmentUrl = r.getCommitmentUrl(); + String fileName= dir+commitmentUrl.substring(commitmentUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(commitmentUrl, fileName); + } + //申明书 + if (ObjectUtil.isNotEmpty(r.getDeclarationUrl())){ + String declarationUrl = r.getDeclarationUrl(); + String fileName= dir+declarationUrl.substring(declarationUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(declarationUrl, fileName); + } + + //身份证正面 + if (ObjectUtil.isNotEmpty(r.getFrontUrl())){ + String frontUrl = r.getFrontUrl(); + String fileName= dir+frontUrl.substring(frontUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(frontUrl, fileName); + } + + //房屋记录 + if (ObjectUtil.isNotEmpty(r.getHomeRecordUrl())){ + String homeRecordUrl = r.getHomeRecordUrl(); + String fileName= dir+homeRecordUrl.substring(homeRecordUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(homeRecordUrl, fileName); + } + + + //户口簿主页 + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ + String homepageUrl = r.getHomepageUrl(); + String fileName= dir+homepageUrl.substring(homepageUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(homepageUrl, fileName); + } + + //劳动合同 + if (ObjectUtil.isNotEmpty(r.getLaborContractUrl())){ + String laborContractUrl = r.getLaborContractUrl(); + String fileName= dir+laborContractUrl.substring(laborContractUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(laborContractUrl, fileName); + } + + //企业营业执照 + if (ObjectUtil.isNotEmpty(r.getLicenseUrl())){ + String licenseUrl = r.getLicenseUrl(); + String fileName= dir+licenseUrl.substring(licenseUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(licenseUrl, fileName); + } + + //户口簿主页 + if (ObjectUtil.isNotEmpty(r.getHomepageUrl())){ + String homepageUrl = r.getHomepageUrl(); + String fileName= dir+homepageUrl.substring(homepageUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(homepageUrl, fileName); + } + + //婚姻证明材料 + if (ObjectUtil.isNotEmpty(r.getMaritalUrl())){ + String maritalUrl = r.getMaritalUrl(); + String fileName= dir+maritalUrl.substring(maritalUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(maritalUrl, fileName); + } + + //身份证背面 + if (ObjectUtil.isNotEmpty(r.getReverseUrl())){ + String reverseUrl = r.getReverseUrl(); + String fileName=dir+reverseUrl.substring(reverseUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(reverseUrl, fileName); + } + + //社保证明 + if (ObjectUtil.isNotEmpty(r.getSocialSecurityUrl())){ + String socialSecurityUrl = r.getSocialSecurityUrl(); + String fileName= dir+socialSecurityUrl.substring(socialSecurityUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(socialSecurityUrl, fileName); + } + + //人才影像卡 + if (ObjectUtil.isNotEmpty(r.getPictureInformationUrl())){ + String pictureInformationUrl = r.getPictureInformationUrl(); + String fileName= dir+pictureInformationUrl.substring(pictureInformationUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(pictureInformationUrl, fileName); + } + //家庭信息 + List buyHousesMembers = buyHousesMemberMap.get(r.getId().toString()); + if (ObjectUtil.isNotNull(buyHousesMembers)) { + buyHousesMembers.stream().forEach(m -> { + if (ObjectUtil.isNotEmpty(m.getFrontUrl())) { + String frontUrl = m.getFrontUrl(); + String fileName = dir+frontUrl.substring(frontUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(frontUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getInsidepageUrl())) { + String insidepageUrl = m.getInsidepageUrl(); + String fileName =dir+ insidepageUrl.substring(insidepageUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(insidepageUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getReverseUrl())) { + String reverseUrl = m.getReverseUrl(); + String fileName =dir+ reverseUrl.substring(reverseUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(reverseUrl, fileName); + } + if (ObjectUtil.isNotEmpty(m.getHomeRecordUrl())) { + String homeRecordUrl = m.getHomeRecordUrl(); + String fileName = dir+homeRecordUrl.substring(homeRecordUrl.lastIndexOf("/") + 1); + MyFileUtils.downLoadPic(homeRecordUrl, fileName); + } + }); + } + }); + } + } + + /** + * 单独推送市局系统 + * @return + */ + @GetMapping("/push") + @Override + public R push(String id) throws ParseException { + Map map = WorkUtils.getInfoToMap("buy_houses",id); + String virtualcode = String.valueOf(map.get("virtualcode")); + map.put("virtualcode", virtualcode == "3" ? "010" : "009"); + String cardType = String.valueOf(map.get("nationality")); + map.put("cardType", "中国籍".equals(cardType) ? 1 : 4); + Object createTime = map.get("passTime"); + SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); + DateFormat cst = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date format = sdf.parse(createTime.toString()); + String dateString = cst.format(format); + map.put("qyStatus", "4"); + map.put("creatTime",dateString); + map.put("gyStatus", "4"); + map.put("shStatus", "4"); + map.put("buyHousesMemberList", "null"); + map.put("buyHousesLogList", "null"); + housingConstructionBureauPushDto.openUrl("https://jcfw.cdzjryb.com/CCSRegistryCenter/rest",map,"253"); +// String s = housingConstructionBureauPushDto.openUrl("http://10.182.1.26/CCSRegistryCenter/rest", map, "253"); + return null; + } + + @Override + public R logout(String id) { + BuyHouses buyHouses = baseMapper.selectById(id); + Map map = new HashMap<>(); + map.put("id",buyHouses.getId()); + map.put("reason","人才主动提交");//原因 + map.put("userName",buyHouses.getUserName()); + map.put("cardId",buyHouses.getCardId()); + map.put("cancelTime", DateUtils.dateTime("yyyy-MM-dd HH:mm:ss")); + map.put("note","人才主动撤销");//备注 + System.out.println("JSONUtil.toJsonPrettyStr(map) = " + JSONUtil.toJsonPrettyStr(map)); + housingConstructionBureauPushDto.openUrl("https://jcfw.cdzjryb.com/CCSRegistryCenter/rest",map,"254");//正式 + return null; + } +} 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 new file mode 100644 index 000000000..3658e6d62 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HousesReviewServiceImpl.java @@ -0,0 +1,534 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.CreditCodeUtil; +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; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.helper.LoginHelper; +import com.ruoyi.common.utils.CardsUtil; +import com.ruoyi.common.utils.StringUtils; +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; +import com.ruoyi.system.mapper.HousesReviewMapper; +import com.ruoyi.system.mapper.MaterialProofMapper; +import com.ruoyi.system.mapper.SubscribeExportMapper; +import com.ruoyi.system.service.IHousesReviewService; +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; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 购房复审登记Service业务层处理 + * + * @author ruoyi + * @date 2023-03-08 + */ +@RequiredArgsConstructor +@Service +@Transactional(rollbackFor = Exception.class) +public class HousesReviewServiceImpl implements IHousesReviewService { + + private final HousesReviewMapper baseMapper; + + private final MaterialModuleServiceImpl materialModuleService; + + private final MaterialProofMapper materialProofMapper; + private final BuyHousesReviewMemberMapper buyHousesReviewMemberMapper; + + private final SubscribeExportMapper subscribeExportMapper; + + @Value("${file.template}") + private String template; + + @Value("${file.path}") + private String filePath; + + @Value("${file.domain}") + private String download; + + @Value("${file.prefix}") + private String prefix; + + + /** + * 查询购房复审登记 + */ + @Override + public HousesReviewVo queryById(Long id){ + HousesReviewVo housesReviewVo = baseMapper.selectVoById(id); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(BuyHousesReviewMember::getBuyHousesId, housesReviewVo.getId()); + List buyHousesReviewMembers = buyHousesReviewMemberMapper.selectList(queryWrapper); + housesReviewVo.setBuyHousesMemberList(buyHousesReviewMembers); + if (buyHousesReviewMembers.size()==0){ + housesReviewVo.setBuyHousesMemberList(new ArrayList<>()); + } + return housesReviewVo; + } + + /** + * 查询购房复审登记列表 + */ + @Override + public TableDataInfo queryPageList(HousesReviewBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper2(bo); + Page result = baseMapper.selectPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询购房复审登记列表 + */ + @Override + public List queryList(HousesReviewBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper3(HousesReviewBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(bo.getIds()) && bo.getIds().length>0){ + lqw.in(HousesReview::getId,bo.getIds()); + } + lqw.and(StringUtils.isNotBlank(bo.getName()),t -> + t.like(HousesReview::getName,bo.getName()) + .or().like(HousesReview::getCard,bo.getName()) + .or().like(HousesReview::getProjectName,bo.getName())); + lqw.orderByDesc(HousesReview::getUpdateTime); + lqw.like(StringUtils.isNotBlank(bo.getCardType()), HousesReview::getCardType, bo.getCardType()); + lqw.eq(StringUtils.isNotBlank(bo.getQualification()), HousesReview::getQualification, bo.getQualification()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditTime()), HousesReview::getAuditTime, bo.getAuditTime()); + lqw.like(StringUtils.isNotBlank(bo.getPresellCard()), HousesReview::getPresellCard, bo.getPresellCard()); + lqw.eq(StringUtils.isNotBlank(bo.getDealType()), HousesReview::getDealType, bo.getDealType()); + lqw.eq(StringUtils.isNotBlank(bo.getProjectArea()), HousesReview::getProjectArea, bo.getProjectArea()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationConfirmTime()), HousesReview::getQualificationConfirmTime, bo.getQualificationConfirmTime()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationPreApplyTime()), HousesReview::getQualificationPreApplyTime, bo.getQualificationPreApplyTime()); + lqw.eq(StringUtils.isNotBlank(bo.getFamilyType()), HousesReview::getFamilyType, bo.getFamilyType()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), HousesReview::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getRegisterFailureTime()), HousesReview::getRegisterFailureTime, bo.getRegisterFailureTime()); + lqw.eq(StringUtils.isNotBlank(bo.getNationality()), HousesReview::getNationality, bo.getNationality()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), HousesReview::getMaritalStatus, bo.getMaritalStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getCompanyType()), HousesReview::getCompanyType, bo.getCompanyType()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), HousesReview::getCompanyName, bo.getCompanyName()); + lqw.like(StringUtils.isNotBlank(bo.getTalentsType()), HousesReview::getTalentsType, bo.getTalentsType()); + lqw.eq(StringUtils.isNotBlank(bo.getCreditCode()), HousesReview::getCreditCode, bo.getCreditCode()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyAddress()), HousesReview::getCompanyAddress, bo.getCompanyAddress()); + lqw.eq(StringUtils.isNotBlank(bo.getSourceBy()), HousesReview::getSourceBy, bo.getSourceBy()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()), HousesReview::getProcessStatus, bo.getProcessStatus()); + return lqw; + } + + private LambdaQueryWrapper buildQueryWrapper2(HousesReviewBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(bo.getIds())){ + lqw.in(HousesReview::getId,bo.getIds()); + } + lqw.orderByAsc(HousesReview::getProcessStatus); + lqw.orderByDesc(HousesReview::getUpdateTime); + lqw.eq(StringUtils.isNotBlank(bo.getCardType()), HousesReview::getCardType, bo.getCardType()); + lqw.eq(StringUtils.isNotBlank(bo.getCard()), HousesReview::getCard, bo.getCard()); + lqw.like(StringUtils.isNotBlank(bo.getName()), HousesReview::getName, bo.getName()); + lqw.eq(StringUtils.isNotBlank(bo.getQualification()), HousesReview::getQualification, bo.getQualification()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditTime()), HousesReview::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getPresellCard()), HousesReview::getPresellCard, bo.getPresellCard()); + lqw.eq(StringUtils.isNotBlank(bo.getDealType()), HousesReview::getDealType, bo.getDealType()); + lqw.eq(StringUtils.isNotBlank(bo.getProjectName()), HousesReview::getProjectName, bo.getProjectName()); + lqw.eq(StringUtils.isNotBlank(bo.getProjectArea()), HousesReview::getProjectArea, bo.getProjectArea()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationConfirmTime()), HousesReview::getQualificationConfirmTime, bo.getQualificationConfirmTime()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationPreApplyTime()), HousesReview::getQualificationPreApplyTime, bo.getQualificationPreApplyTime()); + lqw.eq(StringUtils.isNotBlank(bo.getFamilyType()), HousesReview::getFamilyType, bo.getFamilyType()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), HousesReview::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getRegisterFailureTime()), HousesReview::getRegisterFailureTime, bo.getRegisterFailureTime()); + lqw.eq(StringUtils.isNotBlank(bo.getNationality()), HousesReview::getNationality, bo.getNationality()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), HousesReview::getMaritalStatus, bo.getMaritalStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getCompanyType()), HousesReview::getCompanyType, bo.getCompanyType()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), HousesReview::getCompanyName, bo.getCompanyName()); + lqw.eq(StringUtils.isNotBlank(bo.getTalentsType()), HousesReview::getTalentsType, bo.getTalentsType()); + 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.getProcessStatus()), HousesReview::getProcessStatus, bo.getProcessStatus()); + return lqw; + } + + private LambdaQueryWrapper buildQueryWrapper(HousesReviewBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + if (ObjectUtil.isNotNull(bo.getIds())){ + lqw.in(HousesReview::getId,bo.getIds()); + } + lqw.eq(StringUtils.isNotBlank(bo.getCardType()), HousesReview::getCardType, bo.getCardType()); + lqw.eq(StringUtils.isNotBlank(bo.getCard()), HousesReview::getCard, bo.getCard()); + lqw.like(StringUtils.isNotBlank(bo.getName()), HousesReview::getName, bo.getName()); + lqw.eq(StringUtils.isNotBlank(bo.getQualification()), HousesReview::getQualification, bo.getQualification()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditTime()), HousesReview::getAuditTime, bo.getAuditTime()); + lqw.eq(StringUtils.isNotBlank(bo.getPresellCard()), HousesReview::getPresellCard, bo.getPresellCard()); + lqw.eq(StringUtils.isNotBlank(bo.getDealType()), HousesReview::getDealType, bo.getDealType()); + lqw.like(StringUtils.isNotBlank(bo.getProjectName()), HousesReview::getProjectName, bo.getProjectName()); + lqw.eq(StringUtils.isNotBlank(bo.getProjectArea()), HousesReview::getProjectArea, bo.getProjectArea()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationConfirmTime()), HousesReview::getQualificationConfirmTime, bo.getQualificationConfirmTime()); + lqw.eq(StringUtils.isNotBlank(bo.getQualificationPreApplyTime()), HousesReview::getQualificationPreApplyTime, bo.getQualificationPreApplyTime()); + lqw.eq(StringUtils.isNotBlank(bo.getFamilyType()), HousesReview::getFamilyType, bo.getFamilyType()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), HousesReview::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getRegisterFailureTime()), HousesReview::getRegisterFailureTime, bo.getRegisterFailureTime()); + lqw.eq(StringUtils.isNotBlank(bo.getNationality()), HousesReview::getNationality, bo.getNationality()); + lqw.eq(StringUtils.isNotBlank(bo.getMaritalStatus()), HousesReview::getMaritalStatus, bo.getMaritalStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getCompanyType()), HousesReview::getCompanyType, bo.getCompanyType()); + lqw.like(StringUtils.isNotBlank(bo.getCompanyName()), HousesReview::getCompanyName, bo.getCompanyName()); + lqw.eq(StringUtils.isNotBlank(bo.getTalentsType()), HousesReview::getTalentsType, bo.getTalentsType()); + 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.getProcessStatus()), HousesReview::getProcessStatus, bo.getProcessStatus()); + return lqw; + } + + /** + * 新增购房复审登记 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean insertByBo(HousesReviewBo bo) { + //先判断是否存在数据 + HousesReview add = BeanUtil.toBean(bo, HousesReview.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + if (bo.getBuyHousesMemberList().size()>0){ + bo.getBuyHousesMemberList().stream().forEach( e ->{ + e.setBuyHousesId(add.getId().toString()); + }); + + buyHousesReviewMemberMapper.insertBatch(bo.getBuyHousesMemberList()); + } + bo.setId(add.getId()); + } + + return flag; + } + + /** + * 修改购房复审登记 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean updateByBo(HousesReviewBo bo) { + //判断该人才是否可提交 + HousesReview housesReview = baseMapper.selectById(bo.getId()); + if (ObjectUtil.isNotNull(housesReview.getProcessStatus()) + && (Constants.WAIT.equals(housesReview.getProcessStatus()) + || Constants.SUCCEED.equals(housesReview.getProcessStatus()) + || Constants.PUBLICS.equals(housesReview.getProcessStatus()))){ + throw new ServiceException("当前人才状态不允许提交"); + } + bo.setProcessStatus(Constants.WAIT); + +// todo 注释原因:驳回重新提交资料后,以前的资料能否保存历史记录,可以查看 + //先删除存在的家庭情况关系表 + buyHousesReviewMemberMapper.delete( new LambdaQueryWrapper() + .eq(BuyHousesReviewMember::getBuyHousesId, bo.getId())); + //删除补充材料 + materialProofMapper.delete(new LambdaQueryWrapper() + .eq(MaterialProof::getHouseId, bo.getId()) + .eq(MaterialProof::getProcessKey,"house_review")); + Integer number=1; +// 获取当前关系材料的最新一条数据 + /* Integer number=1; + BuyHousesReviewMember buyHousesReviewMember = buyHousesReviewMemberMapper.selectOne(new LambdaQueryWrapper<>(BuyHousesReviewMember.class) + .eq(BuyHousesReviewMember::getBuyHousesId, bo.getId()) + .orderByDesc(BuyHousesReviewMember::getUpdateTime)); + if (ObjectUtil.isNotNull(buyHousesReviewMember)){ + number+=buyHousesReviewMember.getNumber(); + } + + if (ObjectUtil.isNotNull(bo.getBuyHousesMemberList()) && bo.getBuyHousesMemberList().size()>0){ + Integer finalNumber = number; + bo.getBuyHousesMemberList().stream().forEach(e ->{ + e.setBuyHousesId(bo.getId().toString()); + e.setNumber(finalNumber); + }); + buyHousesReviewMemberMapper.insertBatch(bo.getBuyHousesMemberList()); + }*/ + if (ObjectUtil.isNotNull(bo.getBuyHousesMemberList()) && bo.getBuyHousesMemberList().size()>0) { + Integer finalNumber = number; + bo.getBuyHousesMemberList().forEach(e -> { + e.setBuyHousesId(bo.getId().toString()); + e.setId(null); + e.setNumber(finalNumber); + }); + buyHousesReviewMemberMapper.insertBatch(bo.getBuyHousesMemberList()); + } + //获取 + if(ObjectUtil.isNotNull(bo.getMaterialsList()) && bo.getMaterialsList().size()>0){ + ArrayList list = new ArrayList<>(); + bo.getMaterialsList().forEach(e ->{ + MaterialProof materialProof = BeanUtil.toBean(e, MaterialProof.class); + materialProof.setHouseId(bo.getId().toString()); + materialProof.setStatus(0L); + materialProof.setModulePathId(e.getId().toString()); + materialProof.setId(null); + materialProof.setProcessKey("house_review"); + list.add(materialProof); + }); + materialProofMapper.insertBatch(list); + } + bo.setProcessKey("house_review"); + HousesReview update = BeanUtil.toBean(bo, HousesReview.class); + validEntityBeforeSave(update); + int i = baseMapper.updateById(update); + if (i>0) { + ProcessVo processVo = new ProcessVo(); + processVo.setProcessKey("house_review"); + processVo.setStep("1"); + Map map = BeanUtil.beanToMap(bo); + processVo.setParams(map); + processVo.setBusinessId(bo.getId().toString()); + processVo.setStartUser(bo.getName()); + processVo.setCompanyName(bo.getCompanyName()); + processVo.setCardId(bo.getCard()); + WorkComplyUtils.comply(processVo); + } + return i>0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(HousesReview entity){ + if (!CardsUtil.isIDCard(entity.getCard())){ + throw new ServiceException("证件号码格式不正确"); + } + if (!CreditCodeUtil.isCreditCode(entity.getCreditCode())){ + throw new ServiceException("社会统一社会信用代码格式不正确"); + } + if (!"D".equals(entity.getTalentsType())){ + entity.setTypeExtend(""); + } + //如果是区级没有企业类型且D类不区分学历和技能 + if (entity.getSourceBy().equals("1")){ + entity.setCompanyType(""); + if (entity.getTalentsType().equals("D")){ + entity.setTypeExtend(""); + } + } + } + + /** + * 批量删除购房复审登记 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + List housesReviews = baseMapper.selectBatchIds(ids); + boolean b = housesReviews.stream().anyMatch(h -> h.getProcessStatus().equals(Constants.PUBLICS) + || h.getProcessStatus().equals(Constants.WAIT) + || h.getProcessStatus().equals(Constants.SUCCEED)); + if (b){ + throw new ServiceException("当前所选数据中存在审核的数据,请审核之后再删除"); + } + } + return baseMapper.deleteBatchIds(ids) > 0; + } + + @Override + public Boolean saveBatch(List list) { + return baseMapper.insertBatch(list); + } + + /** + * 获取材料接口 + * @param bo + * @return + */ + @Override + public R getMaterialInfo(HousesReviewBo bo) { + //执行修改 + HousesReview housesReview = baseMapper.selectById(bo.getId()); + if (Constants.PUBLICS.equals(housesReview.getProcessStatus()) + || Constants.WAIT.equals(housesReview.getProcessStatus()) + || Constants.SUCCEED.equals(housesReview.getProcessStatus())){ + }else { + HousesReview update = BeanUtil.toBean(bo, HousesReview.class); + validEntityBeforeSave(update); + baseMapper.updateById(update); + Map map = BeanUtil.beanToMap(update); + List materialInfo = materialModuleService.getMaterialInfo(map); + return R.ok(materialInfo); + } + Map map = BeanUtil.beanToMap(bo); + List materialInfo = materialModuleService.getMaterialInfo(map); + return R.ok(materialInfo); + } + + @Override + public HousesReviewVo queryByIdOne(Long id) { + HousesReviewVo housesReviewVo = baseMapper.selectVoById(id); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(BuyHousesReviewMember::getBuyHousesId, housesReviewVo.getId()); + List buyHousesReviewMembers = buyHousesReviewMemberMapper.selectList(queryWrapper); + housesReviewVo.setBuyHousesMemberList(buyHousesReviewMembers); + if (buyHousesReviewMembers.size()==0){ + housesReviewVo.setBuyHousesMemberList(new ArrayList<>()); + } + return housesReviewVo; + } + + /** + * 获取材料 + * @param id + * @return + */ + @Override + public R getMaterialByBusinessId(Long id) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialProof::getHouseId, id); + return R.ok(materialProofMapper.selectList(wrapper)); + + + } + + /** + * 获取导出列表 + * @param bo + * @return + */ + @Override + public R subscribeExport(HousesReviewEvent bo){ + Long userId = LoginHelper.getUserId(); + //判断是否存在正在导出记录 + SubscribeExport subscribeExport1 = subscribeExportMapper.selectOne(new LambdaQueryWrapper<>(SubscribeExport.class) + .eq(SubscribeExport::getUserId, userId) + .eq(SubscribeExport::getExportStatus, "0")); + if (ObjectUtil.isNotNull(subscribeExport1)){ + return R.fail("您已存在一条正在导出数据,请等待前一条导出之后再执行"); + } + //添加导出记录 + SubscribeExport subscribeExport = new SubscribeExport(); + subscribeExport.setProcessKey(bo.getProcessKey()); + subscribeExport.setExportStatus("0"); + subscribeExport.setDescription(bo.getDescription()); + subscribeExport.setUserId(userId.toString()); + subscribeExportMapper.insert(subscribeExport); + bo.setExcelId(subscribeExport.getId()); + SpringUtils.context().publishEvent(bo); + return R.ok("预约成功"); + } + + + /** + * 下载excel + * @param bo + */ + @Override + public void exportExcel(HousesReviewBo bo, HttpServletResponse response) { + bo.setProcessStatus(Constants.SUCCEED); + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + List housesReviews = baseMapper.selectVoList(lqw); + ExcelUtil.exportExcel(housesReviews,"人才列表", HousesReviewVo.class,response); + } + + /** + * 数据库统计 + * @param bo + * @param pageQuery + * @return + */ + @Override + public TableDataInfo managerQueryPageList(HousesReviewBo bo, PageQuery pageQuery) { + bo.setProcessStatus(Constants.SUCCEED); + LambdaQueryWrapper lqw = buildQueryWrapper3(bo); + Page result = baseMapper.selectPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + @Async + @EventListener + public void export(HousesReviewEvent event) throws IOException { + HousesReviewBo bo = BeanUtil.toBean(event, HousesReviewBo.class); + LambdaQueryWrapper lqw = buildQueryWrapper3(bo); + List housesReviews = baseMapper.selectVoList(lqw); + String title = "人才认定申请表"; + String separator = File.separator; + String format = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); + String path = filePath + separator + format; + if (housesReviews.size() > 0) { + List collect = housesReviews.stream().map(HousesReviewVo::getId).collect(Collectors.toList()); + List materialProofList = materialProofMapper.selectList(new LambdaQueryWrapper<>(MaterialProof.class).in(MaterialProof::getHouseId, collect)); + //根据业务id进行分组 + Map> collectMap = materialProofList.stream().collect(Collectors.groupingBy(MaterialProof::getHouseId)); + housesReviews.stream().forEach(r -> { + List materialProofs = collectMap.get(r.getId().toString()); + if (materialProofs.size()>0) { + materialProofs.stream().forEach(p -> { + String userNameFile = path + separator + r.getName(); + File userFile = new File(userNameFile); + if (!userFile.exists() && !userFile.isDirectory()) { + userFile.mkdirs(); + } + String s = userNameFile + separator + r.getName() + "--"; + String file = p.getFile(); + MyFileUtils.downLoadPic(file, s + p.getMaterialName() + file.substring(file.lastIndexOf("."))); + System.out.println("file = " + file); + }); + } + }); + String p = path + separator + title + ".xlsx"; + String fo = filePath + separator + format + ".zip"; + File file = new File(p); + //获取父目录 + File fileParent = file.getParentFile(); + //判断是否存在 + if (!fileParent.exists()) { + //创建父目录文件 + fileParent.mkdirs(); + } + file.createNewFile(); + OutputStream outXlsx = new FileOutputStream(p); + ExcelUtil.exportExcel(housesReviews,"111",HousesReviewVo.class,outXlsx); + outXlsx.close(); + ZipUtils.toZip(path, fo, true); + System.out.println("path = " + path); + System.out.println("fo = " + fo); + //生成后删除文件 + DeleteFileUtil.delete(path); + String zip = format+".zip"; + String url =download+prefix+"/"+zip; + SubscribeExport subscribeExport = new SubscribeExport(); + subscribeExport.setPath(url); + subscribeExport.setId(event.getExcelId()); + subscribeExport.setExportStatus("1"); + subscribeExportMapper.updateById(subscribeExport); + } + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialModuleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialModuleServiceImpl.java new file mode 100644 index 000000000..149d65fa6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialModuleServiceImpl.java @@ -0,0 +1,183 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +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.core.domain.PageQuery; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.helper.DataBaseHelper; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.MaterialModule; +import com.ruoyi.system.domain.MaterialProof; +import com.ruoyi.system.domain.MaterialTalents; +import com.ruoyi.system.domain.bo.HousesReviewBo; +import com.ruoyi.system.domain.bo.MaterialModuleBo; +import com.ruoyi.system.domain.vo.MaterialModuleVo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; +import com.ruoyi.system.mapper.MaterialModuleMapper; +import com.ruoyi.system.mapper.MaterialProofMapper; +import com.ruoyi.system.mapper.MaterialTalentsMapper; +import com.ruoyi.system.service.IMaterialModuleService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 材料模块Service业务层处理 + * + * @author ruoyi + * @date 2023-03-09 + */ +@RequiredArgsConstructor +@Service +public class MaterialModuleServiceImpl implements IMaterialModuleService { + + private final MaterialModuleMapper baseMapper; + + private final MaterialTalentsMapper materialTalentsMapper; + + private final MaterialProofMapper materialProofMapper; + + /** + * 查询材料模块 + */ + @Override + public MaterialModuleVo queryById(Long id){ + MaterialModuleVo materialModuleVo = baseMapper.selectVoById(id); + if (ObjectUtil.isNotNull(materialModuleVo.getAuditDept())){ + String[] split = materialModuleVo.getAuditDept().split(","); + Long[] longs = Convert.toLongArray(split); + materialModuleVo.setAuditDeptArr(longs); + } + return materialModuleVo; + } + + /** + * 查询材料模块列表 + */ + @Override + public TableDataInfo queryPageList(MaterialModuleBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPageList(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询材料模块列表 + */ + @Override + public List queryList(MaterialModuleBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(MaterialModuleBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), MaterialModule::getMaterialName, bo.getMaterialName()); + lqw.like(StringUtils.isNotBlank(bo.getMaterialKey()), MaterialModule::getMaterialKey, bo.getMaterialKey()); + return lqw; + } + + /** + * 新增材料模块 + */ + @Override + public Boolean insertByBo(MaterialModuleBo bo) { + MaterialModule add = BeanUtil.toBean(bo, MaterialModule.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改材料模块 + */ + @Override + public Boolean updateByBo(MaterialModuleBo bo) { + MaterialModule update = BeanUtil.toBean(bo, MaterialModule.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(MaterialModule entity){ + //将数组转为字符串 + if (ObjectUtil.isNotNull(entity.getAuditDeptArr()) && entity.getAuditDeptArr().length>0){ + String join = StringUtils.join(entity.getAuditDeptArr(), ","); + entity.setAuditDept(join); + } + } + + /** + * 批量删除材料模块 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } + + @Override + public R selectMaterialList(MaterialModuleBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return R.ok(baseMapper.selectVoList(lqw)); + } + + public List getMaterialInfo(Map map){ + Set keys = map.keySet(); + LambdaQueryWrapper eq = new LambdaQueryWrapper() + .eq(MaterialTalents::getTalentsValue, map.get("processKey")) + .eq(MaterialTalents::getDelFlag,"0"); + MaterialTalentsVo materialTalentsVo = materialTalentsMapper.selectVoOne(eq); + //根据id获取关于他下面的所有子集 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .apply(DataBaseHelper.findInSet(materialTalentsVo.getId(), "selected")); + List materialTalents = materialTalentsMapper.selectList(wrapper); + ArrayList list = new ArrayList<>(); + if (!"".equals(materialTalentsVo.getMaterials()) && ObjectUtil.isNotNull(materialTalentsVo.getMaterials())){ + list.add(materialTalentsVo.getMaterials()); + } + for (MaterialTalents materialTalent : materialTalents) { + if (keys.contains(materialTalent.getTalentsValue())){ + //获取当前目录下的数据 + Object value = map.get(materialTalent.getTalentsValue()); + if (ObjectUtil.isNotNull(value)) { + List collect = materialTalents.stream().filter(m -> m.getTalentsValue().equals(value) && materialTalent.getId().equals(m.getParentId()) && ObjectUtil.isNotEmpty(m.getMaterials())).map(MaterialTalents::getMaterials).collect(Collectors.toList()); + System.out.println("collect = " + collect); + list.addAll(collect); + } + } + } + String join = String.join(",", list); + List strings = Arrays.asList(join.split(",")); + List collect = strings.stream().distinct().map(Long ::parseLong).collect(Collectors.toList()); + List materialTalentsVos = baseMapper.selectVoBatchIds(collect); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(MaterialProof::getHouseId, map.get("id")) + .eq(MaterialProof::getProcessKey,map.get("processKey")); + List materialProofs = materialProofMapper.selectList(queryWrapper); + materialTalentsVos.forEach(e -> { + materialProofs.forEach(m ->{ + if (e.getId().toString().equals(m.getModulePathId())){ + e.setFile(m.getFile()); + } + }); + }); + return materialTalentsVos; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialProofServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialProofServiceImpl.java new file mode 100644 index 000000000..c6e1b4529 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialProofServiceImpl.java @@ -0,0 +1,117 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +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.core.domain.PageQuery; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.MaterialProof; +import com.ruoyi.system.domain.bo.MaterialProofBo; +import com.ruoyi.system.domain.vo.MaterialProofVo; +import com.ruoyi.system.mapper.MaterialProofMapper; +import com.ruoyi.system.service.IMaterialProofService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 材料Service业务层处理 + * + * @author ruoyi + * @date 2023-03-15 + */ +@RequiredArgsConstructor +@Service +public class MaterialProofServiceImpl implements IMaterialProofService { + + private final MaterialProofMapper baseMapper; + + /** + * 查询材料 + */ + @Override + public MaterialProofVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询材料列表 + */ + @Override + public TableDataInfo queryPageList(MaterialProofBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询材料列表 + */ + @Override + public List queryList(MaterialProofBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(MaterialProofBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getHouseId()), MaterialProof::getHouseId, bo.getHouseId()); + lqw.eq(bo.getCreateTime() != null, MaterialProof::getCreateTime, bo.getCreateTime()); + lqw.eq(bo.getStatus() != null, MaterialProof::getStatus, bo.getStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getModulePathId()), MaterialProof::getModulePathId, bo.getModulePathId()); + lqw.eq(StringUtils.isNotBlank(bo.getFile()), MaterialProof::getFile, bo.getFile()); + lqw.eq(StringUtils.isNotBlank(bo.getMaterialKey()), MaterialProof::getMaterialKey, bo.getMaterialKey()); + lqw.eq(StringUtils.isNotBlank(bo.getDescription()), MaterialProof::getDescription, bo.getDescription()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditDept()), MaterialProof::getAuditDept, bo.getAuditDept()); + lqw.eq(StringUtils.isNotBlank(bo.getCheckType()), MaterialProof::getCheckType, bo.getCheckType()); + return lqw; + } + + /** + * 新增材料 + */ + @Override + public Boolean insertByBo(MaterialProofBo bo) { + MaterialProof add = BeanUtil.toBean(bo, MaterialProof.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改材料 + */ + @Override + public Boolean updateByBo(MaterialProofBo bo) { + MaterialProof update = BeanUtil.toBean(bo, MaterialProof.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(MaterialProof entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除材料 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialTalentsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialTalentsServiceImpl.java new file mode 100644 index 000000000..32128e5df --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MaterialTalentsServiceImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.MaterialTalents; +import com.ruoyi.system.domain.bo.MaterialTalentsBo; +import com.ruoyi.system.domain.vo.MaterialTalentsVo; +import com.ruoyi.system.mapper.MaterialTalentsMapper; +import com.ruoyi.system.service.IMaterialTalentsService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * 材料关系Service业务层处理 + * + * @author ruoyi + * @date 2023-03-09 + */ +@RequiredArgsConstructor +@Service +public class MaterialTalentsServiceImpl implements IMaterialTalentsService { + + private final MaterialTalentsMapper baseMapper; + + /** + * 查询材料关系 + */ + @Override + public MaterialTalentsVo queryById(Long id){ + MaterialTalentsVo materialTalentsVo = baseMapper.selectVoById(id); + return materialTalentsVo; + } + + + /** + * 查询材料关系列表 + */ + @Override + public List queryList(MaterialTalentsBo bo) { + return baseMapper.selectVoListSpecial (bo); + } + + private LambdaQueryWrapper buildQueryWrapper(MaterialTalentsBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getTalentsName()), MaterialTalents::getTalentsName, bo.getTalentsName()); + return lqw; + } + + /** + * 新增材料关系 + */ + @Override + public Boolean insertByBo(MaterialTalentsBo bo) { + if (!bo.getParentId().equals(0)){ + //获取它父类的关系级 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialTalents::getId, bo.getParentId()); + MaterialTalents materialTalents = baseMapper.selectOne(wrapper); + if (!bo.getParentId().equals(0L)){ + String selected = materialTalents.getSelected(); + if (ObjectUtil.isNull(selected)){ + bo.setSelected(materialTalents.getId().toString()); + }else { + ArrayList list = new ArrayList<>(); + List strings = Arrays.asList(materialTalents.getSelected().split(",")); + list.addAll(strings); + list.add(materialTalents.getId().toString()); + String join = StringUtils.join(list, ","); + bo.setSelected(join); + } + } + } + + MaterialTalents add = BeanUtil.toBean(bo, MaterialTalents.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改材料关系 + */ + @Override + public Boolean updateByBo(MaterialTalentsBo bo) { + if (!bo.getParentId().equals(0L)){ + //获取它父类的关系级 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(MaterialTalents::getId, bo.getParentId()); + MaterialTalents materialTalents = baseMapper.selectOne(wrapper); + String selected = materialTalents.getSelected(); + if (ObjectUtil.isEmpty(selected)){ + bo.setSelected(materialTalents.getId().toString()); + }else { + ArrayList list = new ArrayList<>(); + List strings = Arrays.asList(materialTalents.getSelected().split(",")); + list.addAll(strings); + list.add(materialTalents.getId().toString()); + String join = StringUtils.join(list, ","); + bo.setSelected(join); + } + } + MaterialTalents update = BeanUtil.toBean(bo, MaterialTalents.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(MaterialTalents entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除材料关系 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PushLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PushLogServiceImpl.java new file mode 100644 index 000000000..8c5d0fab9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PushLogServiceImpl.java @@ -0,0 +1,109 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.common.core.domain.event.PushLogEvent; +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 lombok.RequiredArgsConstructor; +import org.springframework.context.event.EventListener; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.bo.PushLogBo; +import com.ruoyi.system.domain.vo.PushLogVo; +import com.ruoyi.system.domain.PushLog; +import com.ruoyi.system.mapper.PushLogMapper; +import com.ruoyi.system.service.IPushLogService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 推送日志Service业务层处理 + * + * @author ruoyi + * @date 2023-07-20 + */ +@RequiredArgsConstructor +@Service +public class PushLogServiceImpl implements IPushLogService { + + private final PushLogMapper baseMapper; + + /** + * 查询推送日志 + */ + @Override + public PushLogVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询推送日志列表 + */ + @Override + public TableDataInfo queryPageList(PushLogBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询推送日志列表 + */ + @Override + public List queryList(PushLogBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(PushLogBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getPushData()), PushLog::getPushData, bo.getPushData()); + lqw.eq(StringUtils.isNotBlank(bo.getResultData()), PushLog::getResultData, bo.getResultData()); + return lqw; + } + + /** + * 新增推送日志 + */ + @Async + @EventListener + public void insertByBo(PushLogEvent event) { + PushLog add = BeanUtil.toBean(event, PushLog.class); + baseMapper.insert(add); + } + + /** + * 修改推送日志 + */ + @Override + public Boolean updateByBo(PushLogBo bo) { + PushLog update = BeanUtil.toBean(bo, PushLog.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(PushLog entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除推送日志 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RsaSecurityServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RsaSecurityServiceImpl.java new file mode 100644 index 000000000..1e25a02bb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/RsaSecurityServiceImpl.java @@ -0,0 +1,161 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONUtil; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.CacheNames; +import com.ruoyi.common.core.service.IRsaSecurityService2; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.JsonUtils; +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.redis.CacheUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.CachePut; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.bo.RsaSecurityBo; +import com.ruoyi.system.domain.vo.RsaSecurityVo; +import com.ruoyi.common.core.domain.RsaSecurity; +import com.ruoyi.system.mapper.RsaSecurityMapper; +import com.ruoyi.system.service.IRsaSecurityService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 请求RSA数据加解密Service业务层处理 + * + * @author ruoyi + * @date 2023-05-17 + */ +@RequiredArgsConstructor +@Service +public class RsaSecurityServiceImpl implements IRsaSecurityService, IRsaSecurityService2 { + + private final RsaSecurityMapper baseMapper; + + /** + * 查询请求RSA数据加解密 + */ + @Override + public RsaSecurityVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询请求RSA数据加解密列表 + */ + @Override + public TableDataInfo queryPageList(RsaSecurityBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询请求RSA数据加解密列表 + */ + @Override + public List queryList(RsaSecurityBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(RsaSecurityBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.like(StringUtils.isNotBlank(bo.getPath()), RsaSecurity::getPath, bo.getPath()); + lqw.eq(bo.getInDecode() != null, RsaSecurity::getInDecode, bo.getInDecode()); + lqw.eq(bo.getOutEncode() != null, RsaSecurity::getOutEncode, bo.getOutEncode()); + lqw.eq(StringUtils.isNotBlank(bo.getPublicKey()), RsaSecurity::getPublicKey, bo.getPublicKey()); + lqw.eq(StringUtils.isNotBlank(bo.getPrivateKey()), RsaSecurity::getPrivateKey, bo.getPrivateKey()); + lqw.eq(StringUtils.isNotBlank(bo.getMethod()), RsaSecurity::getMethod, bo.getMethod()); + lqw.eq(StringUtils.isNotBlank(bo.getRestricted()), RsaSecurity::getRestricted, bo.getRestricted()); + return lqw; + } + + /** + * 新增请求RSA数据加解密 + */ + @CachePut(cacheNames = CacheNames.RSA_SECURITY, key = "#bo.path+':'+#bo.method") + @Override + public RsaSecurity insertByBo(RsaSecurityBo bo) { + RsaSecurity add = BeanUtil.toBean(bo, RsaSecurity.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + return baseMapper.selectById(add.getId()); + } + throw new ServiceException("操作失败"); + } + + /** + * 修改请求RSA数据加解密 + */ + @CachePut(cacheNames = CacheNames.RSA_SECURITY, key = "#bo.path+':'+#bo.method") + @Override + public RsaSecurity updateByBo(RsaSecurityBo bo) { + RsaSecurity update = BeanUtil.toBean(bo, RsaSecurity.class); + validEntityBeforeSave(update); + boolean flag = baseMapper.updateById(update) > 0; + if (flag) { + return baseMapper.selectById(update.getId()); + } + throw new ServiceException("操作失败"); + } + + + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(RsaSecurity entity){ + //TODO 做一些数据校验,如唯一约束 + //判断path是否已经存在 + boolean exists = baseMapper.exists( + new LambdaQueryWrapper<>(RsaSecurity.class) + .eq(RsaSecurity::getPath, entity.getPath()) + .eq(RsaSecurity::getMethod, entity.getMethod()) + .ne(ObjectUtil.isNotNull(entity.getId()), RsaSecurity::getId, entity.getId())); + if (exists){ + throw new ServiceException("当前路径path已存在"); + } + } + /** + * 查询缓存中的path + */ + public RsaSecurity getInfo(String path,String method){ + Object o = CacheUtils.get(CacheNames.RSA_SECURITY, path+":"+method); + if (ObjectUtil.isNotNull(o)){ + return JsonUtils.parseObject(JsonUtils.toJsonString(o), RsaSecurity.class); + } + return baseMapper.selectOne(new LambdaQueryWrapper<>(RsaSecurity.class) + .eq(RsaSecurity::getPath,path) + .eq(RsaSecurity::getMethod,method)); + } + + public void loadingRsaSecurityCache(){ + List rsaSecurities = baseMapper.selectList(); + CacheUtils.clear(CacheNames.RSA_SECURITY); + rsaSecurities.forEach(r ->{ + CacheUtils.put(CacheNames.RSA_SECURITY, r.getPath()+":"+r.getMethod(), r); + }); + } + /** + * 批量删除请求RSA数据加解密 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} 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 new file mode 100644 index 000000000..d03b3a27c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SubscribeExportServiceImpl.java @@ -0,0 +1,137 @@ +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; +import com.ruoyi.system.domain.SubscribeExport; +import com.ruoyi.system.mapper.SubscribeExportMapper; +import com.ruoyi.system.service.ISubscribeExportService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 预约导出Service业务层处理 + * + * @author ruoyi + * @date 2023-04-20 + */ +@RequiredArgsConstructor +@Service +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; + + /** + * 查询预约导出 + */ + @Override + public SubscribeExportVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询预约导出列表 + */ + @Override + public TableDataInfo queryPageList(SubscribeExportBo bo, PageQuery pageQuery) { + if (!LoginHelper.isAdmin()){ + bo.setUserId(LoginHelper.getUserId().toString()); + } + bo.setExportStatus("1"); + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + lqw.orderByDesc(SubscribeExport::getCreateTime); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询预约导出列表 + */ + @Override + public List queryList(SubscribeExportBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(SubscribeExportBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getPath()), SubscribeExport::getPath, bo.getPath()); + lqw.eq(StringUtils.isNotBlank(bo.getExportStatus()), SubscribeExport::getExportStatus, bo.getExportStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getUserId()), SubscribeExport::getUserId, bo.getUserId()); + lqw.eq(StringUtils.isNotBlank(bo.getProcessKey()), SubscribeExport::getProcessKey, bo.getProcessKey()); + return lqw; + } + + /** + * 新增预约导出 + */ + @Override + public Boolean insertByBo(SubscribeExportBo bo) { + SubscribeExport add = BeanUtil.toBean(bo, SubscribeExport.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改预约导出 + */ + @Override + public Boolean updateByBo(SubscribeExportBo bo) { + SubscribeExport update = BeanUtil.toBean(bo, SubscribeExport.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(SubscribeExport entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除预约导出 + */ + @Override + 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/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 932753b26..e94366391 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -6,11 +6,13 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.constant.CacheNames; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.service.ConfigService; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.helper.LoginHelper; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.redis.CacheUtils; import com.ruoyi.common.utils.spring.SpringUtils; @@ -21,7 +23,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -62,6 +67,20 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService { return baseMapper.selectById(configId); } + /** + * 根据key获取配置信息 + * @param key + * @return + */ + @Override + public void selectConfigByConfigKey(String key) { + String s = selectConfigByKey(key); + if ("true".equals(s)){ + throw new ServiceException("系统升级维护中!感谢您的等待!"); + } + System.out.println("s = " + s); + } + /** * 根据键名查询参数配置信息 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 85d892411..c12994e1d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -235,7 +235,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService @Override public String getDictLabel(String dictType, String dictValue, String separator) { // 优先从本地缓存获取 - List datas = (List) SaHolder.getStorage().get(CacheConstants.SYS_DICT_KEY + dictType); + List datas = (List) CacheUtils.get(CacheNames.SYS_DICT, dictType); if (ObjectUtil.isNull(datas)) { datas = SpringUtils.getAopProxy(this).selectDictDataByType(dictType); SaHolder.getStorage().set(CacheConstants.SYS_DICT_KEY + dictType, datas); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java index 1cd176f79..16cf31c56 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java @@ -49,7 +49,6 @@ public class SysLogininforServiceImpl implements ISysLogininforService { HttpServletRequest request = logininforEvent.getRequest(); final UserAgent userAgent = UserAgentUtil.parse(request.getHeader("User-Agent")); final String ip = ServletUtils.getClientIP(request); - String address = AddressUtils.getRealAddressByIP(ip); StringBuilder s = new StringBuilder(); s.append(getBlock(ip)); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 84e762175..aad38645c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -39,7 +39,7 @@ import java.util.*; */ @RequiredArgsConstructor @Service -public class SysRoleServiceImpl implements ISysRoleService { +public class SysRoleServiceImpl implements ISysRoleService{ private final SysRoleMapper baseMapper; private final SysRoleMenuMapper roleMenuMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index b4105870c..fd4dcc19f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -45,7 +45,7 @@ import java.util.Map; @Slf4j @RequiredArgsConstructor @Service -public class SysUserServiceImpl implements ISysUserService, UserService { +public class SysUserServiceImpl implements ISysUserService, UserService{ private final SysUserMapper baseMapper; private final SysDeptMapper deptMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java new file mode 100644 index 000000000..5ff753bc7 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java @@ -0,0 +1,145 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.http.HttpRequest; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.ruoyi.common.core.domain.R; +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 lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.bo.UserBo; +import com.ruoyi.system.domain.vo.UserVo; +import com.ruoyi.system.domain.User; +import com.ruoyi.system.mapper.UserMapper; +import com.ruoyi.system.service.IUserService; +import org.springframework.transaction.annotation.Transactional; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 【请填写功能名称】Service业务层处理 + * + * @author ruoyi + * @date 2023-04-03 + */ +@RequiredArgsConstructor +@Service +@Transactional(rollbackFor = Exception.class) +public class UserServiceImpl implements IUserService { + + private final UserMapper baseMapper; + + /** + * 查询【请填写功能名称】 + */ + @Override + public UserVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询【请填写功能名称】列表 + */ + @Override + public TableDataInfo queryPageList(UserBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询【请填写功能名称】列表 + */ + @Override + public List queryList(UserBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(UserBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getStatus() != null, User::getStatus, bo.getStatus()); + lqw.like(StringUtils.isNotBlank(bo.getLoginName()), User::getLoginName, bo.getLoginName()); + lqw.eq(StringUtils.isNotBlank(bo.getPassword()), User::getPassword, bo.getPassword()); + lqw.eq(StringUtils.isNotBlank(bo.getCardNumber()), User::getCardNumber, bo.getCardNumber()); + lqw.eq(StringUtils.isNotBlank(bo.getType()), User::getType, bo.getType()); + lqw.eq(StringUtils.isNotBlank(bo.getValidityDate()), User::getValidityDate, bo.getValidityDate()); + lqw.eq(StringUtils.isNotBlank(bo.getWxToken()), User::getWxToken, bo.getWxToken()); + lqw.eq(bo.getEnterNumber() != null, User::getEnterNumber, bo.getEnterNumber()); + lqw.like(StringUtils.isNotBlank(bo.getUserName()), User::getUserName, bo.getUserName()); + lqw.eq(bo.getLastTime() != null, User::getLastTime, bo.getLastTime()); + lqw.eq(bo.getDirection() != null, User::getDirection, bo.getDirection()); + lqw.eq(bo.getJurisdiction() != null, User::getJurisdiction, bo.getJurisdiction()); + lqw.eq(StringUtils.isNotBlank(bo.getJobWanted()), User::getJobWanted, bo.getJobWanted()); + lqw.eq(bo.getRegisterTime() != null, User::getRegisterTime, bo.getRegisterTime()); + lqw.eq(StringUtils.isNotBlank(bo.getWxToken1()), User::getWxToken1, bo.getWxToken1()); + lqw.eq(StringUtils.isNotBlank(bo.getCardId()), User::getCardId, bo.getCardId()); + return lqw; + } + + /** + * 新增【请填写功能名称】 + */ + @Override + public Boolean insertByBo(UserBo bo) { + User add = BeanUtil.toBean(bo, User.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改【请填写功能名称】 + */ + @Override + public Boolean updateByBo(UserBo bo) { + User update = BeanUtil.toBean(bo, User.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(User entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除【请填写功能名称】 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + @Override + public int resetUserPwd(String userName, String password) { + return baseMapper.update(null, + new LambdaUpdateWrapper() + .set(User::getPassword, password) + .eq(User::getLoginName, userName)); + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/BuyHouseCheckMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BuyHouseCheckMapper.xml new file mode 100644 index 000000000..2ee9c13a8 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BuyHouseCheckMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/BuyHousesMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BuyHousesMapper.xml new file mode 100644 index 000000000..288b07a67 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BuyHousesMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/BuyHousesMemberMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BuyHousesMemberMapper.xml new file mode 100644 index 000000000..714a292b8 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BuyHousesMemberMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/BuyHousesReviewMemberMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BuyHousesReviewMemberMapper.xml new file mode 100644 index 000000000..5a50eb1c4 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/BuyHousesReviewMemberMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/HousesReviewMapper.xml b/ruoyi-system/src/main/resources/mapper/system/HousesReviewMapper.xml new file mode 100644 index 000000000..e4f14a8db --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/HousesReviewMapper.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml new file mode 100644 index 000000000..48e143140 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/MaterialModuleMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/MaterialProofMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MaterialProofMapper.xml new file mode 100644 index 000000000..81cdeba4d --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/MaterialProofMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/MaterialTalentsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/MaterialTalentsMapper.xml new file mode 100644 index 000000000..8d64df500 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/MaterialTalentsMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/PushLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/PushLogMapper.xml new file mode 100644 index 000000000..67d766faa --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/PushLogMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/RsaSecurityMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RsaSecurityMapper.xml new file mode 100644 index 000000000..5ee640832 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/RsaSecurityMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/SubscribeExportMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SubscribeExportMapper.xml new file mode 100644 index 000000000..0873b91d2 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/SubscribeExportMapper.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml deleted file mode 100644 index 983125b60..000000000 --- a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index e73e715db..9945adf9f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -24,6 +24,7 @@ + @@ -65,6 +66,7 @@ u.create_by, u.create_time, u.remark, + u.properties, d.dept_id, d.parent_id, d.ancestors, @@ -85,7 +87,7 @@