mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 17:58:17 +08:00
新增和修改安居接口以及优化流程接口
This commit is contained in:
parent
1dc1eca1fc
commit
4ca7337770
47
pom.xml
47
pom.xml
@ -37,6 +37,7 @@
|
||||
<xxl-job.version>2.3.1</xxl-job.version>
|
||||
<lombok.version>1.18.26</lombok.version>
|
||||
<bouncycastle.version>1.72</bouncycastle.version>
|
||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||
|
||||
<!-- 临时修复 snakeyaml 漏洞 -->
|
||||
<snakeyaml.version>1.33</snakeyaml.version>
|
||||
@ -117,6 +118,12 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
<!-- 文件上传工具类 -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>${commons.fileupload.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
@ -341,6 +348,44 @@
|
||||
<version>${ruoyi-vue-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 文件上传模块-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-file</artifactId>
|
||||
<version>${ruoyi-vue-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 插件:整合SSO -->
|
||||
<!--<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-sso</artifactId>
|
||||
<version>${satoken.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-dao-redis-jackson</artifactId>
|
||||
<version>${satoken.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
<version>2.11.1</version>
|
||||
</dependency>-->
|
||||
|
||||
<!-- 视图引擎(在前后端不分离模式下提供视图支持) -->
|
||||
<!--<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<!-- Http请求工具(在模式三的单点注销功能下用到,如不需要可以注释掉) -->
|
||||
<!--<dependency>
|
||||
<groupId>com.dtflys.forest</groupId>
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.26</version>
|
||||
</dependency>-->
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@ -356,6 +401,8 @@
|
||||
<module>ruoyi-oss</module>
|
||||
<module>ruoyi-sms</module>
|
||||
<module>ruoyi-work</module>
|
||||
<module>ruoyi-file</module>
|
||||
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
||||
@ -89,6 +89,11 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-file</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- skywalking 整合 logback -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.skywalking</groupId>-->
|
||||
|
||||
@ -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<Map> upload(MultipartFile file)
|
||||
{
|
||||
try{
|
||||
// 上传并返回访问地址
|
||||
String url = sysFileService.uploadFile(file);
|
||||
Map<String, String> 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.ruoyi.system.domain.BuyHouses;
|
||||
import com.ruoyi.system.domain.bo.HousesReviewBo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -18,7 +19,6 @@ 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.BuyHousesVo;
|
||||
@ -35,7 +35,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/declare")
|
||||
@RequestMapping("/system/house")
|
||||
public class BuyHousesController extends BaseController {
|
||||
|
||||
private final IBuyHousesService iBuyHousesService;
|
||||
@ -75,24 +75,24 @@ public class BuyHousesController extends BaseController {
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@SaCheckPermission("system:houses:add")
|
||||
/*@SaCheckPermission("system:houses:add")
|
||||
@Log(title = "【购房申请添加】", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BuyHousesBo bo) {
|
||||
return toAjax(iBuyHousesService.insertByBo(bo));
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@SaCheckPermission("system:houses:edit")
|
||||
/* @SaCheckPermission("system:houses:edit")
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BuyHousesBo bo) {
|
||||
return toAjax(iBuyHousesService.updateByBo(bo));
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
@ -115,4 +115,7 @@ public class BuyHousesController extends BaseController {
|
||||
public R<?> getMaterialInfo(@RequestBody BuyHousesBo bo){
|
||||
return iBuyHousesService.getMaterialInfo(bo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -148,6 +148,8 @@ public class HousesReviewController extends BaseController {
|
||||
//查询出导入数据中的身份证有那些是属于区级人才的
|
||||
List<String> collect1 = buyHousesMapper.selectList(queryWrapper).stream().map(BuyHouses::getCardId).collect(Collectors.toList());
|
||||
for (HousesReview housesReview : list) {
|
||||
housesReview.setProcessKey("house_review");
|
||||
housesReview.setProcessStatus("submit");
|
||||
if ( collect1.size() > 0 && collect1.contains(housesReview.getCard()) ) {
|
||||
housesReview.setSourceBy("1");
|
||||
} else {
|
||||
|
||||
@ -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;
|
||||
@ -8,22 +10,29 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
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.enums.LimitType;
|
||||
import com.ruoyi.common.helper.LoginHelper;
|
||||
import com.ruoyi.common.utils.JsonUtils;
|
||||
import com.ruoyi.common.utils.StrUtils;
|
||||
import com.ruoyi.common.utils.redis.RedisUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.sms.core.SmsTemplate;
|
||||
import com.ruoyi.sms.entity.SmsResult;
|
||||
import com.ruoyi.system.domain.BuyHouses;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
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;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
@ -47,7 +56,9 @@ public class SysLoginController {
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/login")
|
||||
public R<Map<String, Object>> login(@Validated @RequestBody LoginBody loginBody) {
|
||||
public R<Map<String, Object>> login(
|
||||
// @Validated({LoginBody.passwordLogin.class})
|
||||
@RequestBody LoginBody loginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
@ -56,6 +67,8 @@ public class SysLoginController {
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 短信登录(示例)
|
||||
*
|
||||
@ -64,7 +77,9 @@ public class SysLoginController {
|
||||
*/
|
||||
@SaIgnore
|
||||
@PostMapping("/smsLogin")
|
||||
public R<Map<String, Object>> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) {
|
||||
public R<Map<String, Object>> smsLogin(
|
||||
@Validated({LoginBody.smgLogin.class})
|
||||
@RequestBody SmsLoginBody smsLoginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
|
||||
@ -125,4 +140,130 @@ public class SysLoginController {
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
|
||||
return R.ok(menuService.buildMenus(menus));
|
||||
}
|
||||
|
||||
//----------------------------------------------------客户端-------------------------------------------------------------
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@SaIgnore
|
||||
@RateLimiter(count = 2, time = 10)
|
||||
@PostMapping("/userLogin")
|
||||
public R<Map<String, Object>> userLogin(
|
||||
@Validated({LoginBody.passwordLogin.class})
|
||||
@RequestBody LoginBody loginBody) {
|
||||
Map<String, Object> ajax = new HashMap<>();
|
||||
// 生成令牌
|
||||
String token = loginService.userLogin(loginBody.getUsername(), loginBody.getPassword());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return R.ok(ajax);
|
||||
}
|
||||
|
||||
@SaIgnore
|
||||
// @RateLimiter(count = 2, time = 10)
|
||||
@PostMapping("/userSmsLogin")
|
||||
public R<Map<String, Object>> userSmsLogin(@Validated(LoginBody.smgLogin.class) @RequestBody LoginBody loginBody) {
|
||||
Map<String, Object> 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户发送验证码
|
||||
* @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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 短信登录发送验证码
|
||||
* @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);
|
||||
}
|
||||
|
||||
public R<?> sendMsg(String phones,String key ){
|
||||
//1.获取redis中是否存在该key
|
||||
Boolean aBoolean = RedisUtils.hasKey(key + phones);
|
||||
if (aBoolean) {
|
||||
return R.fail("当前账号验证码已发送,2分钟内有效,请勿再次点击");
|
||||
} else {
|
||||
SmsTemplate smsTemplate = SpringUtils.getBean(SmsTemplate.class);
|
||||
Map<String, String> map = new HashMap<>(1);
|
||||
String code = StrUtils.getRandomString(6);
|
||||
map.put("code",code);
|
||||
SmsResult send = smsTemplate.send(phones, "SMS_174992554", map);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.web.controller.user;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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.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 oracle.jdbc.proxy.annotation.GetProxy;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 客户端购房申请相关接口
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/user/house")
|
||||
public class HouseController extends BaseController {
|
||||
private final IBuyHousesService iBuyHousesService;
|
||||
|
||||
/**
|
||||
* 购房申请添加
|
||||
*/
|
||||
@Log(title = "【购房申请添加】", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BuyHousesBo bo) {
|
||||
return toAjax(iBuyHousesService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 购房申请修改
|
||||
*/
|
||||
@Log(title = "【购房申请修改】", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下载人才认定申请表
|
||||
*/
|
||||
@PostMapping("/download")
|
||||
public R downloadWord(@Validated(DownloadGroup.class) @RequestBody BuyHousesBo buyHousesBo){
|
||||
return iBuyHousesService.downloadWord(buyHousesBo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程进度列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/declareList")
|
||||
public R getDeclareList(){
|
||||
return R.ok(iBuyHousesService.getDeclareList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过调用高新人才判断该身份证是否具备人才资格
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.ruoyi.web.controller.user;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.work.domain.ActProcess;
|
||||
import com.ruoyi.work.domain.HisProcess;
|
||||
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<UserVo> 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<UserVo> list = iUserService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "【请填写功能名称】", UserVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<UserVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(iUserService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody UserBo bo) {
|
||||
return toAjax(iUserService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody UserBo bo) {
|
||||
return toAjax(iUserService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iUserService.deleteWithValidByIds(Arrays.asList(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断这个人是否具备申请购房资格
|
||||
*/
|
||||
@GetMapping("cardId/{cardId}")
|
||||
public R<?>getUserCandidateInfo(@PathVariable(value = "cardId") String cardId) throws Exception {
|
||||
return iUserService.getUserCandidateInfo(cardId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前业务进行步骤
|
||||
*/
|
||||
@Log(title = "获取当前业务运行到那一步",businessType = BusinessType.OTHER)
|
||||
@PostMapping("/processPlan")
|
||||
public R<?> processPlan(@RequestBody ActProcess actProcess){
|
||||
List<TProcess> tProcesses = processMapper.selectList(new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, actProcess.getProcessKey()));
|
||||
if (tProcesses.size()==0){
|
||||
throw new ServiceException("当前流程不存在");
|
||||
}
|
||||
LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>();
|
||||
Map<String, Object> 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"));
|
||||
// hashMap.put("cardId",map.get("cardId"));
|
||||
List<ProcessVoResultDto> processPlan= WorkComplyUtils.getProcessPlan(processVo);
|
||||
hashMap.put("list",processPlan);
|
||||
return R.ok(hashMap);
|
||||
}
|
||||
|
||||
}
|
||||
@ -160,12 +160,26 @@ mail:
|
||||
|
||||
--- # sms 短信
|
||||
sms:
|
||||
enabled: false
|
||||
enabled: true
|
||||
# 阿里云 dysmsapi.aliyuncs.com
|
||||
# 腾讯云 sms.tencentcloudapi.com
|
||||
endpoint: "dysmsapi.aliyuncs.com"
|
||||
accessKeyId: xxxxxxx
|
||||
accessKeySecret: xxxxxx
|
||||
signName: 测试
|
||||
accessKeyId: LTAI564a5PHBmDPI
|
||||
accessKeySecret: 0ba8OURvLI9e174t8nIGnsKMQtraov
|
||||
signName: 成都高新人才之家
|
||||
# 腾讯专用
|
||||
sdkAppId:
|
||||
|
||||
# 本地文件存储
|
||||
file:
|
||||
domain: http://192.168.0.54:8080
|
||||
path: D:\\gaoxin\\images
|
||||
prefix: /images
|
||||
size: 10
|
||||
template: D:\\gaoxin\\file\\
|
||||
doc: D:\\gaoxin\\doc\\
|
||||
mapping: /doc
|
||||
# domain: 192.168.0.54:8080
|
||||
# path: D:\\gaoxin\\images
|
||||
# prefix: /images
|
||||
# size: 10
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.not.blank=验证码不可为空
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=对不起, 您的账号:{0} 不存在.
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
@ -43,3 +44,5 @@ sms.code.not.blank=短信验证码不能为空
|
||||
sms.code.retry.limit.count=短信验证码输入错误{0}次
|
||||
sms.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位)
|
||||
|
||||
@ -43,3 +43,7 @@ sms.code.not.blank=Sms code cannot be blank
|
||||
sms.code.retry.limit.count=Sms code input error {0} times
|
||||
sms.code.retry.limit.exceed=Sms 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
|
||||
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)
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
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}次
|
||||
@ -43,3 +44,5 @@ sms.code.not.blank=短信验证码不能为空
|
||||
sms.code.retry.limit.count=短信验证码输入错误{0}次
|
||||
sms.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位)
|
||||
|
||||
@ -3,13 +3,19 @@ package com.ruoyi.test;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.helper.DataBaseHelper;
|
||||
import com.ruoyi.common.utils.AesUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.domain.*;
|
||||
import com.ruoyi.system.domain.vo.HousesReviewVo;
|
||||
@ -157,12 +163,14 @@ public class DemoUnitTest {
|
||||
@Test
|
||||
public void test002(){
|
||||
ProcessVo processVo = new ProcessVo();
|
||||
processVo.setProcessKey("apply_house");
|
||||
processVo.setProcessKey("apply_jn");
|
||||
processVo.setStep("1");
|
||||
BuyHouses buyHouses = buyHousesMapper.selectById("1011");
|
||||
BuyHouses buyHouses = buyHousesMapper.selectById("10");
|
||||
buyHouses.setUpdateTime(DateUtils.getNowDate());
|
||||
buyHouses.setCompanyId("100");
|
||||
Map<String, Object> map = BeanUtil.beanToMap(buyHouses);
|
||||
processVo.setParams(map);
|
||||
processVo.setBusinessId("1011");
|
||||
processVo.setBusinessId("10");
|
||||
processVo.setStartUser(buyHouses.getUserName());
|
||||
WorkComplyUtils.comply(processVo);
|
||||
}
|
||||
@ -171,7 +179,7 @@ public class DemoUnitTest {
|
||||
public void test003(){
|
||||
HisProcess hisProcess = new HisProcess();
|
||||
hisProcess.setStatus("2");
|
||||
BuyHouses buyHouses = buyHousesMapper.selectById("2");
|
||||
BuyHouses buyHouses = buyHousesMapper.selectById("10");
|
||||
Map<String, Object> map = BeanUtil.beanToMap(buyHouses);
|
||||
hisProcess.setBusinessId(buyHouses.getId().toString());
|
||||
hisProcess.setParams(map);
|
||||
@ -267,7 +275,7 @@ public class DemoUnitTest {
|
||||
|
||||
@Test
|
||||
public void test0008(){
|
||||
String host= "https://xyxtest.easyfees.cn/fcc";
|
||||
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";
|
||||
@ -343,10 +351,30 @@ public class DemoUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesst00000(){
|
||||
BuyHouses buyHouses = buyHousesMapper.selectById(1011L);
|
||||
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();*/
|
||||
String s = AesUtil.encryptBASE64("18716148446");
|
||||
System.out.println("s = " + s);
|
||||
LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>();
|
||||
JSONObject json1 = JSONUtil.createObj()
|
||||
.set("loginName", AesUtil.encryptBASE64("15881326343"))
|
||||
.set("password",AesUtil.encryptBASE64("Feng19891217"));
|
||||
// hashMap.put("loginName", AesUtil.encryptBASE64("18716148446"));
|
||||
// hashMap.put("password",AesUtil.encryptBASE64("1234Qwer"));
|
||||
|
||||
String http = HttpRequest.post("https://gx.chengdutalent.cn:8010/user/login")
|
||||
.header("Content-Type","application/json;charset=UTF-8")
|
||||
.body(String.valueOf(json1))
|
||||
.execute().body();
|
||||
String backURL = String.valueOf(JSONUtil.parseObj(http).get("backURL"));
|
||||
System.out.println("http = " + http);
|
||||
/* BuyHouses buyHouses = buyHousesMapper.selectById(1011L);
|
||||
Map<String, Object> map = BeanUtil.beanToMap(buyHouses);
|
||||
List<MaterialModuleVo> materialInfo = materialModuleService.getMaterialInfo(map);
|
||||
System.out.println("materialInfo = " + materialInfo);
|
||||
System.out.println("materialInfo = " + materialInfo);*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +159,48 @@
|
||||
<artifactId>bcprov-jdk15to18</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 导work-->
|
||||
<dependency>
|
||||
<groupId>com.deepoove</groupId>
|
||||
<artifactId>poi-tl</artifactId>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-excelant</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>4.1.2</version>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -46,4 +46,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:";
|
||||
}
|
||||
|
||||
@ -91,6 +91,15 @@ public interface Constants {
|
||||
* 数据不存在
|
||||
*/
|
||||
String NONENTITY = "nonentity";
|
||||
/**
|
||||
* 待提交
|
||||
*/
|
||||
String SUBMIT = "submit";
|
||||
|
||||
/**
|
||||
* 公式中
|
||||
*/
|
||||
String PUBLICS = "publics";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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})
|
||||
@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,28 @@ public class LoginBody {
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
|
||||
/**
|
||||
* 账号登录验证
|
||||
*/
|
||||
public interface passwordLogin {}
|
||||
|
||||
/**
|
||||
* 短信登录验证
|
||||
*/
|
||||
public interface smgLogin {}
|
||||
|
||||
/**
|
||||
* 忘记密码验证
|
||||
*/
|
||||
public interface forgetPasswordLogin {}
|
||||
|
||||
/**
|
||||
* 注册验证
|
||||
*/
|
||||
public interface registerUser {}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -90,6 +90,10 @@ public class LoginUser implements Serializable {
|
||||
*/
|
||||
private String username;
|
||||
|
||||
private String companyId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
package com.ruoyi.common.core.validate;
|
||||
|
||||
public interface DownloadGroup {
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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).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) {
|
||||
ConfigService sysConfigService = SpringUtils.getBean(ConfigService.class);
|
||||
String configValue = sysConfigService.getConfigValue("sys:preventing:hotlinking");
|
||||
List<String> 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 false;
|
||||
}
|
||||
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<String, String> 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失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
123
ruoyi-common/src/main/java/com/ruoyi/common/utils/AesUtil.java
Normal file
123
ruoyi-common/src/main/java/com/ruoyi/common/utils/AesUtil.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.util.StringUtils;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.BASE64Encoder;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class AesUtil {
|
||||
//密钥 (需要前端和后端保持一致)
|
||||
private static final String KEY = "FFff123456.!-12s";
|
||||
private static final String IV = "FFff123456.!-12s";
|
||||
|
||||
/**
|
||||
* 加密方法
|
||||
* @param data 要加密的数据
|
||||
* @param key 加密key
|
||||
* @param iv 加密iv
|
||||
* @return 加密的结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String data, String key, String iv) throws Exception {
|
||||
try {
|
||||
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
int blockSize = cipher.getBlockSize();
|
||||
byte[] dataBytes = data.getBytes();
|
||||
int plaintextLength = dataBytes.length;
|
||||
if (plaintextLength % blockSize != 0) {
|
||||
plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
|
||||
}
|
||||
byte[] plaintext = new byte[plaintextLength];
|
||||
System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
|
||||
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
|
||||
IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
|
||||
byte[] encrypted = cipher.doFinal(plaintext);
|
||||
return new Base64().encodeToString(encrypted);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密方法
|
||||
* @param data 要解密的数据
|
||||
* @param key 解密key
|
||||
* @param iv 解密iv
|
||||
* @return 解密的结果
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String desEncrypt(String data, String key, String iv) throws Exception {
|
||||
try {
|
||||
byte[] encrypted1 = new Base64().decode(data);
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
|
||||
SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
|
||||
IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
|
||||
cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
|
||||
byte[] original = cipher.doFinal(encrypted1);
|
||||
String originalString = new String(original);
|
||||
return originalString;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认的key和iv加密
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String encrypt(String data) throws Exception {
|
||||
return encrypt(data, KEY, IV);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认的key和iv解密
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String desEncrypt(String data) throws Exception {
|
||||
return desEncrypt(data, KEY, IV);
|
||||
}
|
||||
|
||||
/**
|
||||
* BASE64解密
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decryptBASE64(String key) throws Exception {
|
||||
if (!StringUtils.isEmpty(key)){
|
||||
return new String(new BASE64Decoder().decodeBuffer(key), StandardCharsets.UTF_8);
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* BASE64加密
|
||||
*/
|
||||
public static String encryptBASE64(String key) throws Exception {
|
||||
if (!StringUtils.isEmpty(key)) {
|
||||
return (new BASE64Encoder()).encodeBuffer(key.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String s = encryptBASE64("http://192.168.0.200:8010/upload/GXTalents/images/843329b85e974ef5bae06d9c01bc909e.jpg");
|
||||
System.out.println(s);
|
||||
String s1 = decryptBASE64("aHR0cHM6Ly9neC5jaGVuZ2R1dGFsZW50LmNuOjgwMTAvdXBsb2FkL0dYVGFsZW50cy9pbWFnZXMvMTM2ODBlMmI0ZTY4NDI1N2ExM2UyNjI5MGQ1NDljODMucG5n");
|
||||
System.out.println(s1);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
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<Long> splitStr2LongArr(String str) {
|
||||
String[] strings = splitStr2StrArr(str,",");
|
||||
if (strings == null) return null;
|
||||
|
||||
List<Long> result = new ArrayList<>();
|
||||
for (String string : strings) {
|
||||
result.add(Long.parseLong(string));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 把逗号分隔字符串转换List的Long
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static List<Long> splitStr2LongArr(String str,String split) {
|
||||
String[] strings = splitStr2StrArr(str,split);
|
||||
if (strings == null) return null;
|
||||
|
||||
List<Long> 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";
|
||||
Random random = new Random();
|
||||
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("<br>");
|
||||
}
|
||||
return sBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
/**
|
||||
* 获取文件类型
|
||||
* <p>
|
||||
* 例如: ruoyi.txt, 返回: txt
|
||||
*
|
||||
* @param file 文件名
|
||||
* @return 后缀(不含".")
|
||||
*/
|
||||
public static String getFileType(File file)
|
||||
{
|
||||
if (null == file)
|
||||
{
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return getFileType(file.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件类型
|
||||
* <p>
|
||||
* 例如: 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;
|
||||
}
|
||||
}
|
||||
@ -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 "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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<String,Object> 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<String,Object> 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<String,Object> 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;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -29,10 +29,10 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 短信 用哪个导入哪个依赖 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.aliyun</groupId>-->
|
||||
<!-- <artifactId>dysmsapi20170525</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dysmsapi20170525</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.tencentcloudapi</groupId>-->
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@ -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(),
|
||||
FilenameUtils.getBaseName(file.getOriginalFilename()), 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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
@ -112,7 +113,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(":");
|
||||
}
|
||||
|
||||
@ -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,25 @@ 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
|
||||
/* @Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
@ -49,4 +64,28 @@ 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("*")
|
||||
// 设置允许的方法
|
||||
.allowedMethods("GET");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-work</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
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.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 buy_houses
|
||||
@ -15,7 +18,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@TableName("buy_houses")
|
||||
public class BuyHouses {
|
||||
public class BuyHouses extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ -162,4 +165,11 @@ public class BuyHouses {
|
||||
|
||||
private String version;
|
||||
|
||||
private String companyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyHousesMember> buyHousesMemberList;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -127,4 +127,9 @@ public class HousesReview extends BaseEntity {
|
||||
*/
|
||||
private String companyAddressArea;
|
||||
|
||||
/**
|
||||
* d类字段扩展
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
104
ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java
Normal file
104
ruoyi-system/src/main/java/com/ruoyi/system/domain/User.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 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")
|
||||
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;
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ 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;
|
||||
@ -39,7 +40,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 身份证/护照
|
||||
*/
|
||||
@NotBlank(message = "身份证/护照不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "身份证/护照不能为空", groups = { AddGroup.class, EditGroup.class ,DownloadGroup.class})
|
||||
private String cardId;
|
||||
|
||||
/**
|
||||
@ -51,13 +52,13 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 单位地址
|
||||
*/
|
||||
@NotBlank(message = "单位地址不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "单位地址不能为空", groups = { AddGroup.class, EditGroup.class, DownloadGroup.class })
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
* 工作单位
|
||||
*/
|
||||
@NotBlank(message = "工作单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "工作单位不能为空", groups = { AddGroup.class, EditGroup.class , DownloadGroup.class})
|
||||
private String companyName;
|
||||
|
||||
/**
|
||||
@ -81,7 +82,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 学历
|
||||
*/
|
||||
@NotBlank(message = "学历不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "学历不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String education;
|
||||
|
||||
/**
|
||||
@ -141,7 +142,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message = "手机号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "手机号不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
@ -159,7 +160,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@NotBlank(message = "性别不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "性别不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
@ -171,7 +172,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 统一社会信用代码
|
||||
*/
|
||||
@NotBlank(message = "统一社会信用代码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "统一社会信用代码不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String socialCode;
|
||||
|
||||
/**
|
||||
@ -189,7 +190,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 类型 A B C D
|
||||
*/
|
||||
@NotBlank(message = "类型 A B C D不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "类型 A B C D不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String type;
|
||||
|
||||
/**
|
||||
@ -201,7 +202,7 @@ public class BuyHousesBo extends BaseEntity {
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotBlank(message = "姓名不能为空", groups = { AddGroup.class, EditGroup.class,DownloadGroup.class })
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
@ -211,24 +212,34 @@ public class BuyHousesBo extends BaseEntity {
|
||||
private Date affTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*人才影像卡
|
||||
*/
|
||||
@NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String pictureInformationUrl;
|
||||
|
||||
/**
|
||||
*
|
||||
*工作地址
|
||||
*/
|
||||
@NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String workAddress;
|
||||
|
||||
/**
|
||||
* 流程key
|
||||
*/
|
||||
private String processKey;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
private String processStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyHousesMember> buyHousesMemberList;
|
||||
|
||||
|
||||
private String version;
|
||||
|
||||
private String companyId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -178,6 +178,11 @@ public class HousesReviewBo extends BaseEntity {
|
||||
|
||||
private List<MaterialProof> materialProofList;
|
||||
|
||||
/**
|
||||
* d类字段扩展
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public class MaterialModuleBo extends BaseEntity {
|
||||
/**
|
||||
* 审核部门
|
||||
*/
|
||||
@NotBlank(message = "审核部门不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "审核部门不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String auditDept;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,136 @@
|
||||
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 java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
@ -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;
|
||||
|
||||
}
|
||||
@ -223,6 +223,8 @@ public class BuyHousesVo {
|
||||
|
||||
private String processKey;
|
||||
|
||||
private String processStatus;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyHousesMember> buyHousesMemberList;
|
||||
|
||||
@ -231,5 +233,9 @@ public class BuyHousesVo {
|
||||
@TableField(exist = false)
|
||||
private List<MaterialProof> materialProofList;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String companyId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -2,10 +2,12 @@ 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.core.domain.BaseEntity;
|
||||
import com.ruoyi.system.domain.BuyHousesReviewMember;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -18,14 +20,14 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class HousesReviewVo {
|
||||
public class HousesReviewVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
// @ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@ -152,6 +154,7 @@ public class HousesReviewVo {
|
||||
* 企业所在地
|
||||
*/
|
||||
// @ExcelProperty(value = "企业所在地")
|
||||
|
||||
private String companyAddress;
|
||||
|
||||
/**
|
||||
@ -170,10 +173,16 @@ public class HousesReviewVo {
|
||||
|
||||
private String companyAddressArea;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<BuyHousesReviewMember> buyHousesMemberList;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* d类字段扩展
|
||||
*/
|
||||
private String typeExtend;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,138 @@
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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<UserMapper, User, UserVo> {
|
||||
|
||||
}
|
||||
@ -3,7 +3,9 @@ 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.DeclareListDTO;
|
||||
import com.ruoyi.system.domain.vo.BuyHousesVo;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -48,4 +50,14 @@ public interface IBuyHousesService {
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
R<?> getMaterialInfo(BuyHousesBo bo);
|
||||
|
||||
BuyHouses getBuyHousesByCardId(String cardId);
|
||||
|
||||
R downloadWord(BuyHousesBo buyHouses);
|
||||
|
||||
List<DeclareListDTO> getDeclareList();
|
||||
|
||||
R<?> getInfo(BuyHouses buyHouses);
|
||||
|
||||
R getGaoXinCandidateInfoByCardId(String cardId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
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<UserVo> queryPageList(UserBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
List<UserVo> queryList(UserBo bo);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
Boolean insertByBo(UserBo bo);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
Boolean updateByBo(UserBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除【请填写功能名称】信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
*/
|
||||
int resetUserPwd(String userName, String password);
|
||||
|
||||
R<?> getUserCandidateInfo(String cardId) throws Exception;
|
||||
}
|
||||
@ -4,10 +4,15 @@ 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;
|
||||
@ -16,6 +21,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,7 +32,11 @@ 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;
|
||||
@ -34,7 +44,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.Duration;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
@ -47,10 +59,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;
|
||||
|
||||
@ -73,10 +89,10 @@ public class SysLoginService {
|
||||
if (captchaEnabled) {
|
||||
validateCaptcha(username, code, uuid, request);
|
||||
}
|
||||
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);
|
||||
|
||||
@ -88,10 +104,9 @@ public class SysLoginService {
|
||||
public String smsLogin(String phonenumber, String smsCode) {
|
||||
// 通过手机号查找用户
|
||||
SysUser user = loadUserByPhonenumber(phonenumber);
|
||||
|
||||
checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode));
|
||||
checkLogin(LoginType.SMS, user.getUserName(), () -> !validateSmsCode(phonenumber, smsCode,CacheConstants.CAPTCHA_CODE_KEY));
|
||||
// 此处可根据登录用户的数据不同 自行创建 loginUser
|
||||
LoginUser loginUser = buildLoginUser(user);
|
||||
LoginUser loginUser = buildLoginSysUser(user);
|
||||
// 生成token
|
||||
LoginHelper.loginByDevice(loginUser, DeviceType.APP);
|
||||
|
||||
@ -100,7 +115,11 @@ public class SysLoginService {
|
||||
return StpUtil.getTokenValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序登录
|
||||
* @param xcxCode
|
||||
* @return
|
||||
*/
|
||||
public String xcxLogin(String xcxCode) {
|
||||
// xcxCode 为 小程序调用 wx.login 授权后获取
|
||||
// todo 以下自行实现
|
||||
@ -154,8 +173,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();
|
||||
@ -184,8 +203,8 @@ public class SysLoginService {
|
||||
}
|
||||
}
|
||||
|
||||
private SysUser loadUserByUsername(String username) {
|
||||
SysUser user = userMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
private SysUser loadSysUserByUsername(String username) {
|
||||
SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserName, SysUser::getStatus)
|
||||
.eq(SysUser::getUserName, username));
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
@ -195,11 +214,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<SysUser>()
|
||||
SysUser user = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getPhonenumber, SysUser::getStatus)
|
||||
.eq(SysUser::getPhonenumber, phonenumber));
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
@ -209,7 +228,7 @@ public class SysLoginService {
|
||||
log.info("登录用户:{} 已被停用.", phonenumber);
|
||||
throw new UserException("user.blocked", phonenumber);
|
||||
}
|
||||
return userMapper.selectUserByPhonenumber(phonenumber);
|
||||
return sysUserMapper.selectUserByPhonenumber(phonenumber);
|
||||
}
|
||||
|
||||
private SysUser loadUserByOpenid(String openid) {
|
||||
@ -229,7 +248,7 @@ 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());
|
||||
@ -243,6 +262,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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
@ -254,7 +285,7 @@ public class SysLoginService {
|
||||
sysUser.setLoginIp(ServletUtils.getClientIP());
|
||||
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||
sysUser.setUpdateBy(username);
|
||||
userMapper.updateById(sysUser);
|
||||
sysUserMapper.updateById(sysUser);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,8 +318,133 @@ public class SysLoginService {
|
||||
throw new UserException(loginType.getRetryLimitCount(), errorNumber);
|
||||
}
|
||||
}
|
||||
|
||||
// 登录成功 清空错误次数
|
||||
RedisUtils.deleteObject(errorKey);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
private User loadUserByUsername(String username) {
|
||||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
|
||||
.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 String 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"));
|
||||
return StpUtil.getTokenValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
* @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<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
|
||||
.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();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +1,41 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.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.BeanCopyUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExportWordUtil;
|
||||
import com.ruoyi.system.domain.BuyHouses;
|
||||
import com.ruoyi.system.domain.BuyHousesMember;
|
||||
import com.ruoyi.system.domain.MaterialProof;
|
||||
import com.ruoyi.system.domain.bo.BuyHousesBo;
|
||||
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.BuyHousesMapper;
|
||||
import com.ruoyi.system.mapper.BuyHousesMemberMapper;
|
||||
import com.ruoyi.system.mapper.MaterialProofMapper;
|
||||
import com.ruoyi.system.service.IBuyHousesService;
|
||||
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.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
@ -33,8 +45,23 @@ import java.util.Map;
|
||||
*/
|
||||
@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;
|
||||
|
||||
private final String URL = "http://192.168.0.54:8010//candidates/getCardId";
|
||||
|
||||
private final BuyHousesMapper baseMapper;
|
||||
|
||||
private final BuyHousesMemberMapper buyHousesMemberMapper;
|
||||
@ -123,11 +150,33 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BuyHousesBo bo) {
|
||||
//验证这个身份证是否提交过
|
||||
List<BuyHouses> buyHouses = baseMapper.selectList(new LambdaQueryWrapper<>(BuyHouses.class)
|
||||
.eq(BuyHouses::getCardId, bo.getCardId()));
|
||||
if (buyHouses.size()>0){
|
||||
throw new ServiceException("当前人才已提交申请");
|
||||
}
|
||||
bo.setProcessStatus(Constants.WAIT);
|
||||
BuyHouses add = BeanUtil.toBean(bo, BuyHouses.class);
|
||||
validEntityBeforeSave(add);
|
||||
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<String, Object> map = BeanUtil.beanToMap(bo);
|
||||
processVo.setParams(map);
|
||||
processVo.setBusinessId(bo.getId().toString());
|
||||
processVo.setStartUser(bo.getUserName());
|
||||
WorkComplyUtils.comply(processVo);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@ -139,7 +188,20 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
public Boolean updateByBo(BuyHousesBo bo) {
|
||||
BuyHouses update = BeanUtil.toBean(bo, BuyHouses.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
update.setProcessStatus(Constants.WAIT);
|
||||
Boolean flag = baseMapper.updateById(update) > 0;
|
||||
if (flag){
|
||||
//将数据添加到流程中
|
||||
ProcessVo processVo = new ProcessVo();
|
||||
processVo.setProcessKey("apply_house");
|
||||
processVo.setStep("1");
|
||||
Map<String, Object> map = BeanUtil.beanToMap(bo);
|
||||
processVo.setParams(map);
|
||||
processVo.setBusinessId(bo.getId().toString());
|
||||
processVo.setStartUser(bo.getUserName());
|
||||
WorkComplyUtils.comply(processVo);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,6 +209,21 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
*/
|
||||
private void validEntityBeforeSave(BuyHouses entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
//验证当前状态是否可以修改
|
||||
//判断数据库中是否存在该人才通过身份证去验证
|
||||
BuyHouses buyHouses = baseMapper.selectOne(new LambdaQueryWrapper<>(BuyHouses.class)
|
||||
.eq(BuyHouses::getCardId, entity.getCardId()));
|
||||
if (!Constants.SUBMIT.equals(buyHouses.getProcessStatus()) && !Constants.FAILD.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())));
|
||||
buyHousesMemberMapper.insertBatch(entity.getBuyHousesMemberList());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,4 +243,171 @@ public class BuyHousesServiceImpl implements IBuyHousesService {
|
||||
List<MaterialModuleVo> materialInfo = materialModuleService.getMaterialInfo(map);
|
||||
return R.ok(materialInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuyHouses getBuyHousesByCardId(String cardId) {
|
||||
//验证当前人是否哦申请过购房信息
|
||||
List<BuyHouses> buyHouses = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<BuyHouses>()
|
||||
.eq(BuyHouses::getCardId, cardId));
|
||||
|
||||
if (buyHouses.size()>0){
|
||||
BuyHouses buyHouses1 = buyHouses.get(0);
|
||||
List<BuyHousesMember> buyHousesMembers = buyHousesMemberMapper.selectList(new LambdaQueryWrapper<>(BuyHousesMember.class)
|
||||
.eq(BuyHousesMember::getBuyHousesId, buyHouses1.getId()));
|
||||
buyHouses1.setBuyHousesMemberList(buyHousesMembers);
|
||||
return buyHouses1;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 先保存再执行下载
|
||||
* @param buyHousesBo
|
||||
*/
|
||||
@Override
|
||||
public R downloadWord(BuyHousesBo buyHousesBo) {
|
||||
LinkedHashMap<String, Object> 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());
|
||||
BuyHouses toBean = BeanUtil.toBean(buyHousesBo, BuyHouses.class);
|
||||
baseMapper.updateById(toBean);
|
||||
map.put("buyHouses",toBean);
|
||||
}
|
||||
}
|
||||
LinkedHashMap<String, Object> 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, filePath, fileName, hashMap);
|
||||
System.out.println("word = " + word);
|
||||
String file= download + prefix + "/" + fileName + ".docx";
|
||||
map.put("file",file);
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取进度列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<DeclareListDTO> getDeclareList() {
|
||||
ArrayList<DeclareListDTO> list = new ArrayList<>();
|
||||
//查询购房信息
|
||||
Long userId = LoginHelper.getUserId();
|
||||
List<BuyHouses> 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) {
|
||||
//先判断本地数据库是否有值
|
||||
BuyHousesVo buyHousesVo = baseMapper.selectVoOne(new LambdaQueryWrapper<>(BuyHouses.class).eq(BuyHouses::getCardId,buyHouses.getCardId()));
|
||||
if (ObjectUtil.isNotNull(buyHousesVo)){
|
||||
LambdaQueryWrapper<MaterialProof> wrapper = new LambdaQueryWrapper<MaterialProof>()
|
||||
.eq(MaterialProof::getHouseId, buyHousesVo.getId())
|
||||
.eq(MaterialProof::getProcessKey, buyHousesVo.getProcessKey());
|
||||
List<MaterialProof> materialProofs = materialProofMapper.selectList(wrapper);
|
||||
buyHousesVo.setMaterialProofList(materialProofs);
|
||||
LambdaQueryWrapper<BuyHousesMember> queryWrapper = new LambdaQueryWrapper<BuyHousesMember>()
|
||||
.eq(BuyHousesMember::getBuyHousesId, buyHousesVo.getId());
|
||||
List<BuyHousesMember> buyHousesMembers = buyHousesMemberMapper.selectList(queryWrapper);
|
||||
buyHousesVo.setBuyHousesMemberList(buyHousesMembers);
|
||||
return R.ok(buyHousesVo);
|
||||
}
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("cardId", buyHouses);
|
||||
String json = HttpUtil.get(URL, paramMap);
|
||||
JSONObject entrie = JSONUtil.parseObj(json);
|
||||
String data = String.valueOf(entrie.get("date"));
|
||||
if (ObjectUtil.isNull(data)){
|
||||
return R.fail("获取失败");
|
||||
}
|
||||
JSONObject entries = JSONUtil.parseObj(data);
|
||||
BuyHouses buyHousesDto = new BuyHouses();
|
||||
buyHousesDto.setCardId(String.valueOf(entries.get("cardId")));
|
||||
buyHousesDto.setNationality(String.valueOf(entries.get("nationality")));
|
||||
buyHousesDto.setUserName(String.valueOf(entries.get("name")));
|
||||
buyHousesDto.setPhone(String.valueOf(entries.get("phone")));
|
||||
buyHousesDto.setCompanyName(String.valueOf(entries.get("companyName")));
|
||||
buyHousesDto.setDistrict(String.valueOf(entries.get("district")));
|
||||
buyHousesDto.setSex(String.valueOf(entries.get("sex")));
|
||||
buyHousesDto.setProcessStatus(Constants.SUBMIT);
|
||||
buyHousesDto.setType(String.valueOf(entries.get("type")));
|
||||
buyHousesDto.setProcessKey("apply_house");
|
||||
return R.ok(buyHousesDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证是否具有人才资格
|
||||
* @param cardId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public R getGaoXinCandidateInfoByCardId(String cardId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("cardId", cardId);
|
||||
String json = HttpUtil.get(URL, paramMap);
|
||||
JSONObject entries = JSONUtil.parseObj(json);
|
||||
String code = String.valueOf(entries.get("code"));
|
||||
LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>();
|
||||
if (ObjectUtil.isNull(code)){
|
||||
return R.fail("获取人才信息失败");
|
||||
}else {
|
||||
if ("666666".equals(code)){
|
||||
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);
|
||||
}else {
|
||||
return R.fail("暂无资格");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,6 +145,7 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HousesReviewBo bo) {
|
||||
bo.setProcessStatus("wait");
|
||||
//先删除存在的关系表
|
||||
LambdaQueryWrapper<BuyHousesReviewMember> wrapper = new LambdaQueryWrapper<BuyHousesReviewMember>()
|
||||
.eq(BuyHousesReviewMember::getBuyHousesId, bo.getId());
|
||||
@ -162,17 +163,17 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
}
|
||||
if (ObjectUtil.isNotNull(e.getInsidepageUrl())) {
|
||||
if (!buyHousesMemberList.stream().anyMatch(b -> e.getInsidepageUrl().equals(b.getInsidepageUrl()))) {
|
||||
list.add(new Long(e.getFrontUrl()));
|
||||
list.add(new Long(e.getInsidepageUrl()));
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(e.getHomeRecordUrl())) {
|
||||
if (!buyHousesMemberList.stream().anyMatch(b -> ObjectUtil.isNotNull(e.getHomeRecordUrl()) && e.getHomeRecordUrl().equals(b.getHomeRecordUrl()))) {
|
||||
list.add(new Long(e.getFrontUrl()));
|
||||
list.add(new Long(e.getHomeRecordUrl()));
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(e.getReverseUrl())) {
|
||||
if (!buyHousesMemberList.stream().anyMatch(b -> ObjectUtil.isNotNull(e.getReverseUrl()) && e.getReverseUrl().equals(b.getReverseUrl()))) {
|
||||
list.add(new Long(e.getFrontUrl()));
|
||||
list.add(new Long(e.getReverseUrl()));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -241,6 +242,7 @@ public class HousesReviewServiceImpl implements IHousesReviewService {
|
||||
materialProof.setStatus(0L);
|
||||
materialProof.setModulePathId(e.getId().toString());
|
||||
materialProof.setId(null);
|
||||
materialProof.setProcessKey("house_review");
|
||||
list.add(materialProof);
|
||||
});
|
||||
materialProofMapper.insertBatch(list);
|
||||
|
||||
@ -136,7 +136,7 @@ public class MaterialModuleServiceImpl implements IMaterialModuleService {
|
||||
.apply(DataBaseHelper.findInSet(materialTalentsVo.getId(), "selected"));
|
||||
List<MaterialTalents> materialTalents = materialTalentsMapper.selectList(wrapper);
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
if (ObjectUtil.isNotNull(materialTalentsVo.getMaterials())){
|
||||
if (!"".equals(materialTalentsVo.getMaterials()) && ObjectUtil.isNotNull(materialTalentsVo.getMaterials())){
|
||||
list.add(materialTalentsVo.getMaterials());
|
||||
}
|
||||
for (MaterialTalents materialTalent : materialTalents) {
|
||||
@ -150,14 +150,10 @@ public class MaterialModuleServiceImpl implements IMaterialModuleService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String join = String.join(",", list);
|
||||
List<String> strings = Arrays.asList(join.split(","));
|
||||
|
||||
List<Long> collect = strings.stream().distinct().map(Long ::parseLong).collect(Collectors.toList());
|
||||
|
||||
List<MaterialModuleVo> materialTalentsVos = baseMapper.selectVoBatchIds(collect);
|
||||
|
||||
LambdaQueryWrapper<MaterialProof> queryWrapper = new LambdaQueryWrapper<MaterialProof>()
|
||||
.eq(MaterialProof::getHouseId, map.get("id"))
|
||||
.eq(MaterialProof::getProcessKey,map.get("processKey"));
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -0,0 +1,159 @@
|
||||
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.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.AesUtil;
|
||||
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 java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-04-03
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class UserServiceImpl implements IUserService {
|
||||
|
||||
private final UserMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*/
|
||||
@Override
|
||||
public UserVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<UserVo> queryPageList(UserBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<User> lqw = buildQueryWrapper(bo);
|
||||
Page<UserVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*/
|
||||
@Override
|
||||
public List<UserVo> queryList(UserBo bo) {
|
||||
LambdaQueryWrapper<User> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<User> buildQueryWrapper(UserBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<User> 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<Long> 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<User>()
|
||||
.set(User::getPassword, password)
|
||||
.eq(User::getLoginName, userName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<?> getUserCandidateInfo(String cardId) throws Exception {
|
||||
LinkedHashMap<String, Object> hashMap = new LinkedHashMap<>();
|
||||
hashMap.put("loginName",AesUtil.decryptBASE64("18716148446"));
|
||||
hashMap.put("password",AesUtil.decryptBASE64("1234Qwer"));
|
||||
HttpRequest.post("https://gx.chengdutalent.cn:8010/user/login")
|
||||
.form(hashMap)
|
||||
.timeout(20000)
|
||||
.execute().body();
|
||||
//调用高新的接口
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="processKey" column="process_key"/>
|
||||
<result property="processStatus" column="process_status"/>
|
||||
<result property="companyAddressArea" column="company_address_area"/>
|
||||
<result property="typeExtend" column="type_extend"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectVoPageList" resultMap="MaterialModuleResult">
|
||||
SELECT m.id,material_name,`material_key`,s.dept_name AS audit_dept,description,m.sort,m.is_must
|
||||
FROM `material_module` m
|
||||
INNER JOIN sys_dept s ON s.dept_id = m.audit_dept
|
||||
LEFT JOIN sys_dept s ON s.dept_id = m.audit_dept
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
34
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
Normal file
34
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.UserMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.system.domain.User" id="UserResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="loginName" column="login_name"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="cardNumber" column="card_number"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="validityDate" column="validity_date"/>
|
||||
<result property="wxToken" column="wx_token"/>
|
||||
<result property="enterNumber" column="enter_number"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="userName" column="user_name"/>
|
||||
<result property="lastTime" column="last_time"/>
|
||||
<result property="direction" column="direction"/>
|
||||
<result property="jurisdiction" column="jurisdiction"/>
|
||||
<result property="jobWanted" column="job_wanted"/>
|
||||
<result property="registerTime" column="register_time"/>
|
||||
<result property="wxToken1" column="wx_token1"/>
|
||||
<result property="cardId" column="card_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="userType" column="user_type"/>
|
||||
<result property="companyId" column="company_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -25,7 +25,7 @@ import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 流程
|
||||
* 流程配置模块
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-03-24
|
||||
|
||||
@ -29,7 +29,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程相关
|
||||
* 公共流程相关
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@ -105,7 +105,7 @@ public class WorkController extends BaseController {
|
||||
* 流程办理
|
||||
*/
|
||||
@Log(title = "流程办理",businessType = BusinessType.OTHER)
|
||||
@SaCheckPermission("work:task:batchDeleted")
|
||||
// @SaCheckPermission("work:task:batchDeleted")
|
||||
@PostMapping("/batchDeleted")
|
||||
public R<?> batchDeleted(@RequestBody HisProcess hisProcess){
|
||||
if (ObjectUtil.isNull(hisProcess.getStatus())){
|
||||
@ -117,16 +117,14 @@ public class WorkController extends BaseController {
|
||||
if (ObjectUtil.isNull(hisProcess.getBusinessId())){
|
||||
return R.fail("业务id不可为空");
|
||||
}
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, hisProcess.getProcessKey());
|
||||
List<TProcess> tProcesses = processMapper.selectList(wrapper);
|
||||
List<TProcess> tProcesses = processMapper.selectList(new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, hisProcess.getProcessKey()));
|
||||
if (tProcesses.size()==0){
|
||||
throw new ServiceException("当前流程不存在");
|
||||
}
|
||||
Map<String, Object> map = WorkUtils.getInfoToMap(tProcesses.get(0).getBean(),hisProcess.getBusinessId());
|
||||
hisProcess.setParams(map);
|
||||
String s = WorkComplyUtils.batchDeleted(hisProcess);
|
||||
|
||||
if (s.equals(Constants.NONENTITY)){
|
||||
return R.fail("暂无审核");
|
||||
}else{
|
||||
@ -162,7 +160,15 @@ public class WorkController extends BaseController {
|
||||
@Log(title = "回退",businessType = BusinessType.OTHER)
|
||||
@PostMapping("/rollBackLog")
|
||||
public R<?> rollBackLog(@RequestBody RollBackLog rollBackLog){
|
||||
return toAjax(WorkComplyUtils.rollBack(rollBackLog));
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, rollBackLog.getProcessKey());
|
||||
List<TProcess> tProcesses = processMapper.selectList(wrapper);
|
||||
if (tProcesses.size()==0){
|
||||
throw new ServiceException("当前流程不存在");
|
||||
}
|
||||
Map<String, Object> map = WorkUtils.getInfoToMap(tProcesses.get(0).getBean(),rollBackLog.getBusinessId());
|
||||
rollBackLog.setParams(map);
|
||||
return toAjax(WorkComplyUtils.rollBack(rollBackLog)>1?1:0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ public class ActProcess {
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 是由存在下一步骤
|
||||
*/
|
||||
@ -56,7 +57,6 @@ public class ActProcess {
|
||||
|
||||
private String startUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
@ -64,7 +64,6 @@ public class HisProcess{
|
||||
|
||||
private String startUser;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ -99,6 +98,10 @@ public class HisProcess{
|
||||
@TableField(exist = false)
|
||||
private String audit1;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
private Boolean isNext;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -54,4 +54,7 @@ public class RollBackLog extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private String audit;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String processKey;
|
||||
|
||||
}
|
||||
|
||||
@ -53,5 +53,7 @@ public class ActProcessBo {
|
||||
@NotBlank(message = "步骤不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String step;
|
||||
|
||||
private String userId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -58,5 +58,7 @@ public class HisProcessBo extends BaseEntity {
|
||||
|
||||
private String companyName;
|
||||
|
||||
private String userId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -71,5 +71,7 @@ public class ActProcessVo {
|
||||
|
||||
private String startUser;
|
||||
|
||||
private String userId;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -78,6 +78,9 @@ public class HisProcessVo {
|
||||
@TableField(exist = false)
|
||||
private String bean;
|
||||
|
||||
|
||||
private String userId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String description;
|
||||
|
||||
|
||||
@ -114,6 +114,16 @@ public class ProcessVo {
|
||||
@TableField(exist = false)
|
||||
private List<AuditLog> auditLogList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<AuditLog> auditLogList1;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer size;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ActProcessVo> actProcessVoList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -82,6 +82,7 @@ public class WorkComplyUtils {
|
||||
throw new ServiceException("当前业务正在审核中,请耐心等待");
|
||||
}
|
||||
ProcessVo tProcessByKey = processMapper.selectVoOne(lqw);
|
||||
actProcessVo.setUserId(String.valueOf(LoginHelper.getUserId()));
|
||||
actProcessVo.setCreateTime(DateUtils.getNowDate());
|
||||
actProcessVo.setCheckType(tProcessByKey.getCheckType());
|
||||
actProcessVo.setStep(tProcessByKey.getStep());
|
||||
@ -156,12 +157,14 @@ public class WorkComplyUtils {
|
||||
//根据审核人员类型判断流程中那条数据属于当前人的
|
||||
String checkType = actProcessVos.get(0).getCheckType();
|
||||
String audit ="";
|
||||
if ("1".equals(checkType) || "4".equals(checkType)){
|
||||
if ("1".equals(checkType)){
|
||||
audit=loginUser.getUserId().toString();
|
||||
}else if ("2".equals(checkType)){
|
||||
audit = loginUser.getDeptId().toString();
|
||||
}else if ("3".equals(checkType)){
|
||||
audit = loginUser.getRoleId().toString();
|
||||
}else if ("4".equals(checkType)){
|
||||
audit =String.valueOf(loginUser.getCompanyId());
|
||||
}
|
||||
String finalAudit = audit;
|
||||
List<ActProcessVo> collect = actProcessVos.stream().filter(e -> checkType.equals(e.getCheckType()) && finalAudit.equals(e.getAudit())).collect(Collectors.toList());
|
||||
@ -170,10 +173,12 @@ public class WorkComplyUtils {
|
||||
hisProcess.setCheckType(actProcessVo.getCheckType());
|
||||
//往历史表里面添加当前数据
|
||||
hisProcess.setProcessId(actProcessVo.getProcessId());
|
||||
hisProcess.setUserId(actProcessVo.getUserId());
|
||||
hisProcess.setCreateTime(actProcessVo.getCreateTime());
|
||||
hisProcess.setStep(actProcessVo.getStep());
|
||||
hisProcess.setType(actProcessVo.getType());
|
||||
hisProcess.setStartUser(actProcessVo.getStartUser());
|
||||
hisProcess.setIsNext(actProcessVo.getIsNext());
|
||||
if ("1".equals(actProcessVo.getCheckType())) {//人员id
|
||||
Long userId = loginUser.getUserId();
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(userId) ? userId.toString() : "");
|
||||
@ -184,13 +189,12 @@ public class WorkComplyUtils {
|
||||
Long roleId = loginUser.getRoleId();
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(roleId) ? roleId.toString() : "");
|
||||
} else if ("4".equals(actProcessVo.getCheckType())) {//企业
|
||||
Long userId = loginUser.getUserId();
|
||||
String userId = String.valueOf(hisProcess.getParams().get("companyId"));
|
||||
hisProcess.setCompanyName(hisProcess.getParams().get("companyName").toString());
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(userId) ? userId.toString() : "");
|
||||
hisProcess.setAudit(ObjectUtil.isNotEmpty(userId) ? userId : "");
|
||||
}
|
||||
//先添加一个属于当前用户的记录
|
||||
hisProcessMapper.insert(hisProcess);
|
||||
|
||||
//todo 保存一条审核日志
|
||||
AuditLog auditLog = new AuditLog();
|
||||
auditLog.setOtherId(hisProcess.getBusinessId());//业务id
|
||||
@ -249,48 +253,60 @@ public class WorkComplyUtils {
|
||||
if (ObjectUtil.isNull(userId)){
|
||||
throw new ServiceException("请先登录");
|
||||
}
|
||||
//获取到历史表中的需要回退到那一步的最新数据
|
||||
LambdaQueryWrapper<HisProcess> lqw = new LambdaQueryWrapper<HisProcess>()
|
||||
.eq(HisProcess::getStep,rollBackLog.getStep())
|
||||
.eq(HisProcess::getBusinessId,rollBackLog.getBusinessId())
|
||||
.eq(HisProcess::getCheckType,rollBackLog.getCheckType())
|
||||
.eq(HisProcess::getAudit,rollBackLog.getAudit())
|
||||
.orderByDesc(HisProcess::getEndTime);
|
||||
List<HisProcessVo> hisProcessVos = hisProcessMapper.selectVoList(lqw);
|
||||
String param ="";
|
||||
//获取当前流程的数据
|
||||
LambdaQueryWrapper<ActProcess> eq = new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ObjectUtil.isNotEmpty(rollBackLog.getBusinessId()), ActProcess::getBusinessId, rollBackLog.getBusinessId());
|
||||
ActProcess actProcesses = actProcessMapper.selectList(eq).get(0);
|
||||
//如果选择回退的步骤在历史表之前,将流程表中的流程替换为当前历史表中的数据
|
||||
if (!rollBackLog.getStep().equals(actProcesses.getStep())){
|
||||
LambdaQueryWrapper<ActProcess> eq1 = new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ObjectUtil.isNotNull(rollBackLog.getBusinessId()), ActProcess::getBusinessId, rollBackLog.getBusinessId());
|
||||
List<ActProcess> actProcesses1 = actProcessMapper.selectList(eq1);
|
||||
List<Long> collect = actProcesses1.stream().map(ActProcess::getId).collect(Collectors.toList());
|
||||
param = JsonUtils.toJsonString(actProcesses1);
|
||||
actProcessMapper.deleteBatchIds(collect);
|
||||
}else {
|
||||
param = JsonUtils.toJsonString(hisProcessVos.get(0));
|
||||
Object updateTime = rollBackLog.getParams().get("updateTime");
|
||||
if (ObjectUtil.isNull(updateTime)){
|
||||
throw new ServiceException("updateTime不可为空");
|
||||
}
|
||||
//如果回退的是当前流程中的步骤(会签),当前会签流程已走了一半,将流程历史表中的记录返回到流程表中
|
||||
HisProcessVo hisProcessVo = hisProcessVos.get(0);
|
||||
//获取出当前流程所在的步骤
|
||||
LambdaQueryWrapper<ActProcess> lwq = new LambdaQueryWrapper<>();
|
||||
lwq.eq(ActProcess::getBusinessId,rollBackLog.getBusinessId());
|
||||
List<ActProcessVo> actProcessVos = actProcessMapper.selectVoList(lwq);
|
||||
//获取去可退回步骤
|
||||
QueryWrapper<HisProcess> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("business_id",rollBackLog.getBusinessId());
|
||||
wrapper.ge("h.step","1");
|
||||
wrapper.le("h.step",actProcessVos.get(0).getStep());
|
||||
wrapper.ge("h.create_time",updateTime);
|
||||
wrapper.groupBy("h.audit");
|
||||
wrapper.orderByAsc("h.step");
|
||||
List<HisProcess> hisProcessVos = hisProcessMapper.selectVoHisList(wrapper);
|
||||
//如果只有一步就提示可直接退回
|
||||
if (hisProcessVos.size()==1){
|
||||
throw new ServiceException("当前流程不允许退回,请直接驳回");
|
||||
}
|
||||
//取出当前流程中最后的步骤
|
||||
String step = hisProcessVos.stream().max(Comparator.comparing(HisProcess::getStep)).get().getStep();
|
||||
//判断当前撤销的步骤是否是跳步
|
||||
if (new Integer(rollBackLog.getStep())< new Integer(step)){
|
||||
//回退当前rollBackLog中的id,将大于step的id给删除
|
||||
List<Long> collect = hisProcessVos.stream().filter(h -> !h.getId().equals(rollBackLog.getId())).map(HisProcess::getId).collect(Collectors.toList());
|
||||
hisProcessMapper.deleteBatchIds(collect);
|
||||
}else {
|
||||
List<Long> collect = hisProcessVos.stream().filter(h -> h.getId().equals(rollBackLog.getId())).map(HisProcess::getId).collect(Collectors.toList());
|
||||
hisProcessMapper.deleteBatchIds(collect);
|
||||
}
|
||||
//把当前流程运行表中的数据删除
|
||||
List<Long> collect = actProcessVos.stream().map(ActProcessVo::getId).collect(Collectors.toList());
|
||||
actProcessMapper.deleteBatchIds(collect);
|
||||
HisProcess hisProcess = hisProcessVos.stream().filter(h -> h.getId().equals(rollBackLog.getId())).collect(Collectors.toList()).get(0);
|
||||
String param = JsonUtils.toJsonString(hisProcess);
|
||||
ActProcess actProcess = new ActProcess();
|
||||
actProcess.setIsNext(actProcesses.getIsNext());
|
||||
actProcess.setType(hisProcessVo.getType());
|
||||
actProcess.setCheckType(hisProcessVo.getCheckType());
|
||||
actProcess.setCompanyName(hisProcessVo.getCompanyName());
|
||||
actProcess.setCreateTime(hisProcessVo.getCreateTime());
|
||||
actProcess.setStep(hisProcessVo.getStep());
|
||||
actProcess.setStartUser(hisProcessVo.getStartUser());
|
||||
actProcess.setBusinessId(hisProcessVo.getBusinessId());
|
||||
actProcess.setAudit(hisProcessVo.getAudit());
|
||||
actProcess.setProcessId(hisProcessVo.getProcessId());
|
||||
int insert = actProcessMapper.insert(actProcess);
|
||||
actProcess.setIsNext(hisProcess.getIsNext());
|
||||
actProcess.setType(hisProcess.getType());
|
||||
actProcess.setUserId(hisProcess.getUserId());
|
||||
actProcess.setCheckType(hisProcess.getCheckType());
|
||||
actProcess.setCompanyName(hisProcess.getCompanyName());
|
||||
actProcess.setCreateTime(hisProcess.getCreateTime());
|
||||
actProcess.setStep(hisProcess.getStep());
|
||||
actProcess.setStartUser(hisProcess.getStartUser());
|
||||
actProcess.setBusinessId(hisProcess.getBusinessId());
|
||||
actProcess.setAudit(hisProcess.getAudit());
|
||||
actProcess.setProcessId(hisProcess.getProcessId());
|
||||
int insert = actProcessMapper.insert(actProcess);
|
||||
rollBackLog.setCreateTime(DateUtils.getNowDate());
|
||||
rollBackLog.setParam(param);
|
||||
rollBackLog.setUpdateBy(userId.toString());
|
||||
rollBackLogMapper.insert(rollBackLog);
|
||||
insert += rollBackLogMapper.insert(rollBackLog);
|
||||
return insert;
|
||||
}
|
||||
/**
|
||||
@ -336,52 +352,51 @@ public class WorkComplyUtils {
|
||||
ActProcessVo actProcessVo = actProcessVos.get(0);
|
||||
String step = actProcessVo.getStep();
|
||||
//如果当前业务就是在第一步,则不返回数据
|
||||
if (!"1".equals(step)){
|
||||
//获取历史表中在该业务流程步骤之前的人员数据,根据业务表的更新时间为节点
|
||||
Object updateTime = businessDTO.getParams().get("updateTime");
|
||||
if (ObjectUtil.isNull(updateTime)){
|
||||
throw new ServiceException("updateTime不可为空");
|
||||
}
|
||||
QueryWrapper<HisProcess> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("business_id",businessDTO.getBusinessId());
|
||||
wrapper.ge("h.step","1");
|
||||
wrapper.le("h.step",step);
|
||||
wrapper.ge("h.create_time",updateTime);
|
||||
wrapper.orderByAsc("h.step");
|
||||
List<HisProcess> hisProcessVos = hisProcessMapper.selectVoHisList(wrapper);
|
||||
for (HisProcess hisProcessVo : hisProcessVos) {
|
||||
if ("4".equals(hisProcessVo.getCheckType())) {//企业审核
|
||||
hisProcessVo.setAudit1(hisProcessVo.getCompanyName());
|
||||
} else if ("1".equals(hisProcessVo.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysUser.getUserName());
|
||||
} else if ("2".equals(hisProcessVo.getCheckType())) {
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysDept.getDeptName());
|
||||
} else if ("3".equals(hisProcessVo.getCheckType())) {
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysRole.getRoleName());
|
||||
}
|
||||
}
|
||||
|
||||
//将每个步骤处理为单个对象
|
||||
Map<String, List<HisProcess>> collect = hisProcessVos.stream().collect(Collectors.groupingBy(HisProcess::getStep));
|
||||
List<HisProcessVoResultDto> collect1 = collect.entrySet()
|
||||
.stream()
|
||||
.map(e -> new HisProcessVoResultDto(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
collect1.forEach(e ->{
|
||||
String s = e.getHisProcessVoList().stream().map(HisProcess::getDescription).collect(Collectors.toList()).get(0);
|
||||
e.setStep(s);
|
||||
});
|
||||
System.out.println("collect = " + collect1);
|
||||
return collect1;
|
||||
// if (!"1".equals(step)){
|
||||
//获取历史表中在该业务流程步骤之前的人员数据,根据业务表的更新时间为节点
|
||||
Object updateTime = businessDTO.getParams().get("updateTime");
|
||||
if (ObjectUtil.isNull(updateTime)){
|
||||
throw new ServiceException("updateTime不可为空");
|
||||
}
|
||||
QueryWrapper<HisProcess> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("business_id",businessDTO.getBusinessId());
|
||||
// wrapper.ge("h.step","1");
|
||||
wrapper.le("h.step",step);
|
||||
wrapper.ge("h.create_time",updateTime);
|
||||
wrapper.groupBy("h.audit");
|
||||
wrapper.orderByAsc("h.step");
|
||||
List<HisProcess> hisProcessVos = hisProcessMapper.selectVoHisList(wrapper);
|
||||
if (hisProcessVos.size()==0){
|
||||
throw new ServiceException("当前流程没有可退回人员");
|
||||
}
|
||||
for (HisProcess hisProcessVo : hisProcessVos) {
|
||||
if ("4".equals(hisProcessVo.getCheckType())) {//企业审核
|
||||
hisProcessVo.setAudit1(hisProcessVo.getCompanyName());
|
||||
} else if ("1".equals(hisProcessVo.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysUser.getUserName());
|
||||
} else if ("2".equals(hisProcessVo.getCheckType())) {
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysDept.getDeptName());
|
||||
} else if ("3".equals(hisProcessVo.getCheckType())) {
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(hisProcessVo.getAudit()));
|
||||
hisProcessVo.setAudit1(sysRole.getRoleName());
|
||||
}
|
||||
}
|
||||
//将每个步骤处理为单个对象
|
||||
Map<String, List<HisProcess>> collect = hisProcessVos.stream().collect(Collectors.groupingBy(HisProcess::getStep));
|
||||
List<HisProcessVoResultDto> collect1 = collect.entrySet()
|
||||
.stream()
|
||||
.map(e -> new HisProcessVoResultDto(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
collect1.forEach(e ->{
|
||||
String s = e.getHisProcessVoList().stream().map(HisProcess::getDescription).collect(Collectors.toList()).get(0);
|
||||
e.setStep(s);
|
||||
});
|
||||
System.out.println("collect = " + collect1);
|
||||
return collect1;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -444,21 +459,18 @@ public class WorkComplyUtils {
|
||||
Page<ActProcess> actProcessVoCCList = actProcessMapper.selectCCList(pageQuery.build(), actProcess);
|
||||
if (actProcessVoCCList.getRecords().size() > 0) {
|
||||
for (ActProcess record : actProcessVoCCList.getRecords()) {
|
||||
if ("1".equals(record.getCheckType())){//人员
|
||||
String username = loginUser.getUsername();
|
||||
record.setAudit(username);
|
||||
}
|
||||
if ("2".equals(record.getCheckType())){//部门
|
||||
String deptName = loginUser.getDeptName();
|
||||
record.setAudit(deptName);
|
||||
}
|
||||
if ("3".equals(record.getCheckType())){//角色
|
||||
Long roleId = loginUser.getRoleId();
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(roleId);
|
||||
record.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
if ("4".equals(record.getCheckType())){//公司
|
||||
record.setAudit(record.getCompanyName());
|
||||
}else if("1".equals(record.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( record.getAudit()));
|
||||
record.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(record.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(record.getAudit()));
|
||||
record.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(record.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(record.getAudit()));
|
||||
record.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(record.getTimeout())&& ObjectUtil.isNotNull(record.getTimeout())){
|
||||
DateTime beforeTime = DateUtil.offsetDay(record.getCreateTime(), new Integer(record.getTimeout()));
|
||||
@ -514,24 +526,21 @@ public class WorkComplyUtils {
|
||||
}
|
||||
return TableDataInfo.build(actProcessVoList);
|
||||
}
|
||||
|
||||
actProcess.setUserId(ObjectUtil.isNotNull(loginUser.getUserId())?loginUser.getUserId().toString():"");
|
||||
actProcess.setRoleId(ObjectUtil.isNotNull(loginUser.getRoleId())?loginUser.getRoleId().toString():"");
|
||||
actProcess.setDeptId(ObjectUtil.isNotNull(loginUser.getDeptId())?loginUser.getDeptId().toString():"");
|
||||
Page<ActProcess> actProcessVoList = actProcessMapper.selectVoListPage(pageQuery.build(),actProcess);
|
||||
List<ActProcess> records = actProcessVoList.getRecords();
|
||||
for (ActProcess record : records) {
|
||||
if ("1".equals(record.getCheckType())){//人员
|
||||
String username = loginUser.getUsername();
|
||||
record.setAudit(username);
|
||||
}
|
||||
if ("2".equals(record.getCheckType())){//部门
|
||||
String deptName = loginUser.getDeptName();
|
||||
record.setAudit(deptName);
|
||||
}
|
||||
if ("3".equals(record.getCheckType())){//角色
|
||||
Long roleId = loginUser.getRoleId();
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(roleId);
|
||||
if("1".equals(record.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( record.getAudit()));
|
||||
record.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(record.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(record.getAudit()));
|
||||
record.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(record.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(record.getAudit()));
|
||||
record.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
switch (record.getType()){
|
||||
@ -567,17 +576,31 @@ public class WorkComplyUtils {
|
||||
if (ObjectUtil.isNull(businessId)){
|
||||
throw new ServiceException("业务id不可为空");
|
||||
}
|
||||
|
||||
Map params = processVo.getParams();
|
||||
if (ObjectUtil.isEmpty(params)){
|
||||
throw new ServiceException("params不可为空");
|
||||
}
|
||||
Object processKey = params.get("processKey");
|
||||
if (ObjectUtil.isNull(processKey)){
|
||||
throw new ServiceException("processKey不可为空");
|
||||
}
|
||||
LambdaQueryWrapper<TProcess> wrapper = new LambdaQueryWrapper<TProcess>()
|
||||
.eq(TProcess::getProcessKey, params.get("processKey"))
|
||||
.orderByAsc(TProcess::getStep);
|
||||
List<ProcessVo> processVos = processMapper.selectVoList(wrapper);
|
||||
List<ProcessVo> list1 = new ArrayList<>();
|
||||
processVos.forEach(e ->{
|
||||
LambdaQueryWrapper<ActProcess> queryWrapper = new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ActProcess::getBusinessId, businessId);
|
||||
List<ActProcessVo> actProcessVoList = actProcessMapper.selectVoList(queryWrapper);
|
||||
|
||||
LambdaQueryWrapper<AuditLog> wrapperLog = new LambdaQueryWrapper<AuditLog>()
|
||||
.eq(AuditLog::getProcessKey, processKey)
|
||||
.eq(AuditLog::getOtherId, businessId)
|
||||
.orderByAsc(AuditLog::getCreateTime);
|
||||
List<AuditLog> auditLogs = auditLogMapper.selectList(wrapperLog);
|
||||
processVos.stream().forEach(e ->{
|
||||
e.setAuditLogList1(auditLogs);
|
||||
e.setActProcessVoList(actProcessVoList);
|
||||
e.setBusinessId(businessId);
|
||||
e.setParams(params);
|
||||
//遍历出他每一步所需要的审核人
|
||||
@ -602,8 +625,10 @@ public class WorkComplyUtils {
|
||||
List<ProcessVo> list = new ArrayList<>();
|
||||
if (1L == e.getProcessCheck()) {
|
||||
String[] split = e.getAudit().split(",");
|
||||
e.setSize(split.length);
|
||||
for (String s : split) {
|
||||
e.setAudit(s);
|
||||
e.setChecked("");
|
||||
dd(e);
|
||||
ProcessVo processVo1 = new ProcessVo();
|
||||
BeanCopyUtils.copy(e,processVo1);
|
||||
@ -618,8 +643,10 @@ public class WorkComplyUtils {
|
||||
String[] split = e.getAudit().split(",");
|
||||
Collections.addAll(personByRule, split);
|
||||
}
|
||||
e.setSize(personByRule.size());
|
||||
for (String s : personByRule) {
|
||||
e.setAudit(s);
|
||||
e.setChecked("");
|
||||
dd(e);
|
||||
ProcessVo processVo1 = new ProcessVo();
|
||||
BeanCopyUtils.copy(e,processVo1);
|
||||
@ -629,17 +656,14 @@ public class WorkComplyUtils {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
list1.forEach(e ->{
|
||||
e.setParams(null);
|
||||
});
|
||||
|
||||
Map<String, List<ProcessVo>> collect = list1.stream().collect(Collectors.groupingBy(ProcessVo::getStep));
|
||||
List<ProcessVoResultDto> collect1 = collect.entrySet()
|
||||
.stream()
|
||||
.map(e -> new ProcessVoResultDto(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
collect1.forEach(e ->{
|
||||
String s = e.getProcessVoList().stream().map(ProcessVo::getDescription).collect(Collectors.toList()).get(0);
|
||||
e.setStep(s);
|
||||
@ -653,41 +677,52 @@ public class WorkComplyUtils {
|
||||
* @param e
|
||||
*/
|
||||
public static void dd(ProcessVo e){
|
||||
LambdaQueryWrapper<ActProcess> queryWrapper = new LambdaQueryWrapper<ActProcess>()
|
||||
.eq(ActProcess::getBusinessId, e.getBusinessId());
|
||||
List<ActProcessVo> actProcessVoList = actProcessMapper.selectVoList(queryWrapper);
|
||||
|
||||
List<ActProcessVo> actProcessVoList =e.getActProcessVoList();
|
||||
List<AuditLog> auditLogs = e.getAuditLogList1();
|
||||
List<ActProcessVo> collect1 = actProcessVoList.stream().filter(a -> a.getAudit().equals(e.getAudit()) && a.getCheckType().equals(e.getCheckType()) && a.getStep().equals(e.getStep()) && a.getType().equals(e.getType())).collect(Collectors.toList());
|
||||
if (actProcessVoList.size()>0){
|
||||
actProcessVoList.forEach(a ->{
|
||||
actProcessVoList.stream().forEach(a ->{
|
||||
if ( new Integer(e.getStep())< new Integer(a.getStep())){
|
||||
e.setChecked("1");
|
||||
e.setChecked("1");//绿色
|
||||
}else if ( new Integer(e.getStep()).equals(new Integer(a.getStep()))){
|
||||
e.setChecked("2");
|
||||
if (collect1.size()>0){
|
||||
e.setChecked("2");//红色
|
||||
}else {
|
||||
e.setChecked("1");
|
||||
}
|
||||
}else {
|
||||
e.setChecked("3");
|
||||
e.setChecked("3");//无色
|
||||
}
|
||||
});
|
||||
|
||||
}else {
|
||||
Map map = e.getParams();
|
||||
Object process_status = map.get("processStatus");
|
||||
if (ObjectUtil.isNotNull(process_status)){
|
||||
if (Constants.SUCCEED.equals(process_status.toString())){
|
||||
e.setChecked("1");
|
||||
}else if (Constants.FAILD.equals(process_status.toString())){
|
||||
if (auditLogs.size()>0){
|
||||
AuditLog auditLog = auditLogs.get(auditLogs.size()-1);
|
||||
if (auditLog.getAudit().equals(e.getAudit()) && auditLog.getStep().equals(e.getStep()) && auditLog.getAuditType().equals(e.getCheckType())){
|
||||
e.setChecked("2");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
e.setChecked("3");
|
||||
}
|
||||
}
|
||||
e.setAuditLogList(null);
|
||||
LambdaQueryWrapper<AuditLog> wrapper = new LambdaQueryWrapper<AuditLog>()
|
||||
.eq(ObjectUtil.isNotNull(e.getProcessKey()) && StringUtils.isNotEmpty(e.getProcessKey()),AuditLog::getProcessKey, e.getProcessKey())
|
||||
.eq(AuditLog::getOtherId, e.getBusinessId())
|
||||
.orderByAsc(AuditLog::getCreateTime);
|
||||
List<AuditLog> auditLogs = auditLogMapper.selectList(wrapper);
|
||||
|
||||
if (auditLogs.size()>0) {
|
||||
if ("4".equals(e.getCheckType())){
|
||||
Object companyId = e.getParams().get("companyId");
|
||||
if (ObjectUtil.isNull(companyId)){
|
||||
throw new ServiceException("companyId不可为空");
|
||||
}
|
||||
e.setAudit(String.valueOf(e.getParams().get("companyId")));
|
||||
}
|
||||
List<AuditLog> collect = auditLogs.stream().filter(a -> e.getStep().equals(a.getStep()) && e.getAudit().equals(a.getAudit())).collect(Collectors.toList());
|
||||
collect.forEach(a -> {
|
||||
collect.stream().forEach(a -> {
|
||||
if (ObjectUtil.isNotNull(a.getStatus())) {
|
||||
switch (a.getStatus()) {
|
||||
case "1":
|
||||
@ -716,12 +751,21 @@ public class WorkComplyUtils {
|
||||
}else if("1".equals(e.getCheckType())) {
|
||||
//根据id获取人员信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(new Long( e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysUser)){
|
||||
throw new ServiceException("根据id获取人员信息失败");
|
||||
}
|
||||
e.setAudit(sysUser.getUserName());
|
||||
}else if ("2".equals(e.getCheckType())){
|
||||
SysDept sysDept = sysDeptMapper.selectDeptById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysDept)){
|
||||
throw new ServiceException("根据id获取部门信息失败");
|
||||
}
|
||||
e.setAudit(sysDept.getDeptName());
|
||||
}else if ("3".equals(e.getCheckType())){
|
||||
SysRole sysRole = sysRoleMapper.selectRoleById(new Long(e.getAudit()));
|
||||
if(ObjectUtil.isNull(sysRole)){
|
||||
throw new ServiceException("根据id获取角色信息失败");
|
||||
}
|
||||
e.setAudit(sysRole.getRoleName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
<result property="description" column="description"/>
|
||||
<result property="bean" column="bean"/>
|
||||
<result property="timeout" column="timeout"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
</resultMap>
|
||||
<select id="selectVoListPage" resultType="com.ruoyi.work.domain.ActProcess" parameterType="com.ruoyi.work.domain.ActProcess">
|
||||
SELECT a.create_time AS createTime,a.business_id AS businessId,a.audit, a.step ,a.start_user AS startUser,a.id,p.process_key AS processKey,
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
<result property="type" column="type"/>
|
||||
<result property="startUser" column="start_user"/>
|
||||
<result property="companyName" column="companyName"/>
|
||||
<result property="isNext" column="is_next"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoListPage" resultType="com.ruoyi.work.domain.HisProcess" parameterType="com.ruoyi.work.domain.HisProcess">
|
||||
@ -44,9 +46,10 @@
|
||||
ORDER BY d.end_time DESC
|
||||
</select>
|
||||
<select id="selectVoHisList" resultType="com.ruoyi.work.domain.HisProcess">
|
||||
SELECT h.id,p.description,h.audit,h.check_type AS checkType,h.step,h.type,h.start_user AS startUser,h.company_name AS companyName,p.bean
|
||||
,h.business_id AS businessId
|
||||
FROM `his_process` h INNER JOIN process p ON p.id = h.process_id
|
||||
SELECT h.id,p.description,h.audit,h.check_type AS checkType,h.step,h.type,h.start_user AS startUser,h.company_name AS companyName,p.bean ,
|
||||
h.business_id AS businessId,p.process_key AS processKey,p.id AS processId,h.is_next AS isNext,h.create_time AS createTime,h.user_id AS userId
|
||||
FROM `his_process` h
|
||||
INNER JOIN process p ON p.id = h.process_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user