Commit 7d26bbe5 by zhu.zewen

新增云签相关接口

parent 76120359
...@@ -3,8 +3,13 @@ package com.jmai.physic.cloudsign; ...@@ -3,8 +3,13 @@ package com.jmai.physic.cloudsign;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.config.CloudSignProperties; import com.jmai.physic.config.CloudSignProperties;
import com.jmai.physic.entity.CloudSignToken;
import com.jmai.physic.mapper.CloudSignTokenMapper;
import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.dto.UserDto;
import com.jmai.sys.util.HttpUtils; import com.jmai.sys.util.HttpUtils;
import com.jmai.sys.util.OpenUtil; import com.jmai.sys.util.OpenUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -12,22 +17,70 @@ import org.springframework.stereotype.Component; ...@@ -12,22 +17,70 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime;
@Slf4j @Slf4j
@Component @Component
public class CloudsignService { public class CloudsignService {
@Resource @Resource
private CloudSignProperties cloudSignProperties; private CloudSignProperties cloudSignProperties;
@Resource
private CloudSignTokenMapper cloudSignTokenMapper;
private String buildUrl(String endpoint) { private String buildUrl(String endpoint) {
return cloudSignProperties.getHost() + endpoint; return cloudSignProperties.getHost() + endpoint;
} }
/** /**
* 从数据库获取当前用户的云签令牌
*/
public String getCurrentUserEncryptedToken() {
Long userId = SpringContextUtils.getUserId();
if (userId == null) {
throw new ServiceException("当前用户ID为空");
}
// 从数据库查询用户的云签令牌
CloudSignToken token = cloudSignTokenMapper.selectOne(
Wrappers.<CloudSignToken>lambdaQuery()
.eq(CloudSignToken::getUserId, userId)
.eq(CloudSignToken::getStatus, 1) // 只查询有效状态的令牌
.orderByDesc(CloudSignToken::getCreateTime) // 获取最新的令牌
);
if (token == null) {
throw new ServiceException("未找到用户的云签令牌,请先登录云签");
}
// 检查令牌是否过期
if (token.getExpiryTime().isBefore(LocalDateTime.now())) {
// 更新令牌状态为失效
token.setStatus(0);
cloudSignTokenMapper.updateById(token);
throw new ServiceException("云签令牌已过期,请重新登录");
}
return token.getEncryptedToken();
}
/**
* 检查云签状态 * 检查云签状态
* @param request * @param request
*/ */
public QueryStatusResponse queryStatus(QueryStatusRequest request){ public QueryStatusResponse queryStatus(QueryStatusRequest request){
String logTip = "queryStatus"; String logTip = "queryStatus";
// 自动填充业务参数和加密令牌
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
request.setEncryptedToken(getCurrentUserEncryptedToken()); // 设置从数据库获取的令牌
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
...@@ -49,11 +102,21 @@ public class CloudsignService { ...@@ -49,11 +102,21 @@ public class CloudsignService {
*/ */
public GenloginqrcodeRespon loginByPin(PinLoginRequest request){ public GenloginqrcodeRespon loginByPin(PinLoginRequest request){
request.setLoginType(1); request.setLoginType(1);
// 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
String logTip = "loginByPin"; String logTip = "loginByPin";
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参: {}",logTip,json);
String response = HttpUtils.sendPostRequestAndParse(buildUrl(cloudSignProperties.getLoginbypinUrl()), json, null); String response = HttpUtils.sendPostRequestAndParse(buildUrl(cloudSignProperties.getLoginbypinUrl()), json, null);
log.info("{}-返回数据: {}",logTip,response); log.info("{}-返回数据: {}",logTip,response);
if(ObjectUtil.isEmpty(response)){ if(ObjectUtil.isEmpty(response)){
...@@ -73,6 +136,17 @@ public class CloudsignService { ...@@ -73,6 +136,17 @@ public class CloudsignService {
*/ */
public GenloginqrcodeRespon genLoginQrcode(GenloginqrcodeRequest request){ public GenloginqrcodeRespon genLoginQrcode(GenloginqrcodeRequest request){
String logTip = "genLoginQrcode"; String logTip = "genLoginQrcode";
// 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参: {}", logTip, json); log.info("{}-入参: {}", logTip, json);
...@@ -95,6 +169,17 @@ public class CloudsignService { ...@@ -95,6 +169,17 @@ public class CloudsignService {
*/ */
public GetLoginResultResponse getLoginByQrcodeResult(GetLoginResultRequest request){ public GetLoginResultResponse getLoginByQrcodeResult(GetLoginResultRequest request){
String logTip = "getLoginResult"; String logTip = "getLoginResult";
// 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
...@@ -111,8 +196,20 @@ public class CloudsignService { ...@@ -111,8 +196,20 @@ public class CloudsignService {
} }
} }
public String sign(String encryptedToken,String relBizNo,String base64SourceData){ /**
* 云签证书数字签名
* @param base64SourceData
* @return 签名后的数据
*/
public String sign(String base64SourceData){
// 从当前用户上下文获取工号作为relBizNo
String relBizNo = SpringContextUtils.getWorkNo();
if (ObjectUtil.isEmpty(relBizNo)) {
throw new ServiceException("当前用户工号为空");
}
SignDataRequest request = new SignDataRequest(); SignDataRequest request = new SignDataRequest();
// 不再需要外部传入encryptedToken,改为从数据库获取
if (cloudSignProperties.getTestEnabled()) { if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode()); request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode()); request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
...@@ -122,11 +219,11 @@ public class CloudsignService { ...@@ -122,11 +219,11 @@ public class CloudsignService {
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode()); request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD()); request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
} }
request.setEncryptedToken(getCurrentUserEncryptedToken());
request.setBusinessTypeCode("007"); request.setBusinessTypeCode("007");
request.setWithTsa(true); request.setWithTsa(true);
request.setEncryptedToken(encryptedToken);
request.setBase64SourceData(base64SourceData); request.setBase64SourceData(base64SourceData);
signData(request); SignDataRespon resp = signData(request);
GetstampRequest getstampRequest = new GetstampRequest(); GetstampRequest getstampRequest = new GetstampRequest();
getstampRequest.setRelBizNo(relBizNo); getstampRequest.setRelBizNo(relBizNo);
String getstamp = getStamp(getstampRequest); String getstamp = getStamp(getstampRequest);
...@@ -139,6 +236,20 @@ public class CloudsignService { ...@@ -139,6 +236,20 @@ public class CloudsignService {
*/ */
public SignDataRespon signData(SignDataRequest request){ public SignDataRespon signData(SignDataRequest request){
String logTip = "signdata"; String logTip = "signdata";
// 自动填充业务参数和加密令牌
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
request.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
request.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
request.setBusinessTypeCode("007");
request.setWithTsa(true);
request.setEncryptedToken(getCurrentUserEncryptedToken());
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
...@@ -188,6 +299,13 @@ public class CloudsignService { ...@@ -188,6 +299,13 @@ public class CloudsignService {
*/ */
public GetCertInfoResponse getCertInfo(GetCertInfoRequest request){ public GetCertInfoResponse getCertInfo(GetCertInfoRequest request){
String logTip = "getCertInfo"; String logTip = "getCertInfo";
// 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
}
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
...@@ -210,6 +328,13 @@ public class CloudsignService { ...@@ -210,6 +328,13 @@ public class CloudsignService {
*/ */
public VerifyDataResponse verifyData(VerifyDataRequest request){ public VerifyDataResponse verifyData(VerifyDataRequest request){
String logTip = "verifyData"; String logTip = "verifyData";
// 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) {
request.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
} else {
request.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
}
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
...@@ -225,4 +350,25 @@ public class CloudsignService { ...@@ -225,4 +350,25 @@ public class CloudsignService {
throw new ServiceException("验证失败"); throw new ServiceException("验证失败");
} }
} }
/**
* 保存云签令牌信息到数据库
*/
public void saveCloudSignToken(UserDto user, String encryptedToken) {
// 创建云签令牌信息并保存到数据库
CloudSignToken cloudSignToken = new CloudSignToken();
cloudSignToken.setUserId(user.getUserId());
cloudSignToken.setWorkNo(user.getWorkNo());
cloudSignToken.setEncryptedToken(encryptedToken);
// 设置令牌过期时间为当前时间加上默认有效期(例如2小时)
cloudSignToken.setExpiryTime(LocalDateTime.now().plusHours(2));
cloudSignToken.setStatus(1); // 设置为有效状态
// 保存到数据库
// 先尝试删除旧的令牌记录(如果有)
cloudSignTokenMapper.delete(Wrappers.<CloudSignToken>lambdaUpdate()
.eq(CloudSignToken::getUserId, user.getUserId()));
// 插入新的令牌记录
cloudSignTokenMapper.insert(cloudSignToken);
}
} }
...@@ -14,10 +14,11 @@ public class SignDataRequest { ...@@ -14,10 +14,11 @@ public class SignDataRequest {
private String businessSystemCode; private String businessSystemCode;
@ApiModelProperty(value = "业务系统应用ID,业务系统的唯一标识号", required = true) @ApiModelProperty(value = "业务系统应用ID,业务系统的唯一标识号", required = true)
private String businessSystemAppID; private String businessSystemAppID;
@ApiModelProperty(value = "业务类型代码", required = true)
private String businessTypeCode;
@ApiModelProperty(value = "加密令牌", required = true) @ApiModelProperty(value = "加密令牌", required = true)
private String encryptedToken; private String encryptedToken;
@ApiModelProperty(value = "业务类型代码", required = true)
private String businessTypeCode;
@ApiModelProperty(value = "患者ID") @ApiModelProperty(value = "患者ID")
private String patientId; private String patientId;
@ApiModelProperty(value = "业务ID") @ApiModelProperty(value = "业务ID")
......
...@@ -3,11 +3,9 @@ package com.jmai.physic.controller; ...@@ -3,11 +3,9 @@ package com.jmai.physic.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.*; import com.jmai.physic.cloudsign.*;
import com.jmai.physic.config.CloudSignProperties; import com.jmai.physic.config.CloudSignProperties;
import com.jmai.physic.entity.CloudSignToken;
import com.jmai.physic.mapper.CloudSignTokenMapper; import com.jmai.physic.mapper.CloudSignTokenMapper;
import com.jmai.sys.AbstractService; import com.jmai.sys.AbstractService;
import com.jmai.sys.aop.Auth; import com.jmai.sys.aop.Auth;
...@@ -15,10 +13,8 @@ import com.jmai.sys.aop.AuthSkipped; ...@@ -15,10 +13,8 @@ import com.jmai.sys.aop.AuthSkipped;
import com.jmai.sys.ctx.SpringContextUtils; import com.jmai.sys.ctx.SpringContextUtils;
import com.jmai.sys.dto.ResponseData; import com.jmai.sys.dto.ResponseData;
import com.jmai.sys.dto.UserDto; import com.jmai.sys.dto.UserDto;
import com.jmai.sys.service.BaseService;
import com.jmai.sys.service.UserService; import com.jmai.sys.service.UserService;
import java.time.LocalDateTime;
import java.util.Optional; import java.util.Optional;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -40,6 +36,10 @@ public class CloudSignController extends AbstractService { ...@@ -40,6 +36,10 @@ public class CloudSignController extends AbstractService {
private CloudsignService cloudsignService; private CloudsignService cloudsignService;
@Resource @Resource
private CloudSignProperties cloudSignProperties; private CloudSignProperties cloudSignProperties;
@Resource
private CloudSignTokenMapper cloudSignTokenMapper;
@PostMapping("/queryStatus") @PostMapping("/queryStatus")
@ApiOperation(value = "检查云签状态") @ApiOperation(value = "检查云签状态")
...@@ -49,20 +49,7 @@ public class CloudSignController extends AbstractService { ...@@ -49,20 +49,7 @@ public class CloudSignController extends AbstractService {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
} }
queryStatusRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode()); // 现在业务参数和encryptedToken会在服务层自动填充
queryStatusRequest.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
queryStatusRequest.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
if (cloudSignProperties.getTestEnabled()) {
queryStatusRequest.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
queryStatusRequest.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
queryStatusRequest.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
queryStatusRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
queryStatusRequest.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
queryStatusRequest.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
QueryStatusResponse queryStatus = cloudsignService.queryStatus(queryStatusRequest); QueryStatusResponse queryStatus = cloudsignService.queryStatus(queryStatusRequest);
return ResponseData.ok(queryStatus); return ResponseData.ok(queryStatus);
} }
...@@ -77,16 +64,8 @@ public class CloudSignController extends AbstractService { ...@@ -77,16 +64,8 @@ public class CloudSignController extends AbstractService {
pinLoginRequest.setRelBizNo(workNo); pinLoginRequest.setRelBizNo(workNo);
pinLoginRequest.setUserEncodePin(pinLoginRequest.getUserEncodePin()); pinLoginRequest.setUserEncodePin(pinLoginRequest.getUserEncodePin());
if (cloudSignProperties.getTestEnabled()) {
pinLoginRequest.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode()); // 现在业务参数和测试环境配置会在服务层自动处理
pinLoginRequest.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
pinLoginRequest.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
pinLoginRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
pinLoginRequest.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
pinLoginRequest.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
GenloginqrcodeRespon pinLogin = cloudsignService.loginByPin(pinLoginRequest); GenloginqrcodeRespon pinLogin = cloudsignService.loginByPin(pinLoginRequest);
return ResponseData.ok(pinLogin); return ResponseData.ok(pinLogin);
} }
...@@ -99,18 +78,10 @@ public class CloudSignController extends AbstractService { ...@@ -99,18 +78,10 @@ public class CloudSignController extends AbstractService {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
} }
if (cloudSignProperties.getTestEnabled()) {
req.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
req.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
req.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
req.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
req.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
req.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
req.setNotifyUrl(cloudSignProperties.getCallbackUrl()); req.setNotifyUrl(cloudSignProperties.getCallbackUrl());
req.setImageFormat(1); req.setImageFormat(1);
// 现在业务参数和测试环境配置会在服务层自动处理
GenloginqrcodeRespon qrCodeLogin = cloudsignService.genLoginQrcode(req); GenloginqrcodeRespon qrCodeLogin = cloudsignService.genLoginQrcode(req);
// 如果二维码生成成功,保存二维码图片到本地 // 如果二维码生成成功,保存二维码图片到本地
...@@ -189,7 +160,7 @@ public class CloudSignController extends AbstractService { ...@@ -189,7 +160,7 @@ public class CloudSignController extends AbstractService {
} }
// 保存云签令牌信息 // 保存云签令牌信息
saveCloudSignToken(user, encryptedToken); cloudsignService.saveCloudSignToken(user, encryptedToken);
log.info("云签登录成功,用户ID: {}, 工号: {}, 用户名: {}", user.getUserId(), user.getWorkNo(), user.getUserName()); log.info("云签登录成功,用户ID: {}, 工号: {}, 用户名: {}", user.getUserId(), user.getWorkNo(), user.getUserName());
...@@ -259,27 +230,7 @@ public class CloudSignController extends AbstractService { ...@@ -259,27 +230,7 @@ public class CloudSignController extends AbstractService {
return saveDir + java.io.File.separator + fileName; return saveDir + java.io.File.separator + fileName;
} }
/**
* 保存云签令牌信息到数据库
*/
private void saveCloudSignToken(UserDto user, String encryptedToken) {
// 创建云签令牌信息并保存到数据库
CloudSignToken cloudSignToken = new CloudSignToken();
cloudSignToken.setUserId(user.getUserId());
cloudSignToken.setWorkNo(user.getWorkNo());
cloudSignToken.setEncryptedToken(encryptedToken);
// 设置令牌过期时间为当前时间加上默认有效期(例如2小时)
cloudSignToken.setExpiryTime(LocalDateTime.now().plusHours(2));
cloudSignToken.setStatus(1); // 设置为有效状态
// 保存到数据库
CloudSignTokenMapper cloudSignTokenMapper = SpringContextUtils.getBean(CloudSignTokenMapper.class);
// 先尝试删除旧的令牌记录(如果有)
cloudSignTokenMapper.delete(Wrappers.<CloudSignToken>lambdaUpdate()
.eq(CloudSignToken::getUserId, user.getUserId()));
// 插入新的令牌记录
cloudSignTokenMapper.insert(cloudSignToken);
}
@PostMapping("/getLoginByQrcodeResult") @PostMapping("/getLoginByQrcodeResult")
@ApiOperation(value = "查询二维码登录结果") @ApiOperation(value = "查询二维码登录结果")
...@@ -289,16 +240,7 @@ public class CloudSignController extends AbstractService { ...@@ -289,16 +240,7 @@ public class CloudSignController extends AbstractService {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
} }
if (cloudSignProperties.getTestEnabled()) { // 现在业务参数和测试环境配置会在服务层自动处理
getLoginResultRequest.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
getLoginResultRequest.setBusinessSystemCode(cloudSignProperties.getTestBusinessSystemCode());
getLoginResultRequest.setBusinessSystemAppID(cloudSignProperties.getTestBusinessSystemAppID());
} else {
getLoginResultRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
getLoginResultRequest.setBusinessSystemCode(cloudSignProperties.getBusinessSystemCode());
getLoginResultRequest.setBusinessSystemAppID(cloudSignProperties.getBusinessSystemApplD());
}
GetLoginResultResponse getLoginResult = cloudsignService.getLoginByQrcodeResult(getLoginResultRequest); GetLoginResultResponse getLoginResult = cloudsignService.getLoginByQrcodeResult(getLoginResultRequest);
return ResponseData.ok(getLoginResult); return ResponseData.ok(getLoginResult);
} }
...@@ -311,12 +253,7 @@ public class CloudSignController extends AbstractService { ...@@ -311,12 +253,7 @@ public class CloudSignController extends AbstractService {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
} }
if (cloudSignProperties.getTestEnabled()) { // 现在业务参数和测试环境配置会在服务层自动处理
getCertInfoRequest.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
} else {
getCertInfoRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
}
GetCertInfoResponse getCertInfo = cloudsignService.getCertInfo(getCertInfoRequest); GetCertInfoResponse getCertInfo = cloudsignService.getCertInfo(getCertInfoRequest);
return ResponseData.ok(getCertInfo); return ResponseData.ok(getCertInfo);
} }
...@@ -329,12 +266,7 @@ public class CloudSignController extends AbstractService { ...@@ -329,12 +266,7 @@ public class CloudSignController extends AbstractService {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
} }
if (cloudSignProperties.getTestEnabled()) { // 现在业务参数和测试环境配置会在服务层自动处理
verifyDataRequest.setBusinessOrgCode(cloudSignProperties.getTestBusinessOrgCode());
} else {
verifyDataRequest.setBusinessOrgCode(cloudSignProperties.getBusinessOrgCode());
}
VerifyDataResponse verifyData = cloudsignService.verifyData(verifyDataRequest); VerifyDataResponse verifyData = cloudsignService.verifyData(verifyDataRequest);
return ResponseData.ok(verifyData); return ResponseData.ok(verifyData);
} }
......
...@@ -154,7 +154,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA ...@@ -154,7 +154,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
public PhysicAmpoule sign(PhysicAmpouleSignReq physicAmpouleSignReq) { public PhysicAmpoule sign(PhysicAmpouleSignReq physicAmpouleSignReq) {
Boolean finished = false; Boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicAmpouleSignReq.getEncryptedToken(), physicAmpouleSignReq.getRelBizNo(), physicAmpouleSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicAmpouleSignReq.getBase64SourceData());
PhysicAmpoule ampoule = getInfo(physicAmpouleSignReq.getPhysicAmpouleId()); PhysicAmpoule ampoule = getInfo(physicAmpouleSignReq.getPhysicAmpouleId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if(ampoule.getStatus().equals(0)){ if(ampoule.getStatus().equals(0)){
......
...@@ -165,7 +165,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -165,7 +165,7 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
Boolean finished =false; Boolean finished =false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicApplySignReq.getEncryptedToken(), physicApplySignReq.getRelBizNo(), physicApplySignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicApplySignReq.getBase64SourceData());
PhysicApply physicApply = physicApplyMapper.selectById(physicApplySignReq.getPhysicApplyId()); PhysicApply physicApply = physicApplyMapper.selectById(physicApplySignReq.getPhysicApplyId());
if(physicApply.getStatus().equals(0)){ if(physicApply.getStatus().equals(0)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.LY)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.LY)){
......
...@@ -130,7 +130,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -130,7 +130,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
public PhysicBill sign(PhysicBillSignReq physicBillSignReq) { public PhysicBill sign(PhysicBillSignReq physicBillSignReq) {
Boolean finished = false; Boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicBillSignReq.getEncryptedToken(), physicBillSignReq.getRelBizNo(), physicBillSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicBillSignReq.getBase64SourceData());
PhysicBill bill = physicBillMapper.selectById(physicBillSignReq.getPhysicBillId()); PhysicBill bill = physicBillMapper.selectById(physicBillSignReq.getPhysicBillId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if (ObjectUtil.equals(bill.getStatus(), 0)) { if (ObjectUtil.equals(bill.getStatus(), 0)) {
...@@ -326,7 +326,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -326,7 +326,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
Long currentDeptId = SpringContextUtils.getDeptId(); Long currentDeptId = SpringContextUtils.getDeptId();
String getstamp = cloudsignService.sign(req.getEncryptedToken(), req.getRelBizNo(), req.getBase64SourceData()); String getstamp = cloudsignService.sign(req.getBase64SourceData());
PhysicBillHandover handover = physicBillHandoverMapper.selectById(req.getHandoverId()); PhysicBillHandover handover = physicBillHandoverMapper.selectById(req.getHandoverId());
if (ObjectUtil.isEmpty(handover)) { if (ObjectUtil.isEmpty(handover)) {
throw new ServiceException("未找到交接单:" + req.getHandoverId()); throw new ServiceException("未找到交接单:" + req.getHandoverId());
......
...@@ -122,7 +122,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -122,7 +122,7 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getEncryptedToken(), physicDestroyCheckSignReq.getRelBizNo(), physicDestroyCheckSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicDestroyCheckSignReq.getBase64SourceData());
PhysicDestroyCheck physicDestroyCheck = physicDestroyCheckMapper.selectById(physicDestroyCheckSignReq.getPhysicDestroyCheckId()); PhysicDestroyCheck physicDestroyCheck = physicDestroyCheckMapper.selectById(physicDestroyCheckSignReq.getPhysicDestroyCheckId());
if(physicDestroyCheck.getStatus().equals(0)){ if(physicDestroyCheck.getStatus().equals(0)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.XH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.XH)){
......
...@@ -63,7 +63,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -63,7 +63,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
public PhysicDestroy sign(PhysicDestroySignReq physicDestroySignReq) { public PhysicDestroy sign(PhysicDestroySignReq physicDestroySignReq) {
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicDestroySignReq.getEncryptedToken(), physicDestroySignReq.getRelBizNo(), physicDestroySignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicDestroySignReq.getBase64SourceData());
PhysicDestroy physicDestroy = physicDestroyMapper.selectById(physicDestroySignReq.getPhysicDestroyId()); PhysicDestroy physicDestroy = physicDestroyMapper.selectById(physicDestroySignReq.getPhysicDestroyId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if(physicDestroy.getStatus().equals(0)){ if(physicDestroy.getStatus().equals(0)){
......
...@@ -153,7 +153,7 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -153,7 +153,7 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
public PhysicRecord sign(PhysicRecordSignReq physicRecordSignReq) { public PhysicRecord sign(PhysicRecordSignReq physicRecordSignReq) {
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicRecordSignReq.getEncryptedToken(), physicRecordSignReq.getRelBizNo(), physicRecordSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicRecordSignReq.getBase64SourceData());
PhysicRecord physicRecord = getInfo(physicRecordSignReq.getPhysicRecordId()); PhysicRecord physicRecord = getInfo(physicRecordSignReq.getPhysicRecordId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if (ObjectUtil.equals(physicRecord.getStatus(), 0)) { if (ObjectUtil.equals(physicRecord.getStatus(), 0)) {
......
...@@ -211,7 +211,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -211,7 +211,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
public PhysicStorageAmpoule sign(PhysicStorageAmpouleSignReq physicStorageAmpouleSignReq) { public PhysicStorageAmpoule sign(PhysicStorageAmpouleSignReq physicStorageAmpouleSignReq) {
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getEncryptedToken(), physicStorageAmpouleSignReq.getRelBizNo(), physicStorageAmpouleSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicStorageAmpouleSignReq.getBase64SourceData());
PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId()); PhysicStorageAmpoule ampoule = getInfo(physicStorageAmpouleSignReq.getPhysicStorageAmpouleId());
if(ampoule.getType()==2 && ampoule.getDestroyStatus()==1){ if(ampoule.getType()==2 && ampoule.getDestroyStatus()==1){
throw new ServiceException("已销毁记录不需要签名"); throw new ServiceException("已销毁记录不需要签名");
......
...@@ -91,7 +91,7 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -91,7 +91,7 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
public PhysicWarehouseVO sign(PhysicWarehouseSignReq physicWarehouseSignReq) { public PhysicWarehouseVO sign(PhysicWarehouseSignReq physicWarehouseSignReq) {
boolean finished = false; boolean finished = false;
Long userId = SpringContextUtils.getUserId(); Long userId = SpringContextUtils.getUserId();
String getstamp = cloudsignService.sign(physicWarehouseSignReq.getEncryptedToken(), physicWarehouseSignReq.getRelBizNo(), physicWarehouseSignReq.getBase64SourceData()); String getstamp = cloudsignService.sign(physicWarehouseSignReq.getBase64SourceData());
PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseSignReq.getPhysicWarehouseId()); PhysicWarehouse physicWarehouse = physicWarehouseMapper.selectById(physicWarehouseSignReq.getPhysicWarehouseId());
SysUser sysUser = sysUserMapper.selectById(userId); SysUser sysUser = sysUserMapper.selectById(userId);
if(physicWarehouse.getStatus().equals(0)){ if(physicWarehouse.getStatus().equals(0)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment