提交代码
parent
785794a948
commit
df08d716a7
|
@ -4,16 +4,22 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.ApplyCfgTypeEnum;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.enums.ShiFouEnum;
|
||||
import com.ruoyi.common.utils.NoUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysApplyConfigService;
|
||||
import com.yanzhu.jh.project.domain.SurProjectAttendanceCfg;
|
||||
import com.yanzhu.jh.project.service.ISurProjectAttendanceCfgService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -26,9 +32,14 @@ import java.util.List;
|
|||
@RequestMapping("/system/applyConfig")
|
||||
public class SysApplyConfigController extends BaseController
|
||||
{
|
||||
private static final String vendorsCode = "yanzhu";
|
||||
|
||||
@Autowired
|
||||
private ISysApplyConfigService sysApplyConfigService;
|
||||
|
||||
@Autowired
|
||||
private ISurProjectAttendanceCfgService surProjectAttendanceCfgService;
|
||||
|
||||
/**
|
||||
* 查询系统应用注册列表
|
||||
*/
|
||||
|
@ -72,6 +83,19 @@ public class SysApplyConfigController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
|
||||
surProjectAttendanceCfg.setProjectId(sysApplyConfig.getProjectId());
|
||||
surProjectAttendanceCfg.setSubDeptId(sysApplyConfig.getDeptId());
|
||||
surProjectAttendanceCfg.setVendorsCode(vendorsCode);
|
||||
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
surProjectAttendanceCfg.setState(ShiFouEnum.FOU.getLongCode());
|
||||
int res = surProjectAttendanceCfgService.insertSurProjectAttendanceCfg(surProjectAttendanceCfg);
|
||||
if(res>0){
|
||||
// 同步将信息保存到sur_project_attendance_cfg
|
||||
sysApplyConfig.setCfgId(surProjectAttendanceCfg.getId());
|
||||
}
|
||||
}
|
||||
return toAjax(sysApplyConfigService.insertSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
|
@ -83,6 +107,12 @@ public class SysApplyConfigController extends BaseController
|
|||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysApplyConfig sysApplyConfig)
|
||||
{
|
||||
if(ApplyCfgTypeEnum.LABOUR.getCode().equals(sysApplyConfig.getCfgType())){
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = new SurProjectAttendanceCfg();
|
||||
surProjectAttendanceCfg.setId(sysApplyConfig.getCfgId());
|
||||
surProjectAttendanceCfg.setEnabled(sysApplyConfig.getIsDel().equals(ShiFouEnum.FOU.getCode())?ShiFouEnum.SHI.getLongCode():ShiFouEnum.FOU.getLongCode());
|
||||
surProjectAttendanceCfgService.updateSurProjectAttendanceCfg(surProjectAttendanceCfg);
|
||||
}
|
||||
return toAjax(sysApplyConfigService.updateSysApplyConfig(sysApplyConfig));
|
||||
}
|
||||
|
||||
|
@ -94,6 +124,16 @@ public class SysApplyConfigController extends BaseController
|
|||
@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)){
|
||||
surProjectAttendanceCfgService.deleteSurProjectAttendanceCfgByIds(cfgIds.stream().toArray(Long[]::new));
|
||||
}
|
||||
return toAjax(sysApplyConfigService.deleteSysApplyConfigByIds(ids));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 应用配置类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum ApplyCfgTypeEnum {
|
||||
|
||||
LABOUR("1", "劳务人员信息接入");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
ApplyCfgTypeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 厂商编号类型枚举
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum VendorsCodeEnum {
|
||||
|
||||
YANZHU("yanzhu", "研筑");
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
VendorsCodeEnum(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,12 @@ public class SysApplyConfig extends BaseEntity
|
|||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 服务配置主键 */
|
||||
private Long cfgId;
|
||||
|
||||
/** 服务配置类型 */
|
||||
private String cfgType;
|
||||
|
||||
/** 应用主键 */
|
||||
@Excel(name = "应用主键")
|
||||
private String appId;
|
||||
|
@ -129,10 +135,28 @@ public class SysApplyConfig extends BaseEntity
|
|||
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())
|
||||
|
|
|
@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<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" />
|
||||
|
@ -22,14 +24,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectSysApplyConfigVo">
|
||||
select sac.id, sac.app_id, sac.public_key, sac.private_key, sac.project_id, sp.projectName, sac.dept_id, sd.dept_name as deptName, sac.is_del, sac.create_by, sac.create_time, sac.update_by, sac.update_time, sac.remark from sys_apply_config sac
|
||||
select sac.id, sac.cfg_type, sac.cfg_id, sac.app_id, sac.public_key, sac.private_key, sac.project_id, sp.projectName, sac.dept_id, sd.dept_name as deptName, sac.is_del, sac.create_by, sac.create_time, sac.update_by, sac.update_time, sac.remark from sys_apply_config sac
|
||||
left join sur_project 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>
|
||||
<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.projectName like concat('%', #{projectName}, '%')</if>
|
||||
<if test="deptName != null "> and sd.dept_name like concat('%', #{deptName}, '%')</if>
|
||||
|
@ -47,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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>
|
||||
|
@ -61,6 +67,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</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>
|
||||
|
@ -78,6 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<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>
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="应用类型" prop="cfgType">
|
||||
<el-select v-model="queryParams.cfgType" placeholder="请选择应用类型" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_apply_cfg_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用主键" prop="appId">
|
||||
<el-input
|
||||
v-model="queryParams.appId"
|
||||
|
@ -89,6 +99,11 @@
|
|||
|
||||
<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="cfgType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_apply_cfg_type" :value="scope.row.cfgType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目信息" align="center" prop="projectName" />
|
||||
<el-table-column label="部门信息" align="center" prop="deptName" />
|
||||
<el-table-column label="AppId" align="center" prop="appId" />
|
||||
|
@ -138,6 +153,16 @@
|
|||
<div class="page-warning">
|
||||
<p><strong style="color: #E6A23C;">“应用公钥”</strong> 在注册应用后由系统生成,请在保存后查看。</p>
|
||||
</div>
|
||||
<el-form-item label="应用类型" prop="cfgType">
|
||||
<el-select v-model="form.cfgType" placeholder="请选择应用类型" style="width: 100%" :disabled="getDisabled()">
|
||||
<el-option
|
||||
v-for="dict in dict.type.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="appId">
|
||||
<el-input v-model="form.appId" placeholder="请输入应用主键" :disabled="true"/>
|
||||
</el-form-item>
|
||||
|
@ -210,7 +235,7 @@ import { listApplyConfig, getApplyConfig, delApplyConfig, addApplyConfig, update
|
|||
|
||||
export default {
|
||||
name: "ApplyConfig",
|
||||
dicts: ['sys_normal_disable'],
|
||||
dicts: ['sys_normal_disable','sys_apply_cfg_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
@ -246,6 +271,9 @@ export default {
|
|||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
cfgType: [
|
||||
{ required: true, message: "请选择注册应用类型", trigger: "blur" },
|
||||
],
|
||||
projectId: [
|
||||
{ required: true, message: "请选择所属项目信息", trigger: "blur" },
|
||||
],
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
package com.yanzhu.jh.project.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.enums.ApplyCfgTypeEnum;
|
||||
import com.ruoyi.common.enums.ShiFouEnum;
|
||||
import com.ruoyi.common.enums.VendorsCodeEnum;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.domain.SysApplyConfig;
|
||||
import com.ruoyi.system.service.ISysApplyConfigService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yanzhu.jh.project.mapper.SurProjectAttendanceCfgMapper;
|
||||
|
@ -17,6 +25,10 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||
@Service
|
||||
public class SurProjectAttendanceCfgServiceImpl implements ISurProjectAttendanceCfgService
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private ISysApplyConfigService sysApplyConfigService;
|
||||
|
||||
@Autowired
|
||||
private SurProjectAttendanceCfgMapper surProjectAttendanceCfgMapper;
|
||||
|
||||
|
@ -69,6 +81,17 @@ public class SurProjectAttendanceCfgServiceImpl implements ISurProjectAttendance
|
|||
{
|
||||
surProjectAttendanceCfg.setUpdateBy(SecurityUtils.getUsername());
|
||||
surProjectAttendanceCfg.setUpdateTime(DateUtils.getNowDate());
|
||||
if(VendorsCodeEnum.YANZHU.getCode().equals(surProjectAttendanceCfg.getVendorsCode())){
|
||||
SysApplyConfig sysApplyConfig = new SysApplyConfig();
|
||||
sysApplyConfig.setCfgType(ApplyCfgTypeEnum.LABOUR.getCode());
|
||||
sysApplyConfig.setCfgId(surProjectAttendanceCfg.getId());
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
sysApplyConfig = list.get(0);
|
||||
sysApplyConfig.setIsDel(surProjectAttendanceCfg.getEnabled().equals(ShiFouEnum.FOU.getLongCode())?ShiFouEnum.SHI.getCode():ShiFouEnum.FOU.getCode());
|
||||
sysApplyConfigService.updateSysApplyConfig(sysApplyConfig);
|
||||
}
|
||||
}
|
||||
return surProjectAttendanceCfgMapper.updateSurProjectAttendanceCfg(surProjectAttendanceCfg);
|
||||
}
|
||||
|
||||
|
@ -81,6 +104,22 @@ public class SurProjectAttendanceCfgServiceImpl implements ISurProjectAttendance
|
|||
@Override
|
||||
public int deleteSurProjectAttendanceCfgByIds(Long[] ids)
|
||||
{
|
||||
List<Long> cfgIds = new ArrayList<>();
|
||||
for(Long id:ids){
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = surProjectAttendanceCfgMapper.selectSurProjectAttendanceCfgById(id);
|
||||
if(VendorsCodeEnum.YANZHU.getCode().equals(surProjectAttendanceCfg.getVendorsCode())){
|
||||
SysApplyConfig sysApplyConfig = new SysApplyConfig();
|
||||
sysApplyConfig.setCfgType(ApplyCfgTypeEnum.LABOUR.getCode());
|
||||
sysApplyConfig.setCfgId(id);
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
cfgIds.add(list.get(0).getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(cfgIds)){
|
||||
sysApplyConfigService.deleteSysApplyConfigByIds(cfgIds.stream().toArray(Long[]::new));
|
||||
}
|
||||
return surProjectAttendanceCfgMapper.deleteSurProjectAttendanceCfgByIds(ids);
|
||||
}
|
||||
|
||||
|
@ -93,6 +132,16 @@ public class SurProjectAttendanceCfgServiceImpl implements ISurProjectAttendance
|
|||
@Override
|
||||
public int deleteSurProjectAttendanceCfgById(Long id)
|
||||
{
|
||||
SurProjectAttendanceCfg surProjectAttendanceCfg = surProjectAttendanceCfgMapper.selectSurProjectAttendanceCfgById(id);
|
||||
if(VendorsCodeEnum.YANZHU.getCode().equals(surProjectAttendanceCfg.getVendorsCode())){
|
||||
SysApplyConfig sysApplyConfig = new SysApplyConfig();
|
||||
sysApplyConfig.setCfgType(ApplyCfgTypeEnum.LABOUR.getCode());
|
||||
sysApplyConfig.setCfgId(id);
|
||||
List<SysApplyConfig> list = sysApplyConfigService.selectSysApplyConfigList(sysApplyConfig);
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
sysApplyConfigService.deleteSysApplyConfigById(list.get(0).getId());
|
||||
}
|
||||
}
|
||||
return surProjectAttendanceCfgMapper.deleteSurProjectAttendanceCfgById(id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue