Compare commits

..

No commits in common. "master" and "test-0831-audit" have entirely different histories.

47 changed files with 254 additions and 793 deletions

View File

@ -1,6 +1,5 @@
#!/bin/sh
#export deploy_path=/opt/builds/${JOB_NAME}/${BUILD_NUMBER}
export deploy_path=/opt/builds/${JOB_NAME}
export deploy_path=/opt/builds/${JOB_NAME}/${BUILD_NUMBER}
echo "--------moveFile start--------------"
rm -rf $deploy_path
mkdir -p $deploy_path

View File

@ -5,7 +5,6 @@ pipeline {
JAVA_HOME = '/usr/lib/jvm/jdk1.8.0_381'
JOBNAME="${JOB_NAME}"
JENKINS_NODE_COOKIE = "dontKillMe"
SPRING_PROFILES_ACTIVE = "sgzb_nw_dev"
}
stages {
stage('Check out') {

View File

@ -1,27 +0,0 @@
RESOURCE_NAME=sgzb-modules-material-common-3.0.jar
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Stop Process...'
kill -15 $tpid
fi
sleep 5
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'Kill Process!'
kill -9 $tpid
else
echo 'Stop Success!'
fi
tpid=`ps -ef|grep $RESOURCE_NAME|grep -v grep|grep -v kill|awk '{print $2}'`
if [ ${tpid} ]; then
echo 'App is running.'
else
echo 'App is NOT running.'
fi
rm -f tpid
nohup java -jar ./$RESOURCE_NAME --spring.profiles.active=sgzb_nw_dev &
echo $! > tpid
echo Start Success!

View File

@ -84,10 +84,4 @@ public interface RemoteUserService
*/
@GetMapping("/user/getUserList")
public R<List<SysUser>> getUserList(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 查询密码是否需要修改
*/
@GetMapping("/user/userPwdState")
public String userPwdState(@RequestParam("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -1,20 +1,20 @@
package com.bonus.sgzb.system.api.domain;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
/**
* 部门表 sys_dept
*
*
* @author ruoyi
*/
public class SysDept extends BaseEntity
@ -64,7 +64,7 @@ public class SysDept extends BaseEntity
/** 父部门名称 */
@ApiModelProperty(value = "父部门名称")
private String parentName;
/** 子部门 */
@ApiModelProperty(value = "子部门")
private List<SysDept> children = new ArrayList<>();
@ -75,12 +75,6 @@ public class SysDept extends BaseEntity
/** 所属组织id */
private Long companyId;
/** 企业机构代码(统一社会信用代码) */
private String socialCreditCode;
/** 企业归属代码 CSG-南方电网下属企业 SE-社会及大集体企业 */
private String enterpriseOwnershipCode;
@Override
public String getRemark() {
return remark;
@ -99,22 +93,6 @@ public class SysDept extends BaseEntity
this.companyId = companyId;
}
public String getSocialCreditCode() {
return socialCreditCode;
}
public void setSocialCreditCode(String socialCreditCode) {
this.socialCreditCode = socialCreditCode;
}
public String getEnterpriseOwnershipCode() {
return enterpriseOwnershipCode;
}
public void setEnterpriseOwnershipCode(String enterpriseOwnershipCode) {
this.enterpriseOwnershipCode = enterpriseOwnershipCode;
}
public Long getDeptId()
{
return deptId;

View File

@ -6,7 +6,6 @@ import com.bonus.sgzb.common.core.annotation.Excel.Type;
import com.bonus.sgzb.common.core.annotation.Excels;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;
import com.bonus.sgzb.common.core.xss.Xss;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -57,7 +56,6 @@ public class SysUser extends BaseEntity
private String avatar;
/** 密码 */
// @JsonIgnore
private transient String password;
/** 帐号状态0正常 1停用 */
@ -94,16 +92,6 @@ public class SysUser extends BaseEntity
/** 角色ID */
private Long roleId;
public String getForceChangePwd() {
return forceChangePwd;
}
public void setForceChangePwd(String forceChangePwd) {
this.forceChangePwd = forceChangePwd;
}
/**强制修改密码 1 强制修改 0 不修改*/
private String forceChangePwd;
/** 导出选中列表 */
private List<Long> dataCondition;

View File

@ -61,11 +61,6 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
public R<List<SysUser>> getUserList(SysUser sysUser, String source) {
return R.fail("获取用户失败:" + throwable.getMessage());
}
@Override
public String userPwdState(String username, String source) {
return "成功";
}
};
}
}

View File

@ -67,14 +67,6 @@ public class LoginUser implements Serializable
*/
private Set<String> roles;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
/**
* 用户信息
*/
@ -85,16 +77,6 @@ public class LoginUser implements Serializable
*/
private String loginMethod;
public String getForceChangePwd() {
return forceChangePwd;
}
public void setForceChangePwd(String forceChangePwd) {
this.forceChangePwd = forceChangePwd;
}
private String forceChangePwd;
public String getLoginMethod() {
return loginMethod;
}

View File

@ -38,32 +38,13 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- sgzb Common Security-->
<dependency>

View File

@ -124,10 +124,9 @@ public class TokenController {
* @return
*/
@PostMapping("loginApp")
public R<?> loginApp(@RequestBody LoginBody form) throws Exception {
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), privateKey);
public R<?> loginApp(@RequestBody LoginBody form) {
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword());
if (userInfo != null) {
userInfo.setLoginMethod("mobile");
return R.ok(tokenService.createToken(userInfo));

View File

@ -94,8 +94,6 @@ public class SysLoginService {
}
passwordService.validate(user, password);
recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "登录成功");
String forceChangePwd = remoteUserService.userPwdState(username,SecurityConstants.INNER);
userInfo.setForceChangePwd(forceChangePwd);
return userInfo;
}

View File

@ -1,42 +0,0 @@
# Spring
spring:
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
username: nacos
password: N2$NjW2&CDEOx$mD*y5h
config:
# 配置中心地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
onlineApprove: /lbcloud-oauth/oauth/token
wechatAppId: crhmaxnE
wechatAppsecret: 3893e6ed90d325f00e34583dd970a56580c05549
getNowPersonDetailData: /lbcloud-user/user/queryLoginUserInfo
baseUrl: https://test-sso.csgmall.com.cn
appAppsecret: d8e6db9fa9bb09da0e270fa739233c823bf9c5f0
personEasyList: /lbcloud-user/api/user/queryAndPaging/basicInfo
h5Appsecret: 3c4a67b7f6a268b4202a5328e6a1726979d5903b
h5AppId: G3NksDH2
appsecret: 596e4863c8d112842ce820c130b236001297ea73
appId: akvVFYgy
appAppId: u8LLfynf
getPersonDetailData: /lbcloud-user/api/user/queryById
registerPhone: /lbcloud-user/api/user/registrationByPhone
userBindUrl: /lbcloud-authority/api/RoleClient/bindDefaultSystemRole
verifyPhoneCode: /lbcloud-mbroker/api/broker/simpleVerificationCode
# 禁用Actuator端点的未经身份验证的访问
management:
endpoint:
env:
enabled: false

View File

@ -4,11 +4,11 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
file-extension: yml

View File

@ -4,8 +4,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.Arrays;
import java.util.List;
/**
* 通用常量信息
@ -147,11 +145,6 @@ public class Constants
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.bonus.sgzb.common.core.utils.file" };
// 常见图片格式
public static final List<String> IMAGE_EXTENSIONS = Arrays.asList("jpg", "jpeg", "png", "gif");
public static final String UPLOAD_FILE_URL_PART = "myqcloud.com";
/**
* 系统初始密码
*/
@ -165,12 +158,12 @@ public class Constants
/**
* 解密私钥
*/
public static String privateKey = "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y=";
public static String privateKey;
// @Value("${sgzb.system.privateKey}")
// public void setServerPort(String privateKey){
// this.privateKey= privateKey;
// }
@Value("${sgzb.system.privateKey}")
public void setServerPort(String privateKey){
this.privateKey= privateKey;
}
public static final String INNER_PROTOCAL = "1"; //内部单位协议

View File

@ -1,21 +1,18 @@
package com.bonus.sgzb.common.core.utils;
import java.util.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.text.StrFormatter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.AntPathMatcher;
import static com.bonus.sgzb.common.core.constant.Constants.IMAGE_EXTENSIONS;
import static com.bonus.sgzb.common.core.constant.Constants.UPLOAD_FILE_URL_PART;
/**
* 字符串工具类
*
* @author ruoyi
*/
@Slf4j
public class StringUtils extends org.apache.commons.lang3.StringUtils
{
/** 空字符串 */
@ -24,59 +21,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
/** 下划线 */
private static final char SEPARATOR = '_';
private static final Map<String, String> CAT_MAP;
static {
CAT_MAP = new HashMap<>();
CAT_MAP.put("线路施工类", "A");
CAT_MAP.put("变电施工类", "B");
CAT_MAP.put("特种及其他设备", "C");
CAT_MAP.put("检修试验", "D");
CAT_MAP.put("创新装备", "E");
}
/**
1 抱杆 01人字抱杆02平臂抱杆03悬浮抱杆04....
2 放线及滑车 01牵张设备02滑车03....
3 收紧设备 01电动紧线机02液压紧线机03...
4 线路动力设备 01机动绞磨02压接机03飞车及间隔棒运输机04....
5 配件及仪器仪表 01锚固02绳索03连接器04全站仪RPK05附件06....
1 一次安装设备 01滤油机02 SF6回收装置03排油泵04真空泵05....
2 变电运输设备 01二次屏柜搬运设备02液压移动小车03轨道小车04 GIS运输小坦克05..
1 直升机及无人机 01多旋翼无人机02固定翼无人机03巡线直升机04...
2 带电清洗设备 01线路水冲洗02变电水冲洗03...
3 起重设备 01汽车起重机02履带式起重机03随车起重机04...
4 土建设备 01履带式推土机02液压式挖掘机03混凝土泵车05旋挖钻机06...
5 运输设备 01厢式货车02平板货车03灌式运输车04履带运输车05...
6 高空作业设备 01曲臂升降车02高处作业平台车03剪叉式升降平台04...
1 一次试验设备 01试验变压器02高压直流发生器03绕组直流电阻04变比测试仪05...
2 二次试验设备 01万用表02电流表03微安表04...
3 油化试验设备 01微水测试仪02介损测试仪03...
1 线路创新装备 01索道自动上下料装置02遥控索道牵引机03塔材组片专用装备04...
2 变电创新装备 01自动安装机械02新型模具和加固装置03 GIS/HGIS设备整体就位装备04..
3 其他新装备 01砌筑作业机器人02高处作业平台车03电缆敷设智能化控制装备04...
map.put("抱杆_人字抱杆","101");
map.put("抱杆_平臂抱杆","102");
map.put("抱杆_悬浮抱杆","103");
map.put("放线及滑车_牵张设备","201");
map.put("放线及滑车_滑车","202");
map.put("收紧设备_电动紧线机","301");
map.put("收紧设备_液压紧线机","302");
map.put("线路动力设备_机动绞磨","401");
map.put("线路动力设备_压接机","402");
map.put("线路动力设备_飞车及间隔棒运输机","403");
map.put("配件及仪器仪表_锚固","501");
map.put("配件及仪器仪表_绳索","502");
map.put("配件及仪器仪表_连接器","503");
map.put("配件及仪器仪表_全站仪RPK","504");
map.put("配件及仪器仪表_附件","505");
*/
/**
* 获取参数不为空值
*
@ -607,51 +551,4 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
}
return sb.toString();
}
// public static void main(String[] args) {
// System.out.println(getDeviceCode("CSG", "线路施工类", "102", new Date(), "500322"));
// }
public static boolean checkIfFileUrlsValid(String fileUrls) {
boolean url_valid = true;
if (StringUtils.isEmpty(fileUrls)) {
return true;
} else {
String[] fileUrlArray = fileUrls.split(",");
for (String fileUrl : fileUrlArray) {
if (!fileUrl.toLowerCase().contains(UPLOAD_FILE_URL_PART)) {
url_valid = false;
}
}
return url_valid;
}
}
public static boolean checkFileUrlsEndWithExtensions(String fileUrls) {
if (StringUtils.isEmpty(fileUrls)) {
return true;
} else {
String[] fileUrlArray = fileUrls.split(",");
List<String> fileUrlList = Arrays.asList(fileUrlArray);
for (String fileUrl : fileUrlList) {
boolean endsWithExtension = false;
for (String extension : IMAGE_EXTENSIONS) {
if (fileUrl.toLowerCase().endsWith(extension)) {
endsWithExtension = true;
break;
}
}
if (!endsWithExtension) {
return false;
}
}
return true;
}
}
public static void main(String[] args) {
String fileUrls = "https://example.com/file1.png,https://example.com/file2.gif";
boolean allEndWithExtensions = checkFileUrlsEndWithExtensions(fileUrls);
System.out.println("所有文件URL都以给定的扩展名结尾 " + allEndWithExtensions);
}
}

View File

@ -33,12 +33,6 @@
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.23</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -1,11 +1,7 @@
package com.bonus.sgzb.common.security.aspect;
import java.lang.reflect.Method;
import java.util.Objects;
import com.alibaba.fastjson2.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.bonus.sgzb.common.security.auth.AuthUtil;
import com.bonus.sgzb.common.security.annotation.RequiresRoles;
import org.aspectj.lang.ProceedingJoinPoint;
@ -58,22 +54,9 @@ public class PreAuthorizeAspect
@Around("pointcut()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable
{
//获取请求参数
boolean needPermission = true;
Object[] args = joinPoint.getArgs();
for (int i = 0; i < args.length; i++) {
Object obj = args[i];
if (Objects.nonNull(obj) && obj instanceof JSONObject) {
JSONObject jsonObject = (JSONObject) obj;
if ("1".equals(jsonObject.getStr("skipPermission"))) {
needPermission = false;
}
}
}
// 注解鉴权
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
checkMethodAnnotation(signature.getMethod(), needPermission);
checkMethodAnnotation(signature.getMethod());
try
{
// 执行原有逻辑
@ -89,7 +72,7 @@ public class PreAuthorizeAspect
/**
* 对一个Method对象进行注解检查
*/
public void checkMethodAnnotation(Method method, boolean needPermission)
public void checkMethodAnnotation(Method method)
{
// 校验 @RequiresLogin 注解
RequiresLogin requiresLogin = method.getAnnotation(RequiresLogin.class);
@ -106,11 +89,10 @@ public class PreAuthorizeAspect
}
// 校验 @RequiresPermissions 注解
if (needPermission) {
RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class);
if (requiresPermissions != null) {
AuthUtil.checkPermi(requiresPermissions);
}
RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class);
if (requiresPermissions != null)
{
AuthUtil.checkPermi(requiresPermissions);
}
}
}

View File

@ -8,7 +8,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-gateway-nw</artifactId>
<artifactId>sgzb-gateway-nw24.8.3</artifactId>
<description>
sgzb-gateway网关模块
@ -20,27 +20,8 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
@ -72,10 +53,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- SpringCloud Loadbalancer -->
<dependency>

View File

@ -1,60 +1,60 @@
//package com.bonus.sgzb.gateway.handler;
//
//import java.util.Optional;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import reactor.core.publisher.Mono;
//import springfox.documentation.swagger.web.SecurityConfiguration;
//import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
//import springfox.documentation.swagger.web.SwaggerResourcesProvider;
//import springfox.documentation.swagger.web.UiConfiguration;
//import springfox.documentation.swagger.web.UiConfigurationBuilder;
///**
// *
// * @author bonus
// * @date
// */
//@RestController
//@RequestMapping("/swagger-resources")
//public class SwaggerHandler
//{
// @Autowired(required = false)
// private SecurityConfiguration securityConfiguration;
//
// @Autowired(required = false)
// private UiConfiguration uiConfiguration;
//
// private final SwaggerResourcesProvider swaggerResources;
//
// @Autowired
// public SwaggerHandler(SwaggerResourcesProvider swaggerResources)
// {
// this.swaggerResources = swaggerResources;
// }
//
// @GetMapping("/configuration/security")
// public Mono<ResponseEntity<SecurityConfiguration>> securityConfiguration()
// {
// return Mono.just(new ResponseEntity<>(
// Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()),
// HttpStatus.OK));
// }
//
// @GetMapping("/configuration/ui")
// public Mono<ResponseEntity<UiConfiguration>> uiConfiguration()
// {
// return Mono.just(new ResponseEntity<>(
// Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK));
// }
//
// @SuppressWarnings("rawtypes")
// @GetMapping("")
// public Mono<ResponseEntity> swaggerResources()
// {
// return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK)));
// }
//}
package com.bonus.sgzb.gateway.handler;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
import springfox.documentation.swagger.web.SecurityConfiguration;
import springfox.documentation.swagger.web.SecurityConfigurationBuilder;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;
import springfox.documentation.swagger.web.UiConfiguration;
import springfox.documentation.swagger.web.UiConfigurationBuilder;
/**
*
* @author bonus
* @date
*/
@RestController
@RequestMapping("/swagger-resources")
public class SwaggerHandler
{
@Autowired(required = false)
private SecurityConfiguration securityConfiguration;
@Autowired(required = false)
private UiConfiguration uiConfiguration;
private final SwaggerResourcesProvider swaggerResources;
@Autowired
public SwaggerHandler(SwaggerResourcesProvider swaggerResources)
{
this.swaggerResources = swaggerResources;
}
@GetMapping("/configuration/security")
public Mono<ResponseEntity<SecurityConfiguration>> securityConfiguration()
{
return Mono.just(new ResponseEntity<>(
Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()),
HttpStatus.OK));
}
@GetMapping("/configuration/ui")
public Mono<ResponseEntity<UiConfiguration>> uiConfiguration()
{
return Mono.just(new ResponseEntity<>(
Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK));
}
@SuppressWarnings("rawtypes")
@GetMapping("")
public Mono<ResponseEntity> swaggerResources()
{
return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK)));
}
}

View File

@ -1,49 +0,0 @@
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
username: nacos
password: N2$NjW2&CDEOx$mD*y5h
config:
# 配置中心地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 172.16.36.33:8848
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 172.16.36.33:8848
dataId: sentinel-sgzb-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow
# Spring Boot Actuator V2中风险漏洞处理禁止远程端口访问
management:
endpoint:
env:
enabled: false

View File

@ -11,11 +11,11 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
file-extension: yml

View File

@ -43,10 +43,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- FastDFS -->
<dependency>

View File

@ -11,7 +11,7 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
*
* @author ruoyi
*/
//@EnableCustomSwagger2
@EnableCustomSwagger2
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
@EnableRyFeignClients
public class SgzbFileApplication

View File

@ -36,10 +36,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>

View File

@ -12,7 +12,7 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
* @author ruoyi
*/
@EnableCustomConfig
//@EnableCustomSwagger2
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class SgzbGenApplication

View File

@ -36,10 +36,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>

View File

@ -12,7 +12,7 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
* @author ruoyi
*/
@EnableCustomConfig
//@EnableCustomSwagger2
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
public class SgzbJobApplication

View File

@ -43,10 +43,10 @@
</dependency>
<!-- SpringBoot Actuator -->
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
@ -83,26 +83,6 @@
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-swagger</artifactId>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
</dependency>
<dependency>
<groupId>junit</groupId>

View File

@ -13,7 +13,7 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
* @author ruoyi
*/
@EnableCustomConfig
//@EnableCustomSwagger2
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
@EnableEncryptableProperties

View File

@ -1,54 +1,54 @@
//package com.bonus.sgzb.system.controller;
//import com.bonus.sgzb.common.core.web.controller.BaseController;
//import com.bonus.sgzb.common.core.web.domain.AjaxResult;
//import com.bonus.sgzb.common.core.web.page.TableDataInfo;
//import com.bonus.sgzb.common.security.annotation.InnerAuth;
//import com.bonus.sgzb.system.api.domain.BmNumLogs;
//import com.bonus.sgzb.system.service.impl.BmNumLogsService;
//import org.springframework.web.bind.annotation.*;
//
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.util.List;
//
///**
//* (bm_num_logs)表控制层
//*
//* @author syruan
//*/
//@RestController
//@RequestMapping("/bm_num_logs")
//public class BmNumLogsController extends BaseController {
//
// /**
// * 服务对象
// */
// @Autowired
// private BmNumLogsService bmNumLogsService;
//
// @GetMapping("/list")
// public TableDataInfo list(BmNumLogs record) {
// startPage();
// List<BmNumLogs> list = bmNumLogsService.selectAll(record);
// return getDataTable(list);
// }
//
// /**
// * 通过主键查询单条数据
// *
// * @param id 主键
// * @return 单条数据
// */
// @GetMapping("selectByPrimaryKey")
// public BmNumLogs selectByPrimaryKey(Integer id) {
// return bmNumLogsService.selectByPrimaryKey(id);
// }
//
// @InnerAuth
// @PostMapping
// public AjaxResult add(@RequestBody BmNumLogs bmNumLogs) {
// return toAjax(bmNumLogsService.insert(bmNumLogs));
// }
//
//
//}
package com.bonus.sgzb.system.controller;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.system.api.domain.BmNumLogs;
import com.bonus.sgzb.system.service.impl.BmNumLogsService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* (bm_num_logs)表控制层
*
* @author syruan
*/
@RestController
@RequestMapping("/bm_num_logs")
public class BmNumLogsController extends BaseController {
/**
* 服务对象
*/
@Autowired
private BmNumLogsService bmNumLogsService;
@GetMapping("/list")
public TableDataInfo list(BmNumLogs record) {
startPage();
List<BmNumLogs> list = bmNumLogsService.selectAll(record);
return getDataTable(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectByPrimaryKey")
public BmNumLogs selectByPrimaryKey(Integer id) {
return bmNumLogsService.selectByPrimaryKey(id);
}
@InnerAuth
@PostMapping
public AjaxResult add(@RequestBody BmNumLogs bmNumLogs) {
return toAjax(bmNumLogsService.insert(bmNumLogs));
}
}

View File

@ -5,7 +5,6 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.security.annotation.InnerAuth;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.system.service.impl.BmStorageLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -27,7 +26,6 @@ public class BmStorageLogController extends BaseController {
@Autowired
private BmStorageLogService bmStorageLogService;
@RequiresPermissions("stock:log:list")
@GetMapping("/list")
public TableDataInfo list(BmStorageLog record) {
startPage();
@ -41,7 +39,6 @@ public class BmStorageLogController extends BaseController {
* @param id 主键
* @return 单条数据
*/
@RequiresPermissions("stock:log:select")
@GetMapping("selectByPrimaryKey")
public BmStorageLog selectByPrimaryKey(Integer id) {
return bmStorageLogService.selectByPrimaryKey(id);

View File

@ -1,5 +1,18 @@
package com.bonus.sgzb.system.controller;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.controller.BaseController;
@ -10,13 +23,6 @@ import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.domain.SysDept;
import com.bonus.sgzb.system.service.ISysDeptService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* 部门信息
@ -85,17 +91,7 @@ public class SysDeptController extends BaseController {
return toAjax(deptService.insertCompanies(list));
}
// @RequiresPermissions("system:dept:add")
@Log(title = "公司管理", businessType = BusinessType.INSERT)
@PostMapping(value = "/addFirm")
public AjaxResult addFirm(@RequestBody SysDept sysDept) {
List<SysDept> list = new ArrayList<>();
list.add(sysDept);
if (!deptService.checkCompaniesNameUnique(list)) {
return error("新增公司失败,公司名称已存在");
}
return toAjax(deptService.insertCompanies(list));
}
/**
* 新增部门
*/

View File

@ -74,7 +74,6 @@ public class SysDictDataController extends BaseController
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
@RequiresPermissions("dict:data:dictType")
public AjaxResult dictType(@PathVariable String dictType)
{
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);

View File

@ -60,7 +60,7 @@ public class SysFileController {
ErrorCode.ATTACHMENT_UPLOAD_FAILED.getMessage());
}
}catch (Exception e){
return AjaxResult.error(e.getMessage());
log.error(e.getMessage());
}
if (file != null && file.getId() != 0){
return AjaxResult.success(file);

View File

@ -108,7 +108,6 @@ public class SysProfileController extends BaseController {
LoginUser loginUser = SecurityUtils.getLoginUser();
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newDecrypt));
tokenService.setLoginUser(loginUser);
userService.updatePwdState(loginUser);
return success();
}
return error("修改密码异常,请联系管理员");
@ -120,7 +119,6 @@ public class SysProfileController extends BaseController {
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file,String fileType) throws Exception {
try {
FileInfo fileInfo = sysFileService.uploadHeadPic(file, fileType);
if (!file.isEmpty()) {
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -141,9 +139,6 @@ public class SysProfileController extends BaseController {
return ajax;
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常,请联系管理员!");
}
return error("上传图片异常,请联系管理员");
}
}

View File

@ -83,11 +83,6 @@ public class SysUserController extends BaseController {
return getDataTable(list);
}
@GetMapping("/userPwdState")
public String userPwdState(String username) {
String state = userService.selectforceChangePwd(username);
return state;
}
/**
* 获取用户列表内部请求
*/
@ -179,7 +174,6 @@ public class SysUserController extends BaseController {
public AjaxResult getInfo() {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser user = userService.selectUserById(SecurityUtils.getLoginUser().getUserid());
user.setPassword(null);
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
@ -204,7 +198,6 @@ public class SysUserController extends BaseController {
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) {
SysUser sysUser = userService.selectUserById(userId);
sysUser.setPassword(null);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));

View File

@ -1,20 +1,19 @@
package com.bonus.sgzb.system.mapper;
import com.bonus.sgzb.system.api.domain.SysDept;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.bonus.sgzb.system.api.domain.SysDept;
/**
* 部门管理 数据层
*
*
* @author ruoyi
*/
public interface SysDeptMapper
{
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@ -22,7 +21,7 @@ public interface SysDeptMapper
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
@ -31,7 +30,7 @@ public interface SysDeptMapper
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@ -39,7 +38,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
*
*
* @param deptId 部门ID
* @return 部门列表
*/
@ -47,7 +46,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@ -55,7 +54,7 @@ public interface SysDeptMapper
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -63,7 +62,7 @@ public interface SysDeptMapper
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -73,7 +72,7 @@ public interface SysDeptMapper
/**
* 校验部门名称是否唯一
*
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
@ -84,7 +83,7 @@ public interface SysDeptMapper
/**
* 新增部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -92,7 +91,7 @@ public interface SysDeptMapper
/**
* 修改部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -100,14 +99,14 @@ public interface SysDeptMapper
/**
* 修改所在部门正常状态
*
*
* @param deptIds 部门ID组
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
* 修改子元素关系
*
*
* @param depts 子元素
* @return 结果
*/
@ -115,7 +114,7 @@ public interface SysDeptMapper
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -131,6 +130,4 @@ public interface SysDeptMapper
String getCompanyByAncestors(String split);
int getMaxDeptId();
int checkCompanyNameUnique(SysDept list);
}

View File

@ -1,8 +1,6 @@
package com.bonus.sgzb.system.mapper;
import java.util.List;
import com.bonus.sgzb.system.api.model.LoginUser;
import org.apache.ibatis.annotations.Param;
import com.bonus.sgzb.system.api.domain.SysUser;
@ -136,8 +134,4 @@ public interface SysUserMapper
List<SysUser> selectUserByRole(SysUser sysUser);
void updatePurchaseNoticePerson(SysUser user);
String selectforceChangePwd(String username);
void updatePwdState(LoginUser loginUser);
}

View File

@ -1,20 +1,19 @@
package com.bonus.sgzb.system.service;
import java.util.List;
import com.bonus.sgzb.system.api.domain.SysDept;
import com.bonus.sgzb.system.domain.vo.TreeSelect;
import java.util.List;
/**
* 部门管理 服务层
*
*
* @author ruoyi
*/
public interface ISysDeptService
{
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@ -22,7 +21,7 @@ public interface ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@ -30,7 +29,7 @@ public interface ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
@ -38,7 +37,7 @@ public interface ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@ -46,7 +45,7 @@ public interface ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@ -54,7 +53,7 @@ public interface ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@ -62,7 +61,7 @@ public interface ISysDeptService
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@ -70,7 +69,7 @@ public interface ISysDeptService
/**
* 是否存在部门子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -78,7 +77,7 @@ public interface ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@ -87,7 +86,7 @@ public interface ISysDeptService
public boolean checkCompaniesNameUnique(List<SysDept> list);
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
@ -95,7 +94,7 @@ public interface ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
public void checkDeptDataScope(Long deptId);
@ -104,7 +103,7 @@ public interface ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -112,7 +111,7 @@ public interface ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -120,7 +119,7 @@ public interface ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser;
import com.bonus.sgzb.system.domain.po.UrgentProcessingUser;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
@ -225,8 +224,4 @@ public interface ISysUserService
* @return
*/
AjaxResult urgentProcessingUser(UrgentProcessingUser urgentProcessingUser);
String selectforceChangePwd(String username);
void updatePwdState(LoginUser loginUser);
}

View File

@ -16,7 +16,7 @@ import com.bonus.sgzb.system.mapper.SysDeptMapper;
import com.bonus.sgzb.system.mapper.SysRoleMapper;
import com.bonus.sgzb.system.mapper.SysUserMapper;
import com.bonus.sgzb.system.service.ISysDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -31,7 +31,6 @@ import java.util.stream.Collectors;
*
* @author ruoyi
*/
@Slf4j
@Service
public class SysDeptServiceImpl implements ISysDeptService {
@Resource
@ -233,7 +232,6 @@ public class SysDeptServiceImpl implements ISysDeptService {
*/
@Override
public int insertDept(SysDept dept) {
log.info("insertDept========{}", dept);
SysDept info = deptMapper.selectDeptById(dept.getParentId());
// 如果父节点不为正常状态,则不允许新增子节点
if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {

View File

@ -53,8 +53,6 @@ public class SysFileServiceImpl implements SysFileService {
*/
@Value("${file.path}")
private String localFilePath;
// 允许的文件格式
private static final List<String> ALLOWED_EXTENSIONS = Arrays.asList("jpg", "jpeg", "txt", "png", "pdf", "docx", "doc", "xlsx", "xls");
@Resource
private FileClient fileClient;
@ -70,16 +68,11 @@ public class SysFileServiceImpl implements SysFileService {
public FileInfo uploadFile(HttpServletRequest request) throws Exception {
FileInfo file = new FileInfo();
StandardMultipartHttpServletRequest req = (StandardMultipartHttpServletRequest) request;
// String photoType = req.getParameter("fileType");
// String photoType = req.getParameter("fileType");
Long userId = SecurityUtils.getLoginUser().getUserid();
HashMap<String, Object> map = getFile(req);
List<MultipartFile> items = (List<MultipartFile>) map.get("filePath");
MultipartFile item = items.get(0);
// 获取文件后缀名
String fileExtension = item.getOriginalFilename().substring(item.getOriginalFilename().lastIndexOf(".") + 1);
if (!ALLOWED_EXTENSIONS.contains(fileExtension.toLowerCase())) {
throw new Exception("不支持该文件格式");
}
try {
//String url = saveFile(request, item, photoType);
/*AjaxResult res = fileClient.uploadFile(item);
@ -91,7 +84,7 @@ public class SysFileServiceImpl implements SysFileService {
String type = fileName.substring(fileName.lastIndexOf(".") + 1);
long size = item.getSize() / 1024 / 1024;
file.setFileName(fileName);
log.info("文件名为:{}", fileName);
log.info("文件名为:{}",fileName);
file.setFileUrl(url);
file.setCreator(userId.toString());
file.setType(type);
@ -109,7 +102,6 @@ public class SysFileServiceImpl implements SysFileService {
/**
* 腾讯云文件上传
*
* @param file
* @return
*/
@ -134,7 +126,7 @@ public class SysFileServiceImpl implements SysFileService {
String key = IdUtils.fastSimpleUuid() + file.getOriginalFilename();
//对上传文件分组根据当前日期 /2024/04/02
String dateTime = new DateTime().toString("yyyy/MM/dd");
key = dateTime + "/" + key;
key = dateTime+"/"+key;
try {
//获取上传文件输入流
InputStream inputStream = file.getInputStream();
@ -147,9 +139,9 @@ public class SysFileServiceImpl implements SysFileService {
// 高级接口会返回一个异步结果Upload
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
// 返回上传文件路径:https://ggkt-atguigu-1310644373.cos.ap-beijing.myqcloud.com/01.jpg
return "https://" + bucketName + "." + "cos" + "." + ConstantPropertiesUtil.END_POINT + ".myqcloud.com" + "/" + key;
return "https://" + bucketName + "." + "cos" + "." + ConstantPropertiesUtil.END_POINT+".myqcloud.com" + "/" + key;
} catch (Exception e) {
log.error(e.getMessage());
log.error(e.getMessage());
}
return null;
}
@ -161,7 +153,7 @@ public class SysFileServiceImpl implements SysFileService {
* @throws Exception
*/
@Override
public FileInfo uploadHeadPic(MultipartFile item, String fileType) {
public FileInfo uploadHeadPic(MultipartFile item,String fileType) {
FileInfo file = new FileInfo();
Long userId = SecurityUtils.getLoginUser().getUserid();
try {
@ -213,7 +205,7 @@ public class SysFileServiceImpl implements SysFileService {
String tmpName = multipartFile.getOriginalFilename();
tmpName = tmpName.substring(tmpName.lastIndexOf("\\") + 1);
tmpName = IdUtil.fastSimpleUUID() + System.currentTimeMillis() + tmpName.substring(tmpName.lastIndexOf("."), tmpName.length());
String imageFiles = localFilePath + "/" + fileType + "/";
String imageFiles = localFilePath+ "/" + fileType + "/";
String os = System.getProperty("os.name");
if (os.toLowerCase().startsWith(GlobalConstants.STRING_WIN)) {
imageFiles = "D://files/" + fileType + "/";

View File

@ -119,13 +119,7 @@ public class SysUserServiceImpl implements ISysUserService {
*/
@Override
public SysUser selectUserByUserName(String userName) {
SysUser sysUser = userMapper.selectUserByUserName(userName);
SysDept sysDept = deptMapper.selectDeptById(sysUser.getCompanyId());
if (Objects.nonNull(sysUser.getDept()) && Objects.nonNull(sysDept)) {
sysUser.getDept().setSocialCreditCode(sysDept.getSocialCreditCode());
sysUser.getDept().setEnterpriseOwnershipCode(sysDept.getEnterpriseOwnershipCode());
}
return sysUser;
return userMapper.selectUserByUserName(userName);
}
/**
@ -282,9 +276,6 @@ public class SysUserServiceImpl implements ISysUserService {
}*/
// 新增用户信息
Long deptId = user.getDeptId();
SysDept sysDept = deptMapper.selectDeptById(deptId);
user.setCompanyId(sysDept.getCompanyId());
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
@ -381,7 +372,6 @@ public class SysUserServiceImpl implements ISysUserService {
*/
@Override
public int resetPwd(SysUser user) {
user.setForceChangePwd("1");
return userMapper.updateUser(user);
}
@ -440,9 +430,6 @@ public class SysUserServiceImpl implements ISysUserService {
SysUserRole ur = new SysUserRole();
ur.setUserId(userId);
ur.setRoleId(roleId);
if (roleId.equals(1)){
continue;
}
list.add(ur);
}
userRoleMapper.batchUserRole(list);
@ -582,16 +569,4 @@ public class SysUserServiceImpl implements ISysUserService {
log.info("ToDoServiceImpl urgentProcessingUser {} end" ,urgentProcessingUser);
return success(userList);
}
@Override
public String selectforceChangePwd(String username) {
return userMapper.selectforceChangePwd(username);
}
@Override
public void updatePwdState(LoginUser loginUser) {
userMapper.updatePwdState(loginUser);
}
}

View File

@ -1,72 +0,0 @@
# Spring
spring:
servlet:
multipart:
max-request-size: 50MB
max-file-size: 30MB
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
username: nacos
password: N2$NjW2&CDEOx$mD*y5h
config:
# 配置中心地址
server-addr: 172.16.36.33:8848
namespace: sgzb_cloud_dev
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#腾讯云sms
tencent:
sms:
#api秘钥标识
accessKeyId: AKIDrreCVaRKDtMcgfU5QW9iEfv67tMfldJn
#api秘钥
accessKeySecret: OXUgeMo0yhBRTGo6sVu3yiFX4rQtAzc3
#请求域名
endpoint: sms.tencentcloudapi.com
#所属区域
region: ap-guangzhou
#腾讯云申请应用id
sdkAppId: 1400494336
#签名
smsSign: 南方电网互联网
#云平台模板id 2116937-验收通知 2115503-登录验证
templateId: 2116937,2115503
# 腾讯云cos
cos:
file:
# 存储桶所在地域
region: ap-guangzhou
# 存储桶所在地域
bucketregion: ap-guangzhou
# 存储桶名称
bucketname: prod-rental-1301524038
# API账号
secretid: AKIDrreCVaRKDtMcgfU5QW9iEfv67tMfldJn
# API密钥
secretkey: OXUgeMo0yhBRTGo6sVu3yiFX4rQtAzc3
# 禁用Actuator端点的未经身份验证的访问
management:
endpoint:
env:
enabled: false

View File

@ -15,11 +15,11 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
file-extension: yml

View File

@ -22,16 +22,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
<result property="socialCreditCode" column="social_credit_code" />
<result property="enterpriseOwnershipCode" column="enterprise_ownership_code" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,
d.remark,d.company_id,d.social_credit_code,d.enterprise_ownership_code
d.remark,d.company_id
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="com.bonus.sgzb.system.api.domain.SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
@ -54,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
@ -65,25 +63,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
@ -96,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.deptName}
</foreach>
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
@ -104,16 +102,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertCompanies" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
insert into sys_dept(
dept_id,parent_id,dept_name,ancestors,order_num,leader,phone,email,status,create_by,company_id,create_time,social_credit_code,enterprise_ownership_code)
dept_id,parent_id,dept_name,ancestors,order_num,leader,phone,email,status,create_by,company_id,create_time)
values
<foreach item="item" index="index" collection="depts" separator=",">
(
#{item.deptId},#{item.parentId},#{item.deptName},#{item.ancestors},#{item.orderNum},#{item.leader},
#{item.phone},#{item.email},#{item.status},#{item.createBy},#{item.companyId},sysdate(),#{item.socialCreditCode},#{item.enterpriseOwnershipCode}
#{item.phone},#{item.email},#{item.status},#{item.createBy},#{item.companyId},sysdate()
)
</foreach>
</insert>
<insert id="insertDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
@ -143,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</insert>
<update id="updateDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
update sys_dept
<set>
@ -156,13 +154,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="socialCreditCode != null and socialCreditCode != ''">social_credit_code = #{socialCreditCode},</if>
<if test="enterpriseOwnershipCode != null and enterpriseOwnershipCode != ''">enterprise_ownership_code = #{enterpriseOwnershipCode},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
@ -175,14 +171,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
@ -201,9 +197,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select max(dept_id)
from sys_dept
</select>
<select id="checkCompanyNameUnique" resultType="java.lang.Integer">
select count(*)
from sys_dept
where dept_name = #{deptName}
</select>
</mapper>
</mapper>

View File

@ -180,9 +180,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
</select>
<select id="selectforceChangePwd" resultType="java.lang.String">
select force_change_pwd from sys_user where user_name = #{username}
</select>
<insert id="insertUser" parameterType="com.bonus.sgzb.system.api.domain.SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
@ -199,7 +196,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
force_change_pwd,
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
@ -215,7 +211,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
1,
sysdate()
)
</insert>
@ -236,7 +231,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="forceChangePwd != null">force_change_pwd = #{forceChangePwd},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
@ -256,12 +250,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updatePurchaseNoticePerson">
update purchase_notice_person set telphone = #{phonenumber} where user_id = #{userId}
</update>
<update id="updatePwdState">
update sys_user set force_change_pwd = '0' where user_id = #{userid}
</update>
<delete id="deleteUserById" parameterType="Long">
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
</delete>