Compare commits

...

29 Commits

Author SHA1 Message Date
sxu 71dbf55a74 for nw 2024-08-14 09:07:42 +08:00
sxu 9f86f85784 for nw 2024-08-14 09:07:39 +08:00
sxu b6c403e070 for nw 2024-08-14 09:01:19 +08:00
sxu 3e4955f0b9 for nw 2024-08-14 08:59:13 +08:00
sxu e667e58ebf for gz 2024-08-13 18:44:49 +08:00
sxu 77b1e433b5 for gz 2024-08-13 18:43:24 +08:00
sxu 17670d4856 for gz 2024-08-13 18:36:04 +08:00
sxu 791ce058b3 for gz 2024-08-13 18:05:13 +08:00
sxu cb9b23b1f2 for gz 2024-08-13 18:03:12 +08:00
sxu a593c2cfd5 for gz 2024-08-13 17:49:08 +08:00
sxu 5386986f87 for gz 2024-08-13 17:49:04 +08:00
sxu e5a1dad2f1 for gz 2024-08-13 17:33:16 +08:00
sxu 49b30b9f6c for gz 2024-08-13 17:28:55 +08:00
sxu 2d75b41377 for gz 2024-08-13 17:03:57 +08:00
sxu 869b534c5e for gz 2024-08-13 16:14:08 +08:00
sxu 5d9ff667c6 merge gz to cq 2024-08-13 15:30:41 +08:00
sxu ef18dd3dc4 for gz 2024-08-13 13:00:32 +08:00
sxu 2aaa299d28 sysdept 2024-08-13 09:51:59 +08:00
sxu c1b1f3d673 sysrole 2024-08-13 09:45:33 +08:00
sxu 7d2e669896 system-api 2024-08-13 08:59:10 +08:00
sxu c3ff002026 profile 2024-08-13 08:49:55 +08:00
sxu 8de276dee6 profile 2024-08-12 19:15:02 +08:00
sxu f0267a4290 profile 2024-08-12 19:10:58 +08:00
sxu 4d83a3b180 Merge remote-tracking branch 'origin' into config20240812 2024-08-12 18:39:21 +08:00
sxu 91896095ba 配置改动+多客户示例 2024-08-12 09:41:08 +08:00
sxu 795b03a307 配置改动+多客户示例 2024-08-11 13:41:01 +08:00
sxu 618e6069ba 配置改动+多客户示例 2024-08-11 13:38:29 +08:00
sxu d8ca2e9575 配置改动+多客户示例 2024-08-11 10:33:43 +08:00
sxu 040e07e6d8 配置改动+多客户示例 2024-08-11 10:19:33 +08:00
68 changed files with 1490 additions and 589 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -6,34 +6,27 @@ mkdir -p $deploy_path
cd $deploy_path
rm -rf *.jar
echo "workspace is ${WORKSPACE}"
mv ${WORKSPACE}/sgzb-auth/target/sgzb-auth.jar $deploy_path
mv ${WORKSPACE}/sgzb-gateway/target/sgzb-gateway.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-system/target/sgzb-modules-system.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-base/target/sgzb-modules-base.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-file/target/sgzb-modules-file.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-material/target/sgzb-modules-material.jar $deploy_path
mv ${WORKSPACE}/sgzb-auth/target/sgzb-auth-1.0.jar $deploy_path
mv ${WORKSPACE}/sgzb-gateway/target/sgzb-gateway-1.0.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-material/target/sgzb-modules-material-1.0.jar $deploy_path
mv ${WORKSPACE}/sgzb-modules/sgzb-system/target/sgzb-modules-system-1.0.jar $deploy_path
chmod 777 *.jar
echo "--------moveFile end--------------"
export sgzb_auth_enable=true
export sgzb_gateway_enable=true
export sgzb_modules_system_enable=true
export sgzb_modules_base_enable=false
export sgzb_modules_file_enable=false
export sgzb_modules_material_enable=true
export sgzb_modules_system_enable=true
export sgzb_auth_jar=sgzb-auth.jar
export sgzb_gateway_jar=sgzb-gateway.jar
export sgzb_modules_system_jar=sgzb-modules-system.jar
export sgzb_modules_base_jar=sgzb-modules-base.jar
export sgzb_modules_file_jar=sgzb-modules-file.jar
export sgzb_modules_material_jar=sgzb-modules-material.jar
export sgzb_auth_jar=sgzb-auth-1.0.jar
export sgzb_gateway_jar=sgzb-gateway-1.0.jar
export sgzb_modules_material_jar=sgzb-modules-material-1.0.jar
export sgzb_modules_system_jar=sgzb-modules-system-1.0.jar
export sgzb_auth_port=39200
export sgzb_gateway_port=39080
export sgzb_modules_system_port=39201
export sgzb_modules_base_port=39301
export sgzb_modules_file_port=39300
export sgzb_modules_material_port=39302
export sgzb_modules_system_port=39201
if($auth_service_enable);then
echo "--------auth开始启动--------------"
@ -81,69 +74,6 @@ if($sgzb_gateway_enable);then
fi
if($sgzb_modules_system_enable);then
echo "--------sgzb_modules_system 开始启动--------------"
echo "--------删除sgzb_modules_system开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_system_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_system process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_system killed success"
fi
echo "--------sgzb_modules_system开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_system_jar >/dev/null 2>&1 &
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_system_pid" ]
do
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_system pid is $sgzb_modules_system_pid"
echo "--------sgzb_modules_system 启动成功--------------"
fi
if($sgzb_modules_base_enable);then
echo "--------sgzb_modules_base 开始启动--------------"
echo "--------删除sgzb_modules_base开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_base_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_base process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_base killed success"
fi
echo "--------sgzb_modules_base开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_base_jar >/dev/null 2>&1 &
sgzb_modules_base_pid=`lsof -i:$sgzb_modules_base_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_base_pid" ]
do
sgzb_modules_base_pid=`lsof -i:$sgzb_modules_base_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_base pid is $sgzb_modules_base_pid"
echo "--------sgzb_modules_base 启动成功--------------"
fi
if($sgzb_modules_file_enable);then
echo "--------sgzb_modules_file 开始启动--------------"
echo "--------删除sgzb_modules_file开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_file_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_file process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_file killed success"
fi
echo "--------sgzb_modules_file开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_file_jar >/dev/null 2>&1 &
sgzb_modules_file_pid=`lsof -i:$sgzb_modules_file_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_file_pid" ]
do
sgzb_modules_file_pid=`lsof -i:$sgzb_modules_file_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_file pid is $sgzb_modules_file_pid"
echo "--------sgzb_modules_file 启动成功--------------"
fi
if($sgzb_modules_material_enable);then
echo "--------sgzb_modules_material 开始启动--------------"
echo "--------删除sgzb_modules_material开始--------------"
@ -163,4 +93,26 @@ if($sgzb_modules_material_enable);then
done
echo "sgzb_modules_material pid is $sgzb_modules_material_pid"
echo "--------sgzb_modules_material 启动成功--------------"
fi
if($sgzb_modules_system_enable);then
echo "--------sgzb_modules_system 开始启动--------------"
echo "--------删除sgzb_modules_system开始--------------"
P_ID=`ps -ef | grep -w $sgzb_modules_system_jar | grep -v "grep" | awk '{print $2}'`
if [ "$P_ID" == "" ]; then
echo "===sgzb_modules_system process not exists or stop success"
else
kill -9 $P_ID
echo "sgzb_modules_system killed success"
fi
echo "--------sgzb_modules_system开始部署--------------"
nohup /usr/lib/jvm/jdk1.8.0_381/bin/java -jar $sgzb_modules_system_jar >/dev/null 2>&1 &
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
until [ -n "$sgzb_modules_system_pid" ]
do
sgzb_modules_system_pid=`lsof -i:$sgzb_modules_system_port|grep "LISTEN"|awk '{print $2}'`
done
echo "sgzb_modules_system pid is $sgzb_modules_system_pid"
echo "--------sgzb_modules_system 启动成功--------------"
fi

View File

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

View File

@ -67,11 +67,32 @@ public class SysDept extends BaseEntity
/** 子部门 */
@ApiModelProperty(value = "子部门")
private List<SysDept> children = new ArrayList<SysDept>();
private List<SysDept> children = new ArrayList<>();
/** 备注信息 */
private String remark;
/** 所属组织id */
private Long companyId;
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public Long getDeptId()
{
return deptId;

View File

@ -78,6 +78,17 @@ public class SysRole extends BaseEntity
/** 数据所属组织 */
private String deptName;
/** 所属组织id */
private Long companyId;
public Long getCompanyId() {
return companyId;
}
public void setCompanyId(Long companyId) {
this.companyId = companyId;
}
public SysRole()
{
@ -259,6 +270,7 @@ public class SysRole extends BaseEntity
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("deptName", getDeptName())
.append("companyId", getCompanyId())
.toString();
}
}

View File

@ -34,7 +34,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
@Override
public R<LoginUser> getUserInfoByPhone(String phone, String source) {
return R.fail("获取用户失败:" + throwable.getMessage());
return R.fail("根据手机号获取用户失败:" + throwable.getMessage());
}
@Override
@ -59,7 +59,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
@Override
public R<List<SysUser>> getUserList(SysUser sysUser, String source) {
return R.fail("获取用户失败:" + throwable.getMessage());
return R.fail("获取用户列表失败:" + throwable.getMessage());
}
};
}

View File

@ -8,7 +8,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-auth</artifactId>
<artifactId>sgzb-auth-1.0</artifactId>
<description>
sgzb-auth认证授权中心

View File

@ -9,12 +9,15 @@ import com.bonus.sgzb.auth.service.NwUserLoginService;
import com.bonus.sgzb.auth.utils.RsaUtil;
import com.bonus.sgzb.common.core.constant.CacheConstants;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.GlobalConstants;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.redis.service.RedisService;
import com.bonus.sgzb.system.api.RemoteUserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import com.bonus.sgzb.auth.service.SysLoginService;
import com.bonus.sgzb.common.core.domain.R;
@ -36,6 +39,9 @@ import java.util.Map;
@Slf4j
public class TokenController {
@Value("${sgzb.site}")
private String site;
@Autowired
private TokenService tokenService;
@ -57,28 +63,76 @@ public class TokenController {
//web端登录
@PostMapping("login")
public R<?> login(@RequestBody LoginBody form) throws Exception {
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), Constants.privateKey);
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
if (decryptedData.equals(Constants.USER_PASSWORD)) {
userInfo.setCode(1);
}
String uuid = form.getUuid();
String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
if (StringUtils.isBlank(captcha)) {
// 删除验证码缓存
if (Constants.SITE_NW.equals(site)) {
//优先校验图形验证码
String uuid = form.getUuid();
Object cacheObject = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
String captcha = cacheObject == null ? null : cacheObject.toString();
// 获取后立即删除图形验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码超时,请重新刷新");
}
if (form.getCode() != null && form.getCode().equals(captcha)) {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
// 获取登录token
return R.ok(tokenService.createToken(userInfo));
if (StringUtils.isBlank(captcha)) {
throw new ServiceException("图形验证码失效,请重新刷新获取");
}
if (form.getCode() != null && !form.getCode().equals(captcha)) {
throw new ServiceException("图形验证码错误");
}
//根据用户名查询用户信息
LoginUser user = sysLoginService.selectByName(form.getUsername());
if (StringUtils.isNull(user)) {
throw new ServiceException("用户名不存在/密码错误");
}
//获取查询的用户手机号
String phone = user.getSysUser().getPhonenumber();
if ("adminBns".equals(form.getUsername())) {
if (!StringUtils.isNotBlank(phone)) {
throw new ServiceException("手机号为空,请联系管理员!");
}
//管理员用户需要额外校验手机短信验证码
String redisCode = redisService.getCacheObject("code_" + phone);
if (StringUtils.isEmpty(redisCode)) {
throw new ServiceException("短信验证码失效", 500);
}
if (!StringUtils.equals(redisCode.split(GlobalConstants.STRING_UNDERLINE)[0], form.getTextCode())) {
throw new ServiceException("短信验证码错误", 500);
}
}
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), Constants.privateKey);
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
if (decryptedData.equals(Constants.DEFAULT_USER_PASSWORD_NW)) {
userInfo.setCode(1);
}
if (form.getCode() != null && form.getCode().equals(captcha)) {
redisService.deleteObject("code_" + phone);
// 获取登录token
return R.ok(tokenService.createToken(userInfo));
} else {
return R.fail("登录失败,请联系管理员!");
}
} else {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码错误");
String decryptedData = RsaUtil.decryptByPrivateKey(form.getPassword(), Constants.privateKey);
// 用户登录
LoginUser userInfo = sysLoginService.login(form.getUsername(), decryptedData);
if (decryptedData.equals(Constants.DEFAULT_USER_PASSWORD_CQ)) {
userInfo.setCode(1);
}
String uuid = form.getUuid();
String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
if (StringUtils.isBlank(captcha)) {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码超时,请重新刷新");
}
if (form.getCode() != null && form.getCode().equals(captcha)) {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
// 获取登录token
return R.ok(tokenService.createToken(userInfo));
} else {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码错误");
}
}
}
@ -102,8 +156,38 @@ public class TokenController {
@PostMapping("sendCode")
public R<?> sendCode(@RequestBody LoginBody form) {
R<Boolean> sendState = remoteUserService.sendCode(form.getPhone());
return sendState;
if (Constants.SITE_NW.equals(site)) {
if ("adminBns".equals(form.getUsername())) {
// 根据用户名查询用户信息
LoginUser userInfo = sysLoginService.selectByName(form.getUsername());
//获取查询的用户手机号
String phone = userInfo.getSysUser().getPhonenumber();
if (StringUtils.isBlank(phone)) {
throw new ServiceException("手机号为空,请联系管理员!");
}
//图形验证码校验成功发送短信
R<Boolean> sendState = remoteUserService.sendCode(phone);
return sendState;
} else {
String uuid = form.getUuid();
String captcha = redisService.getCacheObject(CacheConstants.CAPTCHA_CODE_KEY + uuid).toString();
if (StringUtils.isBlank(captcha)) {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码超时,请重新刷新");
}
if (form.getCode() != null && !form.getCode().equals(captcha)) {
// 删除验证码缓存
redisService.deleteObject(CacheConstants.CAPTCHA_CODE_KEY + uuid);
return R.fail("验证码错误");
}
R<Boolean> sendState = remoteUserService.sendCode(form.getPhone());
return sendState;
}
} else {
R<Boolean> sendState = remoteUserService.sendCode(form.getPhone());
return sendState;
}
}
@PostMapping("checkCode")

View File

@ -31,4 +31,9 @@ public class LoginBody {
private String uuid;
/**
* 短信验证码
*/
private String textCode;
}

View File

@ -282,4 +282,15 @@ public class SysLoginService {
}
return password.toString();
}
/**
* 根据用户名查询用户信息
* @param username
* @return
*/
public LoginUser selectByName(String username) {
// 查询用户信息
R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
return userResult.getData();
}
}

View File

@ -0,0 +1,38 @@
# Spring
spring:
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,44 @@
# Spring
spring:
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -0,0 +1,38 @@
# Spring
spring:
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,44 @@
# Spring
spring:
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_nwjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -9,36 +9,4 @@ spring:
name: sgzb-auth
profiles:
# 环境配置
active: sgzb_cloud_dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
# 配置文件格式
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
active: sgzb_local_cq

View File

@ -7,6 +7,16 @@ package com.bonus.sgzb.common.core.constant;
*/
public class Constants
{
/**
* 南网仓储
*/
public static final String SITE_NW = "nw";
/**
* 重庆机具
*/
public static final String SITE_CQ = "cq";
/**
* UTF-8 字符集
*/
@ -140,9 +150,14 @@ public class Constants
"org.springframework", "org.apache", "com.bonus.sgzb.common.core.utils.file" };
/**
* 系统初始密码
* 重庆系统初始密码
*/
public static final String USER_PASSWORD = "CqCc@2024*";
public static final String DEFAULT_USER_PASSWORD_CQ = "CqCc@2024*";
/**
* 南网系统初始密码
*/
public static final String DEFAULT_USER_PASSWORD_NW = "NwCc@2024*";
/**
* 系统初始密码

View File

@ -8,7 +8,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-gateway</artifactId>
<artifactId>sgzb-gateway-1.0</artifactId>
<description>
sgzb-gateway网关模块

View File

@ -25,6 +25,14 @@ public class SgzbGatewayApplication implements CommandLineRunner {
private StringEncryptor encryptor;
@Override
public void run(String... args) throws Exception {
// String nacos = encrypt("Jjsp@nacos2023" );
// String mysqlNm = encrypt("root" );
// String mysqlPs = encrypt("Bonus@admin123!" );
// String redis = encrypt("Dszbns@Redis123!" );
// System.err.println( "nacos原始明文密码加密后的结果为" + nacos );
// System.err.println( "mysqlNm原始明文密码加密后的结果为" + mysqlNm );
// System.err.println( "mysqlPs原始明文密码加密后的结果为" + mysqlPs );
// System.err.println( "redis原始明文密码加密后的结果为" + redis );
}

View File

@ -0,0 +1,54 @@
# Spring Boot Actuator V2中风险漏洞处理禁止远程端口访问
management:
endpoint:
env:
enabled: false
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 192.168.0.62:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 192.168.0.56:8848
dataId: sentinel-sgzb-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow
#加密组件
jasypt:
encryptor:
password: Encrypt
# 适应多公司的个性化配置
sgzb:
site: cq

View File

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

View File

@ -0,0 +1,54 @@
# Spring Boot Actuator V2中风险漏洞处理禁止远程端口访问
management:
endpoint:
env:
enabled: false
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 192.168.0.14:8848
dataId: sentinel-sgzb-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow
#加密组件
jasypt:
encryptor:
password: Encrypt
# 适应多公司的个性化配置
sgzb:
site: cq

View File

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

View File

@ -2,12 +2,6 @@
server:
port: 39080
# Spring Boot Actuator V2中风险漏洞处理禁止远程端口访问
management:
endpoint:
env:
enabled: false
# Spring
spring:
application:
@ -15,46 +9,4 @@ spring:
name: sgzb-gateway
profiles:
# 环境配置
active: sgzb_cloud_dev
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
sentinel:
# 取消控制台懒加载
eager: true
transport:
# 控制台地址
dashboard: 127.0.0.1:8718
# nacos配置持久化
datasource:
ds1:
nacos:
server-addr: 192.168.0.14:8848
dataId: sentinel-sgzb-gateway
groupId: DEFAULT_GROUP
data-type: json
rule-type: gw-flow
#加密组件
jasypt:
encryptor:
password: Encrypt
active: sgzb_local_cq

View File

@ -14,7 +14,6 @@
<module>sgzb-job</module>
<module>sgzb-file</module>
<module>sgzb-material</module>
<module>sgzb-settlement</module>
</modules>
<artifactId>sgzb-modules</artifactId>

View File

@ -36,12 +36,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -14,12 +14,12 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置

View File

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-modules-material</artifactId>
<artifactId>sgzb-modules-material-1.0</artifactId>
<description>
sgzb-modules-material

View File

@ -14,6 +14,7 @@ import com.bonus.sgzb.material.vo.NoticeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -29,6 +30,8 @@ import java.util.List;
@RestController
@RequestMapping("/todo")
public class ToDoController extends BaseController {
@Qualifier("toDoServiceImpl")
@Autowired
private ToDoService toDoService;

View File

@ -0,0 +1,62 @@
package com.bonus.sgzb.material.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.material.domain.ToDoBean;
import com.bonus.sgzb.material.service.ToDoService;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description 首页--代办事项
* @author hay
* @date 2024/1/15 17:16
*/
@Api(tags = " 代办事项")
@RestController
@RequestMapping("/cq/todo")
public class ToDoController_CQ extends BaseController {
@Qualifier("toDoServiceImpl_CQ")
@Autowired
private ToDoService toDoService;
/**
* 代办事项列表
*/
@ApiOperation(value = "代办事项列表")
@GetMapping("/getToDoList")
public TableDataInfo getToDoList(ToDoBean bean)
{
startPage();
List<ToDoBean> list = toDoService.getToDoList(bean);
return getDataTable(list);
}
@ApiOperation(value = "代办事件下拉")
@PostMapping("/getTaskType")
public AjaxResult getTaskType(ToDoBean bean){
return toDoService.getTaskType(bean);
}
/**
* 发送催办短信
* @param noticeInfoVO
* @return
*/
@ApiOperation(value = "催办")
@PostMapping("/urgentProcessing")
public AjaxResult urgentProcessing(@RequestBody NoticeInfoVO noticeInfoVO){
return toAjax(toDoService.urgentProcessing(noticeInfoVO));
}
}

View File

@ -0,0 +1,62 @@
package com.bonus.sgzb.material.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.material.domain.ToDoBean;
import com.bonus.sgzb.material.service.ToDoService;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description 首页--代办事项
* @author hay
* @date 2024/1/15 17:16
*/
@Api(tags = " 代办事项")
@RestController
@RequestMapping("/gz/todo")
public class ToDoController_GZ extends BaseController {
@Qualifier("toDoServiceImpl_GZ")
@Autowired
private ToDoService toDoService;
/**
* 代办事项列表
*/
@ApiOperation(value = "代办事项列表")
@GetMapping("/getToDoList")
public TableDataInfo getToDoList(ToDoBean bean)
{
startPage();
List<ToDoBean> list = toDoService.getToDoList(bean);
return getDataTable(list);
}
@ApiOperation(value = "代办事件下拉")
@PostMapping("/getTaskType")
public AjaxResult getTaskType(ToDoBean bean){
return toDoService.getTaskType(bean);
}
/**
* 发送催办短信
* @param noticeInfoVO
* @return
*/
@ApiOperation(value = "催办")
@PostMapping("/urgentProcessing")
public AjaxResult urgentProcessing(@RequestBody NoticeInfoVO noticeInfoVO){
return toAjax(toDoService.urgentProcessing(noticeInfoVO));
}
}

View File

@ -0,0 +1,22 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.ToDoBean;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author 阮世耀
* @Create 2023/12/13 15:45
* @Version 1.0
*/
@Mapper
public interface ToDoMapper_CQ {
/**
* 获取TaskType
* @param bean
* @return ToDoBean
*/
List<ToDoBean> getTaskType(ToDoBean bean);
}

View File

@ -0,0 +1,22 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.ToDoBean;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author 阮世耀
* @Create 2023/12/13 15:45
* @Version 1.0
*/
@Mapper
public interface ToDoMapper_GZ {
/**
* 获取TaskType
* @param bean
* @return ToDoBean
*/
List<ToDoBean> getTaskType(ToDoBean bean);
}

View File

@ -55,9 +55,10 @@ public class ToDoServiceImpl implements ToDoService {
public AjaxResult getTaskType(ToDoBean bean) {
List<ToDoBean> list =new ArrayList<>();
try {
log.info("通用机具-代办事件-开始查询");
list = toDoMapper.getTaskType(bean);
} catch (Exception e) {
log.error("代办事件-查询失败", e);
log.error("通用机具-代办事件-查询失败", e);
}
return AjaxResult.success(list);
}

View File

@ -0,0 +1,35 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.ToDoBean;
import com.bonus.sgzb.material.mapper.ToDoMapper;
import com.bonus.sgzb.material.mapper.ToDoMapper_CQ;
import com.bonus.sgzb.material.service.ToDoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class ToDoServiceImpl_CQ extends ToDoServiceImpl implements ToDoService {
@Resource
private ToDoMapper toDoMapper;
@Resource
private ToDoMapper_CQ toDoMapper_cq;
@Override
public AjaxResult getTaskType(ToDoBean bean) {
List<ToDoBean> list =new ArrayList<>();
try {
log.info("重庆机具-代办事件-开始查询");
list = toDoMapper_cq.getTaskType(bean);
} catch (Exception e) {
log.error("重庆机具-代办事件-查询失败", e);
}
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,44 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.ToDoBean;
import com.bonus.sgzb.material.mapper.PurchaseCheckInfoMapper;
import com.bonus.sgzb.material.mapper.ToDoMapper;
import com.bonus.sgzb.material.mapper.ToDoMapper_GZ;
import com.bonus.sgzb.material.service.ToDoService;
import com.bonus.sgzb.system.api.RemoteUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
@Slf4j
public class ToDoServiceImpl_GZ extends ToDoServiceImpl implements ToDoService {
@Resource
private ToDoMapper toDoMapper;
@Resource
private ToDoMapper_GZ toDoMapper_gz;
@Resource
private PurchaseCheckInfoMapper purchaseCheckInfoMapper;
@Resource
private RemoteUserService remoteUserService;
@Override
public AjaxResult getTaskType(ToDoBean bean) {
List<ToDoBean> list =new ArrayList<>();
try {
log.info("南网机具-代办事件-开始查询");
list = toDoMapper_gz.getTaskType(bean);
} catch (Exception e) {
log.error("南网仓储-代办事件-查询失败", e);
}
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,28 @@
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,34 @@
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 禁用Actuator端点的未经身份验证的访问
management:
endpoint:
env:
enabled: false
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -0,0 +1,28 @@
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,34 @@
# Spring
spring:
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_nwjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
# 禁用Actuator端点的未经身份验证的访问
management:
endpoint:
env:
enabled: false
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -9,26 +9,5 @@ spring:
name: sgzb-material
profiles:
# 环境配置
active: sgzb_cloud_dev
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
active: sgzb_local_cq

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.material.mapper.ToDoMapper_CQ">
<select id="getTaskType" resultType="com.bonus.sgzb.material.domain.ToDoBean">
SELECT
id as taskTypeId,`name` as taskType
FROM
sys_dic
WHERE
`status`='0'
and p_id='0'
and id not in (1,5,8,13,81)
</select>
</mapper>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.material.mapper.ToDoMapper_GZ">
<select id="getTaskType" resultType="com.bonus.sgzb.material.domain.ToDoBean">
SELECT
id as taskTypeId,`name` as taskType
FROM
sys_dic
WHERE
`status`='0'
and p_id='0'
and id not in (1,5,8,13,81)
</select>
</mapper>

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>sgzb-modules</artifactId>
<groupId>com.bonus.sgzb</groupId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-modules-settlement</artifactId>
<description>
sgzb-modules-settlement
</description>
<dependencies>
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-security</artifactId>
</dependency>
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-swagger</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.bonus.sgzb</groupId>
<artifactId>sgzb-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>

View File

@ -1,36 +0,0 @@
package com.bonus.sgzb.settlement;
import com.bonus.sgzb.common.security.annotation.EnableCustomConfig;
import com.bonus.sgzb.common.security.annotation.EnableRyFeignClients;
import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 结算服务
*
* @author ruoyi
*/
@EnableCustomSwagger2
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableCustomConfig
@EnableRyFeignClients
public class SgzbSettlementApplication
{
public static void main(String[] args)
{
SpringApplication.run(SgzbSettlementApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 结算模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}

View File

@ -1,10 +0,0 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ __ _ _
(_) / _|(_)| |
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
| | | |_| || (_) || |_| || | | | | || || __/
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
__/ |
|___/

View File

@ -1,27 +0,0 @@
# Tomcat
server:
port: 9304
# Spring
spring:
application:
# 应用名称
name: sgzb-settlement
profiles:
# 环境配置
active: sgzb_cloud_dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/ruoyi-file" />
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

View File

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sgzb-modules-system</artifactId>
<artifactId>sgzb-modules-system-1.0</artifactId>
<description>
sgzb-modules-system系统模块

View File

@ -78,6 +78,20 @@ public class SysDeptController extends BaseController {
}
/**
* 新增公司
*/
//@RequiresPermissions("system:dept:add")
@Log(title = "公司管理", businessType = BusinessType.INSERT)
@PostMapping(value = "/addCompany")
public AjaxResult addCompany(@RequestBody List<SysDept> list) {
if (!deptService.checkCompaniesNameUnique(list)) {
return error("新增公司失败,其中有些公司名称已存在");
}
return toAjax(deptService.insertCompanies(list));
}
/**
* 新增部门
*/

View File

@ -50,9 +50,6 @@ public class SysProfileController extends BaseController {
@Autowired
private TokenService tokenService;
@Autowired
private RemoteFileService remoteFileService;
@Resource
private SysFileService sysFileService;
@ -122,6 +119,34 @@ public class SysProfileController extends BaseController {
return error("修改密码异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/update")
public AjaxResult updatePwd2(String actionCode, String handleCode) throws Exception {
//对新老密码进行解密
String oldDecrypt = RsaUtil.decryptByPrivateKey(actionCode, Constants.privateKey);
String newDecrypt = RsaUtil.decryptByPrivateKey(handleCode, Constants.privateKey);
String username = SecurityUtils.getUsername();
SysUser user = userService.selectUserByUserName(username);
String password = user.getPassword();
if (!SecurityUtils.matchesPassword(oldDecrypt, password)) {
return error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newDecrypt, password)) {
return error("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(username, SecurityUtils.encryptPassword(newDecrypt)) > 0) {
// 更新缓存用户密码
LoginUser loginUser = SecurityUtils.getLoginUser();
loginUser.getSysUser().setPassword(SecurityUtils.encryptPassword(newDecrypt));
tokenService.setLoginUser(loginUser);
return success();
}
return error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/

View File

@ -5,7 +5,6 @@ import com.bonus.sgzb.common.core.constant.SecurityConstants;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.domain.R;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.GlobalConstants;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController;
@ -28,7 +27,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
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 org.springframework.web.multipart.MultipartFile;
@ -36,7 +34,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@ -134,6 +131,7 @@ public class SysUserController extends BaseController {
@InnerAuth
@GetMapping("/info/{username}")
public R<LoginUser> info(@PathVariable("username") String username) {
log.info("通过用户名获取用户=====================");
SysUser sysUser = userService.selectUserByUserName(username);
if (StringUtils.isNull(sysUser)) {
return R.fail("用户名或密码错误");
@ -274,6 +272,19 @@ public class SysUserController extends BaseController {
return toAjax(userService.resetPwd(user));
}
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/reset")
public AjaxResult resetPwd2(@RequestBody SysUser user) throws Exception {
//对密码进行解密
String decrypt = RsaUtil.decryptByPrivateKey(user.getPassword(), Constants.privateKey);
userService.checkUserAllowed(user);
userService.checkUserDataScope(user.getUserId());
user.setPassword(SecurityUtils.encryptPassword(decrypt));
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.resetPwd(user));
}
/**
* 根据手机验证码重制密码
*/

View File

@ -68,6 +68,8 @@ public interface SysDeptMapper
*/
public int checkDeptExistUser(Long deptId);
public int checkCompaniesNameUnique(@Param("depts") List<SysDept> list);
/**
* 校验部门名称是否唯一
*
@ -77,6 +79,8 @@ public interface SysDeptMapper
*/
public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId);
public int insertCompanies(@Param("depts") List<SysDept> list);
/**
* 新增部门信息
*
@ -124,4 +128,6 @@ public interface SysDeptMapper
List<SysDept> selectDeptByAncestors(String[] deptIds);
String getCompanyByAncestors(String split);
int getMaxDeptId();
}

View File

@ -83,6 +83,7 @@ public interface ISysDeptService
*/
public boolean checkDeptExistUser(Long deptId);
public boolean checkCompaniesNameUnique(List<SysDept> list);
/**
* 校验部门名称是否唯一
*
@ -98,6 +99,8 @@ public interface ISysDeptService
*/
public void checkDeptDataScope(Long deptId);
public int insertCompanies(List<SysDept> list);
/**
* 新增保存部门信息
*

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.text.Convert;
@ -10,16 +11,20 @@ import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.domain.SysDept;
import com.bonus.sgzb.system.api.domain.SysRole;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser;
import com.bonus.sgzb.system.domain.vo.TreeSelect;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
@ -29,12 +34,19 @@ import java.util.stream.Collectors;
*/
@Service
public class SysDeptServiceImpl implements ISysDeptService {
@Autowired
@Value("${sgzb.site}")
private String site;
@Resource
private SysDeptMapper deptMapper;
@Autowired
@Resource
private SysRoleMapper roleMapper;
@Resource
private SysUserMapper userMapper;
/**
* 查询部门管理数据
*
@ -44,6 +56,11 @@ public class SysDeptServiceImpl implements ISysDeptService {
@Override
@DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) {
if (Constants.SITE_NW.equals(site)) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
dept.setCompanyId(Objects.nonNull(sysUser) ? sysUser.getCompanyId() : null);
}
return deptMapper.selectDeptList(dept);
}
@ -152,6 +169,12 @@ public class SysDeptServiceImpl implements ISysDeptService {
return result > 0;
}
@Override
public boolean checkCompaniesNameUnique(List<SysDept> list) {
int count = deptMapper.checkCompaniesNameUnique(list);
return count == 0;
}
/**
* 校验部门名称是否唯一
*
@ -185,6 +208,29 @@ public class SysDeptServiceImpl implements ISysDeptService {
}
}
@Override
public int insertCompanies(List<SysDept> list) {
long num = deptMapper.getMaxDeptId()+1;
for (SysDept dept : list) {
dept.setCreateBy(SecurityUtils.getUsername());
dept.setParentId(0L);
dept.setAncestors("0");
dept.setOrderNum(999);
dept.setStatus("0");
long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
num = nextMultiple + 1;
dept.setDeptId(nextMultiple);
dept.setCompanyId(nextMultiple);
}
return deptMapper.insertCompanies(list);
}
// public static void main(String[] args) {
// int num = 1200;
// long nextMultiple = (int) Math.ceil((double) num / 100) * 100;
// System.out.print(num);
// }
/**
* 新增保存部门信息
*

View File

@ -3,6 +3,7 @@ package com.bonus.sgzb.system.service.impl;
import cn.hutool.http.HttpRequest;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.exception.ServiceException;
import com.bonus.sgzb.common.core.utils.GlobalConstants;
@ -20,9 +21,13 @@ import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
@ -41,6 +46,9 @@ import static com.bonus.sgzb.common.core.web.domain.AjaxResult.success;
@Slf4j
public class SysSmsServiceImpl implements ISysSmsService {
@Value("${sgzb.site}")
private String site;
@Resource
private RedisService redisService;
@ -67,14 +75,17 @@ public class SysSmsServiceImpl implements ISysSmsService {
if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式不正确");
}
/* try {
String[] args = msg.split(",");
String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(0),args);
return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}*/
return sendMsgByPhone( phone, msg);
if (Constants.SITE_NW.equals(site)) {
try {
String[] args = msg.split(",");
String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(0),args);
return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
} else {
return sendMsgByPhone( phone, msg);
}
}
/**
@ -136,6 +147,10 @@ public class SysSmsServiceImpl implements ISysSmsService {
if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式错误请输入11位数字号码");
}
// 检查发送次数是否超限
if (isOverLimit(phone)) {
throw new ServiceException("当天此手机号发送验证码次数超过限制", 1001);
}
String code = getSixBitCode();
// 校验验证码
if (code.length() != UserConstants.CODE_MIN_LENGTH_LOGIN) {
@ -151,12 +166,38 @@ public class SysSmsServiceImpl implements ISysSmsService {
}
// 存储验证码至Redis中键值为code_15588886157 , 有效期5时间颗粒度为MINUTES:分钟
redisService.setCacheObject("code_" + phone, code, 5L, TimeUnit.MINUTES);
return success("手机号:" + phone + ",用户登录验证码:" + code + ",返回结果:" + body);
String key = UserConstants.MOBILE_PHONE_1D_LIMIT_DIR + phone;
Integer sendCount = redisService.getCacheObject(key);
if (sendCount == null) {
sendCount = 1;
} else {
sendCount++;
}
// 获取当前日期和时间
LocalDateTime now = LocalDateTime.now();
// 获取当天午夜时间
LocalDateTime midnight = LocalDateTime.of(now.toLocalDate(), LocalTime.MIDNIGHT).plusDays(1);
// 计算当前时间到当天午夜的时间差
long secondsUntilMidnight = now.until(midnight, ChronoUnit.SECONDS);
//存储一天手机号发送验证码数据
redisService.setCacheObject(key, sendCount, secondsUntilMidnight, TimeUnit.SECONDS);
return success("手机号:" + phone + ",短信验证码发送成功 ");
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}
/**
* 检查发送次数是否超过限制
* @param phone 手机号
* @return
*/
private boolean isOverLimit(String phone) {
String key = UserConstants.MOBILE_PHONE_1D_LIMIT_DIR + phone;
Integer sendCount = redisService.getCacheObject(key);
// 限制每个手机号每天最多发送10次
return sendCount != null && sendCount >= 10;
}
/**
* 判断验证码是否存在Redis中
@ -180,10 +221,6 @@ public class SysSmsServiceImpl implements ISysSmsService {
}
}
public static void main(String[] args) {
System.out.println(getSixBitCode());
}
/**
* 随机生成6位验证码
*/
@ -247,7 +284,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
}
}
return resp.getRequestId();
return resp.getRequestId();
} catch (TencentCloudSDKException e) {
e.printStackTrace();
log.error("短信发送失败:{}", e.getMessage());

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl;
import com.bonus.sgzb.common.core.constant.Constants;
import com.bonus.sgzb.common.core.constant.UserConstants;
import com.bonus.sgzb.common.core.enums.RoleEnum;
import com.bonus.sgzb.common.core.enums.TaskStatusEnum;
@ -10,9 +11,9 @@ import com.bonus.sgzb.common.core.utils.bean.BeanValidators;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.datascope.annotation.DataScope;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.system.api.domain.SysDept;
import com.bonus.sgzb.system.api.domain.SysRole;
import com.bonus.sgzb.system.api.domain.SysUser;
import com.bonus.sgzb.system.api.model.LoginUser;
import com.bonus.sgzb.system.domain.SysPost;
import com.bonus.sgzb.system.domain.SysUserPost;
import com.bonus.sgzb.system.domain.SysUserRole;
@ -23,7 +24,7 @@ import com.bonus.sgzb.system.service.ISysConfigService;
import com.bonus.sgzb.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@ -31,8 +32,8 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.bonus.sgzb.common.core.web.domain.AjaxResult.success;
@ -46,6 +47,9 @@ import static com.bonus.sgzb.common.core.web.domain.AjaxResult.success;
public class SysUserServiceImpl implements ISysUserService {
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Value("${sgzb.site}")
private String site;
@Resource
private SysUserMapper userMapper;
@ -79,6 +83,11 @@ public class SysUserServiceImpl implements ISysUserService {
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectUserList(SysUser user) {
if (Constants.SITE_NW.equals(site)) {
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
user.setCompanyId(Objects.nonNull(sysUser) ? sysUser.getCompanyId() : null);
}
return userMapper.selectUserList(user);
}
@ -244,30 +253,6 @@ public class SysUserServiceImpl implements ISysUserService {
@Override
@Transactional(rollbackFor = Exception.class)
public int insertUser(SysUser user) {
// 暂时使用,需修改
Long deptId = user.getDeptId();
SysDept sysDept = deptMapper.selectDeptById(deptId);
String ancestors = sysDept.getAncestors();
String[] split = ancestors.split(",");
/* List<SysDept> deptList = deptMapper.selectDeptByAncestors(split);
for (SysDept dept : deptList) {
String ancestors1 = dept.getAncestors();
String[] split1 = ancestors1.split(",");
List<String> list = Arrays.asList(split1);
//表示属于分公司下的某个部门
if (list.size() >= 3) {
user.setCompanyId(dept.getDeptId());
}
}*/
if (split.length == 2) {
//表示属于分公司
user.setCompanyId(sysDept.getDeptId());
}
if (split.length >= 3) {
//表示属于分公司下的某个部门
user.setCompanyId(Long.parseLong(split[2]));
}
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联

View File

@ -0,0 +1,53 @@
# 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: 192.168.0.56:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.56:8848
namespace: sgzb_cqjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,72 @@
# 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: 192.168.0.62:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 192.168.0.62:8848
namespace: sgzb_nwjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -0,0 +1,53 @@
# 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: 127.0.0.1:8848
namespace: sgzb_cqjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_cqjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: cq

View File

@ -0,0 +1,72 @@
# 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: 127.0.0.1:8848
namespace: sgzb_nwjj
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: sgzb_nwjj
# 配置文件格式
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
# 适应多公司的个性化配置
sgzb:
site: nw

View File

@ -4,58 +4,10 @@ server:
# Spring
spring:
servlet:
multipart:
max-request-size: 50MB
max-file-size: 30MB
application:
# 应用名称
name: sgzb-system
profiles:
# 环境配置
active: sgzb_cloud_dev
cloud:
loadbalancer:
# 关闭Ribbon的负载均衡器
ribbon:
enabled: false
# 开启Nacos的负载均衡器
nacos:
enabled: true
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
namespace: sgzb_cloud_dev_cqjj
# 配置文件格式
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
active: sgzb_local_cq

View File

@ -21,11 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="companyId" column="company_id" />
</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.remark,d.company_id
from sys_dept d
</sql>
@ -44,6 +45,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="companyId != null and companyId != ''">
AND company_id = #{companyId}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
@ -81,11 +85,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>
<select id="checkCompaniesNameUnique" resultType="java.lang.Integer">
select count(*)
from sys_dept
where dept_name in
<foreach collection="depts" item="item" index="index" separator="," open="(" close=")">
#{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
</select>
<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)
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()
)
</foreach>
</insert>
<insert id="insertDept" parameterType="com.bonus.sgzb.system.api.domain.SysDept">
insert into sys_dept(
@ -99,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
@ -111,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
</insert>
@ -165,4 +192,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getCompanyByAncestors" resultType="java.lang.String">
select dept_name from sys_dept where parent_id = #{split}
</select>
<select id="getMaxDeptId" resultType="java.lang.Integer">
select max(dept_id)
from sys_dept
</select>
</mapper>

View File

@ -19,12 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deptName" column="dept_name" />
<result property="deptName" column="dept_name" />
<result property="companyId" column="company_id" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark ,IFNULL(CONCAT_WS('/', d3.dept_name, d2.dept_name, d1.dept_name), 'Unknown') AS dept_name
r.status, r.del_flag, r.create_time, r.remark ,r.company_id,IFNULL(CONCAT_WS('/', d3.dept_name, d2.dept_name, d1.dept_name), 'Unknown') AS dept_name
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
@ -110,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="companyId != null and companyId != ''">company_id,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
@ -122,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="companyId != null and companyId != ''">#{companyId},</if>
sysdate()
)
</insert>

View File

@ -14,10 +14,10 @@ spring:
nacos:
discovery:
# 服务注册地址
server-addr: 192.168.0.14:8848
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 192.168.0.14:8848
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置