Commit 376e6c9d authored by danfuman's avatar danfuman

Merge branch 'zuhuduan' of http://192.168.60.201/root/dsk-operate-sys into zuhuduan

parents efacb40a 5a527799
......@@ -3,6 +3,7 @@ package com.dsk;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 启动程序
......@@ -11,6 +12,7 @@ import org.springframework.boot.context.metrics.buffering.BufferingApplicationSt
*/
@SpringBootApplication
@EnableScheduling
public class DskOperateSysApplication {
public static void main(String[] args) {
......
......@@ -3,6 +3,7 @@ package com.dsk.web.controller.system;
import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.RegexPool;
import cn.hutool.core.map.MapUtil;
......@@ -80,6 +81,38 @@ public class SysLoginController {
// /**
// * 发送短信验证码
// *
// * @param phones 电话号
// * @param templateId 模板ID
// */
// @SaIgnore
// @GetMapping("/send/sms/code")
// public R<Object> sendAliyun(String phones, String templateId) {
// LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
// map.put("code", RandomUtil.randomNumbers(4));
// SmsBlend smsBlend = SmsFactory.createSmsBlend(SupplierType.ALIBABA);
// SmsResponse smsResponse = smsBlend.sendMessage(phones, templateId, map);
// return R.ok(smsResponse);
// }
/**
* 短信登录
*
* @param smsLoginBody 登录信息
* @return 结果
*/
@SaIgnore
@PostMapping("/smsLogin")
public R<LoginVo> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) {
// 生成令牌
LoginVo loginVo=loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
return R.ok(loginVo);
}
/**
* 动态切换租户
*
......@@ -118,6 +151,11 @@ public class SysLoginController {
return R.ok(new ArrayList<>());
}
List<SysTenantVo> tenantList=loginService.tenantListByAccount(phone);
if(CollectionUtil.isNotEmpty(tenantList)){
for (SysTenantVo sysTenantVo : tenantList) {
sysTenantVo.setCompanyName("");
}
}
return R.ok(tenantList);
}
......@@ -150,35 +188,6 @@ public class SysLoginController {
return R.ok(MapUtil.of("tenantId",defaultTenant));
}
/**
* 发送短信验证码
*
* @param phones 电话号
* @param templateId 模板ID
*/
@SaIgnore
@GetMapping("/send/sms/code")
public R<Object> sendAliyun(String phones, String templateId) {
LinkedHashMap<String, String> map = new LinkedHashMap<>(1);
map.put("code", RandomUtil.randomNumbers(4));
SmsBlend smsBlend = SmsFactory.createSmsBlend(SupplierType.ALIBABA);
SmsResponse smsResponse = smsBlend.sendMessage(phones, templateId, map);
return R.ok(smsResponse);
}
/**
* 短信登录
*
* @param smsLoginBody 登录信息
* @return 结果
*/
@SaIgnore
@PostMapping("/smsLogin")
public R<LoginVo> smsLogin(@Validated @RequestBody SmsLoginBody smsLoginBody) {
// 生成令牌
LoginVo loginVo=loginService.smsLogin(smsLoginBody.getPhonenumber(), smsLoginBody.getSmsCode());
return R.ok(loginVo);
}
/**
* 邮件登录
*
......
......@@ -84,7 +84,7 @@ public class SysTenantController extends BaseController {
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysTenantBo bo) {
if (!tenantService.checkCompanyNameUnique(bo)) {
return R.fail("新增租户'" + bo.getCompanyName() + "'失败,企业名称已存在");
return R.fail("新增企业'" + bo.getCompanyName() + "'失败,企业名称已存在");
}
return toAjax(TenantHelper.ignore(() -> tenantService.insertByBo(bo)));
}
......@@ -100,7 +100,7 @@ public class SysTenantController extends BaseController {
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysTenantBo bo) {
tenantService.checkTenantAllowed(bo.getTenantId());
if (!tenantService.checkCompanyNameUnique(bo)) {
return R.fail("修改租户'" + bo.getCompanyName() + "'失败,公司名称已存在");
return R.fail("修改企业'" + bo.getCompanyName() + "'失败,公司名称已存在");
}
return toAjax(tenantService.updateByBo(bo));
}
......@@ -162,8 +162,8 @@ public class SysTenantController extends BaseController {
@SaCheckPermission("system:tenant:edit")
@Log(title = "租户", businessType = BusinessType.UPDATE)
@GetMapping("/syncTenantPackage")
public R<Void> syncTenantPackage(@NotBlank(message = "租户ID不能为空") String tenantId,
@NotNull(message = "套餐ID不能为空") Long packageId) {
public R<Void> syncTenantPackage(@NotBlank(message = "企业ID不能为空") String tenantId,
@NotNull(message = "企业方案ID不能为空") Long packageId) {
return toAjax(TenantHelper.ignore(() -> tenantService.syncTenantPackage(tenantId, packageId)));
}
......
package com.dsk.web.schedule;
import com.dsk.common.tenant.helper.TenantHelper;
import com.dsk.system.service.ISysTenantService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 租户相关定时任务类
*
* @author sxk
* @date 2023.09.06
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class TenantTimerTask {
private final ISysTenantService tenantService;
/**
* 每6小时扫描并禁用已过期租户账号
*/
@Scheduled(cron = "0 0 0/6 * * *")
public void updateExpiredTenantStatus() {
log.info("执行定时禁用已过期租户账号(6h/次)");
TenantHelper.ignore(tenantService::handleExpiredTenant);
}
}
\ No newline at end of file
......@@ -50,5 +50,5 @@ xcx.code.not.blank=\u5C0F\u7A0B\u5E8Fcode\u4E0D\u80FD\u4E3A\u7A7A
##\u79DF\u6237
company.number.not.blank=\u4F01\u4E1A\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A
company.not.exists=\u5BF9\u4E0D\u8D77, \u60A8\u7684\u4F01\u4E1A\u4E0D\u5B58\u5728\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
company.blocked=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u4F01\u4E1A\u5DF2\u7981\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
company.blocked=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u4F01\u4E1A\u5DF2\u505C\u7528\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
company.expired=\u5BF9\u4E0D\u8D77\uFF0C\u60A8\u7684\u4F01\u4E1A\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458
\ No newline at end of file
......@@ -77,7 +77,7 @@ public @interface Excel
/**
* 当值为空时,字段的默认值
*/
public String defaultValue() default "";
public String defaultValue() default "-";
/**
* 提示信息
......
......@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.function.Function;
......@@ -329,6 +330,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
//去除字符串标红
public static String removeRed(String str) {
if(ObjectUtils.isEmpty(str)) return null;
return str.replace("<font color='#FF204E'>" ,"").replace("</font>","");
}
}
package com.dsk.jsk.domain.vo;
import com.dsk.common.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 重点项目清单
* @author lcl
* @create 2023/8/28
*/
@Data
public class ImportantProjectExportVo implements Serializable {
@Excel(name = "序号", width = 6)
private Integer id;
@Excel(name = "项目类型", width = 15)
private String buildingProjectType;
@Excel(name = "项目名称", width = 40)
private String projectName;
@Excel(name = "主管部门", width = 35)
private String chargeDepartment;
@Excel(name = "项目法人", width = 35)
private String constructUnit;
@Excel(name = "项目投资额" , suffix = "万元")
private Double projectTotalInvestment;
@Excel(name = "项目地区", width = 15)
private String domicile;
@Excel(name = "建设规模", width = 50)
private String projectScale;
@Excel(name = "附件名称", width = 30)
private String fileTitle;
@Excel(name = "附件链接", width = 30)
private String fileUrl;
}
......@@ -177,9 +177,11 @@ public class JskCombineInfoService {
if(ObjectUtils.isEmpty(dto.getKeys())){
vo.setTenderee(MapUtil.getStr(list.get(i),"tenderee"));
vo.setProjectName(MapUtil.getStr(list.get(i),"projectName"));
vo.setAgency(MapUtil.getStr(list.get(i),"agency"));
}else {
vo.setTenderee(StringUtils.removeRed(MapUtil.getStr(list.get(i),"tenderee")));
vo.setProjectName(StringUtils.removeRed(MapUtil.getStr(list.get(i),"projectName")));
vo.setAgency(StringUtils.removeRed(MapUtil.getStr(list.get(i),"agency")));
}
vo.setStockPercent(MapUtil.getDouble(list.get(i),"stockPercent"));
vo.setMemberLevel(MapUtil.getStr(list.get(i),"memberLevel"));
......@@ -187,7 +189,7 @@ public class JskCombineInfoService {
vo.setAddress(MapUtil.getStr(list.get(i),"address"));
vo.setSubjectMatter(MapUtil.getStr(list.get(i),"subjectMatter"));
vo.setProjectType(MapUtil.getStr(list.get(i),"projectType"));
vo.setAgency(MapUtil.getStr(list.get(i),"agency"));
result.add(vo);
}
return result;
......
package com.dsk.search.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson2.JSONObject;
import com.dsk.biz.utils.ExcelUtils;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.poi.ExcelUtil;
import com.dsk.jsk.domain.bo.ComposeQueryDto;
import com.dsk.jsk.domain.vo.ImportantProjectExportVo;
import com.dsk.search.service.BusinessOpportunityRadarService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -157,4 +163,31 @@ public class BusinessOpportunityRadarController {
}
return opportunityRadarService.importantPage(object);
}
/*
* 重点项目清单关联查询
*/
@RequestMapping("/importantSelect")
public AjaxResult importantSelect(@RequestBody JSONObject object) {
return opportunityRadarService.importantSelect(object);
}
/*
* 重点项目清单筛选条件
*/
@RequestMapping("/importantCondition")
public AjaxResult importantCondition() {
return opportunityRadarService.importantCondition();
}
/**
* 导出重点项目清单
*/
@RequestMapping("/export/important")
@SaCheckPermission("radar:export:important")
public void exportBid(@RequestBody JSONObject object, HttpServletResponse response) {
List<ImportantProjectExportVo> list = opportunityRadarService.exportImportant(object);
// ExcelUtil<ImportantProjectExportVo> util = new ExcelUtil<>(ImportantProjectExportVo.class);
ExcelUtils<ImportantProjectExportVo> util = new ExcelUtils<>(ImportantProjectExportVo.class);
util.exportExcel(response, list, "重点项目", "重点项目导出明细", true);
}
}
package com.dsk.search.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.exception.ServiceException;
import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.StringUtils;
import com.dsk.jsk.domain.vo.ImportantProjectExportVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -98,4 +105,59 @@ public class BusinessOpportunityRadarService {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/bondProject/importantPage", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult importantSelect(JSONObject object) {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/bondProject/importantSelect", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult importantCondition() {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/bondProject/importantCondition", null);
return BeanUtil.toBean(map, AjaxResult.class);
}
public List<ImportantProjectExportVo> exportImportant(JSONObject object) {
if (ObjectUtil.isEmpty(object.get("page"))) {
throw new ServiceException("导出条数不能为空!");
}
Map<String, Object> page = (Map<String,Object>)object.get("page");
if (null==page.get("limit")|| MapUtil.getInt(page,"limit")>2000){
page.put("limit",2000);
}
page.put("page",1);
object.put("page",page);
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/bondProject/importantPage",object);
if (ObjectUtil.isEmpty(map.get("data"))) throw new ServiceException("导出失败,系统错误!");
Map<String, Object> data = BeanUtil.beanToMap(map.get("data"));
if (ObjectUtil.isEmpty(data.get("list"))) throw new ServiceException("导出失败,系统错误!");
List<Map<String, Object>> list = (List<Map<String, Object>>) data.get("list");
if (ObjectUtil.isEmpty(list)) throw new ServiceException("导出失败,无数据导出!");
List<ImportantProjectExportVo> result = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
ImportantProjectExportVo vo = new ImportantProjectExportVo();
vo.setId(i + 1);
vo.setBuildingProjectType(MapUtil.getStr(list.get(i),"buildingProjectType"));
if (null!=list.get(i).get("projectName")){
vo.setProjectName(StringUtils.removeRed(MapUtil.getStr(list.get(i),"projectName")));
}
if (null!=list.get(i).get("chargeDepartment")){
vo.setChargeDepartment(StringUtils.removeRed(MapUtil.getStr(list.get(i),"chargeDepartment")));
}
if (null!=list.get(i).get("constructUnit")){
vo.setConstructUnit(StringUtils.removeRed(MapUtil.getStr(list.get(i),"constructUnit")));
}
if (null!=list.get(i).get("projectScale")){
vo.setProjectScale(StringUtils.removeRed(MapUtil.getStr(list.get(i),"projectScale")));
}
vo.setProjectTotalInvestment(MapUtil.getDouble(list.get(i),"projectTotalInvestment"));
vo.setDomicile(MapUtil.getStr(list.get(i),"domicile"));
vo.setFileTitle(MapUtil.getStr(list.get(i),"fileTitle"));
vo.setFileUrl(MapUtil.getStr(list.get(i),"fileUrl"));
result.add(vo);
}
return result;
}
}
......@@ -451,7 +451,7 @@ export default {
/*overflow-y: auto;*/
overflow-y: overlay;
padding: 8px 0 0;
width: 325px;
width: 146px;
text-align: left;
border-radius: 4px;
box-shadow: 0 2px 9px 2px rgba(0,0,0,.09), 0 1px 2px -2px rgba(0,0,0,.16);
......@@ -461,6 +461,9 @@ export default {
>div{
padding: 8px 8px 8px 32px;
line-height: 20px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
&:hover{
background: rgba(0, 0, 0, 0.04);
......
......@@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 20000
})
// request拦截器
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="企业名称" prop="roleName">
<el-form-item label="企业名称" prop="companyName">
<el-input
v-model="queryParams.companyName"
placeholder="请输入企业名称"
......@@ -10,7 +10,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户名称" prop="roleKey">
<el-form-item label="用户名称" prop="contactUserName">
<el-input
v-model="queryParams.contactUserName"
placeholder="请输入用户名称"
......@@ -19,10 +19,10 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="电话号码" prop="roleKey">
<el-form-item label="手机号码" prop="contactPhone">
<el-input
v-model="queryParams.contactPhone"
placeholder="请输入电话号码"
placeholder="请输入手机号码"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
......@@ -116,7 +116,7 @@
<el-button
size="mini"
type="text"
icon="el-icon-delete"
icon="el-icon-zoom-in"
@click="handleLook(scope.row)"
v-hasPermi="['system:role:remove']"
>查看</el-button>
......@@ -187,7 +187,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="企业规模" prop="accountCount">
<el-input :disabled="disabled" v-model="form.accountCount" placeholder="请输入企业规模"/>
<el-input onkeyup="this.value=this.value.replace(/[^1-9]/g,'')" :disabled="disabled" v-model="form.accountCount" placeholder="请输入企业规模"/>
</el-form-item>
</el-col>
</el-row>
......@@ -375,14 +375,13 @@
this.form = response.data;
this.form.dateRange = [response.data.startTime,response.data.expireTime]
this.open = true;
this.title = "修改企业";
this.title = this.disabled == true?'查看企业':"修改企业";
});
},
//查看
handleLook(row){
this.handleUpdate(row)
this.disabled = true
this.getpack()
},
/** 提交按钮 */
submitForm: function() {
......@@ -405,9 +404,11 @@
loading.close()
} else {
this.$modal.msgError(response.msg)
loading.close();
}
}).catch(response => {
this.$modal.msgError(response.msg)
loading.close();
});
} else {
saveTenant(this.form).then(response => {
......@@ -418,6 +419,7 @@
loading.close();
}else{
this.$modal.msgError(response.msg)
loading.close();
}
}).catch(response => {
this.$modal.msgError(response.msg)
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="方案名称" prop="roleName">
<el-form-item label="方案名称" prop="packageName">
<el-input
v-model="queryParams.packageName"
placeholder="请输入方案名称"
......@@ -92,7 +92,7 @@
<el-button
size="mini"
type="text"
icon="el-icon-edit"
icon="el-icon-zoom-in"
@click="handleLook(scope.row)"
v-hasPermi="['system:role:edit']"
>查看</el-button>
......@@ -336,7 +336,7 @@
}
})
})
this.title = "修改方案";
this.title = this.disabled == true?'查看方案':"修改方案";
});
},
//查看
......
......@@ -8,8 +8,8 @@
<!--快捷登录-->
<el-form v-if="!islog && !islang && isDXlogin" ref="dxform" :model="dxform" :rules="dxRules" class="login-form">
<div class="logintitle">
<div class="on" @click="isDXlogin = true">快捷登录</div>
<div @click="isDXlogin = false">密码登录</div>
<div class="on" @click="isDXlogin = true">快捷登录</div>
</div>
<el-form-item prop="phonenumber">
<el-input
......@@ -63,8 +63,8 @@
<!--密码登录-->
<el-form v-if="!islog && !islang && !isDXlogin" ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<div class="logintitle">
<div @click="isDXlogin = true">快捷登录</div>
<div class="on" @click="isDXlogin = false">密码登录</div>
<div @click="isDXlogin = true">快捷登录</div>
</div>
<el-form-item prop="username">
<el-input
......@@ -190,7 +190,7 @@
return {
tenantId:-1,
islog:false,
isDXlogin:true,
isDXlogin:false,
codeUrl: "",
loginForm: {
username: "",
......@@ -303,10 +303,13 @@
//密码登录时根据手机号获取是否有多个租户
userTenantList({phone:this.loginForm.username}).then(res=>{
if(res.data.length>1){ //需要安全验证(短信登录)
this.islang = true
this.dxform.phonenumber = this.loginForm.username
this.dxform.captchaCode = this.loginForm.code
this.showcode = false
let _this = this
setTimeout(()=> {
_this.islang = true
_this.dxform.phonenumber = _this.loginForm.username
_this.dxform.captchaCode = _this.loginForm.code
_this.showcode = false
},1000)
}else{//无租户列表和一个租户直接登录
this.$store.dispatch("Login", froms).then(() => {
this.loading = false;
......@@ -343,6 +346,7 @@
}
})
}else{
this.$message.error(res.msg)
this.getCode()
this.showcode = true
}
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
<el-form-item label="部门名称" prop="deptName">
<el-form-item label="组织名称" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入部门名称"
placeholder="请输入组织名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="部门状态" clearable>
<el-select v-model="queryParams.status" placeholder="组织状态" clearable>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
......@@ -56,7 +56,7 @@
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
<el-table-column prop="deptName" label="组织名称" width="260"></el-table-column>
<el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
<el-table-column prop="status" label="状态" width="100">
<template slot-scope="scope">
......@@ -96,20 +96,20 @@
</el-table-column>
</el-table>
<!-- 添加或修改部门对话框 -->
<!-- 添加或修改组织对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24" v-if="form.parentId !== 0">
<el-form-item label="上级部门" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
<el-form-item label="上级组织" prop="parentId">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级组织" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="部门名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
<el-form-item label="组织名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入组织名称" />
</el-form-item>
</el-col>
<el-col :span="12">
......@@ -137,7 +137,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门状态">
<el-form-item label="组织状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
......@@ -200,7 +200,7 @@ export default {
showSearch: true,
// 表格树数据
deptList: [],
// 部门树选项
// 组织树选项
deptOptions: [],
// 弹出层标题
title: "",
......@@ -220,10 +220,10 @@ export default {
// 表单校验
rules: {
parentId: [
{ required: true, message: "上级部门不能为空", trigger: "blur" }
{ required: true, message: "上级组织不能为空", trigger: "blur" }
],
deptName: [
{ required: true, message: "部门名称不能为空", trigger: "blur" }
{ required: true, message: "组织名称不能为空", trigger: "blur" }
],
orderNum: [
{ required: true, message: "显示排序不能为空", trigger: "blur" }
......@@ -250,7 +250,7 @@ export default {
this.phone = this.$store.state.user.phonenumber
},
methods: {
/** 查询部门列表 */
/** 查询组织列表 */
getList() {
this.loading = true;
listDept(this.queryParams).then(response => {
......@@ -258,7 +258,7 @@ export default {
this.loading = false;
});
},
/** 转换部门数据结构 */
/** 转换组织数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
......@@ -304,7 +304,7 @@ export default {
this.form.parentId = row.deptId;
}
this.open = true;
this.title = "添加部门";
this.title = "添加组织";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
......@@ -323,7 +323,7 @@ export default {
getDept(row.deptId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改部门";
this.title = "修改组织";
listDeptExcludeChild(row.deptId).then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
if (this.deptOptions.length == 0) {
......@@ -339,15 +339,23 @@ export default {
if (valid) {
if (this.form.deptId != undefined) {
updateDept(this.form).then(response => {
if(response.code == 200){
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}else{
this.$modal.msgError(response.msg)
}
});
} else {
addDept(this.form).then(response => {
if(response.code == 200){
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}else{
this.$modal.msgError(response.msg)
}
});
}
}
......@@ -357,7 +365,7 @@ export default {
handleDelete(row) {
this.deptId = row.deptId
let islast = true
let txt = '是否确认删除名称为"' + row.deptName + '"的数据项?'
let txt = '是否确认删除名称为"' + row.deptName + '"的组织?'
if((row.children && row.children.length>0) || row.existUsers == true){//该组织下还有数据
islast = false
txt='是否删除该组织及该组织包含的所有人员?'
......
......@@ -692,16 +692,19 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const userIds = row.userId || this.ids;
let _this = this
this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
delUser(userIds).then(res=>{
if(res.code == 200){
this.getList();
this.$modal.msgSuccess("删除成功");
_this.getList();
_this.$modal.msgSuccess("删除成功");
}else{
this.$modal.msgError(res.msg);
_this.$modal.msgError(res.msg);
}
});
}).catch(() => {});
}).catch(() => {
_this.$modal.msgError(res.msg);
});
},
/** 导出按钮操作 */
handleExport() {
......
......@@ -24,6 +24,11 @@ public interface ISysTenantService {
// */
// List<SysTenantVo> queryList(SysTenantBo bo);
/**
* 禁用所有已过期租户
*/
void handleExpiredTenant();
/**
* 查询租户
*/
......@@ -70,4 +75,5 @@ public interface ISysTenantService {
* 基于租户ID查询租户
*/
SysTenantVo queryByTenantId(String tenantId);
}
......@@ -100,6 +100,7 @@ public class SysLoginService {
String defaultTenantId = RedisUtils.getCacheObject(GlobalConstants.PHONE_DEFAULT_TENANT + username);
log.info("登录用户:{} 获取缓存默认租户:"+tenantId, username);
if(StrUtil.isNotBlank(defaultTenantId)){
defaultTenantId= checkDefaultTenant(defaultTenantId,username);
tenantId=defaultTenantId;
}
}
......@@ -189,13 +190,14 @@ public class SysLoginService {
public LoginVo smsLogin(String username, String smsCode) {
String tenantId=null;
// if(ReUtil.isMatch(RegexPool.MOBILE, username)) {
// String defaultTenantId = RedisUtils.getCacheObject(GlobalConstants.PHONE_DEFAULT_TENANT + username);
// log.info("登录用户:{} 获取缓存默认租户:"+tenantId, username);
// if(StrUtil.isNotBlank(defaultTenantId)){
// tenantId=defaultTenantId;
// }
// }
if(ReUtil.isMatch(RegexPool.MOBILE, username)) {
String defaultTenantId = RedisUtils.getCacheObject(GlobalConstants.PHONE_DEFAULT_TENANT + username);
log.info("登录用户:{} 获取缓存默认租户:"+tenantId, username);
if(StrUtil.isNotBlank(defaultTenantId)){
defaultTenantId= checkDefaultTenant(defaultTenantId,username);
tenantId=defaultTenantId;
}
}
//查询手机号绑定的所有用户
if (StrUtil.isEmpty(tenantId)) {
......@@ -231,7 +233,7 @@ public class SysLoginService {
// 框架登录不限制从什么表查询 只要最终构建出 LoginUser 即可
SysUser user = loadUserByUsername(username);
checkLogin(LoginType.PASSWORD, username, () -> !validateSmsCode(username, smsCode));
checkLogin(LoginType.SMS, username, () -> !validateSmsCode(username, smsCode));
// 此处可根据登录用户的数据不同 自行创建 loginUser 属性不够用继承扩展就行了
LoginUser loginUser = buildLoginUser(user);
// 生成token
......@@ -501,18 +503,45 @@ public class SysLoginService {
}
SysTenantVo tenant = sysTenantService.queryByTenantId(tenantId);
if (ObjectUtil.isNull(tenant)) {
log.info("登录租户:{} 不存在.", tenantId);
log.info("登录企业:{} 不存在.", tenant.getCompanyName());
throw new TenantException("company.not.exists");
} else if (TenantStatus.DISABLE.getCode().equals(tenant.getStatus())) {
log.info("登录租户:{} 已被停用.", tenantId);
log.info("登录企业:{} 已被停用.", tenant.getCompanyName());
throw new TenantException("company.blocked");
} else if (ObjectUtil.isNotNull(tenant.getExpireTime())
&& new Date().after(tenant.getExpireTime())) {
log.info("登录租户:{} 已超过有效期.", tenantId);
log.info("登录企业:{} 已超过有效期.", tenant.getCompanyName());
throw new TenantException("company.expired");
}
}
public String checkDefaultTenant(String tenantId,String phoneNumber) {
if (!TenantHelper.isEnable()) {
return null;
}
if (TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
return null;
}
SysTenantVo tenant = sysTenantService.queryByTenantId(tenantId);
if (ObjectUtil.isNull(tenant)) {
log.info("登录企业:{} 不存在.", tenant.getCompanyName());
RedisUtils.deleteObject(GlobalConstants.PHONE_DEFAULT_TENANT + phoneNumber);
return null;
} else if (TenantStatus.DISABLE.getCode().equals(tenant.getStatus())) {
log.info("登录企业:{} 已被停用.", tenant.getCompanyName());
RedisUtils.deleteObject(GlobalConstants.PHONE_DEFAULT_TENANT + phoneNumber);
return null;
} else if (ObjectUtil.isNotNull(tenant.getExpireTime())
&& new Date().after(tenant.getExpireTime())) {
log.info("登录企业:{} 已超过有效期.", tenant.getCompanyName());
RedisUtils.deleteObject(GlobalConstants.PHONE_DEFAULT_TENANT + phoneNumber);
return null;
}
return tenantId;
}
public List<SysTenantVo> tenantListByAccount(String username) {
return TenantHelper.ignore(() -> sysTenantService.selectTenantList(username));
}
......
......@@ -68,7 +68,8 @@ public class ISysTenantPackageServiceImpl implements ISysTenantPackageService {
@Override
public List<SysTenantPackageSelectVo> selectList() {
LambdaQueryWrapper<SysTenantPackage> wrapper = new LambdaQueryWrapper<SysTenantPackage>()
.eq(SysTenantPackage::getStatus, TenantPackageConstants.NORMAL);
.eq(SysTenantPackage::getStatus, TenantPackageConstants.NORMAL)
.orderByDesc(SysTenantPackage::getCreateTime);
List<SysTenantPackageVo> tenantPackageVo = baseMapper.selectVoList(wrapper);
return BeanUtil.copyToList(tenantPackageVo, SysTenantPackageSelectVo.class);
}
......
......@@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
......@@ -72,6 +73,25 @@ public class ISysTenantServiceImpl implements ISysTenantService {
return TableDataInfo.build(result);
}
/**
* 禁用所有已过期租户
*/
@Override
public void handleExpiredTenant() {
Date now = new Date();
//查询所有已过期租户
List<SysTenant> tenantList = baseMapper.selectList(new LambdaQueryWrapper<SysTenant>()
.eq(SysTenant::getStatus, TenantConstants.NORMAL)
.gt(SysTenant::getStartTime, now)
.or()
.lt(SysTenant::getExpireTime, now));
//批量禁用已过期租户
if (!tenantList.isEmpty()) {
tenantList.forEach(sysTenant -> sysTenant.setStatus(TenantConstants.DISABLE));
baseMapper.updateBatchById(tenantList);
}
}
// /**
// * 查询租户列表
// */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment