Merge remote-tracking branch 'origin/uat_code' into uat_code
This commit is contained in:
@ -76,7 +76,7 @@ public class BizBidSharedRecordController {
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PreAuthorize("hasAnyAuthority('ebtp-system-admin')")
|
||||
@PutMapping("")
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<Boolean> update(
|
||||
@ApiParam(value = "对象数据", required = true) @RequestBody BizBidSharedRecord bizBidSharedRecord) {
|
||||
return BaseResponse.success(ibizBidSharedRecordService.updateById(bizBidSharedRecord));
|
||||
|
@ -64,7 +64,7 @@ public class BizMessageCategoryController {
|
||||
}
|
||||
|
||||
@ApiOperation("修改消息类别.")
|
||||
@PutMapping
|
||||
@PostMapping("/update")
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public ResponseEntity<Void> update(
|
||||
@ApiParam(value = "消息类别实体", required = true) @Validated @RequestBody BizMessageCategoryUpdateDTO cate) {
|
||||
@ -78,7 +78,7 @@ public class BizMessageCategoryController {
|
||||
}
|
||||
|
||||
@ApiOperation("删除消息类别.")
|
||||
@DeleteMapping("{id}")
|
||||
@PostMapping("/delete/{id}")
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public ResponseEntity<Void> del(@ApiParam(value = "类别id", required = true) @PathVariable String id) {
|
||||
return service.del(id) ? ResponseEntity.ok().build() : ResponseEntity.badRequest().build();
|
||||
|
@ -31,7 +31,7 @@ public class BizMessageProducerController {
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public DescribeSiteMsgDetailVO produce(
|
||||
@ApiParam(value = "消息内容", required = true) @Validated @RequestBody BizMessageRawDTO raw) {
|
||||
log.debug("user send raw message: {}", raw);
|
||||
log.info("user send raw message: {}", raw);
|
||||
|
||||
return service.produce(raw).map(source -> {
|
||||
DescribeSiteMsgDetailVO vo = new DescribeSiteMsgDetailVO();
|
||||
|
@ -63,7 +63,7 @@ public class BizMessageTemplateController {
|
||||
|
||||
@ApiOperation("修改消息模板")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "执行成功"), @ApiResponse(code = 400, message = "执行失败")})
|
||||
@PutMapping
|
||||
@PostMapping("/update")
|
||||
public ResponseEntity<Void> update(@Validated @RequestBody BizMessageTemplateUpdateDTO vo) {
|
||||
boolean success = Optional.ofNullable(vo).map(source -> {
|
||||
BizMessageTemplate dao = new BizMessageTemplate();
|
||||
@ -77,7 +77,7 @@ public class BizMessageTemplateController {
|
||||
|
||||
@ApiOperation("删除消息模板")
|
||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "执行成功"), @ApiResponse(code = 400, message = "执行失败")})
|
||||
@DeleteMapping("{id}")
|
||||
@PostMapping("/delete/{id}")
|
||||
public ResponseEntity<Void> deleteById(@ApiParam(value = "消息模板id", required = true) @PathVariable String id) {
|
||||
return service.del(id) ? ResponseEntity.ok().build() : ResponseEntity.badRequest().build();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class BizMessageProducerServiceImpl implements BizMessageProducerService
|
||||
@Override
|
||||
public Optional<BizMessage> produce(BizMessageRawDTO messageRaw) {
|
||||
return Optional.ofNullable(messageRaw).map(this::evaluate).map(message -> {
|
||||
log.debug("ready to save: {}", message);
|
||||
log.info("ready to save: {}", message);
|
||||
return messageMapper.insert(message) > 0 ? message : null;
|
||||
});
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import com.chinaunicom.mall.ebtp.extend.crypconfigure.dao.CrypConfigureMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.service.ICrypConfigureService;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.util.SslUtil;
|
||||
import com.chinaunicom.mall.ebtp.extend.uniBss.UniBssUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@ -114,7 +115,7 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
|
||||
map.put("SIGN", sign);
|
||||
|
||||
json = getUniBss(bean.getReqName(), map);
|
||||
json = getCiticUniBss(bean.getReqName(), map);
|
||||
|
||||
blockChainLog.setParam(json);//请求参数
|
||||
log.info("------请求天擎接口---json参数:---"+json);
|
||||
@ -388,7 +389,6 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
|
||||
return JSON.toJSONString(uniBss);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中信天擎接口 数据格式 获取加密签名
|
||||
* REQ:{
|
||||
@ -483,19 +483,28 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
|
||||
try {
|
||||
URL url = new URL(path);
|
||||
if("https".equals(url.getProtocol())){
|
||||
SslUtil.ignoreSsl();
|
||||
}
|
||||
|
||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||
PrintWriter out = null;
|
||||
conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
conn.setRequestProperty("Accept-Encoding", "");
|
||||
conn.setRequestProperty("ClientId", ClientId);
|
||||
conn.setRequestProperty("OperationCode", OperationCode);
|
||||
if(ClientId!=null&&!"".equals(ClientId)) {
|
||||
conn.setRequestProperty("ClientId", ClientId);
|
||||
}
|
||||
if(OperationCode!=null&&!"".equals(OperationCode)){
|
||||
conn.setRequestProperty("OperationCode", OperationCode);
|
||||
}
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
conn.setRequestMethod("POST");
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(data);
|
||||
out.flush();
|
||||
|
||||
InputStream is = conn.getInputStream();
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
@ -512,7 +521,6 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, UnsupportedEncodingException {
|
||||
//String json = "{\"RESULT_ID\":\"1\",\"TP_ID\":\"2\",\"SECTION_ID\":\"3\",\"REPORT_ID\":\"4\",\"RESULTDETAIL\":[{\"RESULT_DETAIL_ID\":\"51\",\"RESULT_ID\":\"52\",\"TENDERER_ID\":\"53\",\"WINNER_CANDIDATE\":\"54\",\"PRICE\":\"55\",\"PRICE_REVIEW\":\"56\",\"BUSINESS_SCORE\":\"57\",\"TECHNICAL_SCORE\":\"58\",\"SERVICE_SCORE\":\"59\",\"PRICE_SCORE\":\"60\",\"TOTAL_SCORE\":\"61\",\"CONTRACTED_MONEY\":\"62\",\"TAX_RATE_PRICE\":\"63\",\"SCOREDETAIL\":[{\"RESULT_DETAIL_ID\":\"71\",\"TENDERER_ID\":\"72\",\"USER_ID\":\"73\",\"BUSINESS_SCORE\":\"74\",\"TECHNICAL_SCORE\":\"75\",\"SERVICE_SCORE\":\"76\",\"PRICE_SCORE\":\"77\"}]}]}";
|
||||
|
||||
@ -555,6 +563,5 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
// boolean isOk = crypService.verifyObject(bean);
|
||||
// System.out.println("verify result of Map: "+ isOk);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.crypconfigure.util;
|
||||
import javax.net.ssl.*;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
public class SslUtil {
|
||||
|
||||
private static void trustAllHttpsCertificates() throws Exception {
|
||||
TrustManager[] trustAllCerts = new TrustManager[1];
|
||||
TrustManager tm = new miTM();
|
||||
trustAllCerts[0] = tm;
|
||||
SSLContext sc = SSLContext.getInstance("SSL");
|
||||
sc.init(null, trustAllCerts, null);
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
|
||||
}
|
||||
|
||||
static class miTM implements TrustManager, X509TrustManager {
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isServerTrusted(X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isClientTrusted(X509Certificate[] certs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] certs, String authType) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] certs, String authType)
|
||||
throws CertificateException {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 忽略HTTPS请求的SSL证书,必须在openConnection之前调用
|
||||
*/
|
||||
public static void ignoreSsl() throws Exception{
|
||||
HostnameVerifier hv = (urlHostName, session) -> true;
|
||||
trustAllHttpsCertificates();
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(hv);
|
||||
}
|
||||
}
|
@ -41,7 +41,7 @@ public class TimeServiceConstant {
|
||||
// 获得TSAClient
|
||||
client = (TSAClient) factory.getTSAClient();
|
||||
} catch (Exception e) {
|
||||
log.error("读取配置文件或连接时间戳服务器异常", e);
|
||||
log.error("读取配置文件或连接时间戳服务器异常", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ public class TimeServiceConstant {
|
||||
log.info("timestamp -->" + timestamp);
|
||||
return timestamp;
|
||||
} catch (Exception e) {
|
||||
log.error("申请时间戳异常", e);
|
||||
log.error("申请时间戳异常", e.getMessage());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class TimeServiceConstant {
|
||||
ttsParseResult = new TtsAgent.TtsParseResult(time, HelperUtil.bytesToHexString(verifyResult.getData()),
|
||||
verifyResult.getSignerSubject());
|
||||
} catch (Exception e) {
|
||||
log.error("解析时间戳", e);
|
||||
log.error("解析时间戳", e.getMessage());
|
||||
}
|
||||
return ttsParseResult;
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class TimeServiceConstant {
|
||||
TSAVerifyResult verifyResult = client.verifyTimeStamp(Base64.decodeBase64(timestamp));
|
||||
return verifyResult;
|
||||
} catch (Exception e) {
|
||||
log.error("解析时间戳", e);
|
||||
log.error("解析时间戳", e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class TimeServiceConstant {
|
||||
String timestamp = this.signTimeStamp(data);
|
||||
ttsParseResult = this.verifyTimeStamp2(timestamp);
|
||||
} catch (Exception e) {
|
||||
log.error("获取时间戳异常", e);
|
||||
log.error("获取时间戳异常", e.getMessage());
|
||||
}
|
||||
return ttsParseResult;
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class TimeServiceConstant {
|
||||
TSAVerifyResult verifyResult = this.verifyTimeStamp(timestamp);
|
||||
time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(verifyResult.getSignedTime());
|
||||
} catch (Exception e) {
|
||||
log.error("获取时间戳异常", e);
|
||||
log.error("获取时间戳异常", e.getMessage());
|
||||
}
|
||||
return time;
|
||||
}
|
||||
@ -173,7 +173,7 @@ public class TimeServiceConstant {
|
||||
Date date = verifyResult.getSignedTime();
|
||||
return date;
|
||||
} catch (Exception e) {
|
||||
log.error("获取时间戳异常", e);
|
||||
log.error("获取时间戳异常", e.getMessage());
|
||||
}
|
||||
return new Date();
|
||||
}
|
||||
@ -203,7 +203,7 @@ public class TimeServiceConstant {
|
||||
date = verifyResult.getSignedTime();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("获取时间戳异常", e);
|
||||
log.error("获取时间戳异常", e.getMessage());
|
||||
}
|
||||
SystemTime systemTime = new SystemTime()
|
||||
.setYear(date.getYear() + 1900)
|
||||
|
@ -1,47 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.controller;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.service.EbtpUserInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/v1/userinfo/")
|
||||
public class UserInfoController {
|
||||
|
||||
@Autowired
|
||||
private EbtpUserInfoService ebtpUserInfoService;
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param token (认证token)
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("get")
|
||||
public ResponseEntity<BaseCacheUser> getUserInfo(
|
||||
@RequestHeader(name = "Authorization", required = false) String token) {
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
log.error("access token is empty");
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
|
||||
}
|
||||
return ResponseEntity.ok(ebtpUserInfoService.getUserInfo(token));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新redis缓存的信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("refresh")
|
||||
public ResponseEntity<Boolean> refreshToken() {
|
||||
return ResponseEntity.ok(ebtpUserInfoService.refresh());
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.entity.BaseRole;
|
||||
|
||||
public interface BaseRoleMapper extends BaseMapper<BaseRole> {
|
||||
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.entity.BaseUser;
|
||||
|
||||
public interface BaseUserMapper extends BaseMapper<BaseUser> {
|
||||
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 功能模块bean
|
||||
*
|
||||
* @author zyx
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@TableName(value = "maint_base_role", autoResultMap = true)
|
||||
public class BaseRole implements Serializable {
|
||||
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "角色")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* role_id
|
||||
*/
|
||||
@ApiModelProperty(value = "role_id")
|
||||
private String roleId;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@ApiModelProperty(value = "状态,0-默认")
|
||||
private int status;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 功能模块bean
|
||||
*
|
||||
* @author zyx
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@TableName(value = "maint_base_user", autoResultMap = true)
|
||||
public class BaseUser implements Serializable {
|
||||
|
||||
private static final Long serialVersionUID = 1L;
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@ApiModelProperty(value = "账号")
|
||||
private String account;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@ApiModelProperty(value = "省份")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@ApiModelProperty(value = "角色")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* 租户
|
||||
*/
|
||||
@ApiModelProperty(value = "租户")
|
||||
private String tenant;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.service;
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||
|
||||
public interface EbtpUserInfoService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public BaseCacheUser getUserInfo(String token);
|
||||
|
||||
/**
|
||||
* 刷新redis缓存的信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean refresh();
|
||||
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userinfo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.AuthorityEntity;
|
||||
import com.chinaunicom.mall.ebtp.cloud.userinfo.starter.service.UserInfoService;
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.dao.BaseRoleMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.dao.BaseUserMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.entity.BaseRole;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.entity.BaseUser;
|
||||
import com.chinaunicom.mall.ebtp.extend.userinfo.service.EbtpUserInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class EbtpUserInfoServiceImpl implements EbtpUserInfoService {
|
||||
|
||||
@Autowired
|
||||
private UserInfoService service;
|
||||
@Autowired
|
||||
private BaseUserMapper baseUserMapper;
|
||||
@Autowired
|
||||
private BaseRoleMapper baseRoleMapper;
|
||||
|
||||
@Autowired(required = false)
|
||||
@Qualifier("cacheRedisTemplate")
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
private static final String EXTEND_USER_KEY = "ebtpUserTableCache";
|
||||
private static final String USERS = "users";
|
||||
private static final String ROLES = "roles";
|
||||
|
||||
@Override
|
||||
public BaseCacheUser getUserInfo(String token) {
|
||||
//查询山分库
|
||||
BaseCacheUser user = service.getUserInfo(token);
|
||||
|
||||
if (Objects.isNull(user)) {
|
||||
return new BaseCacheUser();
|
||||
}
|
||||
|
||||
//获取redis缓存
|
||||
Map<String, Object> userTable = getUserTable();
|
||||
|
||||
//获取用户信息
|
||||
List<BaseUser> users = (List<BaseUser>) userTable.get(USERS);
|
||||
BaseUser baseUser = users.stream().filter(u -> u.getAccount().equals(user.getLoginName())).findFirst().orElse(null);
|
||||
if (Objects.isNull(baseUser)) {
|
||||
return user;
|
||||
}
|
||||
|
||||
List<BaseRole> roles = (List<BaseRole>) userTable.get(ROLES);
|
||||
user.setProvince(baseUser.getProvince())
|
||||
//覆盖角色
|
||||
.setAuthorityList(
|
||||
Optional.of(roles
|
||||
.stream()
|
||||
.filter(r -> baseUser.getRole().contains(r.getRole()))
|
||||
.map(br ->
|
||||
new AuthorityEntity()
|
||||
.setRoleId(br.getRoleId())
|
||||
.setRoleCode(br.getRole())
|
||||
.setRoleName(br.getRemarks())
|
||||
.setRoleScope("EBTP")
|
||||
.setAuthorities(Collections.emptyList()))
|
||||
.collect(Collectors.toList()))
|
||||
.orElseGet(Collections::emptyList));
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getUserTable() {
|
||||
Object o = redisTemplate.opsForValue().get(EXTEND_USER_KEY);
|
||||
|
||||
if (Objects.isNull(o)) {
|
||||
o = cacheUserTable();
|
||||
}
|
||||
return (Map<String, Object>) o ;
|
||||
}
|
||||
|
||||
private Map<String, Object> cacheUserTable() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(USERS, baseUserMapper.selectList(Wrappers.lambdaQuery(BaseUser.class).eq(BaseUser::getTenant, "ebtp_mall")));
|
||||
map.put(ROLES, baseRoleMapper.selectList(Wrappers.emptyWrapper()));
|
||||
redisTemplate.opsForValue().set(EXTEND_USER_KEY, map, 8, TimeUnit.HOURS);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除token缓存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean refresh() {
|
||||
cacheUserTable();
|
||||
return true;
|
||||
}
|
||||
|
||||
public EbtpUserInfoServiceImpl() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userpassword.controller;
|
||||
|
||||
|
||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.service.IUserPasswordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "")
|
||||
@RequestMapping("/v1/userpassword")
|
||||
public class UserPasswordController{
|
||||
|
||||
@Resource
|
||||
private IUserPasswordService iuserPasswordService;
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("查询数据")
|
||||
@PostMapping("/validatePassword")
|
||||
public BaseResponse<Boolean> validatePassword(@RequestParam("code") String code){
|
||||
return BaseResponse.success(iuserPasswordService.validatePassword(code));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userpassword.dao;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword;
|
||||
|
||||
/**
|
||||
* @author daixc
|
||||
*/
|
||||
public interface UserPasswordMapper extends BaseMapper<UserPassword> {
|
||||
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?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.chinaunicom.mall.ebtp.extend.userpassword.dao.UserPasswordMapper">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword">
|
||||
<result column="password" jdbcType="VARCHAR" property="password"/>
|
||||
</resultMap>
|
||||
|
||||
<!--逻辑删除方法 此方法为代码生成器生成 不允许修改 如有特殊需求 请自行新建SQL语句-->
|
||||
<update id="deleteOff" parameterType="java.lang.Long">
|
||||
update user_password
|
||||
set
|
||||
delete_flag="deleted"
|
||||
where ID=#{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
@ -1,33 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userpassword.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 实体类 UserPassword
|
||||
*
|
||||
* @auto.generated
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName(value = "user_password", autoResultMap = true)
|
||||
public class UserPassword implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "")
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userpassword.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword;
|
||||
|
||||
/**
|
||||
* 对数据表 user_password 操作的 service
|
||||
* @author Auto create
|
||||
*
|
||||
*/
|
||||
public interface IUserPasswordService extends IService<UserPassword> {
|
||||
|
||||
|
||||
boolean validatePassword(String code);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.chinaunicom.mall.ebtp.extend.userpassword.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.dao.UserPasswordMapper;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.entity.UserPassword;
|
||||
import com.chinaunicom.mall.ebtp.extend.userpassword.service.IUserPasswordService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
/**
|
||||
* 对数据表 user_password 操作的 serviceImpl
|
||||
* @author daixc
|
||||
*
|
||||
*/
|
||||
@Service
|
||||
public class UserPasswordServiceImpl extends ServiceImpl<UserPasswordMapper, UserPassword> implements IUserPasswordService {
|
||||
|
||||
@Override
|
||||
public boolean validatePassword(String code) {
|
||||
UserPassword userPassword = this.list().get(0);
|
||||
if(StringUtils.isNotBlank(code) && code.equals(userPassword.getPassword())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -6,4 +6,8 @@ app:
|
||||
apollo:
|
||||
bootstrap:
|
||||
enabled: true
|
||||
namespace: application
|
||||
namespace: application
|
||||
|
||||
jasypt:
|
||||
encryptor:
|
||||
bean: stringEncryptor
|
Reference in New Issue
Block a user