提交代码
parent
e0b57d70b0
commit
183709ccb7
|
@ -110,6 +110,16 @@ public interface RemoteUserService
|
|||
@PostMapping("/user/register")
|
||||
public R<Long> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/user/registerAppIdUser")
|
||||
public R<Long> registerAppIdUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 删除用户角色
|
||||
*
|
||||
|
|
|
@ -83,6 +83,12 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
return R.fail("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Long> registerAppIdUserInfo(SysUser sysUser, String source)
|
||||
{
|
||||
return R.fail("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Long> removeUserRoles(SysUser sysUser, String source)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.yanzhu.common.core.enums;
|
||||
|
||||
|
||||
import com.yanzhu.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 是否状态
|
||||
*
|
||||
* @author JiangYuQi
|
||||
*/
|
||||
public enum ShiFouEnum {
|
||||
|
||||
FOU("0", "否"), SHI("1", "是");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
ShiFouEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
public Long getLongCode()
|
||||
{
|
||||
return Convert.toLong(code);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ public enum UserTypeEnums {
|
|||
|
||||
XTRY("00", "正式人员","key"),
|
||||
XMRY("08", "项目人员","key"),
|
||||
DJRY("98", "对接人员","key"),
|
||||
QTRY("99", "其它人员","key"),
|
||||
FBWTDL("80", "分包代理人","fbwtdl"),
|
||||
FBXMJL("79", "分包项目经理","fbxmjl"),
|
||||
|
|
|
@ -34,4 +34,25 @@ public class NoUtils {
|
|||
return ++Seq;
|
||||
}
|
||||
|
||||
private static final String APPPREFIX = "yzkj";
|
||||
private static int COUNTER = 0;
|
||||
|
||||
/**
|
||||
* 生成appId
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2023-11-07
|
||||
*/
|
||||
public static String createAppId() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String sequencePart = String.format("%03d", getContractNextSequence());
|
||||
return APPPREFIX + timestamp+ StringUtils.randomString(5) + sequencePart;
|
||||
}
|
||||
|
||||
private static synchronized int getContractNextSequence() {
|
||||
if (COUNTER >= 999) {
|
||||
COUNTER = 0;
|
||||
}
|
||||
return ++COUNTER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -769,4 +769,27 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||
}
|
||||
}
|
||||
|
||||
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||
|
||||
/**
|
||||
* 获取随机字符串
|
||||
*
|
||||
* @param length 长度
|
||||
* @return 返回指定长度的随机字符串。
|
||||
*/
|
||||
public static String randomString(int length) {
|
||||
if (length < 1) {
|
||||
length = 1;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int randomIndex = random.nextInt(CHARACTERS.length());
|
||||
char randomChar = CHARACTERS.charAt(randomIndex);
|
||||
sb.append(randomChar);
|
||||
}
|
||||
String randomString = sb.toString();
|
||||
return randomString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,11 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.*;
|
||||
import java.net.ConnectException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用http发送方法
|
||||
|
@ -182,6 +181,57 @@ public class HttpUtils
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param reqUrl 发送请求的 URL
|
||||
* @param reqJson 请求参数,请求参数应该是 JSON 的形式。
|
||||
* @param headerMap 请求头部,头部参数应该是 MAPS 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendJSONPost(String reqUrl, String reqJson, Map<String, String> headerMap) throws IOException {
|
||||
// 创建URL对象
|
||||
URL url = new URL(reqUrl);
|
||||
|
||||
// 打开连接
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
// 设置请求方法为POST
|
||||
connection.setRequestMethod("POST");
|
||||
|
||||
// headers不为空,设置请求头
|
||||
if (headerMap != null) {
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
connection.setRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 允许输入输出流
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
// 设置请求头
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setRequestProperty("Accept", "application/json");
|
||||
|
||||
// 发送JSON数据
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = reqJson.getBytes("utf-8");
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
|
||||
// 获取响应实体
|
||||
StringBuilder responseBody = new StringBuilder();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"))) {
|
||||
String inputLine;
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
responseBody.append(inputLine);
|
||||
}
|
||||
}
|
||||
// 关闭连接
|
||||
connection.disconnect();
|
||||
// 返回响应结果
|
||||
return responseBody.toString();
|
||||
}
|
||||
|
||||
public static String sendSSLPost(String url, String param)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
|
|
@ -51,7 +51,6 @@ public class SurProjectAttendanceUser extends JhBaseEntity
|
|||
private Long workerCategory;
|
||||
|
||||
/** 工号 */
|
||||
|
||||
private Long qrCode;
|
||||
|
||||
/** 姓名 */
|
||||
|
@ -87,11 +86,9 @@ public class SurProjectAttendanceUser extends JhBaseEntity
|
|||
private String photo;
|
||||
|
||||
/** 近照 */
|
||||
|
||||
private String recentPhoto;
|
||||
|
||||
/** 所属班组ID */
|
||||
|
||||
private String groupId;
|
||||
|
||||
/** 所属班组 */
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
package com.yanzhu.manage.domain;
|
||||
|
||||
import com.yanzhu.common.core.annotation.Excel;
|
||||
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 系统应用注册对象 sys_apply_config
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
public class SysApplyConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 服务配置主键 */
|
||||
private Long cfgId;
|
||||
|
||||
/** 服务配置类型 */
|
||||
private String cfgType;
|
||||
|
||||
/** 应用主键 */
|
||||
@Excel(name = "应用主键")
|
||||
private String appId;
|
||||
|
||||
/** 公钥 */
|
||||
private String publicKey;
|
||||
|
||||
/** 私钥 */
|
||||
private String privateKey;
|
||||
|
||||
/** 项目主键 */
|
||||
@Excel(name = "项目主键")
|
||||
private Long projectId;
|
||||
|
||||
/** 项目名称 */
|
||||
@Excel(name = "项目名称")
|
||||
private String projectName;
|
||||
|
||||
/** 部门主键 */
|
||||
@Excel(name = "部门主键")
|
||||
private Long deptId;
|
||||
|
||||
/** 部门名称 */
|
||||
@Excel(name = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
/** 是否删除 */
|
||||
@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;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
public String getCfgType() {
|
||||
return cfgType;
|
||||
}
|
||||
|
||||
public void setCfgType(String cfgType) {
|
||||
this.cfgType = cfgType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("cfgId", getCfgId())
|
||||
.append("cfgType", getCfgType())
|
||||
.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,62 @@
|
|||
package com.yanzhu.manage.mapper;
|
||||
|
||||
import com.yanzhu.manage.domain.SysApplyConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册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,117 @@
|
|||
<?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.yanzhu.manage.mapper.SysApplyConfigMapper">
|
||||
|
||||
<resultMap type="SysApplyConfig" id="SysApplyConfigResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="cfgType" column="cfg_type" />
|
||||
<result property="cfgId" column="cfg_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="projectName" column="project_name" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<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 sac.id, sac.cfg_type, sac.cfg_id, sac.app_id, sac.public_key, sac.private_key, sac.project_id, sp.project_name, sac.dept_id, sd.dept_name, sac.is_del, sac.create_by, sac.create_time, sac.update_by, sac.update_time, sac.remark from sys_apply_config sac
|
||||
left join pro_project_info sp on sac.project_id = sp.id
|
||||
left join sys_dept sd on sac.dept_id = sd.dept_id
|
||||
</sql>
|
||||
|
||||
<select id="selectSysApplyConfigList" parameterType="SysApplyConfig" resultMap="SysApplyConfigResult">
|
||||
<include refid="selectSysApplyConfigVo"/>
|
||||
<where>
|
||||
<if test="cfgId != null "> and sac.cfg_id = #{cfgId}</if>
|
||||
<if test="cfgType != null "> and sac.cfg_type = #{cfgType}</if>
|
||||
<if test="appId != null "> and sac.app_id like concat('%', #{appId}, '%')</if>
|
||||
<if test="projectName != null "> and sp.project_name like concat('%', #{projectName}, '%')</if>
|
||||
<if test="deptName != null "> and sd.dept_name like concat('%', #{deptName}, '%')</if>
|
||||
<if test="isDel != null and isDel != ''"> and sac.is_del = #{isDel}</if>
|
||||
</where>
|
||||
order by sac.id desc
|
||||
</select>
|
||||
|
||||
<select id="selectSysApplyConfigById" parameterType="Long" resultMap="SysApplyConfigResult">
|
||||
<include refid="selectSysApplyConfigVo"/>
|
||||
where sac.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="cfgType != null">cfg_type,</if>
|
||||
<if test="cfgId != null">cfg_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="cfgType != null">#{cfgType},</if>
|
||||
<if test="cfgId != null">#{cfgId},</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="cfgType != null">cfg_type = #{cfgType},</if>
|
||||
<if test="cfgId != null">cfg_id = #{cfgId},</if>
|
||||
<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>
|
|
@ -80,7 +80,7 @@ public class AttendanceJgwTask {
|
|||
* @param secret 应用密钥
|
||||
* @return
|
||||
*/
|
||||
public static String getToken(String appid, String secret) {
|
||||
private String getToken(String appid, String secret) {
|
||||
log.info("开始查询济工网TOKEN...{}::{}",appid,secret);
|
||||
String grantType = "client_credential";
|
||||
String path = "/webapi/credential";
|
||||
|
@ -204,12 +204,12 @@ public class AttendanceJgwTask {
|
|||
quartzProSubdepts.setCreateBy("JGW-TASK");
|
||||
quartzProSubdepts.setCreateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsService.insertQuartzProSubdepts(quartzProSubdepts);
|
||||
redisService.setCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
redisService.setCacheObject("doSyncProContractor.jgw.contractorId::"+json.getString("contractorId"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
}else{
|
||||
QuartzProSubdepts quartzProSubdepts = list.get(0);
|
||||
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("contractorId"));
|
||||
quartzProSubdeptsService.updateQuartzProSubdepts(quartzProSubdepts);
|
||||
redisService.setCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"),list.get(0),2L,TimeUnit.HOURS);
|
||||
redisService.setCacheObject("doSyncProContractor.jgw.contractorId::"+json.getString("contractorId"),list.get(0),2L,TimeUnit.HOURS);
|
||||
}
|
||||
}else{
|
||||
QuartzProSubdepts quartzProSubdepts = new QuartzProSubdepts();
|
||||
|
@ -226,7 +226,7 @@ public class AttendanceJgwTask {
|
|||
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("contractorId"));
|
||||
quartzProSubdepts.setCreateBy("JGW-TASK");
|
||||
quartzProSubdepts.setCreateTime(DateUtils.getNowDate());
|
||||
redisService.setCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
redisService.setCacheObject("doSyncProContractor.jgw.contractorId::"+json.getString("contractorId"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
if (arr.size()>=10 && rowId > 0) {
|
||||
|
@ -328,7 +328,7 @@ public class AttendanceJgwTask {
|
|||
quartzProSubdeptsGroup.setCreateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsGroup.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
quartzProSubdeptsGroupService.insertQuartzProSubdeptsGroup(quartzProSubdeptsGroup);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.jgw.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
}else{
|
||||
QuartzProSubdeptsGroup quartzProSubdeptsGroup = list.get(0);
|
||||
quartzProSubdeptsGroup.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
|
@ -336,7 +336,7 @@ public class AttendanceJgwTask {
|
|||
quartzProSubdeptsGroup.setUpdateBy("JGW-TASK");
|
||||
quartzProSubdeptsGroup.setUpdateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsGroupService.updateQuartzProSubdeptsGroup(quartzProSubdeptsGroup);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.jgw.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
if (rowId > 0) {
|
||||
|
|
|
@ -0,0 +1,478 @@
|
|||
package com.yanzhu.job.task;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||
import com.yanzhu.common.core.enums.*;
|
||||
import com.yanzhu.common.core.text.Convert;
|
||||
import com.yanzhu.common.core.utils.DateUtils;
|
||||
import com.yanzhu.common.core.utils.Md5Utils;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
import com.yanzhu.common.core.utils.file.FileUtils;
|
||||
import com.yanzhu.common.core.utils.http.HttpUtils;
|
||||
import com.yanzhu.common.redis.service.RedisService;
|
||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.job.domain.*;
|
||||
import com.yanzhu.job.service.*;
|
||||
import com.yanzhu.system.api.RemoteFileService;
|
||||
import com.yanzhu.system.api.RemoteUserService;
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.*;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Description: 数智建数据定时任务
|
||||
* @Title: AttendanceJgwTask
|
||||
* @Package com.yanzhu.job.task
|
||||
* @Author: JiangYuQi
|
||||
* @CreateTime: 2024/10/26 17:05
|
||||
*/
|
||||
@Slf4j
|
||||
@Component("attendanceSzjTask")
|
||||
public class AttendanceSzjTask {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private ISysNativeService sysNativeService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private IQuartzProSubdeptsService quartzProSubdeptsService;
|
||||
|
||||
@Autowired
|
||||
private IQuartzProSubdeptsGroupService quartzProSubdeptsGroupService;
|
||||
|
||||
@Autowired
|
||||
private IQuartzProSubdeptsUsersService quartzProSubdeptsUsersService;
|
||||
|
||||
@Autowired
|
||||
private IQuartzProAttendanceCfgService quartzProAttendanceCfgService;
|
||||
|
||||
@Autowired
|
||||
private IQuartzProAttendanceDataService quartzProAttendanceDataService;
|
||||
|
||||
private final String code = "szj";
|
||||
private static final String SZJ_HOST = "https://sc.uni-ubi.com/sc/api/";
|
||||
|
||||
/**
|
||||
* 获取访问令牌
|
||||
*
|
||||
* @param secret 应用密钥
|
||||
* @return
|
||||
*/
|
||||
public String getToken(String secret) {
|
||||
log.info("开始查询数智建TOKEN...{}",secret);
|
||||
String key = "attendanceSzjTask.getToken::"+secret;
|
||||
String token = redisService.getCacheObject(key);
|
||||
if(StringUtils.isNotEmpty(token)){
|
||||
return token;
|
||||
}else{
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("secret",secret);
|
||||
try {
|
||||
String result = HttpUtils.sendJSONPost(SZJ_HOST+"v1/api/verify/getToken",JSON.toJSONString(params),null);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(jsonObject!=null && jsonObject.getBoolean("success")){
|
||||
token = jsonObject.getJSONObject("data").getString("token");
|
||||
redisService.setCacheObject(key,token,5L,TimeUnit.HOURS);
|
||||
return token;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("无效token...");
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步单位及班组信息
|
||||
*/
|
||||
public void syncContractorAndGroupData() {
|
||||
log.info("开始同步数智建单位&班组信息...{}",DateUtils.dateTimeStr());
|
||||
QuartzProAttendanceCfg where = new QuartzProAttendanceCfg();
|
||||
where.setEnabled(ShiFouEnums.SHI.getCode());
|
||||
where.setIsDel(ShiFouEnums.FOU.getCode());
|
||||
where.setVendorsCode(code);
|
||||
List<QuartzProAttendanceCfg> list = quartzProAttendanceCfgService.selectProAttendanceCfgList(where);
|
||||
for (QuartzProAttendanceCfg item : list) {
|
||||
String param = item.getVendorsParameter();
|
||||
if (StringUtils.isNotEmpty(param)) {
|
||||
JSONObject jSONObject = JSON.parseObject(param);
|
||||
try {
|
||||
String token = getToken(jSONObject.getString("secret"));
|
||||
doSyncProContractor(token, item);
|
||||
//doSyncDirectlyUnderGroup(jo, 0l, item);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询直属班组
|
||||
*
|
||||
* @param token 请求令牌
|
||||
* @param it 配置信息
|
||||
*/
|
||||
private void doSyncProContractor(String token, QuartzProAttendanceCfg it){
|
||||
log.info("开始查询数智建参建单位信息...{}",it.getProjectId());
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("token",token);
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
String result = HttpUtils.sendJSONPost(SZJ_HOST+"v1/api/enterprise/query",JSON.toJSONString(params),headerMap);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(jsonObject!=null && jsonObject.getBoolean("success")){
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
||||
if(jsonArray.size()>0){
|
||||
for (int i = 0; i < jsonArray.size(); i++){
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
String subDeptType = convertSubDeptType(json.getString("enterpriseType"));
|
||||
// 总包单位不同步
|
||||
if(!"3".equals(subDeptType)){
|
||||
QuartzProSubdepts quartzProSubdeptsQuery = new QuartzProSubdepts();
|
||||
quartzProSubdeptsQuery.setProjectId(it.getProjectId());
|
||||
quartzProSubdeptsQuery.setSubDeptCode(json.getString("creditCode"));
|
||||
List<QuartzProSubdepts> list = quartzProSubdeptsService.selectQuartzProSubdeptsList(quartzProSubdeptsQuery);
|
||||
if(StringUtils.isEmpty(list)){
|
||||
QuartzProSubdepts quartzProSubdepts = new QuartzProSubdepts();
|
||||
quartzProSubdepts.setComId(it.getComId());
|
||||
quartzProSubdepts.setProjectId(it.getProjectId());
|
||||
quartzProSubdepts.setSubDeptType(subDeptType);
|
||||
quartzProSubdepts.setSubDeptName(json.getString("enterpriseName"));
|
||||
quartzProSubdepts.setSubDeptCode(json.getString("creditCode"));
|
||||
quartzProSubdepts.setSubDeptLeaderName(json.getString("contactPerson"));
|
||||
quartzProSubdepts.setSubDeptLeaderPhone(json.getString("contactNumber"));
|
||||
Map<String, Object> subDeptInfos = new HashMap<>();
|
||||
subDeptInfos.put("signDate",json.getString("registTime"));
|
||||
subDeptInfos.put("address",json.getString("enterpriseAddress"));
|
||||
subDeptInfos.put("businessAddress",json.getString("enterpriseAddress"));
|
||||
subDeptInfos.put("officePhone",json.getString("contactNumber"));
|
||||
quartzProSubdepts.setSubDeptInfos(JSON.toJSONString(subDeptInfos));
|
||||
quartzProSubdepts.setUseStatus(UseStateEnums.IN.getCode());
|
||||
quartzProSubdepts.setUseDates(DateUtils.getNowDate());
|
||||
quartzProSubdepts.setApproveStatus(ApproveStatus.passed.getCode());
|
||||
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
quartzProSubdepts.setCreateBy("SZJ-TASK");
|
||||
quartzProSubdepts.setCreateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsService.insertQuartzProSubdepts(quartzProSubdepts);
|
||||
redisService.setCacheObject("doSyncProContractor.szj.contractorId::"+json.getString("id"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
}else{
|
||||
QuartzProSubdepts quartzProSubdepts = list.get(0);
|
||||
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("contractorId"));
|
||||
quartzProSubdeptsService.updateQuartzProSubdepts(quartzProSubdepts);
|
||||
redisService.setCacheObject("doSyncProContractor.szj.contractorId::"+json.getString("id"),list.get(0),2L,TimeUnit.HOURS);
|
||||
}
|
||||
}else{
|
||||
QuartzProSubdepts quartzProSubdepts = new QuartzProSubdepts();
|
||||
quartzProSubdepts.setComId(it.getComId());
|
||||
quartzProSubdepts.setProjectId(it.getProjectId());
|
||||
quartzProSubdepts.setSubDeptType(subDeptType);
|
||||
quartzProSubdepts.setSubDeptName(json.getString("enterpriseName"));
|
||||
quartzProSubdepts.setSubDeptCode(json.getString("creditCode"));
|
||||
quartzProSubdepts.setSubDeptLeaderName(json.getString("contactPerson"));
|
||||
quartzProSubdepts.setSubDeptLeaderPhone(json.getString("contactNumber"));
|
||||
quartzProSubdepts.setUseStatus(UseStateEnums.IN.getCode());
|
||||
quartzProSubdepts.setUseDates(DateUtils.getNowDate());
|
||||
quartzProSubdepts.setApproveStatus(ApproveStatus.passed.getCode());
|
||||
quartzProSubdepts.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
quartzProSubdepts.setCreateBy("SZJ-TASK");
|
||||
quartzProSubdepts.setCreateTime(DateUtils.getNowDate());
|
||||
redisService.setCacheObject("doSyncProContractor.szj.contractorId::"+json.getString("id"),quartzProSubdepts,2L,TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换单位类型
|
||||
* @param enterpriseType
|
||||
* @return
|
||||
*/
|
||||
private String convertSubDeptType(String enterpriseType){
|
||||
String subDeptType;
|
||||
switch (enterpriseType){
|
||||
case "1" : subDeptType = "2"; break;
|
||||
case "13" : subDeptType = "0"; break;
|
||||
case "3" : subDeptType = "1"; break;
|
||||
case "4" : subDeptType = "5"; break;
|
||||
case "5" : subDeptType = "4"; break;
|
||||
case "6" : subDeptType = "11"; break;
|
||||
case "7" : subDeptType = "6"; break;
|
||||
case "8" : subDeptType = "7"; break;
|
||||
case "9" : subDeptType = "8"; break;
|
||||
case "10" : subDeptType = "9"; break;
|
||||
case "11" : subDeptType = "10"; break;
|
||||
default : subDeptType = "99"; break;
|
||||
}
|
||||
return subDeptType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询直属班组
|
||||
*
|
||||
* @param token 请求令牌
|
||||
* @param it 配置信息
|
||||
*/
|
||||
private void doSyncDirectlyUnderGroup(String token, QuartzProAttendanceCfg it) {
|
||||
log.info("开始同步数智建直属班组信息...{}",it.getProjectId());
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
headerMap.put("token",token);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
try {
|
||||
String result = HttpUtils.sendJSONPost(SZJ_HOST+"v1/api/team/query",JSON.toJSONString(params),headerMap);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
if(jsonObject!=null && jsonObject.getBoolean("success")) {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
||||
if (jsonArray.size() > 0) {
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject json = jsonArray.getJSONObject(i);
|
||||
Map<String, String> dataMap = convertSubJobTypes(json.getString("corpType"));
|
||||
QuartzProSubdeptsGroup quartzProSubdeptsGroupQuery = new QuartzProSubdeptsGroup();
|
||||
quartzProSubdeptsGroupQuery.setProjectId(it.getProjectId());
|
||||
quartzProSubdeptsGroupQuery.setGroupName(json.getString("teamName"));
|
||||
List<QuartzProSubdeptsGroup> list = quartzProSubdeptsGroupService.selectQuartzProSubdeptsGroupList(quartzProSubdeptsGroupQuery);
|
||||
if(StringUtils.isEmpty(list)){
|
||||
QuartzProSubdepts quartzProSubdepts = redisService.getCacheObject("doSyncProContractor.contractorId::"+json.getString("contractorId"));
|
||||
QuartzProSubdeptsGroup quartzProSubdeptsGroup = new QuartzProSubdeptsGroup();
|
||||
quartzProSubdeptsGroup.setComId(it.getComId());
|
||||
quartzProSubdeptsGroup.setProjectId(it.getProjectId());
|
||||
quartzProSubdeptsGroup.setSubDeptId(quartzProSubdepts.getId());
|
||||
quartzProSubdeptsGroup.setSubDeptType(quartzProSubdepts.getSubDeptType());
|
||||
quartzProSubdeptsGroup.setSubDeptName(quartzProSubdepts.getSubDeptName());
|
||||
quartzProSubdeptsGroup.setSubDeptCode(quartzProSubdepts.getSubDeptCode());
|
||||
quartzProSubdeptsGroup.setGroupName(json.getString("teamName"));
|
||||
if(StringUtils.eqObj(dataMap.get("type"),"2")){
|
||||
quartzProSubdeptsGroup.setGroupCode(DeptGroupEnums.SPECIAL.getCode());
|
||||
}else if(StringUtils.eqObj(dataMap.get("type"),"3")){
|
||||
quartzProSubdeptsGroup.setGroupCode(DeptGroupEnums.MANAGE.getCode());
|
||||
}
|
||||
quartzProSubdeptsGroup.setCraftType(dataMap.get("type"));
|
||||
quartzProSubdeptsGroup.setCraftPost(dataMap.get("post"));
|
||||
quartzProSubdeptsGroup.setUseStatus(UseStateEnums.IN.getCode());
|
||||
quartzProSubdeptsGroup.setApproveStatus(ApproveStatus.passed.getCode());
|
||||
quartzProSubdeptsGroup.setIsDel(Convert.toLong(json.getString("deleteFlag"),0L));
|
||||
quartzProSubdeptsGroup.setCreateBy("JGW-TASK");
|
||||
quartzProSubdeptsGroup.setCreateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsGroup.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
quartzProSubdeptsGroupService.insertQuartzProSubdeptsGroup(quartzProSubdeptsGroup);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.jgw.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
}else{
|
||||
QuartzProSubdeptsGroup quartzProSubdeptsGroup = list.get(0);
|
||||
quartzProSubdeptsGroup.setSource(code.toUpperCase()+"::"+json.getString("id"));
|
||||
quartzProSubdeptsGroup.setIsDel(Convert.toLong(json.getString("deleteFlag"),0L));
|
||||
quartzProSubdeptsGroup.setUpdateBy("JGW-TASK");
|
||||
quartzProSubdeptsGroup.setUpdateTime(DateUtils.getNowDate());
|
||||
quartzProSubdeptsGroupService.updateQuartzProSubdeptsGroup(quartzProSubdeptsGroup);
|
||||
redisService.setCacheObject("doSyncDirectlyUnderGroup.jgw.teamLeaderId::"+json.getString("leaderId"),quartzProSubdeptsGroup,2L,TimeUnit.HOURS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换工种类型
|
||||
* @param jobTypes
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> convertSubJobTypes(String jobTypes){
|
||||
Map<String, String> dataMap = new HashMap<>();
|
||||
if(StringUtils.isEmpty(jobTypes)){
|
||||
dataMap.put("type","3");
|
||||
dataMap.put("post","4037");
|
||||
return dataMap;
|
||||
}
|
||||
switch (jobTypes){
|
||||
case "3001" : dataMap.put("type","2");dataMap.put("post","1015"); break;
|
||||
case "3002" : dataMap.put("type","2");dataMap.put("post","1014"); break;
|
||||
case "3003" :
|
||||
case "3004" : dataMap.put("type","2");dataMap.put("post","2021"); break;
|
||||
case "3005" : dataMap.put("type","2");dataMap.put("post","2022"); break;
|
||||
case "3006" : dataMap.put("type","2");dataMap.put("post","1013"); break;
|
||||
case "3007" : dataMap.put("type","1");dataMap.put("post","1006"); break;
|
||||
case "3008" : dataMap.put("type","1");dataMap.put("post","1004"); break;
|
||||
case "3009" : dataMap.put("type","1");dataMap.put("post","1001"); break;
|
||||
case "3010" : dataMap.put("type","1");dataMap.put("post","1003"); break;
|
||||
case "3011" : dataMap.put("type","1");dataMap.put("post","1017"); break;
|
||||
case "3012" : dataMap.put("type","1");dataMap.put("post","1007"); break;
|
||||
case "3013" : dataMap.put("type","1");dataMap.put("post","1008"); break;
|
||||
case "3014" : dataMap.put("type","1");dataMap.put("post","1009"); break;
|
||||
case "3015" : dataMap.put("type","1");dataMap.put("post","1012"); break;
|
||||
case "3016" : dataMap.put("type","3");dataMap.put("post","3024"); break;
|
||||
case "3017" : dataMap.put("type","1");dataMap.put("post","1010"); break;
|
||||
case "3018" : dataMap.put("type","3");dataMap.put("post","3025"); break;
|
||||
case "3019" : dataMap.put("type","2");dataMap.put("post","2017"); break;
|
||||
case "3020" : dataMap.put("type","2");dataMap.put("post","2018"); break;
|
||||
case "3021" : dataMap.put("type","2");dataMap.put("post","2016"); break;
|
||||
case "3031" :
|
||||
case "3032" :
|
||||
case "3042" : dataMap.put("type","2");dataMap.put("post","2019"); break;
|
||||
case "3072" :
|
||||
case "3039" :
|
||||
case "6002" :
|
||||
case "6003" :
|
||||
case "6004" :
|
||||
case "6005" :
|
||||
case "6006" :
|
||||
case "6007" :
|
||||
case "6008" :
|
||||
case "6009" :
|
||||
case "6010" :
|
||||
case "6012" :
|
||||
case "6013" :
|
||||
case "6014" :
|
||||
case "6015" :
|
||||
case "6016" :
|
||||
case "6017" :
|
||||
case "6018" :
|
||||
case "6019" :
|
||||
case "6020" :
|
||||
case "6021" :
|
||||
case "6022" :
|
||||
case "6023" :
|
||||
case "6024" :
|
||||
case "6025" :
|
||||
case "6026" :
|
||||
case "6027" :
|
||||
case "6028" :
|
||||
case "6029" :
|
||||
case "6030" :
|
||||
case "6031" :
|
||||
case "6032" :
|
||||
case "6033" :
|
||||
case "6034" :
|
||||
case "6035" :
|
||||
case "6036" :
|
||||
case "6037" :
|
||||
case "6038" :
|
||||
case "6039" :
|
||||
case "6040" :
|
||||
case "6041" :
|
||||
case "6042" :
|
||||
case "6043" :
|
||||
case "6044" :
|
||||
case "6045" :
|
||||
case "6046" :
|
||||
case "6047" :
|
||||
case "6048" :
|
||||
case "6049" :
|
||||
case "6050" :
|
||||
case "6051" :
|
||||
case "6052" :
|
||||
case "6053" :
|
||||
case "6054" :
|
||||
case "6055" :
|
||||
case "6056" :
|
||||
case "6057" :
|
||||
case "6058" :
|
||||
case "6059" :
|
||||
case "6060" :
|
||||
case "6061" :
|
||||
case "6062" :
|
||||
case "6063" :
|
||||
case "6064" :
|
||||
case "6065" :
|
||||
case "6066" :
|
||||
case "6067" :
|
||||
case "6068" :
|
||||
case "6069" :
|
||||
case "6070" :
|
||||
case "6071" :
|
||||
case "6072" :
|
||||
case "6073" :
|
||||
case "6074" :
|
||||
case "6075" :
|
||||
case "6076" :
|
||||
case "6077" :
|
||||
case "6078" :
|
||||
case "6079" :
|
||||
case "6080" :
|
||||
case "6081" :
|
||||
case "6082" :
|
||||
case "6083" :
|
||||
case "6084" :
|
||||
case "6085" :
|
||||
case "6086" :
|
||||
case "6087" :
|
||||
case "6088" :
|
||||
case "6089" :
|
||||
case "6090" :
|
||||
case "6091" :
|
||||
case "6092" :
|
||||
case "6093" :
|
||||
case "6094" :
|
||||
case "6095" :
|
||||
case "6096" :
|
||||
case "6097" :
|
||||
case "6001" : dataMap.put("type","3");dataMap.put("post","4037"); break;
|
||||
case "6011" : dataMap.put("type","3");dataMap.put("post","3023"); break;
|
||||
case "3036" :
|
||||
case "3054" :
|
||||
case "3056" :
|
||||
case "3057" :
|
||||
case "3058" :
|
||||
case "3059" :
|
||||
case "3060" :
|
||||
case "3061" :
|
||||
case "3062" :
|
||||
case "3063" :
|
||||
case "3064" :
|
||||
case "3065" :
|
||||
case "3055" : dataMap.put("type","1");dataMap.put("post","8888"); break;
|
||||
case "3041" :
|
||||
case "3040" :
|
||||
case "3037" :
|
||||
case "3038" :
|
||||
case "3043" :
|
||||
case "3044" :
|
||||
case "3045" :
|
||||
case "3046" :
|
||||
case "3047" :
|
||||
case "3048" :
|
||||
case "3049" :
|
||||
case "3050" :
|
||||
case "3051" :
|
||||
case "3052" :
|
||||
case "3053" :
|
||||
case "3033" :
|
||||
case "3066" :
|
||||
case "3067" :
|
||||
case "3068" :
|
||||
case "3069" :
|
||||
case "3070" :
|
||||
case "3035" :
|
||||
case "3071" :
|
||||
case "3034" : dataMap.put("type","2");dataMap.put("post","9999"); break;
|
||||
default : dataMap.put("type","3");dataMap.put("post","4037"); break;
|
||||
}
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,327 +0,0 @@
|
|||
//package com.yanzhu.job.task;
|
||||
//
|
||||
//import cn.hutool.core.util.StrUtil;
|
||||
//import com.alibaba.fastjson2.JSON;
|
||||
//import com.alibaba.fastjson2.JSONArray;
|
||||
//import com.alibaba.fastjson2.JSONObject;
|
||||
//import com.yanzhu.common.redis.service.RedisService;
|
||||
//import com.yanzhu.job.domain.*;
|
||||
//import com.yanzhu.job.service.*;
|
||||
//import okhttp3.HttpUrl;
|
||||
//import okhttp3.OkHttpClient;
|
||||
//import okhttp3.Request;
|
||||
//import okhttp3.Response;
|
||||
//import org.apache.commons.codec.digest.DigestUtils;
|
||||
//import org.apache.logging.log4j.util.Strings;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.util.*;
|
||||
//import java.util.concurrent.TimeUnit;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
//@Component("attendanceTask")
|
||||
//public class AttendanceTask {
|
||||
//
|
||||
// @Autowired
|
||||
// private RedisService redisCache;
|
||||
//
|
||||
// @Autowired
|
||||
// private ISysNativeService sysNativeService;
|
||||
//
|
||||
// @Autowired
|
||||
// IQuartzProjectAttendanceUserService attendanceUserService;
|
||||
//
|
||||
// @Autowired
|
||||
// IQuartzProAttendanceCfgService attendanceCfgService;
|
||||
//
|
||||
// @Autowired
|
||||
// IQuartzProAttendanceDataService attendanceDataService;
|
||||
//
|
||||
// @Autowired
|
||||
// IQuartzProjectAttendanceGroupService attendanceGroupService;
|
||||
//
|
||||
// private String getNative(long id){
|
||||
// String ckey="attendance_jgw_native_"+id;
|
||||
// Object obj=redisCache.getCacheObject(ckey);
|
||||
// String tmp="";
|
||||
// if(obj!=null){
|
||||
// tmp=obj.toString();
|
||||
// if(StrUtil.isNotEmpty(tmp)){
|
||||
// return tmp;
|
||||
// }
|
||||
// }
|
||||
// List<SysNative> list=sysNativeService.selectSysNativeListById(id);
|
||||
// if(list.size()==0){
|
||||
// id=id/100*100;
|
||||
// list=sysNativeService.selectSysNativeListById(id);
|
||||
// if(list.size()==0){
|
||||
// id=id/10000*10000;
|
||||
// list=sysNativeService.selectSysNativeListById(id);
|
||||
// }
|
||||
// }
|
||||
// if(list.size()==0){
|
||||
// tmp="";
|
||||
// }else{
|
||||
// tmp= list.get(0).getAddress();
|
||||
// }
|
||||
// redisCache.setCacheObject(ckey, tmp, 1L, TimeUnit.DAYS);
|
||||
// return tmp;
|
||||
// }
|
||||
//
|
||||
// public void syncWorker(){
|
||||
// QuartzProAttendanceCfg where =new QuartzProAttendanceCfg();
|
||||
// where.setEnabled(1l);
|
||||
// where.setIsDel(0l);
|
||||
// where.setVendorsCode("gld");
|
||||
// List<QuartzProAttendanceCfg> list=attendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
// for(QuartzProAttendanceCfg it :list){
|
||||
// String param= it.getVendorsParameter();
|
||||
// if(Strings.isNotEmpty(param)){
|
||||
// try{
|
||||
// JSONObject jo=JSON.parseObject(param);
|
||||
// String appId=jo.getString("appId");
|
||||
// String secret=jo.getString("secret");
|
||||
// String projectId=jo.getString("projectId");
|
||||
// doSyncWorker(appId,secret,projectId,1,it);
|
||||
// }catch (Exception ex){
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void syncGroup(){
|
||||
// QuartzProAttendanceCfg where =new QuartzProAttendanceCfg();
|
||||
// where.setEnabled(1l);
|
||||
// where.setIsDel(0l);
|
||||
// where.setVendorsCode("gld");
|
||||
// List<QuartzProAttendanceCfg> list=attendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
// for(QuartzProAttendanceCfg it :list){
|
||||
// String param= it.getVendorsParameter();
|
||||
// if(Strings.isNotEmpty(param)){
|
||||
// try{
|
||||
// JSONObject jo=JSON.parseObject(param);
|
||||
// String appId=jo.getString("appId");
|
||||
// String secret=jo.getString("secret");
|
||||
// String projectId=jo.getString("projectId");
|
||||
// doSyncGroup(appId,secret,projectId,it);
|
||||
// }catch (Exception ex){
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void doSyncGroup(String appId, String secret, String projectId, QuartzProAttendanceCfg it) {
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("projectId", projectId);
|
||||
// params.put("appid",appId);
|
||||
// String sign = getSign(params,secret);
|
||||
// String host="https://glm.glodon.com/api/open";
|
||||
// params.put("sign",sign);
|
||||
// String path="/worker/allGroup";
|
||||
// HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
// params.forEach((s, o) -> {
|
||||
// urlBuilder.addQueryParameter(s, (String) o);
|
||||
// });
|
||||
// Request request = new Request.Builder()
|
||||
// .url(urlBuilder.build())
|
||||
// .build();
|
||||
// String data = getResult(request);
|
||||
// JSONObject jo= JSON.parseObject(data);
|
||||
// JSONArray arr=jo.getJSONArray("data");
|
||||
// if(arr!=null && arr.size()>0) {
|
||||
// for (int i = 0; i < arr.size(); i++) {
|
||||
// JSONObject json=arr.getJSONObject(i);
|
||||
// QuartzProjectAttendanceGroup group= QuartzProjectAttendanceGroup.create(json);
|
||||
// group.setAppId(appId);
|
||||
// group.setCfgid(it.getId());
|
||||
// attendanceGroupService.add(group);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void doSyncWorker(String appid, String secret, String projectld, int page, QuartzProAttendanceCfg it){
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("projectId", projectld);
|
||||
// params.put("start", "2000-01-01 00:00:00");
|
||||
// params.put("end", "2099-01-01 00:00:00");
|
||||
// params.put("pageNo",""+page);
|
||||
// params.put("pageSize", "1000");
|
||||
// params.put("appid",appid);
|
||||
// String sign = getSign(params,secret);
|
||||
// String host="https://glm.glodon.com/api/open";
|
||||
// params.put("sign",sign);
|
||||
// String path="/worker/new/allWorkerInfo";
|
||||
// HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
// params.forEach((s, o) -> {
|
||||
// urlBuilder.addQueryParameter(s, (String) o);
|
||||
// });
|
||||
// Request request = new Request.Builder()
|
||||
// .url(urlBuilder.build())
|
||||
// .build();
|
||||
// String data = getResult(request);
|
||||
// JSONObject jo= JSON.parseObject(data);
|
||||
// JSONArray arr=jo.getJSONArray("data");
|
||||
// if(arr!=null && arr.size()>0){
|
||||
// for(int i=0;i<arr.size();i++){
|
||||
// JSONObject json=arr.getJSONObject(i);
|
||||
// QuartzProjectAttendanceUser user= QuartzProjectAttendanceUser.create(json);
|
||||
// String idNumber=json.getString("identification");//身份证
|
||||
// if(StrUtil.isNotEmpty(idNumber) && idNumber.length()>6){
|
||||
// try {
|
||||
// long idStr = Long.parseLong(idNumber.substring(0, 6));
|
||||
// String natstr=getNative(idStr);
|
||||
// if(StrUtil.isNotEmpty(natstr)){
|
||||
// user.setNativePlace(natstr);
|
||||
// }
|
||||
// }catch (Exception ex){
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// user.setVendorsCode(it.getVendorsCode());
|
||||
// user.setCfgid(it.getId());
|
||||
// user.setAppId(appid);
|
||||
// attendanceUserService.add(user);
|
||||
// }
|
||||
// }
|
||||
// if(arr.size()==1000){
|
||||
// doSyncWorker(appid,secret,projectld,page+1,it);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void syncAttendanceData(){
|
||||
// QuartzProAttendanceCfg where =new QuartzProAttendanceCfg();
|
||||
// where.setEnabled(1l);
|
||||
// where.setIsDel(0l);
|
||||
// where.setVendorsCode("gld");
|
||||
// List<QuartzProAttendanceCfg> list=attendanceCfgService.selectSurProjectAttendanceCfgList(where);
|
||||
// for(QuartzProAttendanceCfg it :list){
|
||||
// String param= it.getVendorsParameter();
|
||||
// if(Strings.isNotEmpty(param)){
|
||||
// try{
|
||||
// JSONObject jo=JSON.parseObject(param);
|
||||
// String appId=jo.getString("appId");
|
||||
// String secret=jo.getString("secret");
|
||||
// String projectId=jo.getString("projectId");
|
||||
// QuartzProjectAttendanceData dwhere=new QuartzProjectAttendanceData();
|
||||
// dwhere.setCfgid(it.getId());
|
||||
// String startId=attendanceDataService.getLastServerId(dwhere);
|
||||
// doSyncAttendanceData(appId,secret,projectId,startId,it);
|
||||
// }catch (Exception ex){
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void doSyncAttendanceData(String appid, String secret, String projectId, String id, QuartzProAttendanceCfg it){
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("projectId", projectId);
|
||||
// params.put("startId",""+id);
|
||||
// params.put("pageSize", "500");
|
||||
// params.put("appid",appid);
|
||||
// String sign = getSign(params,secret);
|
||||
// String host="https://glm.glodon.com/api/open";
|
||||
// params.put("sign",sign);
|
||||
// String path="/attendance/card";
|
||||
// HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
// params.forEach((s, o) -> {
|
||||
// urlBuilder.addQueryParameter(s, (String) o);
|
||||
// });
|
||||
// Request request = new Request.Builder()
|
||||
// .url(urlBuilder.build())
|
||||
// .build();
|
||||
// String data = getResult(request);
|
||||
// JSONObject jo= JSON.parseObject(data);
|
||||
// JSONArray arr=jo.getJSONArray("data");
|
||||
// String lastId= "0";
|
||||
// if(arr!=null && arr.size()>0){
|
||||
// for(int i=0;i<arr.size();i++){
|
||||
// JSONObject json=arr.getJSONObject(i);
|
||||
// QuartzProjectAttendanceData sdata= QuartzProjectAttendanceData.create(json);
|
||||
// lastId=sdata.getServerid();
|
||||
// sdata.setCfgid(it.getId());
|
||||
// sdata.setAppId(appid);
|
||||
// sdata.setVendorsCode(it.getVendorsCode());
|
||||
// attendanceDataService.add(sdata);
|
||||
// }
|
||||
// }
|
||||
// //System.out.println("-------->"+id+","+lastId);
|
||||
// if(arr.size()==500){
|
||||
// doSyncAttendanceData(appid,secret,projectId,lastId,it);
|
||||
// }
|
||||
// }
|
||||
// public static void main(String[] args){
|
||||
//
|
||||
// System.out.println("-------1--------->AttendanceUserTask.syncWorker");
|
||||
// Map<String, Object> params = new HashMap<>();
|
||||
// params.put("projectId", "709599705953792");
|
||||
// params.put("start", "2000-01-01 00:00:00");
|
||||
// params.put("end", "2099-01-01 00:00:00");
|
||||
// params.put("pageNo","1");
|
||||
// params.put("pageSize", "1000");
|
||||
// //params.put("pageNo", "1");
|
||||
// params.put("startId", "0");
|
||||
// params.put("appid","f24454233c5346fe82df6b8dd35e9d6d");
|
||||
// String sign = getSign(params,"754619e2a33491b84a4d47838d2ffc0a");
|
||||
// System.out.println("--->"+sign);
|
||||
// params.put("sign",sign);
|
||||
// String host="https://glm.glodon.com/api/open";
|
||||
// String path="/worker/new/allWorkerInfo";
|
||||
// HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(host + path)).newBuilder();
|
||||
// params.forEach((s, o) -> {
|
||||
// urlBuilder.addQueryParameter(s, (String) o);
|
||||
// });
|
||||
// Request request = new Request.Builder()
|
||||
// .url(urlBuilder.build())
|
||||
// .build();
|
||||
// String data = getResult(request);
|
||||
// //System.out.println("data:"+data);
|
||||
// JSONObject jo= JSON.parseObject(data);
|
||||
// JSONArray jsonArray=jo.getJSONArray("data");
|
||||
// for(int i=0;i<jsonArray.size();i++){
|
||||
// JSONObject o=jsonArray.getJSONObject(i);
|
||||
// //if(o.getLong("workerId")==7813018){
|
||||
// System.out.println(o.getString("status"));
|
||||
// //}
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static String getResult(Request request) {
|
||||
// OkHttpClient client = new OkHttpClient.Builder()
|
||||
// .sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager())
|
||||
// .hostnameVerifier(SSLSocketClient.getHostnameVerifier())
|
||||
// .build();
|
||||
// Response response;
|
||||
// try {
|
||||
// response = client.newCall(request).execute();
|
||||
// if (response.body() != null) {
|
||||
// return response.body().string();
|
||||
// } else {
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// throw new RuntimeException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static String getSign(Map<String,Object> paramsMap,String appSecret){
|
||||
// List<String> paramsList = new ArrayList<>();
|
||||
// paramsMap.forEach((s, o) -> {
|
||||
// String stringBuilder = s + o;
|
||||
// paramsList.add(stringBuilder);
|
||||
// });
|
||||
// StringBuilder beforeMd5 = new StringBuilder();
|
||||
// beforeMd5.append(appSecret);
|
||||
// paramsList.stream()
|
||||
// .sorted(String::compareTo)
|
||||
// .collect(Collectors.toList())
|
||||
// .forEach(beforeMd5::append);
|
||||
// beforeMd5.append(appSecret);
|
||||
// return DigestUtils.md5Hex(beforeMd5.toString()).toUpperCase();
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,371 @@
|
|||
package com.yanzhu.manage.api;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yanzhu.common.core.annotation.RateLimiter;
|
||||
import com.yanzhu.common.core.constant.CacheConstants;
|
||||
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||
import com.yanzhu.common.core.enums.ApplyCfgTypeEnum;
|
||||
import com.yanzhu.common.core.enums.LimitType;
|
||||
import com.yanzhu.common.core.enums.ShiFouEnum;
|
||||
import com.yanzhu.common.core.enums.VendorsCodeEnum;
|
||||
import com.yanzhu.common.core.exception.ServiceException;
|
||||
import com.yanzhu.common.core.text.Convert;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
import com.yanzhu.common.core.utils.file.MultipartFileUtils;
|
||||
import com.yanzhu.common.core.web.controller.BaseController;
|
||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||
import com.yanzhu.common.redis.service.RedisService;
|
||||
import com.yanzhu.common.security.service.TokenService;
|
||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.manage.api.vo.*;
|
||||
import com.yanzhu.manage.domain.SurProjectAttendanceData;
|
||||
import com.yanzhu.manage.domain.SurProjectAttendanceGroup;
|
||||
import com.yanzhu.manage.domain.SurProjectAttendanceUser;
|
||||
import com.yanzhu.manage.domain.SysApplyConfig;
|
||||
import com.yanzhu.manage.enums.HttpStatusEnum;
|
||||
import com.yanzhu.manage.service.ISurProjectAttendanceDataService;
|
||||
import com.yanzhu.manage.service.ISurProjectAttendanceGroupService;
|
||||
import com.yanzhu.manage.service.ISurProjectAttendanceUserService;
|
||||
import com.yanzhu.system.api.RemoteFileService;
|
||||
import com.yanzhu.system.api.RemoteUserService;
|
||||
import com.yanzhu.system.api.domain.SysFile;
|
||||
import com.yanzhu.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 劳务人员APIController
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/labourApi")
|
||||
public class LabourApiController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private RemoteFileService remoteFileService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceGroupService surProjectAttendanceGroupService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceUserService surProjectAttendanceUserService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceDataService surProjectAttendanceDataService;
|
||||
|
||||
/**
|
||||
* 获取系统token
|
||||
* 限流规则[60秒内最多请求10次,限流策略IP]
|
||||
*
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "获取TOKEN")
|
||||
@RateLimiter(count = 10, limitType = LimitType.IP)
|
||||
@PostMapping("/v1/getToken")
|
||||
public AjaxResult getToken(@Validated @RequestBody LabourSignReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisService.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG + req.getAppId());
|
||||
if (sysApplyConfig == null) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
if (StringUtils.eqObj(ShiFouEnum.SHI.getCode(), sysApplyConfig.getIsDel())) {
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(), HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if (!StringUtils.eqObj(ApplyCfgTypeEnum.LABOUR.getCode(), sysApplyConfig.getCfgType())) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
if (!StringUtils.eqObj(req.getSecret(), sysApplyConfig.getPrivateKey())) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
String key = "labourApi.getToken::" + req.getAppId();
|
||||
Map<String, Object> rspMap = redisService.getCacheObject(key);
|
||||
if (Objects.nonNull(rspMap)) {
|
||||
return AjaxResult.success(rspMap);
|
||||
} else {
|
||||
rspMap = this.getAppIdLoginToken(sysApplyConfig);
|
||||
redisService.setCacheObject(key, rspMap, 320L, TimeUnit.MINUTES);
|
||||
return AjaxResult.success(rspMap);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* appId登录创建用户并模拟登录
|
||||
*
|
||||
* @param sysApplyConfig 用户账号
|
||||
* @return token
|
||||
*/
|
||||
private Map<String, Object> getAppIdLoginToken(SysApplyConfig sysApplyConfig) {
|
||||
// 查询用户是否存在,不存在则保存
|
||||
LoginUser loginUser = remoteUserService.getUserInfo(sysApplyConfig.getAppId(), SecurityConstants.INNER).getData();
|
||||
if (Objects.nonNull(loginUser)) {
|
||||
return tokenService.createToken(loginUser);
|
||||
} else {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送,修改班组信息
|
||||
* 限流规则[30秒内最多请求100次,限流策略IP]
|
||||
*
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送班组信息")
|
||||
@PostMapping("/v1/pushLabourGroup")
|
||||
public AjaxResult pushLabourGroup(@Validated @RequestBody LabourGroupReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisService.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG + SecurityUtils.getUsername());
|
||||
if (StringUtils.equals(ShiFouEnum.SHI.getCode(), sysApplyConfig.getIsDel())) {
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(), HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if (!Objects.equals(ApplyCfgTypeEnum.LABOUR.getCode(), sysApplyConfig.getCfgType())) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
// 查询当前班组是否已推送
|
||||
SurProjectAttendanceGroup searchModel = new SurProjectAttendanceGroup();
|
||||
searchModel.setAppId(sysApplyConfig.getAppId());
|
||||
searchModel.setServerid(req.getServerid());
|
||||
List<SurProjectAttendanceGroup> list = surProjectAttendanceGroupService.selectSurProjectAttendanceGroupList(searchModel);
|
||||
if (list.size() > 0) {
|
||||
SurProjectAttendanceGroup surProjectAttendanceGroup = list.get(0);
|
||||
surProjectAttendanceGroup.setCompanyId(req.getCompanyId());
|
||||
surProjectAttendanceGroup.setCompanyName(req.getCompanyName());
|
||||
surProjectAttendanceGroup.setCompanyCode(req.getCompanyCode());
|
||||
surProjectAttendanceGroup.setCompanyTypeId(req.getCompanyTypeId());
|
||||
surProjectAttendanceGroup.setName(req.getName());
|
||||
surProjectAttendanceGroup.setLeaderName(req.getLeaderName());
|
||||
surProjectAttendanceGroup.setLeaderPhone(req.getLeaderPhone());
|
||||
surProjectAttendanceGroup.setIsDel(req.getIsDel());
|
||||
surProjectAttendanceGroup.setUpdateBy(VendorsCodeEnum.YANZHU.getCode());
|
||||
surProjectAttendanceGroup.setUpdateTime(new Date());
|
||||
surProjectAttendanceGroupService.updateSurProjectAttendanceGroup(surProjectAttendanceGroup);
|
||||
} else {
|
||||
SurProjectAttendanceGroup surProjectAttendanceGroup = new SurProjectAttendanceGroup();
|
||||
surProjectAttendanceGroup.setAppId(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceGroup.setCfgid(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceGroup.setServerid(req.getServerid());
|
||||
surProjectAttendanceGroup.setCompanyId(req.getCompanyId());
|
||||
surProjectAttendanceGroup.setCompanyCode(req.getCompanyCode());
|
||||
surProjectAttendanceGroup.setCompanyName(req.getCompanyName());
|
||||
surProjectAttendanceGroup.setCompanyTypeId(req.getCompanyTypeId());
|
||||
surProjectAttendanceGroup.setName(req.getName());
|
||||
surProjectAttendanceGroup.setLeaderName(req.getLeaderName());
|
||||
surProjectAttendanceGroup.setLeaderPhone(req.getLeaderPhone());
|
||||
surProjectAttendanceGroup.setIsDel(req.getIsDel());
|
||||
surProjectAttendanceGroup.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceGroup.setCreateTime(new Date());
|
||||
surProjectAttendanceGroupService.insertSurProjectAttendanceGroup(surProjectAttendanceGroup);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送,修改人员信息
|
||||
* 限流规则[30秒内最多请求100次,限流策略IP]
|
||||
*
|
||||
* @param req 请求信息
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@ApiOperation(value = "推送人员信息")
|
||||
@PostMapping("/v1/pushLabourUser")
|
||||
public AjaxResult pushLabourUser(@Validated @RequestBody LabourUserReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisService.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG + SecurityUtils.getUsername());
|
||||
if (StringUtils.equals(ShiFouEnum.SHI.getCode(), sysApplyConfig.getIsDel())) {
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(), HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if (!Objects.equals(ApplyCfgTypeEnum.LABOUR.getCode(), sysApplyConfig.getCfgType())) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
// 查询当前人员是否已推送
|
||||
SurProjectAttendanceUser searchModel = new SurProjectAttendanceUser();
|
||||
searchModel.setAppId(sysApplyConfig.getAppId());
|
||||
searchModel.setWorkerId(req.getWorkerId());
|
||||
List<SurProjectAttendanceUser> list = surProjectAttendanceUserService.selectSurProjectAttendanceUserList(searchModel);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
SurProjectAttendanceUser surProjectAttendanceUser = list.get(0);
|
||||
surProjectAttendanceUser.setName(req.getName());
|
||||
surProjectAttendanceUser.setVendorsCode(VendorsCodeEnum.YANZHU.getCode());
|
||||
surProjectAttendanceUser.setEthnic(req.getEthnic());
|
||||
surProjectAttendanceUser.setNativePlace(req.getNativePlace());
|
||||
surProjectAttendanceUser.setGender(req.getGender());
|
||||
surProjectAttendanceUser.setPhone(req.getPhone());
|
||||
try {
|
||||
//保存入场照片
|
||||
SysFile sysFile = remoteFileService.upload(MultipartFileUtils.base64ToMultipartFile(req.getRecentPhotoBase64())).getData();
|
||||
surProjectAttendanceUser.setRecentPhoto(sysFile.getUrl());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
surProjectAttendanceUser.setGroupId(req.getGroupId());
|
||||
surProjectAttendanceUser.setGroupName(req.getGroupName());
|
||||
surProjectAttendanceUser.setWorkTypeName(req.getWorkTypeName());
|
||||
surProjectAttendanceUser.setSpecWorkType(req.getSpecWorkType());
|
||||
surProjectAttendanceUser.setState(req.getState());
|
||||
surProjectAttendanceUser.setEnterDate(req.getEnterDate());
|
||||
surProjectAttendanceUser.setCompanyId(req.getCompanyId());
|
||||
surProjectAttendanceUser.setCompanyName(req.getCompanyName());
|
||||
surProjectAttendanceUser.setIsDel(req.getIsDel());
|
||||
surProjectAttendanceUser.setUpdateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setUpdateTime(new Date());
|
||||
surProjectAttendanceUserService.updateSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
} else {
|
||||
SurProjectAttendanceUser surProjectAttendanceUser = new SurProjectAttendanceUser();
|
||||
surProjectAttendanceUser.setAppId(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setCfgid(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceUser.setName(req.getName());
|
||||
surProjectAttendanceUser.setEthnic(req.getEthnic());
|
||||
surProjectAttendanceUser.setNativePlace(req.getNativePlace());
|
||||
surProjectAttendanceUser.setGender(req.getGender());
|
||||
surProjectAttendanceUser.setPhone(req.getPhone());
|
||||
surProjectAttendanceUser.setGroupId(req.getGroupId());
|
||||
surProjectAttendanceUser.setGroupName(req.getGroupName());
|
||||
surProjectAttendanceUser.setWorkTypeName(req.getWorkTypeName());
|
||||
surProjectAttendanceUser.setSpecWorkType(req.getSpecWorkType());
|
||||
surProjectAttendanceUser.setState(req.getState());
|
||||
surProjectAttendanceUser.setEnterDate(req.getEnterDate());
|
||||
surProjectAttendanceUser.setCompanyId(req.getCompanyId());
|
||||
surProjectAttendanceUser.setCompanyName(req.getCompanyName());
|
||||
surProjectAttendanceUser.setIsDel(req.getIsDel());
|
||||
surProjectAttendanceUser.setCreateBy(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceUser.setCreateTime(new Date());
|
||||
surProjectAttendanceUserService.insertSurProjectAttendanceUser(surProjectAttendanceUser);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
public static final String CACHEKEY = "api.labour.v1.pushLabourData::";
|
||||
|
||||
/**
|
||||
* 推送,修改班组人员考勤信息
|
||||
* 限流规则[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 LabourDataReqVo req) {
|
||||
SysApplyConfig sysApplyConfig = redisService.getCacheObject(CacheConstants.YANZHU_SYSTEM_CONFIG + SecurityUtils.getUsername());
|
||||
if (StringUtils.equals(ShiFouEnum.SHI.getCode(), sysApplyConfig.getIsDel())) {
|
||||
throw new ServiceException(HttpStatusEnum.DISABLE.getInfo(), HttpStatusEnum.DISABLE.getCode());
|
||||
}
|
||||
if (!Objects.equals(ApplyCfgTypeEnum.LABOUR.getCode(), sysApplyConfig.getCfgType())) {
|
||||
throw new ServiceException(HttpStatusEnum.ERROR.getInfo(), HttpStatusEnum.ERROR.getCode());
|
||||
}
|
||||
String cacheKey = CACHEKEY + req.getWorkerId();
|
||||
Boolean cacheValue = Convert.toBool(redisService.getCacheObject(cacheKey), true);
|
||||
//30秒内未重复请求
|
||||
if (cacheValue) {
|
||||
redisService.setCacheObject(cacheKey, false, 60L, TimeUnit.SECONDS);
|
||||
// 查询当前班组人员考勤是否已推送
|
||||
SurProjectAttendanceData findData = new SurProjectAttendanceData();
|
||||
findData.setCfgid(sysApplyConfig.getCfgId());
|
||||
findData.setAppId(sysApplyConfig.getAppId());
|
||||
findData.setWorkerId(req.getWorkerId());
|
||||
findData.setAttendanceTime(req.getAttendanceTime());
|
||||
SurProjectAttendanceData surProjectAttendanceData = surProjectAttendanceDataService.findCurrentAttendanceData(findData);
|
||||
if (surProjectAttendanceData != null) {
|
||||
//这里不能修改出勤时间
|
||||
if (Objects.equals("L", req.getAttendanceType())) {
|
||||
surProjectAttendanceData.setAttendanceOutTime(req.getAttendanceTime());
|
||||
}
|
||||
surProjectAttendanceData.setUpdateBy(sysApplyConfig.getAppId() + "Api推送离场打卡");
|
||||
try {
|
||||
List<LabourDataPMReqVo> result;
|
||||
if (surProjectAttendanceData.getRemark() != null) {
|
||||
result = JSON.parseArray(surProjectAttendanceData.getRemark(), LabourDataPMReqVo.class);
|
||||
} else {
|
||||
result = new ArrayList<>();
|
||||
}
|
||||
LabourDataPMReqVo labourDataPMReqVo = new LabourDataPMReqVo();
|
||||
labourDataPMReqVo.setAttendanceType(surProjectAttendanceData.getAttendanceType());
|
||||
labourDataPMReqVo.setAttendanceTime(surProjectAttendanceData.getAttendanceTime());
|
||||
labourDataPMReqVo.setScanPhoto(surProjectAttendanceData.getScanPhoto());
|
||||
result.add(labourDataPMReqVo);
|
||||
surProjectAttendanceData.setRemark(JSONObject.toJSONString(result));
|
||||
} catch (Exception e) {
|
||||
log.error("保存考勤PM信息出错...{}", e.getMessage());
|
||||
}
|
||||
surProjectAttendanceDataService.updateSurProjectAttendanceData(surProjectAttendanceData);
|
||||
} else {
|
||||
surProjectAttendanceData = new SurProjectAttendanceData();
|
||||
/**
|
||||
* 查询人员考勤信息
|
||||
*/
|
||||
SurProjectAttendanceUser findUser = new SurProjectAttendanceUser();
|
||||
findUser.setCfgid(sysApplyConfig.getCfgId());
|
||||
findUser.setWorkerId(req.getWorkerId());
|
||||
SurProjectAttendanceUser surProjectAttendanceUser = surProjectAttendanceUserService.findYzCurrentAttendanceUser(findUser);
|
||||
if (StringUtils.isNull(surProjectAttendanceUser)) {
|
||||
throw new ServiceException("未查询到人员信息", HttpStatusEnum.DARA_EXCEPTION.getCode());
|
||||
}
|
||||
if (StringUtils.isNull(surProjectAttendanceUser.getCompanyTypeId())) {
|
||||
throw new ServiceException("人员部门类型信息不完整", HttpStatusEnum.DARA_EXCEPTION.getCode());
|
||||
}
|
||||
surProjectAttendanceData.setCfgid(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceData.setAppId(sysApplyConfig.getAppId());
|
||||
surProjectAttendanceData.setProjectId(sysApplyConfig.getProjectId());
|
||||
surProjectAttendanceData.setProjectName(sysApplyConfig.getProjectName());
|
||||
surProjectAttendanceData.setDeptId(sysApplyConfig.getDeptId());
|
||||
surProjectAttendanceData.setDeptName(sysApplyConfig.getDeptName());
|
||||
surProjectAttendanceData.setVendorsCode(VendorsCodeEnum.YANZHU.getCode());
|
||||
surProjectAttendanceData.setCompanyId(surProjectAttendanceUser.getCompanyId());
|
||||
surProjectAttendanceData.setCompanyName(surProjectAttendanceUser.getCompanyName());
|
||||
surProjectAttendanceData.setWorkerName(surProjectAttendanceUser.getName());
|
||||
surProjectAttendanceData.setWorkerPhoto(surProjectAttendanceUser.getRecentPhoto());
|
||||
surProjectAttendanceData.setWorkerGender(surProjectAttendanceUser.getGender());
|
||||
surProjectAttendanceData.setBirthDate(surProjectAttendanceUser.getBirthDate());
|
||||
surProjectAttendanceData.setEthnic(surProjectAttendanceUser.getEthnic());
|
||||
surProjectAttendanceData.setNativePlace(surProjectAttendanceUser.getNativePlace());
|
||||
surProjectAttendanceData.setPhone(surProjectAttendanceUser.getPhone());
|
||||
surProjectAttendanceData.setWorkTypeName(surProjectAttendanceUser.getWorkTypeName());
|
||||
surProjectAttendanceData.setSpecWorkType(surProjectAttendanceUser.getSpecWorkType());
|
||||
surProjectAttendanceData.setGroupName(surProjectAttendanceUser.getGroupName());
|
||||
surProjectAttendanceData.setCompanyTypeId(surProjectAttendanceUser.getCompanyTypeId());
|
||||
surProjectAttendanceData.setWorkTypeCode(surProjectAttendanceUser.getWorkTypeCode());
|
||||
surProjectAttendanceData.setAttendanceTime(req.getAttendanceTime());
|
||||
try {
|
||||
//保存打卡照片
|
||||
SysFile sysFile = remoteFileService.upload(MultipartFileUtils.base64ToMultipartFile(req.getScanPhotoBase64())).getData();
|
||||
surProjectAttendanceData.setScanPhoto(sysFile.getUrl());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
surProjectAttendanceData.setCreateBy(sysApplyConfig.getAppId() + "Api推送入场打卡");
|
||||
surProjectAttendanceData.setCreateTime(new Date());
|
||||
surProjectAttendanceDataService.insertSurProjectAttendanceData(surProjectAttendanceData);
|
||||
}
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 劳务实名制管理对象
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-22
|
||||
*/
|
||||
@Data
|
||||
public class LabourDataPMReqVo
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 进门还是出门E进,L出 */
|
||||
private String attendanceType;
|
||||
|
||||
/** 考勤时间yyyy-MM-dd HH:mm:ss */
|
||||
private String attendanceTime;
|
||||
|
||||
/** 打卡照片 */
|
||||
private String scanPhoto;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 劳务实名制管理对象
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-22
|
||||
*/
|
||||
public class LabourDataReqVo
|
||||
{
|
||||
|
||||
/** 工人Id */
|
||||
@NotBlank(message = "工人ID不能为空")
|
||||
@Size(max = 64, message = "工人ID最大长度64位")
|
||||
private String workerId;
|
||||
|
||||
/** 进门还是出门E进,L出 */
|
||||
@NotBlank(message = "进出门不能为空")
|
||||
@Pattern(regexp = "E|L", message = "进出门类型格式异常,E进|L出")
|
||||
private String attendanceType;
|
||||
|
||||
/** 考勤时间yyyy-MM-dd HH:mm:ss */
|
||||
@NotBlank(message = "考勤时间不能为空")
|
||||
@Size(min = 18,max = 20, message = "考勤时间格式异常YYYY-MM-dd HH:mm:ss")
|
||||
private String attendanceTime;
|
||||
|
||||
/** 打卡照片 */
|
||||
@NotBlank(message = "打卡照片不能为空")
|
||||
private String scanPhotoBase64;
|
||||
|
||||
/** 数据是否有效 */
|
||||
@NotNull(message = "数据是否有效不能为空")
|
||||
@Max(value = 1, message = "数据是否有效格式异常,0有效|1无效")
|
||||
private Long isDel;
|
||||
|
||||
public String getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(String workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public String getAttendanceTime() {
|
||||
return attendanceTime;
|
||||
}
|
||||
|
||||
public void setAttendanceTime(String attendanceTime) {
|
||||
this.attendanceTime = attendanceTime;
|
||||
}
|
||||
|
||||
public String getScanPhotoBase64() {
|
||||
return scanPhotoBase64;
|
||||
}
|
||||
|
||||
public void setScanPhotoBase64(String scanPhotoBase64) {
|
||||
this.scanPhotoBase64 = scanPhotoBase64;
|
||||
}
|
||||
|
||||
public Long getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
||||
public void setIsDel(Long isDel) {
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public String getAttendanceType() {
|
||||
return attendanceType;
|
||||
}
|
||||
|
||||
public void setAttendanceType(String attendanceType) {
|
||||
this.attendanceType = attendanceType;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
public class LabourGroupReqVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 工人id */
|
||||
@NotBlank(message = "班组主键ID不能为空")
|
||||
@Size(max = 64, message = "班组主键最大64位")
|
||||
private String serverid;
|
||||
|
||||
/** 分包商id */
|
||||
@NotBlank(message = "分包商ID不能为空")
|
||||
private String companyId;
|
||||
|
||||
/** 分包商名称 */
|
||||
@NotBlank(message = "分包商名称不能为空")
|
||||
@Size(max = 64, message = "分包商名称最大64位")
|
||||
private String companyName;
|
||||
|
||||
private String companyCode;
|
||||
|
||||
/** 分包商类型不能为空 */
|
||||
@NotBlank(message = "分包商类型不能为空")
|
||||
@Pattern(regexp = "1|2|3|4|5|6|7|8", message = "分包商类型错误,1总包|2劳务分包|8监理")
|
||||
private String companyTypeId;
|
||||
|
||||
private String bizLicense;
|
||||
|
||||
/** 班组名称 */
|
||||
@NotBlank(message = "班组名称不能为空")
|
||||
@Size(max = 64, message = "班组名称最大64位")
|
||||
private String name;
|
||||
|
||||
private String leaderName;
|
||||
|
||||
private String leaderPhone;
|
||||
|
||||
/** 进场日期 */
|
||||
@NotBlank(message = "进场日期不能为空")
|
||||
@Size(max = 32, message = "进场日期格式异常")
|
||||
private String enterDate;
|
||||
|
||||
/** 数据是否有效 */
|
||||
@NotNull(message = "数据是否有效不能为空")
|
||||
@Max(value = 1, message = "数据是否有效格式异常,0有效|1无效")
|
||||
private Long isDel;
|
||||
|
||||
public String getServerid() {
|
||||
return serverid;
|
||||
}
|
||||
|
||||
public void setServerid(String serverid) {
|
||||
this.serverid = serverid;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public String getCompanyTypeId() {
|
||||
return companyTypeId;
|
||||
}
|
||||
|
||||
public void setCompanyTypeId(String companyTypeId) {
|
||||
this.companyTypeId = companyTypeId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
||||
public void setIsDel(Long isDel) {
|
||||
this.isDel = isDel;
|
||||
}
|
||||
|
||||
public String getCompanyCode() {
|
||||
return companyCode;
|
||||
}
|
||||
|
||||
public void setCompanyCode(String companyCode) {
|
||||
this.companyCode = companyCode;
|
||||
}
|
||||
|
||||
public String getBizLicense() {
|
||||
return bizLicense;
|
||||
}
|
||||
|
||||
public void setBizLicense(String bizLicense) {
|
||||
this.bizLicense = bizLicense;
|
||||
}
|
||||
|
||||
public String getLeaderName() {
|
||||
return leaderName;
|
||||
}
|
||||
|
||||
public void setLeaderName(String leaderName) {
|
||||
this.leaderName = leaderName;
|
||||
}
|
||||
|
||||
public String getLeaderPhone() {
|
||||
return leaderPhone;
|
||||
}
|
||||
|
||||
public void setLeaderPhone(String leaderPhone) {
|
||||
this.leaderPhone = leaderPhone;
|
||||
}
|
||||
|
||||
public String getEnterDate() {
|
||||
return enterDate;
|
||||
}
|
||||
|
||||
public void setEnterDate(String enterDate) {
|
||||
this.enterDate = enterDate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 获取系统token 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class LabourSignReqVo {
|
||||
|
||||
/**
|
||||
* AppId
|
||||
*/
|
||||
@NotBlank(message = "AppId不能为空")
|
||||
@Size(min = 1, max = 64, message = "AppId格式异常")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 账号密钥
|
||||
* RSA(用户账号 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "账号密钥不能为空")
|
||||
@Size(min = 1, max = 64, message = "账号密钥格式异常")
|
||||
private String secret;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import com.ruoyi.common.utils.AuthRsaUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.sign.Md5Utils;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 劳务人员签名推送信息 请求参数
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 12:21
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class LabourSignetVo {
|
||||
|
||||
/**
|
||||
* 签名
|
||||
* RSA(dataMd5 + 时间戳)加密
|
||||
*/
|
||||
@NotBlank(message = "签名不能为空")
|
||||
private String sign;
|
||||
|
||||
/**
|
||||
* 推送数据 明文参数
|
||||
*/
|
||||
@NotBlank(message = "推送数据不能为空")
|
||||
private String data;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@NotNull(message = "时间戳不能为空")
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 获取数据签名
|
||||
*
|
||||
* @author: JiangYuQi
|
||||
* @date: 2024/01/13 10:17
|
||||
*/
|
||||
public Boolean getDataSign(String privateKey) {
|
||||
boolean signFlag = false;
|
||||
try {
|
||||
String decryptByPrivateKey = AuthRsaUtils.decryptByPrivateKey(privateKey,sign);
|
||||
String privateDataStr = Md5Utils.hash(data) + timestamp;
|
||||
log.info("签名值...{}",privateDataStr);
|
||||
log.info("解密值...{}",decryptByPrivateKey);
|
||||
if (StringUtils.equals(privateDataStr, decryptByPrivateKey)) {
|
||||
signFlag = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return signFlag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 效验时间签名[30分钟有效期]
|
||||
*/
|
||||
public Boolean checkTimestamp() {
|
||||
boolean timestampFlag = true;
|
||||
/**long timePoor = Math.abs(timestamp - System.currentTimeMillis());
|
||||
if (timePoor < 1000 * 60 * 30) {
|
||||
timestampFlag = true;
|
||||
}*/
|
||||
return timestampFlag;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
package com.yanzhu.manage.api.vo;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
public class LabourUserReqVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 工人id */
|
||||
@NotBlank(message = "工人ID不能为空")
|
||||
@Size(max = 64, message = "工人ID最大长度64位")
|
||||
private String workerId;
|
||||
|
||||
/** 姓名 */
|
||||
@NotBlank(message = "工人姓名不能为空")
|
||||
@Size(max = 32, message = "工人ID最大长度32位")
|
||||
private String name;
|
||||
|
||||
/** 民族 */
|
||||
@NotBlank(message = "工人民族不能为空")
|
||||
@Size(max = 32, message = "工人民族最大长度32位")
|
||||
private String ethnic;
|
||||
|
||||
/** 籍贯 */
|
||||
@NotBlank(message = "工人籍贯不能为空")
|
||||
@Size(max = 128, message = "工人籍贯最大长度128位")
|
||||
private String nativePlace;
|
||||
|
||||
/** 性别0:男 1:女 */
|
||||
@NotNull(message = "工人性别不能为空")
|
||||
@Max(value = 1, message = "工人性别格式异常")
|
||||
private Long gender;
|
||||
|
||||
/** 联系电话 */
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
@Size(max = 32, message = "联系电话最大32位")
|
||||
private String phone;
|
||||
|
||||
/** 入场照片 */
|
||||
@NotBlank(message = "入场照片不能为空")
|
||||
private String recentPhotoBase64;
|
||||
|
||||
/** 所属班组ID */
|
||||
@NotBlank(message = "所属班组ID不能为空")
|
||||
private String groupId;
|
||||
|
||||
/** 所属班组 */
|
||||
@NotBlank(message = "所属班组不能为空")
|
||||
@Size(max = 64, message = "所属名称最大64位")
|
||||
private String groupName;
|
||||
|
||||
/** 工种名称 */
|
||||
@NotBlank(message = "工种名称不能为空")
|
||||
@Size(max = 64, message = "工种名称最大64位")
|
||||
private String workTypeName;
|
||||
|
||||
/** 是否特殊工种 */
|
||||
@NotNull(message = "是否特殊工种不能为空")
|
||||
@Max(value = 1, message = "是否特殊工种格式异常,0否|1是")
|
||||
private Integer specWorkType;
|
||||
|
||||
/** 进退场状态0:进场,1:退场 */
|
||||
@NotNull(message = "进退场状态不能为空")
|
||||
@Max(value = 1, message = "进退场状态格式异常,0进场|1退场")
|
||||
private Long state;
|
||||
|
||||
/** 进场日期 */
|
||||
@NotBlank(message = "进场日期不能为空")
|
||||
@Size(max = 32, message = "进场日期格式异常")
|
||||
private String enterDate;
|
||||
|
||||
/** 分包商id */
|
||||
@NotBlank(message = "分包商ID不能为空")
|
||||
private String companyId;
|
||||
|
||||
/** 分包商名称 */
|
||||
@Size(max = 64, message = "分包商名称最大64位")
|
||||
private String companyName;
|
||||
|
||||
/** 数据是否有效 */
|
||||
@NotNull(message = "数据是否有效不能为空")
|
||||
@Max(value = 1, message = "数据是否有效格式异常,0有效|1无效")
|
||||
private Long isDel;
|
||||
|
||||
public String getWorkerId() {
|
||||
return workerId;
|
||||
}
|
||||
|
||||
public void setWorkerId(String workerId) {
|
||||
this.workerId = workerId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEthnic() {
|
||||
return ethnic;
|
||||
}
|
||||
|
||||
public void setEthnic(String ethnic) {
|
||||
this.ethnic = ethnic;
|
||||
}
|
||||
|
||||
public String getNativePlace() {
|
||||
return nativePlace;
|
||||
}
|
||||
|
||||
public void setNativePlace(String nativePlace) {
|
||||
this.nativePlace = nativePlace;
|
||||
}
|
||||
|
||||
public Long getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Long gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getRecentPhotoBase64() {
|
||||
return recentPhotoBase64;
|
||||
}
|
||||
|
||||
public void setRecentPhotoBase64(String recentPhotoBase64) {
|
||||
this.recentPhotoBase64 = recentPhotoBase64;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(String groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public String getWorkTypeName() {
|
||||
return workTypeName;
|
||||
}
|
||||
|
||||
public void setWorkTypeName(String workTypeName) {
|
||||
this.workTypeName = workTypeName;
|
||||
}
|
||||
|
||||
public Integer getSpecWorkType() {
|
||||
return specWorkType;
|
||||
}
|
||||
|
||||
public void setSpecWorkType(Integer specWorkType) {
|
||||
this.specWorkType = specWorkType;
|
||||
}
|
||||
|
||||
public Long getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(Long state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getEnterDate() {
|
||||
return enterDate;
|
||||
}
|
||||
|
||||
public void setEnterDate(String enterDate) {
|
||||
this.enterDate = enterDate;
|
||||
}
|
||||
|
||||
public String getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(String companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getCompanyName() {
|
||||
return companyName;
|
||||
}
|
||||
|
||||
public void setCompanyName(String companyName) {
|
||||
this.companyName = companyName;
|
||||
}
|
||||
|
||||
public Long getIsDel() {
|
||||
return isDel;
|
||||
}
|
||||
|
||||
public void setIsDel(Long isDel) {
|
||||
this.isDel = isDel;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package com.yanzhu.manage.controller;
|
||||
|
||||
import com.yanzhu.common.core.enums.ApplyCfgTypeEnum;
|
||||
import com.yanzhu.common.core.enums.ShiFouEnum;
|
||||
import com.yanzhu.common.core.enums.VendorsCodeEnum;
|
||||
import com.yanzhu.common.core.utils.NoUtils;
|
||||
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
||||
import com.yanzhu.common.core.web.controller.BaseController;
|
||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||
import com.yanzhu.common.core.web.page.TableDataInfo;
|
||||
import com.yanzhu.common.log.annotation.Log;
|
||||
import com.yanzhu.common.log.enums.BusinessType;
|
||||
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
||||
import com.yanzhu.manage.domain.AttendanceCfg;
|
||||
import com.yanzhu.manage.domain.SysApplyConfig;
|
||||
import com.yanzhu.manage.service.IAttendanceCfgService;
|
||||
import com.yanzhu.manage.service.ISysApplyConfigService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册Controller
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/applyConfig")
|
||||
public class SysApplyConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysApplyConfigService sysApplyConfigService;
|
||||
|
||||
@Autowired
|
||||
private IAttendanceCfgService attendanceCfgService;
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*/
|
||||
@RequiresPermissions("@ss.hasPermi('system:applyConfig:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
startPage();
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出系统应用注册列表
|
||||
*/
|
||||
@RequiresPermissions("@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, "系统应用注册数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统应用注册详细信息
|
||||
*/
|
||||
@RequiresPermissions("@ss.hasPermi('system:applyConfig:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysApplyConfigService.selectSysApplyConfigById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统应用注册
|
||||
*/
|
||||
@RequiresPermissions("@ss.hasPermi('system:applyConfig:add')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
AttendanceCfg attendanceCfg = new AttendanceCfg();
|
||||
attendanceCfg.setProjectId(sysApplyConfig.getProjectId());
|
||||
attendanceCfg.setComId(sysApplyConfig.getDeptId());
|
||||
attendanceCfg.setVendorsCode(VendorsCodeEnum.YANZHU.getCode());
|
||||
attendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
attendanceCfg.setState(ShiFouEnum.FOU.getLongCode());
|
||||
int res = attendanceCfgService.insertAttendanceCfg(attendanceCfg);
|
||||
if(res>0){
|
||||
// 同步将信息保存到sur_project_attendance_cfg
|
||||
sysApplyConfig.setCfgId(attendanceCfg.getId());
|
||||
}
|
||||
}
|
||||
return toAjax(sysApplyConfigService.insertSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统应用注册
|
||||
*/
|
||||
@RequiresPermissions("@ss.hasPermi('system:applyConfig:edit')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
AttendanceCfg attendanceCfg = new AttendanceCfg();
|
||||
attendanceCfg.setId(sysApplyConfig.getCfgId());
|
||||
attendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
attendanceCfgService.updateAttendanceCfg(attendanceCfg);
|
||||
}
|
||||
return toAjax(sysApplyConfigService.updateSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统应用注册
|
||||
*/
|
||||
@RequiresPermissions("@ss.hasPermi('system:applyConfig:remove')")
|
||||
@Log(title = "系统应用注册", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
List<Long> cfgIds = new ArrayList<>();
|
||||
for(Long id:ids){
|
||||
SysApplyConfig sysApplyConfig = sysApplyConfigService.selectSysApplyConfigById(id);
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
cfgIds.add(sysApplyConfig.getCfgId());
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(cfgIds)){
|
||||
attendanceCfgService.deleteAttendanceCfgByIds(cfgIds.stream().toArray(Long[]::new));
|
||||
}
|
||||
return toAjax(sysApplyConfigService.deleteSysApplyConfigByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建应用ID
|
||||
*/
|
||||
@PostMapping("/createAppId")
|
||||
public AjaxResult createAppId()
|
||||
{
|
||||
return success(NoUtils.createAppId());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.yanzhu.manage.service;
|
||||
|
||||
import com.yanzhu.manage.domain.SysApplyConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册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,167 @@
|
|||
package com.yanzhu.manage.service.impl;
|
||||
|
||||
import com.yanzhu.common.core.constant.CacheConstants;
|
||||
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||
import com.yanzhu.common.core.enums.UserTypeEnums;
|
||||
import com.yanzhu.common.core.utils.DateUtils;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
import com.yanzhu.common.redis.service.RedisService;
|
||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.manage.domain.SysApplyConfig;
|
||||
import com.yanzhu.manage.mapper.SysApplyConfigMapper;
|
||||
import com.yanzhu.manage.service.ISysApplyConfigService;
|
||||
import com.yanzhu.system.api.RemoteUserService;
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统应用注册Service业务层处理
|
||||
*
|
||||
* @author JiangYuQi
|
||||
* @date 2024-01-13
|
||||
*/
|
||||
@Service
|
||||
public class SysApplyConfigServiceImpl implements ISysApplyConfigService
|
||||
{
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
@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) {
|
||||
redisService.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.setPrivateKey(StringUtils.randomString(25));
|
||||
sysApplyConfig.setCreateBy(SecurityUtils.getUsername());
|
||||
sysApplyConfig.setCreateTime(DateUtils.getNowDate());
|
||||
int res = sysApplyConfigMapper.insertSysApplyConfig(sysApplyConfig);
|
||||
if(res>0){
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setComId(sysApplyConfig.getDeptId());
|
||||
sysUser.setDeptId(sysApplyConfig.getDeptId());
|
||||
sysUser.setUserName(sysApplyConfig.getAppId());
|
||||
sysUser.setUserType(UserTypeEnums.DJRY.getCode());
|
||||
sysUser.setNickName(sysApplyConfig.getAppId());
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(sysApplyConfig.getPrivateKey()));
|
||||
sysUser.setStatus("0");
|
||||
sysUser.setCreateBy("AppId登录创建用户");
|
||||
sysUser.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysUser.setUpdateTime(DateUtils.getNowDate());
|
||||
remoteUserService.registerAppIdUserInfo(sysUser,SecurityConstants.INNER);
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ spring:
|
|||
# 工作空间配置
|
||||
# namespace: a113aa27-4d61-46e0-81d6-9cede0457f0d
|
||||
# 服务分组
|
||||
#group: lijun
|
||||
group: JiangYuQi
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: @discovery.server-addr@
|
||||
|
|
|
@ -205,6 +205,7 @@ public class SysUserController extends BaseController {
|
|||
SysUser sysUser = userService.selectByPhone(phone);
|
||||
return R.ok(sysUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
|
@ -237,7 +238,7 @@ public class SysUserController extends BaseController {
|
|||
@InnerAuth
|
||||
@PostMapping("/register")
|
||||
public R<Long> register(@RequestBody SysUser sysUser) {
|
||||
String username = sysUser.getUserName();
|
||||
//String username = sysUser.getUserName();
|
||||
if (Objects.isNull(sysUser.getUserType()) || Objects.equals(UserTypeEnums.XTRY.getCode(), sysUser.getUserType()) || Objects.equals(UserTypeEnums.XMRY.getCode(), sysUser.getUserType())) {
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
||||
return R.fail("当前系统没有开启注册功能!");
|
||||
|
@ -249,6 +250,15 @@ public class SysUserController extends BaseController {
|
|||
return R.ok(userService.registerUser(sysUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*/
|
||||
@InnerAuth
|
||||
@PostMapping("/registerAppIdUser")
|
||||
public R<Long> registerAppIdUser(@RequestBody SysUser sysUser) {
|
||||
return R.ok(userService.registerAppIdUser(sysUser));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户角色
|
||||
*/
|
||||
|
|
|
@ -165,6 +165,13 @@ public interface ISysUserService
|
|||
*/
|
||||
public Long registerUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
public Long registerAppIdUser(SysUser user);
|
||||
|
||||
/**
|
||||
* 删除用户角色
|
||||
* @param user
|
||||
|
|
|
@ -683,6 +683,20 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户信息
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
public Long registerAppIdUser(SysUser user){
|
||||
int rows = userMapper.insertUser(user);
|
||||
if(rows>0){
|
||||
return user.getUserId();
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户角色
|
||||
* @param user
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"appid": "wx46466c7828eede2b",
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "3.6.0",
|
||||
"libVersion": "3.8.9",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询系统应用注册列表
|
||||
export function listApplyConfig(query) {
|
||||
return request({
|
||||
url: '/manage/applyConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询系统应用注册详细
|
||||
export function getApplyConfig(id) {
|
||||
return request({
|
||||
url: '/manage/applyConfig/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增系统应用注册
|
||||
export function addApplyConfig(data) {
|
||||
return request({
|
||||
url: '/manage/applyConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改系统应用注册
|
||||
export function updateApplyConfig(data) {
|
||||
return request({
|
||||
url: '/manage/applyConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除系统应用注册
|
||||
export function delApplyConfig(id) {
|
||||
return request({
|
||||
url: '/manage/applyConfig/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750493276865" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4578" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M867.584 160.192c-149.632-16.928-262.208-57.408-334.592-120.352l-19.04-16.544-20.544 14.656C379.968 118.944 267.776 160 160 160H128v448c0 137.344 121.088 261.92 370.208 380.864l13.088 6.24 13.344-5.728C771.072 883.52 896 755.232 896 608V163.424l-28.416-3.232zM832 608c0 116.8-107.392 223.36-319.328 316.8C299.872 821.024 192 714.464 192 608V222.976c104.672-6.784 211.584-46.688 318.496-118.944C587.232 162.528 695.168 201.536 832 220.256V608z" p-id="4579"></path><path d="M359.776 468.672a32 32 0 1 0-47.968 42.4l121.792 137.824c12.608 14.24 30.176 21.568 47.904 21.568a64.384 64.384 0 0 0 49.696-23.52l197.6-242.72a32 32 0 0 0-49.632-40.416l-197.6 242.688-121.792-137.824z" p-id="4580"></path></svg>
|
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1750493311338" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6930" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M512 1002.666667l-12.373333-4.693334c-11.946667-4.693333-298.666667-116.053333-369.066667-256C70.826667 622.08 48.213333 426.666667 69.973333 223.146667S469.333333 17.493333 512 17.493333s424.106667 11.52 443.306667 210.346667c20.053333 204.8-4.693333 398.506667-65.706667 518.4-70.826667 139.093333-353.706667 247.466667-365.653333 251.733333zM512 85.333333c-93.013333 0-361.386667 28.16-373.76 145.066667-20.48 189.44 0 374.186667 53.76 481.706667C237.226667 803.413333 426.666667 896 512 929.28c82.773333-32.853333 270.08-122.88 316.586667-213.333333 54.613333-107.093333 77.226667-291.413333 58.88-481.28C876.373333 117.333333 605.44 85.333333 512 85.333333z" p-id="6931"></path><path d="M745.813333 341.333333v42.666667h-170.666666c0 13.653333-2.986667 28.586667-5.546667 42.666667h142.506667v178.773333h-51.626667v-133.12h-202.24v132.693333H410.453333v-176.213333h111.36c0-13.226667 2.986667-28.16 4.693334-42.666667h-149.333334v28.16q0 193.28-57.6 286.293334a114.346667 114.346667 0 0 0-42.666666-24.32q52.48-82.773333 52.48-261.973334V270.08a2011.733333 2011.733333 0 0 0 347.733333-35.84l37.973333 38.4c-39.253333 8.106667-85.333333 15.36-133.12 20.906667L578.56 341.333333z m-160.426666 192.853334a128 128 0 0 1-30.293334 85.333333 314.026667 314.026667 0 0 1-153.6 85.333333 167.253333 167.253333 0 0 0-32.426666-37.546666A293.12 293.12 0 0 0 512 600.32a93.013333 93.013333 0 0 0 24.32-66.133333v-42.666667h49.92zM529.493333 341.333333l2.986667-42.666666c-46.933333 4.266667-98.56 7.68-155.306667 9.813333V341.333333zM597.333333 604.586667a1155.413333 1155.413333 0 0 1 146.346667 66.133333l-33.706667 31.573333a882.773333 882.773333 0 0 0-145.92-69.546666z" p-id="6932"></path></svg>
|
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,304 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="项目名称" prop="projectName">
|
||||
<el-input
|
||||
v-model="queryParams.projectName"
|
||||
placeholder="请输入项目名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用AppId" prop="appId">
|
||||
<el-input
|
||||
v-model="queryParams.appId"
|
||||
placeholder="请输入应用AppId"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="配置类型" prop="cfgType">
|
||||
<el-select v-model="queryParams.cfgType" placeholder="请选择配置类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in sys_apply_cfg_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @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="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['manage:applyConfig:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['manage:applyConfig:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['manage:applyConfig:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['manage:applyConfig:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="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="deptName" />
|
||||
<el-table-column label="所属项目" align="center" prop="projectName" />
|
||||
<el-table-column label="配置类型" align="center" prop="cfgType">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="sys_apply_cfg_type" :value="scope.row.cfgType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配置主键" align="center" prop="cfgId" />
|
||||
<el-table-column label="应用主键" align="center" prop="appId" />
|
||||
<el-table-column label="公钥" align="center" prop="publicKey" />
|
||||
<el-table-column label="私钥" align="center" prop="privateKey" />
|
||||
<el-table-column label="项目主键" align="center" prop="projectId" />
|
||||
<el-table-column label="部门主键" align="center" prop="deptId" />
|
||||
<el-table-column label="是否删除" align="center" prop="isDel" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:applyConfig:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:applyConfig:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改系统应用注册对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="applyConfigRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="配置类型" prop="cfgType">
|
||||
<el-select v-model="form.cfgType" placeholder="请选择配置类型">
|
||||
<el-option
|
||||
v-for="dict in sys_apply_cfg_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配置主键" prop="cfgId">
|
||||
<el-input v-model="form.cfgId" placeholder="请输入配置主键" />
|
||||
</el-form-item>
|
||||
<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-input v-model="form.isDel" placeholder="请输入是否删除" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ApplyConfig">
|
||||
import { listApplyConfig, getApplyConfig, delApplyConfig, addApplyConfig, updateApplyConfig } from "@/api/manage/applyConfig";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_apply_cfg_type } = proxy.useDict('sys_apply_cfg_type');
|
||||
|
||||
const applyConfigList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
projectName: null,
|
||||
appId: null,
|
||||
cfgType: null
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询系统应用注册列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listApplyConfig(queryParams.value).then(response => {
|
||||
applyConfigList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
cfgType: null,
|
||||
cfgId: null,
|
||||
appId: null,
|
||||
publicKey: null,
|
||||
privateKey: null,
|
||||
projectId: null,
|
||||
deptId: null,
|
||||
isDel: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("applyConfigRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加系统应用注册";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _id = row.id || ids.value
|
||||
getApplyConfig(_id).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改系统应用注册";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["applyConfigRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateApplyConfig(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addApplyConfig(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除系统应用注册编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delApplyConfig(_ids);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('manage/applyConfig/export', {
|
||||
...queryParams.value
|
||||
}, `applyConfig_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
|
@ -102,13 +102,13 @@
|
|||
</el-form-item>
|
||||
<template v-if="form.vendorsCode == 'uni'">
|
||||
<el-form-item label="应用KEY" prop="AppKey">
|
||||
<el-input v-model="form.AppKey" placeholder="请输入内容" />
|
||||
<el-input v-model="form.AppKey" placeholder="请输入应用KEY" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用Secret" prop="AppSecret">
|
||||
<el-input v-model="form.AppSecret" placeholder="请输入内容" />
|
||||
<el-input v-model="form.AppSecret" placeholder="请输入应用Secret" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目ID" prop="projectGuid">
|
||||
<el-input v-model="form.projectGuid" placeholder="请输入内容" />
|
||||
<el-input v-model="form.projectGuid" placeholder="请输入项目ID" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="form.vendorsCode=='gld' || form.vendorsCode=='jgw'">
|
||||
|
@ -122,7 +122,14 @@
|
|||
<el-input v-model="form.appProjectId" placeholder="请输项目ID" clearable />
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<template v-if="form.vendorsCode == 'szj'">
|
||||
<el-form-item label="APPID" prop="appId">
|
||||
<el-input v-model="form.appId" placeholder="请输AppId" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="Secret" prop="secret">
|
||||
<el-input v-model="form.secret" placeholder="请输Secret" clearable />
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template v-if="form.vendorsCode=='jgw'">
|
||||
<el-form-item label="项目经理手机" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="项目经理手机" clearable />
|
||||
|
@ -217,6 +224,14 @@ function vendorsCodeChange() {
|
|||
enabled: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||
phone: [{ required: true, trigger: 'blur', message: '输入' }],
|
||||
}
|
||||
} else if (form.value.vendorsCode == 'szj') {
|
||||
rules = {
|
||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||
subDeptId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||
appId: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||
secret: [{ required: true, trigger: 'blur', message: '请输入' }],
|
||||
enabled: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||
}
|
||||
} else if (form.value.vendorsCode == 'gld') {
|
||||
rules = {
|
||||
projectId: [{ required: true, trigger: 'blur', message: '请选择' }],
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="单位类型" prop="subDeptType">
|
||||
<el-select v-model="form.subDeptType" placeholder="请选择单位类型" style="width: 100%">
|
||||
<el-option v-for="dict in sub_dept_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
<el-option v-for="dict in sub_dept_type" v-show="dict.value!='1'" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" prop="subDeptName">
|
||||
|
|
Loading…
Reference in New Issue