mirror of https://gitee.com/maxjhandsome/pig
🔖 Releasing / Version tags. 2.8
This commit is contained in:
parent
58331006d7
commit
a060f8d7b8
|
@ -24,14 +24,18 @@ import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.web.client.DefaultResponseErrorHandler;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019/03/08
|
||||
* @date 2020-06-23
|
||||
*/
|
||||
@ConfigurationPropertiesScan
|
||||
@ComponentScan("com.pig4cloud.pig.common.security")
|
||||
|
@ -42,6 +46,14 @@ public class PigResourceServerAutoConfiguration {
|
|||
@LoadBalanced
|
||||
public RestTemplate lbRestTemplate() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
// 传递ACCEPT JSON
|
||||
restTemplate.setInterceptors(Collections.singletonList((request, body, execution) -> {
|
||||
request.getHeaders().set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
||||
return execution.execute(request, body);
|
||||
}));
|
||||
|
||||
// 处理400 异常
|
||||
restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
|
||||
@Override
|
||||
@SneakyThrows
|
||||
|
|
|
@ -153,7 +153,7 @@ public class UserController {
|
|||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R updateUserInfo(@Valid @RequestBody UserDTO userDto) {
|
||||
return R.ok(userService.updateUserInfo(userDto));
|
||||
return userService.updateUserInfo(userDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.pig4cloud.pig.admin.api.dto.UserDTO;
|
|||
import com.pig4cloud.pig.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pig.admin.api.entity.SysUser;
|
||||
import com.pig4cloud.pig.admin.api.vo.UserVO;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -61,7 +62,7 @@ public interface SysUserService extends IService<SysUser> {
|
|||
* @param userDto 用户信息
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean updateUserInfo(UserDTO userDto);
|
||||
R updateUserInfo(UserDTO userDto);
|
||||
|
||||
/**
|
||||
* 更新指定用户信息
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.pig4cloud.pig.admin.mapper.SysUserMapper;
|
|||
import com.pig4cloud.pig.admin.service.*;
|
||||
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pig.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pig.common.core.util.R;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -45,7 +46,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
|
@ -156,19 +156,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
@Override
|
||||
@CacheEvict(value = CacheConstants.USER_DETAILS, key = "#userDto.username")
|
||||
public Boolean updateUserInfo(UserDTO userDto) {
|
||||
public R updateUserInfo(UserDTO userDto) {
|
||||
UserVO userVO = baseMapper.getUserVoByUsername(userDto.getUsername());
|
||||
|
||||
if (!ENCODER.matches(userDto.getPassword(), userVO.getPassword())) {
|
||||
return R.failed("原密码错误,修改失败");
|
||||
}
|
||||
|
||||
SysUser sysUser = new SysUser();
|
||||
|
||||
Assert.notNull(userDto.getPassword(), "原密码不存在");
|
||||
Assert.notNull(userDto.getNewpassword1(), "新密码不存在");
|
||||
Assert.state(ENCODER.matches(userDto.getPassword(), userVO.getPassword()), "原密码错误,修改失败");
|
||||
sysUser.setPassword(ENCODER.encode(userDto.getNewpassword1()));
|
||||
|
||||
sysUser.setPhone(userDto.getPhone());
|
||||
sysUser.setUserId(userVO.getUserId());
|
||||
sysUser.setAvatar(userDto.getAvatar());
|
||||
return this.updateById(sysUser);
|
||||
return R.ok(this.updateById(sysUser));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -77,7 +76,6 @@ public class GeneratorServiceImpl implements GeneratorService {
|
|||
List<GenFormConf> formConfList = genFormConfMapper.selectList(Wrappers.<GenFormConf>lambdaQuery()
|
||||
.eq(GenFormConf::getTableName, genConfig.getTableName()).orderByDesc(GenFormConf::getCreateTime));
|
||||
|
||||
DynamicDataSourceContextHolder.push(genConfig.getDsName());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -53,6 +53,7 @@
|
|||
<fastjson.version>1.2.69</fastjson.version>
|
||||
<swagger.fox.version>2.9.2</swagger.fox.version>
|
||||
<swagger.core.version>1.5.24</swagger.core.version>
|
||||
<reactor.netty.version>0.9.7.RELEASE</reactor.netty.version>
|
||||
<security.oauth.version>2.3.6.RELEASE</security.oauth.version>
|
||||
<docker.plugin.version>0.32.0</docker.plugin.version>
|
||||
<docker.host>http://172.17.0.111:2375</docker.host>
|
||||
|
@ -139,6 +140,12 @@
|
|||
<artifactId>spring-security-oauth2</artifactId>
|
||||
<version>${security.oauth.version}</version>
|
||||
</dependency>
|
||||
<!--稳定版本,替代spring boot bom内置-->
|
||||
<dependency>
|
||||
<groupId>io.projectreactor.netty</groupId>
|
||||
<artifactId>reactor-netty</artifactId>
|
||||
<version>${reactor.netty.version}</version>
|
||||
</dependency>
|
||||
<!--swagger 最新依赖内置版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
|
|
Loading…
Reference in New Issue