提交代码
parent
93b207a1dc
commit
b529cf5946
|
@ -78,6 +78,12 @@
|
|||
<artifactId>ruoyi-flowable</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package com.ruoyi.api.base;
|
||||
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 获取系统token 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
@Data
|
||||
public class TokenReqVo {
|
||||
|
||||
/**
|
||||
* AppId
|
||||
*/
|
||||
@NotBlank(message = "AppId不能为空")
|
||||
@Size(min = 1, max = 64, message = "AppId格式异常")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(用户账号 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
public Boolean getLoginSign(String privateKey) {
|
||||
boolean signFlag = false;
|
||||
try {
|
||||
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
|
||||
if (StringUtils.equals(appId + timestamp, decryptByPrivateKey) && checkTimestamp()) {
|
||||
signFlag = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
return signFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 效验时间签名
|
||||
*/
|
||||
private Boolean checkTimestamp() {
|
||||
boolean timestampFlag = false;
|
||||
long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 3) {
|
||||
timestampFlag = true;
|
||||
}
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,414 @@
|
|||
package com.ruoyi.api.labour.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.api.base.TokenReqVo;
|
||||
import com.ruoyi.api.labour.domain.LabourSignetVo;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.RateLimiter;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.enums.LimitType;
|
||||
import com.ruoyi.common.enums.UserTypeEnum;
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.service.SysLoginService;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceData;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceGroup;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceUser;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceDataService;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceGroupService;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 劳务人员APIController
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/labour")
|
||||
public class LabourApiController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceGroupService surProjectAttendanceGroupService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceUserService surProjectAttendanceUserService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceDataService surProjectAttendanceDataService;
|
||||
|
||||
/**
|
||||
* 获取系统token
|
||||
* 限流规则[60秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Anonymous
|
||||
@ApiOperation(value = "获取TOKEN")
|
||||
@RateLimiter(count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/getToken")
|
||||
public AjaxResult getToken(@Validated @RequestBody TokenReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+req.getAppId());
|
||||
if(sysApplyConfig==null){
|
||||
throw new RuntimeException("AppId不存在或已被停用");
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
String systemToken = "";
|
||||
if (req.getLoginSign(sysApplyConfig.getPrivateKey())) {
|
||||
systemToken = this.getAppIdLoginToken(req.getAppId(),sysApplyConfig);
|
||||
} else {
|
||||
throw new RuntimeException("签名值不合法");
|
||||
}
|
||||
ajax.put("systemToken", systemToken);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* appId登录创建用户并模拟登录
|
||||
*
|
||||
* @param appId 用户账号
|
||||
* @return token
|
||||
*/
|
||||
private String getAppIdLoginToken(String appId,SysApplyConfig sysApplyConfig) {
|
||||
// 查询用户是否存在,不存在则保存
|
||||
SysUser sysUser = userService.selectUserByUserName(appId);
|
||||
String password = Convert.toStr(System.currentTimeMillis());
|
||||
if (sysUser == null) {
|
||||
sysUser = new SysUser();
|
||||
sysUser.setDeptId(sysApplyConfig.getDeptId());
|
||||
sysUser.setUserName(Convert.toStr(sysApplyConfig.getAppId()));
|
||||
sysUser.setNickName(Convert.toStr(sysApplyConfig.getAppId()));
|
||||
sysUser.setUserType(UserTypeEnum.APPLY.getCode());
|
||||
sysUser.setStatus("0");
|
||||
sysUser.setCreateBy("AppId登录创建用户");
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
userService.insertUser(sysUser);
|
||||
} else {
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(password));
|
||||
sysUser.setUpdateBy("AppId登录更新用户密码");
|
||||
userService.updateUser(sysUser);
|
||||
}
|
||||
return loginService.unifiedLogin(appId, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送,修改班组信息
|
||||
* 限流规则[30秒内最多请求100次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送班组信息")
|
||||
@RateLimiter(time = 30, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourGroup")
|
||||
public AjaxResult pushLabourGroup(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
SurProjectAttendanceGroup surProjectAttendanceGroup = JSONObject.parseObject(result, SurProjectAttendanceGroup.class);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceGroup.getServerid())){
|
||||
// 查询当前班组是否已推送
|
||||
SurProjectAttendanceGroup searchModel = new SurProjectAttendanceGroup();
|
||||
searchModel.setAppId(sysApplyConfig.getAppId());
|
||||
searchModel.setServerid(surProjectAttendanceGroup.getServerid());
|
||||
List<SurProjectAttendanceGroup> list = surProjectAttendanceGroupService.selectSurProjectAttendanceGroupList(searchModel);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
surProjectAttendanceGroup.setId(list.get(0).getId());
|
||||
surProjectAttendanceGroup.setCreateBy(list.get(0).getCreateBy());
|
||||
surProjectAttendanceGroup.setCreateTime(list.get(0).getCreateTime());
|
||||
surProjectAttendanceGroup.setUpdateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceGroup.setUpdateTime(new Date());
|
||||
surProjectAttendanceGroupService.updateSurProjectAttendanceGroup(surProjectAttendanceGroup);
|
||||
}else{
|
||||
surProjectAttendanceGroup.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceGroup.setCreateTime(new Date());
|
||||
surProjectAttendanceGroupService.insertSurProjectAttendanceGroup(surProjectAttendanceGroup);
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量推送,修改班组列表信息
|
||||
* 限流规则[30秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送班组列表信息")
|
||||
@RateLimiter(time = 30, count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourGroupList")
|
||||
public AjaxResult pushLabourGroupList(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
// 失败集合
|
||||
List<Integer> failServiceIdList = new ArrayList<>();
|
||||
// 保存集合
|
||||
List<SurProjectAttendanceGroup> saveList = new ArrayList<>();
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
List<SurProjectAttendanceGroup> surProjectAttendanceGroupList = JSON.parseArray(result,SurProjectAttendanceGroup.class);
|
||||
if(CollectionUtils.isNotEmpty(surProjectAttendanceGroupList)){
|
||||
// 批量删除已保存数据
|
||||
List<String> params = new ArrayList<>();
|
||||
for(SurProjectAttendanceGroup surProjectAttendanceGroup:surProjectAttendanceGroupList){
|
||||
params.add(sysApplyConfig.getAppId()+"-"+surProjectAttendanceGroup.getServerid());
|
||||
}
|
||||
surProjectAttendanceGroupService.deleteSurProjectAttendanceGroupByParams(params);
|
||||
for(int i=0;i<surProjectAttendanceGroupList.size();i++){
|
||||
SurProjectAttendanceGroup surProjectAttendanceGroup = surProjectAttendanceGroupList.get(i);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceGroup.getServerid())){
|
||||
surProjectAttendanceGroup.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceGroup.setCreateTime(new Date());
|
||||
saveList.add(surProjectAttendanceGroup);
|
||||
}else{
|
||||
failServiceIdList.add(i);
|
||||
}
|
||||
}
|
||||
surProjectAttendanceGroupService.batchSurProjectAttendanceGroup(saveList);
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送,修改人员信息
|
||||
* 限流规则[30秒内最多请求100次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送人员信息")
|
||||
@RateLimiter(time = 30, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourUser")
|
||||
public AjaxResult pushLabourUser(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
SurProjectAttendanceUser surProjectAttendanceUser = JSONObject.parseObject(result, SurProjectAttendanceUser.class);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceUser.getWorkerId())){
|
||||
// 查询当前人员是否已推送
|
||||
SurProjectAttendanceUser searchModel = new SurProjectAttendanceUser();
|
||||
searchModel.setAppId(sysApplyConfig.getAppId());
|
||||
searchModel.setWorkerId(surProjectAttendanceUser.getWorkerId());
|
||||
List<SurProjectAttendanceUser> list = surProjectAttendanceUserService.selectSurProjectAttendanceUserList(searchModel);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
surProjectAttendanceUser.setId(list.get(0).getId());
|
||||
surProjectAttendanceUser.setCreateBy(list.get(0).getCreateBy());
|
||||
surProjectAttendanceUser.setCreateTime(list.get(0).getCreateTime());
|
||||
surProjectAttendanceUser.setUpdateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setUpdateTime(new Date());
|
||||
surProjectAttendanceUserService.updateSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
}else{
|
||||
surProjectAttendanceUser.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setCreateTime(new Date());
|
||||
surProjectAttendanceUserService.insertSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量推送,修改人员信息
|
||||
* 限流规则[30秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送人员信息")
|
||||
@RateLimiter(time = 30, count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourUserList")
|
||||
public AjaxResult pushLabourUserList(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
// 失败集合
|
||||
List<Integer> failServiceIdList = new ArrayList<>();
|
||||
// 保存集合
|
||||
List<SurProjectAttendanceUser> saveList = new ArrayList<>();
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
List<SurProjectAttendanceUser> surProjectAttendanceUserList = JSON.parseArray(result,SurProjectAttendanceUser.class);
|
||||
if(CollectionUtils.isNotEmpty(surProjectAttendanceUserList)){
|
||||
// 批量删除已保存数据
|
||||
List<String> params = new ArrayList<>();
|
||||
for(SurProjectAttendanceUser surProjectAttendanceUser:surProjectAttendanceUserList){
|
||||
params.add(sysApplyConfig.getAppId()+"-"+surProjectAttendanceUser.getWorkerId());
|
||||
}
|
||||
surProjectAttendanceUserService.deleteSurProjectAttendanceUserByParams(params);
|
||||
for(int i=0;i<surProjectAttendanceUserList.size();i++){
|
||||
SurProjectAttendanceUser surProjectAttendanceUser = surProjectAttendanceUserList.get(i);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceUser.getWorkerId())){
|
||||
surProjectAttendanceUser.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setCreateTime(new Date());
|
||||
saveList.add(surProjectAttendanceUser);
|
||||
}else{
|
||||
failServiceIdList.add(i);
|
||||
}
|
||||
}
|
||||
surProjectAttendanceUserService.batchSurProjectAttendanceUser(saveList);
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送,修改班组人员考勤信息
|
||||
* 限流规则[30秒内最多请求255次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送班组人员考勤信息")
|
||||
@RateLimiter(time = 30, count = 255, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourData")
|
||||
public AjaxResult pushLabourData(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
SurProjectAttendanceData surProjectAttendanceData = JSONObject.parseObject(result, SurProjectAttendanceData.class);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceData.getWorkerId()) && StringUtils.isNotEmpty(surProjectAttendanceData.getServerid())){
|
||||
// 查询当前班组人员考勤是否已推送
|
||||
SurProjectAttendanceData searchModel = new SurProjectAttendanceData();
|
||||
searchModel.setAppId(sysApplyConfig.getAppId());
|
||||
searchModel.setWorkerId(surProjectAttendanceData.getWorkerId());
|
||||
searchModel.setWorkerId(surProjectAttendanceData.getServerid());
|
||||
List<SurProjectAttendanceData> list = surProjectAttendanceDataService.selectSurProjectAttendanceDataList(searchModel);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
surProjectAttendanceData.setId(list.get(0).getId());
|
||||
surProjectAttendanceData.setCreateBy(list.get(0).getCreateBy());
|
||||
surProjectAttendanceData.setCreateTime(list.get(0).getCreateTime());
|
||||
surProjectAttendanceData.setUpdateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setUpdateTime(new Date());
|
||||
surProjectAttendanceDataService.updateSurProjectAttendanceData(surProjectAttendanceData);
|
||||
}else{
|
||||
surProjectAttendanceData.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setCreateTime(new Date());
|
||||
surProjectAttendanceDataService.insertSurProjectAttendanceData(surProjectAttendanceData);
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量推送,修改班组人员考勤信息
|
||||
* 限流规则[30秒内最多请求10次,限流策略IP]
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送班组人员考勤信息")
|
||||
@RateLimiter(time = 30, count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/pushLabourDataList")
|
||||
public AjaxResult pushLabourDataList(@Validated @RequestBody LabourSignetVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisCache.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG+super.getUsername());
|
||||
if(req.checkTimestamp()){
|
||||
try {
|
||||
// 失败集合
|
||||
List<Integer> failServiceIdList = new ArrayList<>();
|
||||
// 保存集合
|
||||
List<SurProjectAttendanceData> saveList = new ArrayList<>();
|
||||
String result = AuthRsaUtils.decryptByPrivateKey(sysApplyConfig.getPrivateKey(),req.getSign());
|
||||
List<SurProjectAttendanceData> surProjectAttendanceDataList = JSON.parseArray(result,SurProjectAttendanceData.class);
|
||||
if(CollectionUtils.isNotEmpty(surProjectAttendanceDataList)){
|
||||
// 批量删除已保存数据
|
||||
List<String> params = new ArrayList<>();
|
||||
for(SurProjectAttendanceData surProjectAttendanceData:surProjectAttendanceDataList){
|
||||
params.add(sysApplyConfig.getAppId()+"-"+surProjectAttendanceData.getServerid()+"-"+surProjectAttendanceData.getWorkerId());
|
||||
}
|
||||
surProjectAttendanceDataService.deleteSurProjectAttendanceDataByParams(params);
|
||||
for(int i=0;i<surProjectAttendanceDataList.size();i++){
|
||||
SurProjectAttendanceData surProjectAttendanceData = surProjectAttendanceDataList.get(i);
|
||||
if(StringUtils.isNotEmpty(surProjectAttendanceData.getWorkerId()) && StringUtils.isNotEmpty(surProjectAttendanceData.getServerid())){
|
||||
surProjectAttendanceData.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setCreateTime(new Date());
|
||||
saveList.add(surProjectAttendanceData);
|
||||
}else{
|
||||
failServiceIdList.add(i);
|
||||
}
|
||||
}
|
||||
surProjectAttendanceDataService.batchSurProjectAttendanceData(saveList);
|
||||
}else{
|
||||
throw new RuntimeException("数据解析异常");
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("签名解密异常");
|
||||
}
|
||||
}else{
|
||||
throw new RuntimeException("数据已过期");
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.ruoyi.api.labour.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 劳务人员签名推送信息 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
@Data
|
||||
public class LabourSignetVo {
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(用户账号 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 效验时间签名
|
||||
*/
|
||||
public Boolean checkTimestamp() {
|
||||
boolean timestampFlag = false;
|
||||
long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 3) {
|
||||
timestampFlag = true;
|
||||
}
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysApplyConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册Controller
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/applyConfig")
|
||||
public class SysApplyConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysApplyConfigService sysApplyConfigService;
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
startPage();
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统应用注册列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:export')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
ExcelUtil<SysApplyConfig> util = new ExcelUtil<SysApplyConfig>(SysApplyConfig.class);
|
||||
util.exportExcel(response, list, "系统应用注册数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统应用注册详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysApplyConfigService.selectSysApplyConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:add')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
return toAjax(sysApplyConfigService.insertSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:edit')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
return toAjax(sysApplyConfigService.updateSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统应用注册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:applyConfig:remove')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysApplyConfigService.deleteSysApplyConfigByIds(ids));
|
||||
}
|
||||
}
|
|
@ -1,3 +1,37 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
|
@ -6,7 +40,7 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_jh?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_jh_test?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Sxyanzhu@cf
|
||||
# 从库数据源
|
||||
|
@ -58,4 +92,26 @@ spring:
|
|||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -0,0 +1,117 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: /data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8091
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://cd-cynosdbmysql-grp-9rqrhxsm.sql.tencentcdb.com:27981/yanzhu_jh_test?useSSL=false&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Sxyanzhu@cf
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 1
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
|
@ -1,38 +1,3 @@
|
|||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi
|
||||
# 版本
|
||||
version: 3.8.6
|
||||
# 版权年份
|
||||
copyrightYear: 2023
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/data/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8090
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /jhapi
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# 连接数满后的排队数,默认为100
|
||||
accept-count: 1000
|
||||
threads:
|
||||
# tomcat最大线程数,默认为200
|
||||
max: 800
|
||||
# Tomcat启动初始化的线程数,默认值10
|
||||
min-spare: 100
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
|
@ -68,28 +33,6 @@ spring:
|
|||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: 123456
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
|
|
@ -157,6 +157,12 @@
|
|||
<version>7.2.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -41,4 +41,9 @@ public class CacheConstants
|
|||
* 登录账户密码错误次数 redis key
|
||||
*/
|
||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||
|
||||
/**
|
||||
* yanzhu系统应用注册 redis key
|
||||
*/
|
||||
public static final String YANZHU_SYSTEM_CONFIG = "yanzhu_system_config:";
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@ public class SysUser extends BaseEntity
|
|||
@Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户类型 */
|
||||
private String userType;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
@ -297,6 +300,14 @@ public class SysUser extends BaseEntity
|
|||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户类型枚举
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum UserTypeEnum {
|
||||
|
||||
SYSTEM("00","系统用户"),
|
||||
APPLY("99","应用用户");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
UserTypeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021. 西安屹城兴软件服务 All rights reserved.
|
||||
*/
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* RSA加密解密
|
||||
**/
|
||||
public class AuthRsaUtils {
|
||||
|
||||
// Rsa 私钥
|
||||
public static String privateKey = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIcMS8aHgaLNdkABhwxcgsdAGu" +
|
||||
"Z1X7ZKg4EjshM4376qh4w3mnjxnY4aJCdvQVZVhLpL8cE9pje7veZ16BbLTFATB0/K34DaUterGVUv7p1NfwUxSILKaIZHAyRp9N" +
|
||||
"jLyFBVIY2fnT+1ZT9L7Ag6D1069AIxIcQw3VRt8HUNd0lBAgMBAAECgYBLPoOd2vRU5EuFgBRhw82t/L7ANxeb9spskpnucdrgXh" +
|
||||
"1l97ket+iEO3Z3blqmIsHwFs5dT98j4Hv/QySMRrt+dkI2WKUY5ZNKVvpbbZJoNJXd1mF3SyfsRTM73l8fRgJLfhvE+ufV2+dBFM" +
|
||||
"Nd8LsH8uTJo0aowHwgEXQ3ErZAAQJBAMh/FDQe/9Ku+1U67ABdifYl4CskfKNdd9srjYBBjw6NFmTZp3OEHxoWvTWDJMMC0uUBt5" +
|
||||
"BV3Sx3+230dBeAQkECQQCsbvm+iQYMYpVkHe0RGU3nEckaehrqCJXlviH7c6kM4l/taV495mCxwvNwNUizV5uBeLEyKB2RPLAj7U" +
|
||||
"b/10cBAkEAwIFrl6PQA60o+qupX6xwQ5wYQbQ1y/F5nEGUCnpn7hO/VbO52OsZpcYBg7jYejli3qkoY/hddU36ZpeZQ9tNQQJBAI" +
|
||||
"JJP661fbpx6orBCdS3l+MVzyuQQzG91vTGGosRsxOnH/AUgz6mCT2HHcUUnZ/UfAzxkoFhSiXpAvXCXLkGggECQCWKhootNjqoz6" +
|
||||
"txZheR5cpZTHNpAUwSSuqpFxK+rnv9PkEADZyaJKgsW4pHHtcUqUTBYQElDsSWOia86MubuyI=";
|
||||
|
||||
// Rsa 公钥
|
||||
public static String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCHDEvGh4GizXZAAYcMXILHQBrmdV+2SoOBI7I" +
|
||||
"TON++qoeMN5p48Z2OGiQnb0FWVYS6S/HBPaY3u73mdegWy0xQEwdPyt+A2lLXqxlVL+6dTX8FMUiCymiGRwMkafTYy8hQVSGNn50" +
|
||||
"/tWU/S+wIOg9dOvQCMSHEMN1UbfB1DXdJQQIDAQAB";
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param text 待解密的文本
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPrivateKey(String text) throws Exception {
|
||||
return decryptByPrivateKey(privateKey, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥解密
|
||||
*
|
||||
* @param publicKeyString 公钥
|
||||
* @param text 待解密的信息
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPublicKey(String publicKeyString, String text) throws Exception {
|
||||
X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, publicKey);
|
||||
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥加密
|
||||
*
|
||||
* @param privateKeyString 私钥
|
||||
* @param text 待加密的信息
|
||||
* @return 加密后的文本
|
||||
*/
|
||||
public static String encryptByPrivateKey(String privateKeyString, String text) throws Exception {
|
||||
PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
|
||||
byte[] result = cipher.doFinal(text.getBytes());
|
||||
return Base64.encodeBase64String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 私钥解密
|
||||
*
|
||||
* @param privateKeyString 私钥
|
||||
* @param text 待解密的文本
|
||||
* @return 解密后的文本
|
||||
*/
|
||||
public static String decryptByPrivateKey(String privateKeyString, String text) throws Exception {
|
||||
PKCS8EncodedKeySpec pkcs8EncodedKeySpec5 = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec5);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, privateKey);
|
||||
byte[] result = cipher.doFinal(Base64.decodeBase64(text));
|
||||
return new String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公钥加密
|
||||
*
|
||||
* @param publicKeyString 公钥
|
||||
* @param text 待加密的文本
|
||||
* @return 加密后的文本
|
||||
*/
|
||||
public static String encryptByPublicKey(String publicKeyString, String text) throws Exception {
|
||||
X509EncodedKeySpec x509EncodedKeySpec2 = new X509EncodedKeySpec(Base64.decodeBase64(publicKeyString));
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec2);
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] result = cipher.doFinal(text.getBytes());
|
||||
return Base64.encodeBase64String(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建RSA密钥对
|
||||
*
|
||||
* @return 生成后的公私钥信息
|
||||
*/
|
||||
public static RsaKeyPair generateKeyPair() throws NoSuchAlgorithmException {
|
||||
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
|
||||
keyPairGenerator.initialize(1024);
|
||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
||||
RSAPublicKey rsaPublicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
RSAPrivateKey rsaPrivateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
String publicKeyString = Base64.encodeBase64String(rsaPublicKey.getEncoded());
|
||||
String privateKeyString = Base64.encodeBase64String(rsaPrivateKey.getEncoded());
|
||||
return new RsaKeyPair(publicKeyString, privateKeyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA密钥对对象
|
||||
*/
|
||||
public static class RsaKeyPair {
|
||||
private final String publicKey;
|
||||
private final String privateKey;
|
||||
|
||||
public RsaKeyPair(String publicKey, String privateKey) {
|
||||
this.publicKey = publicKey;
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public String getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey() {
|
||||
return privateKey;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// try {
|
||||
// RsaKeyPair rsaKeyPair = generateKeyPair();
|
||||
// System.out.println("私钥:" + rsaKeyPair.getPrivateKey());
|
||||
// System.out.println("公钥:" + rsaKeyPair.getPublicKey());
|
||||
// } catch (NoSuchAlgorithmException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
|
||||
try {
|
||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||
String str = "oacsry" + timestamp;
|
||||
System.out.println("明文信息:" + str);
|
||||
// 公钥加密->私钥解密
|
||||
String encryptByPublicKeyStr = encryptByPublicKey(publicKey, str);
|
||||
System.out.println("公钥加密:" + encryptByPublicKeyStr);
|
||||
String decryptByPrivateKeyStr = decryptByPrivateKey(privateKey, encryptByPublicKeyStr);
|
||||
System.out.println("私钥解密:" + decryptByPrivateKeyStr);
|
||||
|
||||
System.out.println("***********************************");
|
||||
|
||||
// 私钥加密->公钥解密
|
||||
String encryptByPrivateKeyStr = encryptByPrivateKey(privateKey, str);
|
||||
System.out.println("私钥加密:" + encryptByPrivateKeyStr);
|
||||
String decryptByPublicKeyStr = decryptByPublicKey(publicKey, encryptByPrivateKeyStr);
|
||||
System.out.println("公钥解密:" + decryptByPublicKeyStr);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -143,7 +143,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "保存流程设计器内的xml文件")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody FlowSaveXmlVo vo) {
|
||||
|
@ -167,7 +166,6 @@ public class FlowDefinitionController extends BaseController {
|
|||
return AjaxResult.success("导入成功");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "发起流程")
|
||||
@Log(title = "发起流程", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/start/{procDefId}")
|
||||
|
|
|
@ -37,7 +37,6 @@ public class FlowInstanceController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "激活或挂起流程实例")
|
||||
@PostMapping(value = "/updateState")
|
||||
public AjaxResult updateState(@ApiParam(value = "1:激活,2:挂起", required = true) @RequestParam Integer state,
|
||||
|
|
|
@ -32,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
@RestController
|
||||
@RequestMapping("/flowable/form")
|
||||
public class SysFormController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysFormService SysFormService;
|
||||
|
||||
|
@ -105,10 +106,10 @@ public class SysFormController extends BaseController {
|
|||
return toAjax(SysFormService.deleteSysFormByIds(formIds));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 挂载流程表单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('flowable:form:edit')")
|
||||
@Log(title = "流程表单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addDeployForm")
|
||||
public AjaxResult addDeployForm(@RequestBody SysDeployForm sysDeployForm) {
|
||||
|
|
|
@ -100,6 +100,37 @@ public class SysLoginService
|
|||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一认证登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
*/
|
||||
public String unifiedLogin(String username, String password) {
|
||||
// 用户验证
|
||||
Authentication authentication = null;
|
||||
try {
|
||||
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
|
||||
AuthenticationContextHolder.setContext(authenticationToken);
|
||||
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
|
||||
authentication = authenticationManager.authenticate(authenticationToken);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BadCredentialsException) {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
} else {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
AuthenticationContextHolder.clearContext();
|
||||
}
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 系统应用注册对象 sys_apply_config
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
public class SysApplyConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 应用主键 */
|
||||
@Excel(name = "应用主键")
|
||||
private String appId;
|
||||
|
||||
/** 公钥 */
|
||||
private String publicKey;
|
||||
|
||||
/** 私钥 */
|
||||
private String privateKey;
|
||||
|
||||
/** 项目主键 */
|
||||
@Excel(name = "项目主键")
|
||||
private Long projectId;
|
||||
|
||||
/** 部门主键 */
|
||||
@Excel(name = "部门主键")
|
||||
private Long deptId;
|
||||
|
||||
/** 是否删除 */
|
||||
@Excel(name = "是否删除")
|
||||
private String isDel;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setAppId(String appId)
|
||||
{
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
public String getAppId()
|
||||
{
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setPublicKey(String publicKey)
|
||||
{
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
|
||||
public String getPublicKey()
|
||||
{
|
||||
return publicKey;
|
||||
}
|
||||
public void setPrivateKey(String privateKey)
|
||||
{
|
||||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public String getPrivateKey()
|
||||
{
|
||||
return privateKey;
|
||||
}
|
||||
public void setProjectId(Long projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Long getProjectId()
|
||||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
public void setIsDel(String isDel)
|
||||
{
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public String getIsDel()
|
||||
{
|
||||
return isDel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("appId", getAppId())
|
||||
.append("publicKey", getPublicKey())
|
||||
.append("privateKey", getPrivateKey())
|
||||
.append("projectId", getProjectId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("isDel", getIsDel())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
|
||||
/**
|
||||
* 系统应用注册Mapper接口
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
public interface SysApplyConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询系统应用注册
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 系统应用注册
|
||||
*/
|
||||
public SysApplyConfig selectSysApplyConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 系统应用注册集合
|
||||
*/
|
||||
public List<SysApplyConfig> selectSysApplyConfigList(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysApplyConfig(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysApplyConfig(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 删除系统应用注册
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysApplyConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除系统应用注册
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysApplyConfigByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
|
||||
/**
|
||||
* 系统应用注册Service接口
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
public interface ISysApplyConfigService
|
||||
{
|
||||
/**
|
||||
* 查询系统应用注册
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 系统应用注册
|
||||
*/
|
||||
public SysApplyConfig selectSysApplyConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 系统应用注册集合
|
||||
*/
|
||||
public List<SysApplyConfig> selectSysApplyConfigList(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysApplyConfig(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysApplyConfig(SysApplyConfig sysApplyConfig);
|
||||
|
||||
/**
|
||||
* 批量删除系统应用注册
|
||||
*
|
||||
* @param ids 需要删除的系统应用注册主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysApplyConfigByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除系统应用注册信息
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysApplyConfigById(Long id);
|
||||
|
||||
/**
|
||||
* 加载注册应用
|
||||
*/
|
||||
public void loadingSysApplyConfigCache();
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.SysApplyConfigMapper;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysApplyConfigService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 系统应用注册Service业务层处理
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Service
|
||||
public class SysApplyConfigServiceImpl implements ISysApplyConfigService
|
||||
{
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private SysApplyConfigMapper sysApplyConfigMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化注册应用到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init()
|
||||
{
|
||||
loadingSysApplyConfigCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载注册应用
|
||||
*/
|
||||
@Override
|
||||
public void loadingSysApplyConfigCache()
|
||||
{
|
||||
List<SysApplyConfig> configList = sysApplyConfigMapper.selectSysApplyConfigList(new SysApplyConfig());
|
||||
if(CollectionUtils.isNotEmpty(configList)){
|
||||
for (SysApplyConfig sysApplyConfig : configList) {
|
||||
redisCache.setCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG + sysApplyConfig.getAppId(), sysApplyConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统应用注册
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 系统应用注册
|
||||
*/
|
||||
@Override
|
||||
public SysApplyConfig selectSysApplyConfigById(Long id)
|
||||
{
|
||||
return sysApplyConfigMapper.selectSysApplyConfigById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 系统应用注册
|
||||
*/
|
||||
@Override
|
||||
public List<SysApplyConfig> selectSysApplyConfigList(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
return sysApplyConfigMapper.selectSysApplyConfigList(sysApplyConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysApplyConfig(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
sysApplyConfig.setCreateBy(SecurityUtils.getUsername());
|
||||
sysApplyConfig.setCreateTime(DateUtils.getNowDate());
|
||||
int res = sysApplyConfigMapper.insertSysApplyConfig(sysApplyConfig);
|
||||
if(res>0){
|
||||
this.loadingSysApplyConfigCache();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*
|
||||
* @param sysApplyConfig 系统应用注册
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysApplyConfig(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
sysApplyConfig.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysApplyConfig.setUpdateTime(DateUtils.getNowDate());
|
||||
int res = sysApplyConfigMapper.updateSysApplyConfig(sysApplyConfig);
|
||||
if(res>0){
|
||||
this.loadingSysApplyConfigCache();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统应用注册
|
||||
*
|
||||
* @param ids 需要删除的系统应用注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysApplyConfigByIds(Long[] ids)
|
||||
{
|
||||
int res = sysApplyConfigMapper.deleteSysApplyConfigByIds(ids);
|
||||
if(res>0){
|
||||
this.loadingSysApplyConfigCache();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统应用注册信息
|
||||
*
|
||||
* @param id 系统应用注册主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysApplyConfigById(Long id)
|
||||
{
|
||||
int res = sysApplyConfigMapper.deleteSysApplyConfigById(id);
|
||||
if(res>0){
|
||||
this.loadingSysApplyConfigCache();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -564,4 +570,5 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
public List<Long> selectUserRoles(String phonenumber) {
|
||||
return userRoleMapper.selectUserRoles(phonenumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
<?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.SysApplyConfigMapper">
|
||||
|
||||
<resultMap type="SysApplyConfig" id="SysApplyConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="appId" column="app_id" />
|
||||
<result property="publicKey" column="public_key" />
|
||||
<result property="privateKey" column="private_key" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="isDel" column="is_del" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysApplyConfigVo">
|
||||
select id, app_id, public_key, private_key, project_id, dept_id, is_del, create_by, create_time, update_by, update_time, remark from sys_apply_config
|
||||
</sql>
|
||||
|
||||
<select id="selectSysApplyConfigList" parameterType="SysApplyConfig" resultMap="SysApplyConfigResult">
|
||||
<include refid="selectSysApplyConfigVo"/>
|
||||
<where>
|
||||
<if test="appId != null "> and app_id like concat('%', #{appId}, '%')</if>
|
||||
<if test="projectId != null "> and project_id like concat('%', #{projectId}, '%')</if>
|
||||
<if test="deptId != null "> and dept_id like concat('%', #{deptId}, '%')</if>
|
||||
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysApplyConfigById" parameterType="Long" resultMap="SysApplyConfigResult">
|
||||
<include refid="selectSysApplyConfigVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysApplyConfig" parameterType="SysApplyConfig">
|
||||
insert into sys_apply_config
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="publicKey != null">public_key,</if>
|
||||
<if test="privateKey != null">private_key,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="isDel != null">is_del,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="publicKey != null">#{publicKey},</if>
|
||||
<if test="privateKey != null">#{privateKey},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="isDel != null">#{isDel},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysApplyConfig" parameterType="SysApplyConfig">
|
||||
update sys_apply_config
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="publicKey != null">public_key = #{publicKey},</if>
|
||||
<if test="privateKey != null">private_key = #{privateKey},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysApplyConfigById" parameterType="Long">
|
||||
delete from sys_apply_config where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysApplyConfigByIds" parameterType="String">
|
||||
delete from sys_apply_config where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -84,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
||||
</if>
|
||||
AND user_type != '99'
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
@ -101,6 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
AND user_type != '99'
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
@ -119,6 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
AND user_type != '99'
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
@ -159,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="userType != null and userType != ''">user_type,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
|
@ -173,6 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="userType != null and userType != ''">#{userType},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询系统应用注册列表
|
||||
export function listApplyConfig(query) {
|
||||
return request({
|
||||
url: '/system/applyConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询系统应用注册详细
|
||||
export function getApplyConfig(id) {
|
||||
return request({
|
||||
url: '/system/applyConfig/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增系统应用注册
|
||||
export function addApplyConfig(data) {
|
||||
return request({
|
||||
url: '/system/applyConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改系统应用注册
|
||||
export function updateApplyConfig(data) {
|
||||
return request({
|
||||
url: '/system/applyConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除系统应用注册
|
||||
export function delApplyConfig(id) {
|
||||
return request({
|
||||
url: '/system/applyConfig/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,322 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="应用主键" prop="appId">
|
||||
<el-input
|
||||
v-model="queryParams.appId"
|
||||
placeholder="请输入应用主键"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="项目主键" prop="projectId">
|
||||
<el-input
|
||||
v-model="queryParams.projectId"
|
||||
placeholder="请输入项目主键"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门主键" prop="deptId">
|
||||
<el-input
|
||||
v-model="queryParams.deptId"
|
||||
placeholder="请输入部门主键"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="isDel">
|
||||
<el-select v-model="queryParams.isDel" placeholder="请选择是否删除" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_common_isdel"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:applyConfig:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:applyConfig:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:applyConfig:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:applyConfig:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="applyConfigList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="应用主键" align="center" prop="appId" />
|
||||
<el-table-column label="项目主键" align="center" prop="projectId" />
|
||||
<el-table-column label="部门主键" align="center" prop="deptId" />
|
||||
<el-table-column label="是否删除" align="center" prop="isDel">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_common_isdel" :value="scope.row.isDel"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:applyConfig:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:applyConfig:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改系统应用注册对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="应用主键" prop="appId">
|
||||
<el-input v-model="form.appId" placeholder="请输入应用主键" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公钥" prop="publicKey">
|
||||
<el-input v-model="form.publicKey" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="私钥" prop="privateKey">
|
||||
<el-input v-model="form.privateKey" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目主键" prop="projectId">
|
||||
<el-input v-model="form.projectId" placeholder="请输入项目主键" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门主键" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门主键" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="isDel">
|
||||
<el-select v-model="form.isDel" placeholder="请选择是否删除">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_common_isdel"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listApplyConfig, getApplyConfig, delApplyConfig, addApplyConfig, updateApplyConfig } from "@/api/system/applyConfig";
|
||||
|
||||
export default {
|
||||
name: "ApplyConfig",
|
||||
dicts: ['sys_common_isdel'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 系统应用注册表格数据
|
||||
applyConfigList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
appId: null,
|
||||
projectId: null,
|
||||
deptId: null,
|
||||
isDel: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询系统应用注册列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listApplyConfig(this.queryParams).then(response => {
|
||||
this.applyConfigList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
appId: null,
|
||||
publicKey: null,
|
||||
privateKey: null,
|
||||
projectId: null,
|
||||
deptId: null,
|
||||
isDel: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加系统应用注册";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getApplyConfig(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改系统应用注册";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateApplyConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addApplyConfig(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除系统应用注册编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delApplyConfig(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/applyConfig/export', {
|
||||
...this.queryParams
|
||||
}, `applyConfig_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -26,6 +26,7 @@ public class DeptController extends BaseController {
|
|||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(){
|
||||
long roleId=SecurityUtils.getRoleId();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<artifactId>hutool-poi</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -24,17 +24,21 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
@Excel(name = "配置项ID,可以获取项目ID和总包ID")
|
||||
private Long cfgid;
|
||||
|
||||
/** 注册应用ID */
|
||||
@Excel(name = "注册应用ID")
|
||||
private String appId;
|
||||
|
||||
/** 厂商编号参考字典attendance_vendors */
|
||||
@Excel(name = "厂商编号参考字典attendance_vendors")
|
||||
private String vendorsCode;
|
||||
|
||||
/** 服务端ID */
|
||||
@Excel(name = "服务端ID")
|
||||
private Long serverid;
|
||||
private String serverid;
|
||||
|
||||
/** 工人Id */
|
||||
@Excel(name = "工人Id")
|
||||
private Long workerId;
|
||||
private String workerId;
|
||||
|
||||
/** 进门还是出门E进,L出 */
|
||||
@Excel(name = "进门还是出门E进,L出")
|
||||
|
@ -98,8 +102,8 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
public static SurProjectAttendanceData createFromHuazhu(JSONObject j) {
|
||||
SurProjectAttendanceData d=new SurProjectAttendanceData();
|
||||
d.vendorsCode="huazhu";
|
||||
d.serverid=j.getLongValue("id",0);
|
||||
d.workerId=j.getLongValue("labourWorkerId",0);
|
||||
d.serverid=j.getString("id");
|
||||
d.workerId=j.getString("labourWorkerId");
|
||||
d.attendanceType=j.getLongValue("inOrOut",1l)==1l?"E":"L";
|
||||
long recordTime=j.getLongValue("recordTime",0);
|
||||
if(recordTime>0){
|
||||
|
@ -152,8 +156,8 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
SurProjectAttendanceData d=new SurProjectAttendanceData();
|
||||
d.attendanceTime=json.getString("time");
|
||||
d.attendanceType=json.getString("type");
|
||||
d.serverid=json.getLong("id");
|
||||
d.workerId=json.getLong("workerId");
|
||||
d.serverid=json.getString("id");
|
||||
d.workerId=json.getString("workerId");
|
||||
d.identification=json.getString("identification");
|
||||
d.teamId=json.getLong("teamId");
|
||||
d.workTypeCode=json.getString("workerTypeId");
|
||||
|
@ -196,21 +200,21 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
{
|
||||
return vendorsCode;
|
||||
}
|
||||
public void setServerid(Long serverid)
|
||||
public void setServerid(String serverid)
|
||||
{
|
||||
this.serverid = serverid;
|
||||
}
|
||||
|
||||
public Long getServerid()
|
||||
public String getServerid()
|
||||
{
|
||||
return serverid;
|
||||
}
|
||||
public void setWorkerId(Long workerId)
|
||||
public void setWorkerId(String workerId)
|
||||
{
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public Long getWorkerId()
|
||||
public String getWorkerId()
|
||||
{
|
||||
return workerId;
|
||||
}
|
||||
|
@ -341,6 +345,14 @@ public class SurProjectAttendanceData extends BaseEntity
|
|||
return isDel;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -26,9 +26,13 @@ public class SurProjectAttendanceGroup extends BaseEntity
|
|||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long cfgid;
|
||||
|
||||
/** 注册应用ID */
|
||||
@Excel(name = "注册应用ID")
|
||||
private String appId;
|
||||
|
||||
/** 服务器主键id */
|
||||
@Excel(name = "服务器主键id")
|
||||
private Long serverid;
|
||||
private String serverid;
|
||||
|
||||
/** 营业执照号 */
|
||||
@Excel(name = "营业执照号")
|
||||
|
@ -108,7 +112,7 @@ public class SurProjectAttendanceGroup extends BaseEntity
|
|||
|
||||
public static SurProjectAttendanceGroup create(JSONObject json) {
|
||||
SurProjectAttendanceGroup g=new SurProjectAttendanceGroup();
|
||||
g.serverid=json.getLong("id");
|
||||
g.serverid=json.getString("id");
|
||||
g.bizLicense=json.getString("bizLicense");
|
||||
g.companyCode=json.getString("companyCode");
|
||||
g.companyId=json.getLong("companyId");
|
||||
|
@ -150,12 +154,12 @@ public class SurProjectAttendanceGroup extends BaseEntity
|
|||
{
|
||||
return cfgid;
|
||||
}
|
||||
public void setServerid(Long serverid)
|
||||
public void setServerid(String serverid)
|
||||
{
|
||||
this.serverid = serverid;
|
||||
}
|
||||
|
||||
public Long getServerid()
|
||||
public String getServerid()
|
||||
{
|
||||
return serverid;
|
||||
}
|
||||
|
@ -331,6 +335,14 @@ public class SurProjectAttendanceGroup extends BaseEntity
|
|||
return isDel;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -26,13 +26,17 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
@Excel(name = "配置项ID,可以获取项目ID和总包ID")
|
||||
private Long cfgid;
|
||||
|
||||
/** 注册应用ID */
|
||||
@Excel(name = "注册应用ID")
|
||||
private String appId;
|
||||
|
||||
/** 厂商编号参考字典attendance_vendors */
|
||||
@Excel(name = "厂商编号参考字典attendance_vendors")
|
||||
private String vendorsCode;
|
||||
|
||||
/** 工人id */
|
||||
@Excel(name = "工人id")
|
||||
private Long workerId;
|
||||
private String workerId;
|
||||
|
||||
/** 项目工人履历id对于旧劳务,这个字段相当于工人的projectWorkerId,管理人员的registerManagerId */
|
||||
@Excel(name = "项目工人履历id对于旧劳务,这个字段相当于工人的projectWorkerId,管理人员的registerManagerId")
|
||||
|
@ -159,7 +163,7 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
|
||||
public static SurProjectAttendanceUser createFromHuazhu(JSONObject j) {
|
||||
SurProjectAttendanceUser u=new SurProjectAttendanceUser();
|
||||
u.workerId=j.getLongValue("id",0);
|
||||
u.workerId=j.getString("id");
|
||||
u.name=j.getString("name");
|
||||
u.ethnic=j.getString("nationalName");
|
||||
u.nativePlace=j.getString("provinceName")+j.getString("cityName");
|
||||
|
@ -254,7 +258,7 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
|
||||
public static SurProjectAttendanceUser create(JSONObject json) {
|
||||
SurProjectAttendanceUser u=new SurProjectAttendanceUser();
|
||||
u.workerId=json.getLongValue("workerId",0);
|
||||
u.workerId=json.getString("workerId");
|
||||
u.laborWorkerId=json.getLongValue("laborWorkerId",0);
|
||||
u.workerCategory=json.getLongValue("workerCategory",0);
|
||||
u.qrCode=json.getLongValue("qrCode",0);
|
||||
|
@ -312,12 +316,12 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
{
|
||||
return vendorsCode;
|
||||
}
|
||||
public void setWorkerId(Long workerId)
|
||||
public void setWorkerId(String workerId)
|
||||
{
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public Long getWorkerId()
|
||||
public String getWorkerId()
|
||||
{
|
||||
return workerId;
|
||||
}
|
||||
|
@ -592,6 +596,14 @@ public class SurProjectAttendanceUser extends BaseEntity
|
|||
return isDel;
|
||||
}
|
||||
|
||||
public String getAppId() {
|
||||
return appId;
|
||||
}
|
||||
|
||||
public void setAppId(String appId) {
|
||||
this.appId = appId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -59,7 +59,23 @@ public interface SurProjectAttendanceDataMapper
|
|||
*/
|
||||
public int deleteSurProjectAttendanceDataByIds(Long[] ids);
|
||||
|
||||
public long getLastServerId(SurProjectAttendanceData where);
|
||||
/**
|
||||
* 批量删除劳务实名制管理
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceDataByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增劳务实名制考勤管理
|
||||
*
|
||||
* @param SurProjectAttendanceDataList 劳务实名制考勤管理列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceData(List<SurProjectAttendanceData> SurProjectAttendanceDataList);
|
||||
|
||||
public String getLastServerId(SurProjectAttendanceData where);
|
||||
|
||||
List<SurProjectAttendanceData> groupByComany(SurProjectAttendanceData where);
|
||||
|
||||
|
|
|
@ -58,4 +58,20 @@ public interface SurProjectAttendanceGroupMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceGroupByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除广联达班组信息
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceGroupByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增广联达班组信息
|
||||
*
|
||||
* @param surProjectAttendanceGroupList 广联达班组信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceGroup(List<SurProjectAttendanceGroup> surProjectAttendanceGroupList);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,22 @@ public interface SurProjectAttendanceUserMapper
|
|||
*/
|
||||
public int deleteSurProjectAttendanceUserByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除考勤人员基本属性
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceUserByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增考勤人员基本属性
|
||||
*
|
||||
* @param surProjectAttendanceUserList 考勤人员基本属性列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceUser(List<SurProjectAttendanceUser> surProjectAttendanceUserList);
|
||||
|
||||
public List<SurProjectAttendanceUser> queryAttendanceData(SurProjectAttendanceCfg where);
|
||||
|
||||
public long countTodayAttendance(SurProjectAttendanceUser where);
|
||||
|
|
|
@ -60,9 +60,25 @@ public interface ISurProjectAttendanceDataService
|
|||
*/
|
||||
public int deleteSurProjectAttendanceDataById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除劳务实名制管理
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceDataByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增劳务实名制考勤管理
|
||||
*
|
||||
* @param SurProjectAttendanceDataList 劳务实名制管理考勤列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceData(List<SurProjectAttendanceData> SurProjectAttendanceDataList);
|
||||
|
||||
public void add(SurProjectAttendanceData sdata);
|
||||
|
||||
public long getLastServerId(SurProjectAttendanceData where);
|
||||
public String getLastServerId(SurProjectAttendanceData where);
|
||||
|
||||
public List<SurProjectAttendanceData> groupByComany(SurProjectAttendanceData where);
|
||||
|
||||
|
|
|
@ -59,5 +59,21 @@ public interface ISurProjectAttendanceGroupService
|
|||
*/
|
||||
public int deleteSurProjectAttendanceGroupById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除广联达班组信息
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceGroupByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增广联达班组信息
|
||||
*
|
||||
* @param surProjectAttendanceGroupList 广联达班组信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceGroup(List<SurProjectAttendanceGroup> surProjectAttendanceGroupList);
|
||||
|
||||
public void add(SurProjectAttendanceGroup group);
|
||||
}
|
||||
|
|
|
@ -61,6 +61,22 @@ public interface ISurProjectAttendanceUserService
|
|||
*/
|
||||
public int deleteSurProjectAttendanceUserById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除考勤人员基本属性
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSurProjectAttendanceUserByParams(List<String> list);
|
||||
|
||||
/**
|
||||
* 批量新增考勤人员基本属性
|
||||
*
|
||||
* @param surProjectAttendanceUserList 考勤人员基本属性列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchSurProjectAttendanceUser(List<SurProjectAttendanceUser> surProjectAttendanceUserList);
|
||||
|
||||
public void add(SurProjectAttendanceUser user);
|
||||
|
||||
public List<SurProjectAttendanceUser> queryAttendanceData(SurProjectAttendanceCfg where);
|
||||
|
|
|
@ -97,6 +97,28 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
return surProjectAttendanceDataMapper.deleteSurProjectAttendanceDataById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除劳务实名制管理
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSurProjectAttendanceDataByParams(List<String> list) {
|
||||
return surProjectAttendanceDataMapper.deleteSurProjectAttendanceDataByParams(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增劳务实名制考勤管理
|
||||
*
|
||||
* @param SurProjectAttendanceDataList 劳务实名制考勤管理列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchSurProjectAttendanceData(List<SurProjectAttendanceData> SurProjectAttendanceDataList) {
|
||||
return surProjectAttendanceDataMapper.batchSurProjectAttendanceData(SurProjectAttendanceDataList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceData sdata) {
|
||||
SurProjectAttendanceData where=new SurProjectAttendanceData();
|
||||
|
@ -113,7 +135,7 @@ public class SurProjectAttendanceDataServiceImpl implements ISurProjectAttendanc
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getLastServerId(SurProjectAttendanceData where) {
|
||||
public String getLastServerId(SurProjectAttendanceData where) {
|
||||
return surProjectAttendanceDataMapper.getLastServerId(where);
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,28 @@ public class SurProjectAttendanceGroupServiceImpl implements ISurProjectAttendan
|
|||
return surProjectAttendanceGroupMapper.deleteSurProjectAttendanceGroupById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除广联达班组信息
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSurProjectAttendanceGroupByParams(List<String> list) {
|
||||
return surProjectAttendanceGroupMapper.deleteSurProjectAttendanceGroupByParams(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增广联达班组信息
|
||||
*
|
||||
* @param surProjectAttendanceGroupList 广联达班组信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchSurProjectAttendanceGroup(List<SurProjectAttendanceGroup> surProjectAttendanceGroupList) {
|
||||
return surProjectAttendanceGroupMapper.batchSurProjectAttendanceGroup(surProjectAttendanceGroupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceGroup group) {
|
||||
SurProjectAttendanceGroup where=new SurProjectAttendanceGroup();
|
||||
|
|
|
@ -98,6 +98,28 @@ public class SurProjectAttendanceUserServiceImpl implements ISurProjectAttendanc
|
|||
return surProjectAttendanceUserMapper.deleteSurProjectAttendanceUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除考勤人员基本属性
|
||||
*
|
||||
* @param list 需要删除的数据参数集合
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSurProjectAttendanceUserByParams(List<String> list) {
|
||||
return surProjectAttendanceUserMapper.deleteSurProjectAttendanceUserByParams(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增考勤人员基本属性
|
||||
*
|
||||
* @param surProjectAttendanceUserList 考勤人员基本属性列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchSurProjectAttendanceUser(List<SurProjectAttendanceUser> surProjectAttendanceUserList) {
|
||||
return surProjectAttendanceUserMapper.batchSurProjectAttendanceUser(surProjectAttendanceUserList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(SurProjectAttendanceUser user) {
|
||||
SurProjectAttendanceUser where=new SurProjectAttendanceUser();
|
||||
|
|
|
@ -166,7 +166,7 @@ public class AttendanceTask {
|
|||
String projectId=jo.getString("projectId");
|
||||
SurProjectAttendanceData dwhere=new SurProjectAttendanceData();
|
||||
dwhere.setCfgid(it.getId());
|
||||
long startId=attendanceDataService.getLastServerId(dwhere);
|
||||
String startId=attendanceDataService.getLastServerId(dwhere);
|
||||
doSyncAttendanceData(appId,secret,projectId,startId,it);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
|
@ -174,7 +174,7 @@ public class AttendanceTask {
|
|||
}
|
||||
}
|
||||
}
|
||||
private void doSyncAttendanceData(String appid,String secret,String projectld,long id,SurProjectAttendanceCfg it){
|
||||
private void doSyncAttendanceData(String appid,String secret,String projectld,String id,SurProjectAttendanceCfg it){
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("projectId", projectld);
|
||||
params.put("startId",""+id);
|
||||
|
@ -194,7 +194,7 @@ public class AttendanceTask {
|
|||
String data=getResult(request);
|
||||
JSONObject jo= JSON.parseObject(data);
|
||||
JSONArray arr=jo.getJSONArray("data");
|
||||
long lastId=0;
|
||||
String lastId= "0";
|
||||
if(arr!=null && arr.size()>0){
|
||||
for(int i=0;i<arr.size();i++){
|
||||
JSONObject json=arr.getJSONObject(i);
|
||||
|
@ -244,8 +244,6 @@ public class AttendanceTask {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getResult(Request request) {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
Response response;
|
||||
|
@ -261,6 +259,7 @@ public class AttendanceTask {
|
|||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
private static String getSign(Map<String,Object> paramsMap,String appSecret){
|
||||
List<String> paramsList = new ArrayList<>();
|
||||
paramsMap.forEach((s, o) -> {
|
||||
|
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="SurProjectAttendanceData" id="SurProjectAttendanceDataResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgid" column="cfgid" />
|
||||
<result property="appId" column="app_id" />
|
||||
<result property="vendorsCode" column="vendors_code" />
|
||||
<result property="serverid" column="serverid" />
|
||||
<result property="workerId" column="workerId" />
|
||||
|
@ -48,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectSurProjectAttendanceDataVo"/>
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="appId != null "> and app_id = #{appId}</if>
|
||||
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
|
||||
<if test="serverid != null "> and serverid = #{serverid}</if>
|
||||
<if test="workerId != null "> and workerId = #{workerId}</if>
|
||||
|
@ -77,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into sur_project_attendance_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="vendorsCode != null">vendors_code,</if>
|
||||
<if test="serverid != null">serverid,</if>
|
||||
<if test="workerId != null">workerId,</if>
|
||||
|
@ -102,6 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">#{cfgid},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="vendorsCode != null">#{vendorsCode},</if>
|
||||
<if test="serverid != null">#{serverid},</if>
|
||||
<if test="workerId != null">#{workerId},</if>
|
||||
|
@ -131,6 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update sur_project_attendance_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid = #{cfgid},</if>
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="vendorsCode != null">vendors_code = #{vendorsCode},</if>
|
||||
<if test="serverid != null">serverid = #{serverid},</if>
|
||||
<if test="workerId != null">workerId = #{workerId},</if>
|
||||
|
@ -167,6 +172,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSurProjectAttendanceDataByParams" parameterType="String">
|
||||
delete from sur_project_attendance_data where CONCAT(app_id,'-',serverid,'-',workerId) in
|
||||
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchSurProjectAttendanceData">
|
||||
insert into sur_project_attendance_data( id, cfgid, app_id, vendors_code, serverid, workerId, attendance_type, attendance_time, identification, teamId, workTypeCode, companyId, vendorId, projectType, device_code, work_point_id, scanPhoto, other, state, remark, is_del, create_by, create_time, update_by, update_time) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.cfgid},#{item.appId}, #{item.vendorsCode}, #{item.serverid}, #{item.workerId}, #{item.attendanceType}, #{item.attendanceTime}, #{item.identification}, #{item.teamId}, #{item.workTypeCode}, #{item.companyId}, #{item.vendorId}, #{item.projectType}, #{item.deviceCode}, #{item.workPointId}, #{item.scanPhoto}, #{item.other}, #{item.state}, #{item.remark}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getLastServerId" parameterType="SurProjectAttendanceData" resultType="Long">
|
||||
SELECT IF(MAX(serverid),MAX(serverid),0) serverid FROM sur_project_attendance_data WHERE cfgid=#{cfgid}
|
||||
</select>
|
||||
|
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="SurProjectAttendanceGroup" id="SurProjectAttendanceGroupResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgid" column="cfgid" />
|
||||
<result property="appId" column="app_id" />
|
||||
<result property="serverid" column="serverid" />
|
||||
<result property="bizLicense" column="bizLicense" />
|
||||
<result property="companyCode" column="companyCode" />
|
||||
|
@ -36,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSurProjectAttendanceGroupVo">
|
||||
select id, cfgid, serverid, bizLicense, companyCode, companyId, companyName, companyTypeId, vendorId, name, leaderName, leaderPhone, teamId, teamName, type, leaderId, deleted, createTime, platformGroupId, platformTeamId, enterDate, exitDate, remark, is_del, create_by, create_time, update_by, update_time
|
||||
select id, cfgid, app_id, serverid, bizLicense, companyCode, companyId, companyName, companyTypeId, vendorId, name, leaderName, leaderPhone, teamId, teamName, type, leaderId, deleted, createTime, platformGroupId, platformTeamId, enterDate, exitDate, remark, is_del, create_by, create_time, update_by, update_time
|
||||
from vw_sur_project_attendance_group
|
||||
</sql>
|
||||
|
||||
|
@ -44,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectSurProjectAttendanceGroupVo"/>
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="appId != null "> and app_id = #{appId}</if>
|
||||
<if test="serverid != null "> and serverid = #{serverid}</if>
|
||||
<if test="bizLicense != null and bizLicense != ''"> and bizLicense = #{bizLicense}</if>
|
||||
<if test="companyCode != null and companyCode != ''"> and companyCode = #{companyCode}</if>
|
||||
|
@ -72,11 +74,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectSurProjectAttendanceGroupVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertSurProjectAttendanceGroup" parameterType="SurProjectAttendanceGroup" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sur_project_attendance_group
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="serverid != null">serverid,</if>
|
||||
<if test="bizLicense != null">bizLicense,</if>
|
||||
<if test="companyCode != null">companyCode,</if>
|
||||
|
@ -106,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">#{cfgid},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="serverid != null">#{serverid},</if>
|
||||
<if test="bizLicense != null">#{bizLicense},</if>
|
||||
<if test="companyCode != null">#{companyCode},</if>
|
||||
|
@ -139,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update sur_project_attendance_group
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid = #{cfgid},</if>
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="serverid != null">serverid = #{serverid},</if>
|
||||
<if test="bizLicense != null">bizLicense = #{bizLicense},</if>
|
||||
<if test="companyCode != null">companyCode = #{companyCode},</if>
|
||||
|
@ -179,4 +184,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSurProjectAttendanceGroupByParams" parameterType="String">
|
||||
delete from sur_project_attendance_group where CONCAT(app_id,'-',serverid) in
|
||||
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchSurProjectAttendanceGroup">
|
||||
insert into sur_project_attendance_data(id,cfgid,app_id,serverid,bizLicense,companyCode,companyId,companyName,companyTypeId,vendorId,name,leaderName,leaderPhone,teamId,teamName,type,leaderId,deleted,createTime,platformGroupId,platformTeamId,enterDate,exitDate,remark,create_by,create_time,update_by,update_time) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.id}, #{item.cfgid}, #{item.appId}, #{item.serverid}, #{item.bizLicense}, #{item.companyCode}, #{item.companyId}, #{item.companyName},#{item.companyTypeId}, #{item.vendorId}, #{item.name}, #{item.leaderName}, #{item.leaderPhone}, #{item.teamId}, #{item.teamName}, #{item.type}, #{item.leaderId}, #{item.deleted}, #{item.createTime}, #{item.platformGroupId}, #{item.platformTeamId}, #{item.enterDate},
|
||||
#{item.exitDate}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="SurProjectAttendanceUser" id="SurProjectAttendanceUserResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgid" column="cfgid" />
|
||||
<result property="appId" column="app_id" />
|
||||
<result property="vendorsCode" column="vendors_code" />
|
||||
<result property="workerId" column="workerId" />
|
||||
<result property="laborWorkerId" column="laborWorkerId" />
|
||||
|
@ -60,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectSurProjectAttendanceUserVo"/>
|
||||
<where>
|
||||
<if test="cfgid != null "> and cfgid = #{cfgid}</if>
|
||||
<if test="appId != null "> and app_id = #{appId}</if>
|
||||
<if test="vendorsCode != null and vendorsCode != ''"> and vendors_code = #{vendorsCode}</if>
|
||||
<if test="workerId != null "> and workerId = #{workerId}</if>
|
||||
<if test="laborWorkerId != null "> and laborWorkerId = #{laborWorkerId}</if>
|
||||
|
@ -106,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into sur_project_attendance_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid,</if>
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="vendorsCode != null">vendors_code,</if>
|
||||
<if test="workerId != null">workerId,</if>
|
||||
<if test="laborWorkerId != null">laborWorkerId,</if>
|
||||
|
@ -146,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cfgid != null">#{cfgid},</if>
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="vendorsCode != null">#{vendorsCode},</if>
|
||||
<if test="workerId != null">#{workerId},</if>
|
||||
<if test="laborWorkerId != null">#{laborWorkerId},</if>
|
||||
|
@ -190,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update sur_project_attendance_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="cfgid != null">cfgid = #{cfgid},</if>
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="vendorsCode != null">vendors_code = #{vendorsCode},</if>
|
||||
<if test="workerId != null">workerId = #{workerId},</if>
|
||||
<if test="laborWorkerId != null">laborWorkerId = #{laborWorkerId},</if>
|
||||
|
@ -241,6 +246,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSurProjectAttendanceUserByParams" parameterType="String">
|
||||
delete from sur_project_attendance_user where CONCAT(app_id,'-',workerId) in
|
||||
<foreach collection="list" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="batchSurProjectAttendanceUser">
|
||||
insert into sur_project_attendance_user( id, cfgid, vendors_code, workerId, laborWorkerId, workerCategory, qrCode, name, ethnic, nativePlace, gender, birthDate, phone, degreeName, photo, recentPhoto, groupId, groupName, leader, workTypeCode, workTypeName, specWorkType, hatCode, state, enterDate, exitDate, companyId, companyName, vendorId, teamId, teamName, enterType, other, remark, is_del, create_by, create_time, update_by, update_time) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.cfgid}, #{item.vendorsCode}, #{item.workerId}, #{item.laborWorkerId}, #{item.workerCategory}, #{item.qrCode}, #{item.name}, #{item.ethnic}, #{item.nativePlace}, #{item.gender}, #{item.birthDate}, #{item.phone}, #{item.degreeName}, #{item.photo}, #{item.recentPhoto}, #{item.groupId}, #{item.groupName}, #{item.leader}, #{item.workTypeCode}, #{item.workTypeName}, #{item.specWorkType}, #{item.hatCode}, #{item.state}, #{item.enterDate}, #{item.exitDate}, #{item.companyId}, #{item.companyName}, #{item.vendorId}, #{item.teamId}, #{item.teamName}, #{item.enterType}, #{item.other}, #{item.remark}, #{item.isDel}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<sql id="sqlAttendanceData">
|
||||
(
|
||||
SELECT * FROM sur_project_attendance_data WHERE DATE(attendance_time)=date(#{createBy}) AND cfgid IN (
|
||||
|
|
Loading…
Reference in New Issue