Commit b3eb3fbc by zhu.zewen

优化云签接口

parent 5429833e
...@@ -163,7 +163,7 @@ public class CloudsignService { ...@@ -163,7 +163,7 @@ public class CloudsignService {
* 生成登录二维码 * 生成登录二维码
* @param request * @param request
*/ */
public GenloginqrcodeRespon genLoginQrcode(GenloginqrcodeRequest request){ public GenloginqrcodeResponse genLoginQrcode(GenloginqrcodeRequest request){
String logTip = "genLoginQrcode"; String logTip = "genLoginQrcode";
// 自动填充业务参数 // 自动填充业务参数
if (cloudSignProperties.getTestEnabled()) { if (cloudSignProperties.getTestEnabled()) {
...@@ -184,8 +184,8 @@ public class CloudsignService { ...@@ -184,8 +184,8 @@ public class CloudsignService {
if(ObjectUtil.isEmpty(response)){ if(ObjectUtil.isEmpty(response)){
throw new ServiceException("获取失败"); throw new ServiceException("获取失败");
} }
GenloginqrcodeRespon genloginqrcodeRespon = JSON.parseObject(response, GenloginqrcodeRespon.class); GenloginqrcodeResponse genloginqrcodeResponse = JSON.parseObject(response, GenloginqrcodeResponse.class);
return genloginqrcodeRespon; return genloginqrcodeResponse;
} catch (Exception e) { } catch (Exception e) {
log.error("获取二维码失败:" + e.getMessage(), e); log.error("获取二维码失败:" + e.getMessage(), e);
throw new ServiceException("genLoginQrcode-获取二维码失败", e); throw new ServiceException("genLoginQrcode-获取二维码失败", e);
...@@ -226,22 +226,12 @@ public class CloudsignService { ...@@ -226,22 +226,12 @@ public class CloudsignService {
} }
/** /**
* 云签证书数字签名(简化版,使用默认参数)
* @param base64SourceData 待签名数据的Base64编码
* @return 签名值
*/
@Deprecated
public String sign(String base64SourceData){
return sign(base64SourceData, null);
}
/**
* 云签证书数字签名(带业务ID参数) * 云签证书数字签名(带业务ID参数)
* @param base64SourceData 待签名数据的Base64编码 * @param base64SourceData 待签名数据的Base64编码
* @param bizId 业务ID * @param bizId 业务ID
* @return 签名值 * @return 签名值
*/ */
public String sign(String base64SourceData, String bizId){ public SignResult sign(String base64SourceData, String bizId){
// 使用默认业务类型和时间戳设置,但使用传入的业务ID // 使用默认业务类型和时间戳设置,但使用传入的业务ID
SignDataRequest request = new SignDataRequest(); SignDataRequest request = new SignDataRequest();
...@@ -265,20 +255,19 @@ public class CloudsignService { ...@@ -265,20 +255,19 @@ public class CloudsignService {
request.setBizId(bizId); request.setBizId(bizId);
} }
SignDataRespon resp = signData(request); SignResult result = signData(request);
if (ObjectUtil.notEqual(result.getCode(), 0)) {
if (resp.getStatusCode() != 0) { throw new ServiceException("签名失败: code=" + result.getCode() + ", msg=" + result.getMsg());
throw new ServiceException("签名失败: " + resp.getEventMsg());
} }
return resp.getEventValue().getSignedData(); return result;
} }
/** /**
* 云签证书数字签名 * 云签证书数字签名
* @param request * @param request
*/ */
public SignDataRespon signData(SignDataRequest request){ private SignResult signData(SignDataRequest request){
String logTip = "signdata"; String logTip = "signdata";
String json = OpenUtil.toJson(request); String json = OpenUtil.toJson(request);
...@@ -289,25 +278,78 @@ public class CloudsignService { ...@@ -289,25 +278,78 @@ public class CloudsignService {
if(ObjectUtil.isEmpty(response)){ if(ObjectUtil.isEmpty(response)){
throw new ServiceException("获取失败"); throw new ServiceException("获取失败");
} }
SignDataRespon signDataRespon = JSON.parseObject(response, SignDataRespon.class); SignDataResponse signDataResponse = JSON.parseObject(response, SignDataResponse.class);
// 检查返回的状态码 // 检查返回的状态码
if (signDataRespon.getStatusCode() != 0) { if (signDataResponse.getStatusCode() != 0) {
log.error("{}-签名失败: {}", logTip, signDataRespon.getEventMsg()); log.error("{}-签名失败: {}", logTip, signDataResponse.getEventMsg());
throw new ServiceException("签名失败: " + signDataRespon.getEventMsg()); throw new ServiceException("签名失败: " + signDataResponse.getEventMsg());
} }
return signDataRespon; SignResult signResult = new SignResult();
signResult.setCode(signDataResponse.getStatusCode());
signResult.setMsg(signDataResponse.getEventMsg());
signResult.setBusinessOrgCode(request.getBusinessOrgCode());
signResult.setRelBizNo(SpringContextUtils.getWorkNo());
signResult.setSourceData(request.getBase64SourceData());
signResult.setSignedData(signDataResponse.getEventValue().getSignedData());
signResult.setTimestamp(signDataResponse.getEventValue().getTimestamp());
try {
String signCert = getCurrentUserSignCert();
signResult.setSignCert(signCert);
} catch (Exception e) {
log.error("{}-获取签名证书失败:", logTip, e);
signResult.setSignCert("");
}
try {
String stamp = getCurrentUserStamp();
signResult.setStamp(stamp);
} catch (Exception e) {
log.error("{}-获取印章失败:", logTip, e);
signResult.setStamp("");
}
// 设置签名时间、用户ID和业务ID
signResult.setSignTime(LocalDateTime.now());
signResult.setUserId(SpringContextUtils.getUserId());
signResult.setBizId(request.getBizId());
return signResult;
} catch (ServiceException se) { } catch (ServiceException se) {
// 重新抛出ServiceException // 重新抛出ServiceException
throw se; throw se;
} catch (Exception exception) { } catch (Exception exception) {
log.error("签名失败,e:{}", exception.getMessage(), exception); log.error(logTip+"-签名失败:", exception);
throw new ServiceException("签名失败: " + exception.getMessage()); throw new ServiceException("签名失败: " + exception.getMessage());
} }
} }
/** /**
* 获取当前用户的签名证书
* @return Base64编码的签名证书
*/
public String getCurrentUserSignCert(){
String relBizNo = SpringContextUtils.getWorkNo();
if (ObjectUtil.isEmpty(relBizNo)) {
throw new ServiceException("当前用户工号为空");
}
GetCertInfoRequest request = new GetCertInfoRequest();
request.setRelBizNo(relBizNo);
GetCertInfoResponse response = getCertInfo(request);
if(response.getStatusCode() == 0 && response.getEventValue() != null){
return response.getEventValue().getBase64Cert();
}else{
throw new ServiceException(response.getEventMsg());
}
}
/**
* 获取当前用户的印章图片 * 获取当前用户的印章图片
* @return 印章图片的Base64编码 * @return 印章图片的Base64编码
*/ */
...@@ -333,19 +375,19 @@ public class CloudsignService { ...@@ -333,19 +375,19 @@ public class CloudsignService {
try { try {
log.info("{}-入参:{}",logTip,json); log.info("{}-入参:{}",logTip,json);
String response = HttpUtils.sendPostRequestAndParse(buildUrl(cloudSignProperties.getGetstampUrl()), json, null); String response = HttpUtils.sendPostRequestAndParse(buildUrl(cloudSignProperties.getGetstampUrl()), json, null);
log.info("{}-返回数据:{}",logTip,response);
if(ObjectUtil.isEmpty(response)){ if(ObjectUtil.isEmpty(response)){
throw new ServiceException("获取失败"); throw new ServiceException("获取失败");
} }
GetstampRespon getstampRespon = JSON.parseObject(response, GetstampRespon.class); GetstampResponse getstampResponse = JSON.parseObject(response, GetstampResponse.class);
if(getstampRespon.getStatusCode()==0){ log.info("{}-返回数据:code={}, msg={}",logTip, getstampResponse.getStatusCode(), getstampResponse.getEventMsg());
return getstampRespon.getEventValue().getStampBase64(); if(getstampResponse.getStatusCode()==0){
return getstampResponse.getEventValue().getStampBase64();
}else{ }else{
throw new ServiceException(getstampRespon.getEventMsg()); throw new ServiceException(getstampResponse.getEventMsg());
} }
} catch (Exception exception) { } catch (Exception exception) {
log.error("获取手写签名图片失败,e:{}"+exception.getMessage()); log.error("获取手写签名图片失败", exception);
throw new ServiceException("获取手写签名图片失败"); throw new ServiceException("获取手写签名图片失败" + exception.getMessage());
} }
} }
......
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
@ApiModel(value = "GenloginqrcodeRespon", description = "获取登录二维码响应参数") @ApiModel(value = "GenloginqrcodeRespon", description = "获取登录二维码响应参数")
public class GenloginqrcodeRespon { public class GenloginqrcodeResponse {
@ApiModelProperty(value = "状态码,非0表示执行失败") @ApiModelProperty(value = "状态码,非0表示执行失败")
private Integer statusCode; private Integer statusCode;
@ApiModelProperty(value = "状态信息") @ApiModelProperty(value = "状态信息")
......
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
@ApiModel(value = "GetstampRespon", description = "获取手写签名图片响应参数") @ApiModel(value = "GetstampRespon", description = "获取手写签名图片响应参数")
public class GetstampRespon { public class GetstampResponse {
@ApiModelProperty(value = "状态码,非0表示执行失败") @ApiModelProperty(value = "状态码,非0表示执行失败")
private Integer statusCode; private Integer statusCode;
@ApiModelProperty(value = "状态信息") @ApiModelProperty(value = "状态信息")
...@@ -14,7 +14,6 @@ public class GetstampRespon { ...@@ -14,7 +14,6 @@ public class GetstampRespon {
@ApiModelProperty(value = "事件值对象") @ApiModelProperty(value = "事件值对象")
private EventValue eventValue; private EventValue eventValue;
@Data @Data
@ApiModel(value = "GetstampRespon.EventValue", description = "事件值对象") @ApiModel(value = "GetstampRespon.EventValue", description = "事件值对象")
public static class EventValue { public static class EventValue {
......
...@@ -6,7 +6,7 @@ import lombok.Data; ...@@ -6,7 +6,7 @@ import lombok.Data;
@Data @Data
@ApiModel(value = "SignDataRespon", description = "云签证书数字签名响应参数") @ApiModel(value = "SignDataRespon", description = "云签证书数字签名响应参数")
public class SignDataRespon { public class SignDataResponse {
@ApiModelProperty(value = "状态码,非0表示执行失败") @ApiModelProperty(value = "状态码,非0表示执行失败")
private Integer statusCode; private Integer statusCode;
@ApiModelProperty(value = "状态信息") @ApiModelProperty(value = "状态信息")
...@@ -14,13 +14,12 @@ public class SignDataRespon { ...@@ -14,13 +14,12 @@ public class SignDataRespon {
@ApiModelProperty(value = "事件值对象") @ApiModelProperty(value = "事件值对象")
private EventValue eventValue; private EventValue eventValue;
@Data @Data
@ApiModel(value = "SignDataRespon.EventValue", description = "事件值对象") @ApiModel(value = "SignDataRespon.EventValue", description = "事件值对象")
public static class EventValue { public static class EventValue {
@ApiModelProperty(value = "签名数据") @ApiModelProperty(value = "签名数据")
private String signedData; private String signedData;
@ApiModelProperty(value = "时间戳") @ApiModelProperty(value = "时间戳")
private Integer timestamp; private String timestamp;
} }
} }
package com.jmai.physic.cloudsign;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
@ApiModel(value = "SignResult", description = "云签证书数字签名结果")
public class SignResult {
@ApiModelProperty(value = "状态码,非0表示执行失败")
private Integer code;
@ApiModelProperty(value = "状态信息")
private String msg;
@ApiModelProperty(value = "业务机构号")
private String businessOrgCode;
@ApiModelProperty(value = "工号")
private String relBizNo;
@ApiModelProperty(value = "业务ID")
private String bizId;
@ApiModelProperty(value = "原数据(BASE64,签名前)")
private String sourceData;
@ApiModelProperty(value = "签名数据(签名后)")
private String signedData;
@ApiModelProperty(value = "时间戳")
private String timestamp;
@ApiModelProperty(value = "签名证书(BASE64)")
private String signCert;
@ApiModelProperty(value = "签名图片")
private String stamp;
@ApiModelProperty(value = "签名时间")
private LocalDateTime signTime;
@ApiModelProperty(value = "用户ID")
private Long userId;
@ApiModelProperty(value = "签名图片(BASE64)")
public String getSignBase64Data() {
String stamp = getStamp();
if (ObjectUtil.isEmpty(stamp) && stamp.startsWith("data:image")) {
return stamp;
} else {
return "data:image/png;base64," + stamp;
}
}
}
...@@ -67,7 +67,7 @@ public class CloudSignController extends AbstractService { ...@@ -67,7 +67,7 @@ public class CloudSignController extends AbstractService {
@PostMapping("/genLoginQrcode") @PostMapping("/genLoginQrcode")
@ApiOperation(value = "生成登录二维码") @ApiOperation(value = "生成登录二维码")
public ResponseData<GenloginqrcodeRespon> genLoginQrcode(@RequestBody GenloginqrcodeRequest req) { public ResponseData<GenloginqrcodeResponse> genLoginQrcode(@RequestBody GenloginqrcodeRequest req) {
String workNo = SpringContextUtils.getWorkNo(); String workNo = SpringContextUtils.getWorkNo();
if (ObjectUtil.isEmpty(workNo)) { if (ObjectUtil.isEmpty(workNo)) {
throw new ServiceException("当前用户工号为空"); throw new ServiceException("当前用户工号为空");
...@@ -77,7 +77,7 @@ public class CloudSignController extends AbstractService { ...@@ -77,7 +77,7 @@ public class CloudSignController extends AbstractService {
req.setImageFormat(1); req.setImageFormat(1);
// 现在业务参数和测试环境配置会在服务层自动处理 // 现在业务参数和测试环境配置会在服务层自动处理
GenloginqrcodeRespon qrCodeLogin = cloudsignService.genLoginQrcode(req); GenloginqrcodeResponse qrCodeLogin = cloudsignService.genLoginQrcode(req);
// 如果二维码生成成功,保存二维码图片到本地 // 如果二维码生成成功,保存二维码图片到本地
if (qrCodeLogin.getStatusCode() == 0 && qrCodeLogin.getEventValue() != null if (qrCodeLogin.getStatusCode() == 0 && qrCodeLogin.getEventValue() != null
......
package com.jmai.physic.dto;
import cn.hutool.core.date.DatePattern;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class SignInfoDTO {
private String signBase64Data;
@JSONField(format = DatePattern.NORM_DATETIME_PATTERN)
private LocalDateTime time;
private Long userId;
public SignInfoDTO(String signBase64Data, LocalDateTime time,Long userId) {
this.signBase64Data = signBase64Data;
this.time = time;
this.userId =userId;
}
}
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicAmpoule; import com.jmai.physic.entity.PhysicAmpoule;
import com.jmai.physic.mapper.PhysicAmpouleMapper; import com.jmai.physic.mapper.PhysicAmpouleMapper;
...@@ -154,7 +155,7 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA ...@@ -154,7 +155,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.getBase64SourceData(), physicAmpouleSignReq.getPhysicAmpouleId().toString()); SignResult signResult = cloudsignService.sign(physicAmpouleSignReq.getBase64SourceData(), physicAmpouleSignReq.getPhysicAmpouleId().toString());
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)){
...@@ -162,15 +163,13 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA ...@@ -162,15 +163,13 @@ public class PhysicAmpouleServiceImpl extends AbstractService implements PhysicA
throw new ServiceException("需要接受或退回人权限才可进行签名"); throw new ServiceException("需要接受或退回人权限才可进行签名");
} }
ampoule.setStatus(1); ampoule.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); ampoule.setChUser(JSONUtil.toJsonStr(signResult));
ampoule.setChUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(ampoule.getStatus().equals(1)) { }else if(ampoule.getStatus().equals(1)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
ampoule.setStatus(100); ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); ampoule.setFhUser(JSONUtil.toJsonStr(signResult));
ampoule.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished=true; finished=true;
......
...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicApply; import com.jmai.physic.entity.PhysicApply;
import com.jmai.physic.mapper.PhysicApplyMapper; import com.jmai.physic.mapper.PhysicApplyMapper;
...@@ -165,15 +166,14 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -165,15 +166,14 @@ 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.getBase64SourceData(), physicApplySignReq.getPhysicApplyId().toString()); SignResult signResult = cloudsignService.sign(physicApplySignReq.getBase64SourceData(), physicApplySignReq.getPhysicApplyId().toString());
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)){
throw new ServiceException("需要领药人权限才可进行签名"); throw new ServiceException("需要领药人权限才可进行签名");
} }
physicApply.setStatus(1); physicApply.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicApply.setLyUser(JSONUtil.toJsonStr(signResult));
physicApply.setLyUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicApply.getStatus().equals(1)){ }else if(physicApply.getStatus().equals(1)){
...@@ -181,24 +181,21 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp ...@@ -181,24 +181,21 @@ public class PhysicApplyServiceImpl extends AbstractService implements PhysicApp
throw new ServiceException("需要审核人权限才可进行签名"); throw new ServiceException("需要审核人权限才可进行签名");
} }
physicApply.setStatus(2); physicApply.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicApply.setShUser(JSONUtil.toJsonStr(signResult));
physicApply.setShUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicApply.getStatus().equals(2)){ }else if(physicApply.getStatus().equals(2)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FY)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FY)){
throw new ServiceException("需要发药人权限才可进行签名"); throw new ServiceException("需要发药人权限才可进行签名");
} }
physicApply.setStatus(3); physicApply.setStatus(3);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicApply.setFyUser(JSONUtil.toJsonStr(signResult));
physicApply.setFyUser(JSONUtil.toJsonStr(signInfoDTO));
} }
else if(physicApply.getStatus().equals(3)){ else if(physicApply.getStatus().equals(3)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
physicApply.setStatus(100); physicApply.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicApply.setFhUser(JSONUtil.toJsonStr(signResult));
physicApply.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
......
...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.sys.service.ConfigService; import com.jmai.sys.service.ConfigService;
import com.jmai.sys.dto.ConfigDto; import com.jmai.sys.dto.ConfigDto;
...@@ -130,7 +131,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -130,7 +131,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.getBase64SourceData(), physicBillSignReq.getPhysicBillId().toString()); SignResult signResult = cloudsignService.sign(physicBillSignReq.getBase64SourceData(), physicBillSignReq.getPhysicBillId().toString());
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)) {
...@@ -138,15 +139,13 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -138,15 +139,13 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
throw new ServiceException("需要领药人权限才可进行签名"); throw new ServiceException("需要领药人权限才可进行签名");
} }
bill.setStatus(1); bill.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); bill.setLyUser(JSONUtil.toJsonStr(signResult));
bill.setLyUser(JSONUtil.toJsonStr(signInfoDTO));
} else if (ObjectUtil.equals(bill.getStatus(), 1)) { } else if (ObjectUtil.equals(bill.getStatus(), 1)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
bill.setStatus(100); bill.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); bill.setFhUser(JSONUtil.toJsonStr(signResult));
bill.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
...@@ -285,8 +284,8 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -285,8 +284,8 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
Optional<PhysicBillHandover> lastHandover = getLastHandover(deptId); Optional<PhysicBillHandover> lastHandover = getLastHandover(deptId);
// 验证当前用户是上次接班人 // 验证当前用户是上次接班人
if (lastHandover.isPresent()) { if (lastHandover.isPresent()) {
SignInfoDTO jsUserInfo = JSONUtil.toBean(lastHandover.get().getJsUser(), SignInfoDTO.class); SignResult signResult = JSONUtil.toBean(lastHandover.get().getJsUser(), SignResult.class);
if (ObjectUtil.notEqual(jsUserInfo.getUserId(), userId)) { if (ObjectUtil.notEqual(signResult.getUserId(), userId)) {
throw new ServiceException("仅上次接班人有权限进行下一次交接班"); throw new ServiceException("仅上次接班人有权限进行下一次交接班");
} }
} }
...@@ -326,7 +325,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -326,7 +325,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.getBase64SourceData(), req.getHandoverId().toString()); SignResult signResult = cloudsignService.sign(req.getBase64SourceData(), req.getHandoverId().toString());
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());
...@@ -337,13 +336,11 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -337,13 +336,11 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
if (ObjectUtil.equals(handover.getStatus(), 0)) { if (ObjectUtil.equals(handover.getStatus(), 0)) {
// 交班人/移交人签名 // 交班人/移交人签名
handover.setStatus(1); handover.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); handover.setYjUser(JSONUtil.toJsonStr(signResult));
handover.setYjUser(JSONUtil.toJsonStr(signInfoDTO));
} else if (ObjectUtil.equals(handover.getStatus(), 1)) { } else if (ObjectUtil.equals(handover.getStatus(), 1)) {
// 接班人/接收人签名 // 接班人/接收人签名
handover.setStatus(100); handover.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); handover.setJsUser(JSONUtil.toJsonStr(signResult));
handover.setJsUser(JSONUtil.toJsonStr(signInfoDTO));
handover.setFinishTime(LocalDateTime.now()); handover.setFinishTime(LocalDateTime.now());
finished = true; finished = true;
} else { } else {
...@@ -421,7 +418,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -421,7 +418,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
// 检查是否允许交班人取消且为交班人 // 检查是否允许交班人取消且为交班人
boolean isTransferor = isAllowTransferor(config) && handover.getYjUser() != null; boolean isTransferor = isAllowTransferor(config) && handover.getYjUser() != null;
if (isTransferor) { if (isTransferor) {
SignInfoDTO yjUserInfo = JSONUtil.toBean(handover.getYjUser(), SignInfoDTO.class); SignResult yjUserInfo = JSONUtil.toBean(handover.getYjUser(), SignResult.class);
if (ObjectUtil.equals(yjUserInfo.getUserId(), currentUserId)) { if (ObjectUtil.equals(yjUserInfo.getUserId(), currentUserId)) {
return; return;
} else { } else {
...@@ -432,7 +429,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill ...@@ -432,7 +429,7 @@ public class PhysicBillServiceImpl extends AbstractService implements PhysicBill
// 检查是否允许接班人取消且为接班人 // 检查是否允许接班人取消且为接班人
boolean isReceiver = isAllowReceiver(config) && handover.getJsUser() != null; boolean isReceiver = isAllowReceiver(config) && handover.getJsUser() != null;
if (isReceiver) { if (isReceiver) {
SignInfoDTO jsUserInfo = JSONUtil.toBean(handover.getJsUser(), SignInfoDTO.class); SignResult jsUserInfo = JSONUtil.toBean(handover.getJsUser(), SignResult.class);
if (ObjectUtil.equals(jsUserInfo.getUserId(), currentUserId)) { if (ObjectUtil.equals(jsUserInfo.getUserId(), currentUserId)) {
return; return;
} else { } else {
......
...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.*; import com.jmai.physic.entity.*;
import com.jmai.physic.mapper.PhysicDestroyCheckMapper; import com.jmai.physic.mapper.PhysicDestroyCheckMapper;
...@@ -122,50 +123,44 @@ public class PhysicDestroyCheckServiceImpl extends BaseServiceImpl<PhysicDestroy ...@@ -122,50 +123,44 @@ 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.getBase64SourceData(), physicDestroyCheckSignReq.getPhysicDestroyCheckId().toString()); SignResult signResult = cloudsignService.sign(physicDestroyCheckSignReq.getBase64SourceData(), physicDestroyCheckSignReq.getPhysicDestroyCheckId().toString());
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)){
throw new ServiceException("需要销毁人权限才可进行签名"); throw new ServiceException("需要销毁人权限才可进行签名");
} }
physicDestroyCheck.setStatus(1); physicDestroyCheck.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicDestroyCheck.setXhUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setXhUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(1)){ }else if(physicDestroyCheck.getStatus().equals(1)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.JD)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.JD)){
throw new ServiceException("需要监督人权限才可进行签名"); throw new ServiceException("需要监督人权限才可进行签名");
} }
physicDestroyCheck.setStatus(2); physicDestroyCheck.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicDestroyCheck.setJdUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setJdUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(2)) { }else if(physicDestroyCheck.getStatus().equals(2)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.YXBZR)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.YXBZR)) {
throw new ServiceException("需要药学部主任权限才可进行签名"); throw new ServiceException("需要药学部主任权限才可进行签名");
} }
physicDestroyCheck.setStatus(3); physicDestroyCheck.setStatus(3);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicDestroyCheck.setYxbzrUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setYxbzrUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(3)){ }else if(physicDestroyCheck.getStatus().equals(3)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.YWKKZ)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.YWKKZ)){
throw new ServiceException("需要医务科科长权限才可进行签名"); throw new ServiceException("需要医务科科长权限才可进行签名");
} }
physicDestroyCheck.setStatus(4); physicDestroyCheck.setStatus(4);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicDestroyCheck.setYwkkzUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setYwkkzUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(4)){ }else if(physicDestroyCheck.getStatus().equals(4)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BWKKZ)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BWKKZ)){
throw new ServiceException("需要保卫科科长权限才可进行签名"); throw new ServiceException("需要保卫科科长权限才可进行签名");
} }
physicDestroyCheck.setStatus(5); physicDestroyCheck.setStatus(5);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicDestroyCheck.setBwkkzUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setBwkkzUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroyCheck.getStatus().equals(5)) { }else if(physicDestroyCheck.getStatus().equals(5)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.ZGYZ)) {
throw new ServiceException("需要主管院长权限才可进行签名"); throw new ServiceException("需要主管院长权限才可进行签名");
} }
physicDestroyCheck.setStatus(100); physicDestroyCheck.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signResult));
physicDestroyCheck.setZgyzUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
......
...@@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicDestroy; import com.jmai.physic.entity.PhysicDestroy;
import com.jmai.physic.mapper.PhysicDestroyMapper; import com.jmai.physic.mapper.PhysicDestroyMapper;
...@@ -63,7 +64,7 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -63,7 +64,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.getBase64SourceData(), physicDestroySignReq.getPhysicDestroyId().toString()); SignResult signResult = cloudsignService.sign(physicDestroySignReq.getBase64SourceData(), physicDestroySignReq.getPhysicDestroyId().toString());
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)){
...@@ -71,15 +72,13 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD ...@@ -71,15 +72,13 @@ public class PhysicDestroyServiceImpl extends AbstractService implements PhysicD
throw new ServiceException("需要操作人权限才可进行签名"); throw new ServiceException("需要操作人权限才可进行签名");
} }
physicDestroy.setStatus(1); physicDestroy.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicDestroy.setCzUser(JSONUtil.toJsonStr(signResult));
physicDestroy.setCzUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicDestroy.getStatus().equals(1)){ }else if(physicDestroy.getStatus().equals(1)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
physicDestroy.setStatus(100); physicDestroy.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicDestroy.setFhUser(JSONUtil.toJsonStr(signResult));
physicDestroy.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
......
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicRecord; import com.jmai.physic.entity.PhysicRecord;
import com.jmai.physic.mapper.PhysicRecordMapper; import com.jmai.physic.mapper.PhysicRecordMapper;
...@@ -153,7 +154,7 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -153,7 +154,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.getBase64SourceData(), physicRecordSignReq.getPhysicRecordId().toString()); SignResult signResult = cloudsignService.sign(physicRecordSignReq.getBase64SourceData(), physicRecordSignReq.getPhysicRecordId().toString());
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)) {
...@@ -162,15 +163,13 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -162,15 +163,13 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
throw new ServiceException("需要发药人权限才可进行签名"); throw new ServiceException("需要发药人权限才可进行签名");
} }
physicRecord.setStatus(1); physicRecord.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicRecord.setDpUser(JSONUtil.toJsonStr(signResult));
physicRecord.setDpUser(JSONUtil.toJsonStr(signInfoDTO));
} else if (ObjectUtil.equals(physicRecord.getStatus(), 1)) { } else if (ObjectUtil.equals(physicRecord.getStatus(), 1)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.DP)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.DP)) {
throw new ServiceException("需要调配人权限才可进行签名"); throw new ServiceException("需要调配人权限才可进行签名");
} }
physicRecord.setStatus(2); physicRecord.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicRecord.setFyUser(JSONUtil.toJsonStr(signResult));
physicRecord.setFyUser(JSONUtil.toJsonStr(signInfoDTO));
finished = true; finished = true;
} else if (ObjectUtil.equals(physicRecord.getStatus(), 2)) { } else if (ObjectUtil.equals(physicRecord.getStatus(), 2)) {
// 2)验收人签名 // 2)验收人签名
...@@ -178,16 +177,14 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe ...@@ -178,16 +177,14 @@ public class PhysicRecordServiceImpl extends AbstractService implements PhysicRe
throw new ServiceException("需要医生权限才可进行签名"); throw new ServiceException("需要医生权限才可进行签名");
} }
physicRecord.setStatus(3); physicRecord.setStatus(3);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicRecord.setYsUser(JSONUtil.toJsonStr(signResult));
physicRecord.setYsUser(JSONUtil.toJsonStr(signInfoDTO));
} else if (ObjectUtil.equals(physicRecord.getStatus(), 3)) { } else if (ObjectUtil.equals(physicRecord.getStatus(), 3)) {
// 3)复核人签名 // 3)复核人签名
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.FH)) {
throw new ServiceException("需要复核人权限才可进行签名"); throw new ServiceException("需要复核人权限才可进行签名");
} }
physicRecord.setStatus(100); physicRecord.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); physicRecord.setFhUser(JSONUtil.toJsonStr(signResult));
physicRecord.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
......
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicStorageAmpoule; import com.jmai.physic.entity.PhysicStorageAmpoule;
import com.jmai.physic.mapper.PhysicStorageAmpouleMapper; import com.jmai.physic.mapper.PhysicStorageAmpouleMapper;
...@@ -211,7 +212,7 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -211,7 +212,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.getBase64SourceData(), physicStorageAmpouleSignReq.getPhysicStorageAmpouleId().toString()); SignResult signResult = cloudsignService.sign(physicStorageAmpouleSignReq.getBase64SourceData(), physicStorageAmpouleSignReq.getPhysicStorageAmpouleId().toString());
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("已销毁记录不需要签名");
...@@ -222,15 +223,13 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements ...@@ -222,15 +223,13 @@ public class PhysicStorageAmpouleServiceImpl extends AbstractService implements
throw new ServiceException("需要接收人权限才可进行签名"); throw new ServiceException("需要接收人权限才可进行签名");
} }
ampoule.setStatus(1); ampoule.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); ampoule.setJsUser(JSONUtil.toJsonStr(signResult));
ampoule.setJsUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(ampoule.getStatus().equals(1)) { }else if(ampoule.getStatus().equals(1)) {
if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.TH)) { if (!RoleTypeEum.isPass(sysUser.getRoleAsList(), RoleTypeEum.TH)) {
throw new ServiceException("需要退回人权限才可进行签名"); throw new ServiceException("需要退回人权限才可进行签名");
} }
ampoule.setStatus(100); ampoule.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(), userId); ampoule.setThUser(JSONUtil.toJsonStr(signResult));
ampoule.setThUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished=true; finished=true;
......
...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.jmai.api.exception.ServiceException; import com.jmai.api.exception.ServiceException;
import com.jmai.physic.cloudsign.CloudsignService; import com.jmai.physic.cloudsign.CloudsignService;
import com.jmai.physic.cloudsign.SignResult;
import com.jmai.physic.dto.*; import com.jmai.physic.dto.*;
import com.jmai.physic.entity.PhysicWarehouse; import com.jmai.physic.entity.PhysicWarehouse;
import com.jmai.physic.mapper.PhysicAmpouleMapper; import com.jmai.physic.mapper.PhysicAmpouleMapper;
...@@ -91,7 +92,7 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -91,7 +92,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.getBase64SourceData(), physicWarehouseSignReq.getPhysicWarehouseId().toString()); SignResult signResult = cloudsignService.sign(physicWarehouseSignReq.getBase64SourceData(), physicWarehouseSignReq.getPhysicWarehouseId().toString());
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)){
...@@ -99,23 +100,20 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys ...@@ -99,23 +100,20 @@ public class PhysicWarehouseServiceImpl extends AbstractService implements Phys
throw new ServiceException("需要验收人权限才可进行签名"); throw new ServiceException("需要验收人权限才可进行签名");
} }
physicWarehouse.setStatus(1); physicWarehouse.setStatus(1);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId); physicWarehouse.setYsUser(JSONUtil.toJsonStr(signResult));
physicWarehouse.setYsUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicWarehouse.getStatus().equals(1)){ }else if(physicWarehouse.getStatus().equals(1)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.FH)){
throw new ServiceException("需要验收人权限才可进行签名"); throw new ServiceException("需要验收人权限才可进行签名");
} }
physicWarehouse.setStatus(2); physicWarehouse.setStatus(2);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicWarehouse.setFhUser(JSONUtil.toJsonStr(signResult));
physicWarehouse.setFhUser(JSONUtil.toJsonStr(signInfoDTO));
}else if(physicWarehouse.getStatus().equals(2)){ }else if(physicWarehouse.getStatus().equals(2)){
if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BG)){ if(!RoleTypeEum.isPass(sysUser.getRoleAsList(),RoleTypeEum.BG)){
throw new ServiceException("需要保管权限才可进行签名"); throw new ServiceException("需要保管权限才可进行签名");
} }
physicWarehouse.setStatus(100); physicWarehouse.setStatus(100);
SignInfoDTO signInfoDTO = new SignInfoDTO(getstamp, LocalDateTime.now(),userId);; physicWarehouse.setBgUser(JSONUtil.toJsonStr(signResult));
physicWarehouse.setBgUser(JSONUtil.toJsonStr(signInfoDTO));
// 完成 // 完成
finished = true; finished = true;
......
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