diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 8e2591f..570f715 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -49,7 +49,6 @@ public class RuoYiApplication if(CollectionUtil.isNotEmpty(sysUsers)){ for (SysUser sysUser : sysUsers) { redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY+sysUser.getEmail(),sysUser); } } // 初始化角色redis diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java index 5b83233..c285136 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsVideoConferenceController.java @@ -1,16 +1,28 @@ package com.ruoyi.web.controller.wisdomarbitrate.mscase; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.VideoCallBackVO; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; +import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; /** @@ -24,6 +36,12 @@ import javax.validation.Valid; public class MsVideoConferenceController extends BaseController { @Autowired private VideoConferenceService videoService; + @Autowired + private ServerConfig serverConfig; + @Autowired + private MsCaseAttachMapper msCaseAttachMapper; + @Autowired + private MsCaseApplicationService caseApplicationService; /** * 根据案件ID查询视频 * @param caseId 案件id @@ -34,8 +52,82 @@ public class MsVideoConferenceController extends BaseController { return videoService.videoList(caseId); } + /** + * 通用上传请求(单个) + * param officeFlag: 是否上传到onlyoffice,0-否,1-是 + */ + @PostMapping("/upload") + public AjaxResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("annexType") Integer annexType, @RequestParam(value = "officeFlag", required = false) Integer officeFlag,@RequestParam(value = "caseId") Long caseId) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + if(officeFlag != null && officeFlag == 1){ + // officeFlag,fileName为annexPath + JSONArray jsonArray = caseApplicationService.uploadOnlyOffice(fileName,caseId); + if(jsonArray!=null && jsonArray.size() > 0) { + MsCaseAttach caseAttach=null; + for (Object obj : jsonArray) { + JSONObject jsonObject = (JSONObject) obj; + caseAttach = MsCaseAttach.builder() + .caseAppliId(caseId) + .annexName(jsonObject.getString("fileName")) + .annexPath(jsonObject.getString("filePath")) + .annexType(annexType) + .onlyOfficeFileId(jsonObject.getString("fileId")) + .build(); + msCaseAttachMapper.save(caseAttach); + } + if(caseAttach==null){ + return AjaxResult.error("上传失败"); + } + AjaxResult ajax = AjaxResult.success(); + ajax.put("annexId", caseAttach.getAnnexId()); + ajax.put("annexType", annexType); + // ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + }else { + return AjaxResult.error("上传失败"); + } + }else { + Long annexId = saveCaseAttach(annexType, fileName, file.getOriginalFilename(), caseId); + // 是否上传到onlyoffice + AjaxResult ajax = AjaxResult.success(); + ajax.put("annexId", annexId); + ajax.put("annexType", annexType); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + private Long saveCaseAttach(Integer annexType, String path, String originalFilename,Long caseId) { + MsCaseAttach caseAttach = MsCaseAttach.builder() + .annexName(originalFilename) + .caseAppliId(caseId) + .annexPath(path) + .annexType(annexType) + .useId(SecurityUtils.getUserId()) + .useAccount(SecurityUtils.getUsername()) + .build(); + msCaseAttachMapper.save(caseAttach); + return caseAttach.getAnnexId(); + } /** * 从腾讯云下载文件到本地 * @param @@ -49,6 +141,13 @@ public class MsVideoConferenceController extends BaseController { } return success(); } + @Anonymous + @PostMapping("/smsRollBack") + public AjaxResult smsRollBack( @RequestBody String body, HttpServletRequest request) { + logger.info("短信回调======"+body); + videoService.smsRollBack(body,request); + return success(); + } /** * 根据房间号绑定案件ID * @param @@ -110,6 +209,17 @@ public class MsVideoConferenceController extends BaseController { return videoService.secretaryRoleByUserId(userId,caseId); } + /** + * 根据案件id查询申请人/被申请人会议上传附件按钮权限 + * @param caseId + * @return + */ + @Anonymous + @GetMapping("selectRoleMenuByCaseId") + public AjaxResult selectRoleMenuByCaseId( @RequestParam(value = "caseId",required = true) Long caseId) { + + return videoService.selectRoleMenuByCaseId(caseId); + } /** * 根据html字符串转pdf并和案件关联 * @param reservedConferenceVO diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java index d3cf20f..46a496e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -58,7 +58,7 @@ public class CacheConstants /** * 用户邮箱 redis key */ - public static final String USER_EMAIL_KEY = "user_email_key:"; +// public static final String USER_EMAIL_KEY = "user_email_key:"; /** * 角色 redis key */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java index 5f861d0..6b69e9a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/AnnexTypeEnum.java @@ -21,6 +21,7 @@ public enum AnnexTypeEnum implements EnumsInterface { RES_PAYMENT_RECEIPT(9, "被申请人缴费单"), SEAL_PICTURE(10, "印章图片"), FLOW_SVG(11, "流程节点SVG"), + MEETING_FILE(12, "被申请人证据"), ; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java new file mode 100644 index 0000000..b4ec810 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/SMSStatusEnum.java @@ -0,0 +1,64 @@ +package com.ruoyi.common.enums; + +import com.ruoyi.common.interfaces.EnumsInterface; + +/** + * @author wangqiong + * @description 短信状态枚举 + * @date 2023-11-17 14:05 + */ +public enum SMSStatusEnum implements EnumsInterface +{ + SUCCESS(1, "成功"), + SENDING(2, "发送中"), + FAIL(3, "失败"), + + ; + + private final Integer code; + private final String text; + + SMSStatusEnum(Integer code, String text) + { + this.code = code; + this.text = text; + } + + public Integer getCode() + { + return code; + } + + public String getText() + { + return text; + } + + /** + * 根据code获取text + * @param codeNo + * @return + */ + public static String getTextByCode(Integer codeNo){ + for (SMSStatusEnum value : SMSStatusEnum.values()) { + if (value.getCode().equals(codeNo)){ + return value.getText(); + } + } + return codeNo.toString(); + } + + /** + * 根据text获取code + * @param textStr + * @return + */ + public static String getCodeByText(String textStr){ + for (SMSStatusEnum value : SMSStatusEnum.values()) { + if (value.getText().equals(textStr)){ + return value.getText(); + } + } + return textStr; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java index 1a2e2b7..18f3771 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SmsUtils.java @@ -1,5 +1,7 @@ package com.ruoyi.common.utils; +import cn.hutool.json.JSONObject; +import com.ruoyi.common.enums.SMSStatusEnum; import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.sms.v20210111.SmsClient; @@ -24,7 +26,8 @@ public class SmsUtils { //签名内容 private static final String SIGN_NAME = "乙巢智慧仲裁网"; - public static Boolean sendSms(SendSmsRequest request) { + public static JSONObject sendSms(SendSmsRequest request) { + JSONObject jsonObject = new JSONObject(); Credential cred = new Credential(SECRET_ID, SECRET_KEY ); SmsClient client = new SmsClient(cred, "ap-guangzhou"); @@ -40,18 +43,23 @@ public class SmsUtils { res = client.SendSms(req); } catch (TencentCloudSDKException e) { log.error("发送短信出错:", e); - return Boolean.FALSE; + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + return jsonObject; } SendStatus sendStatus = res.getSendStatusSet()[0]; log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - return Boolean.TRUE; + jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); + }else { + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); } - return Boolean.FALSE; + jsonObject.set("sid", sendStatus.getSerialNo()); + return jsonObject; } - public static Boolean sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { - SendSmsRequest request = new SendSmsRequest(phone,templateId,templateParamSet,caseId); + public static JSONObject sendSms(Long caseId,String templateId,String phone,String[] templateParamSet) { + JSONObject jsonObject = new JSONObject(); + SmsUtils1.SendSmsRequest request = new SmsUtils1.SendSmsRequest(phone,templateId,templateParamSet,caseId); Credential cred = new Credential(SECRET_ID, SECRET_KEY ); SmsClient client = new SmsClient(cred, "ap-guangzhou"); @@ -66,16 +74,19 @@ public class SmsUtils { try { res = client.SendSms(req); } catch (TencentCloudSDKException e) { - log.error("发送短信出错:", e); - return Boolean.FALSE; + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); + return jsonObject; } SendStatus sendStatus = res.getSendStatusSet()[0]; log.info("发送短信结果:Code={}, Message={}", sendStatus.getCode(), sendStatus.getMessage()); - + // todo 短信发送时,需要将SerialNo存到数据库,在短信回调时去更新短信发送状态,以及失败原因写到数据库,发送时状态统一为发送中 if (Objects.nonNull(res.getSendStatusSet()) && res.getSendStatusSet().length > 0 && "Ok".equals(res.getSendStatusSet()[0].getCode())){ - return Boolean.TRUE; + jsonObject.set("status", SMSStatusEnum.SENDING.getCode()); + }else { + jsonObject.set("status", SMSStatusEnum.FAIL.getCode()); } - return Boolean.FALSE; + jsonObject.set("sid", sendStatus.getSerialNo()); + return jsonObject; } /** * 参数对象 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 7325df0..94fbd00 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -78,6 +78,13 @@ public interface SysDeptMapper */ public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); + /** + * 根据部门名称查询部门信息 + * @param deptName + * @return + */ + public SysDept selectDeptByName(@Param("deptName") String deptName); + /** * 新增部门信息 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index cbf225b..c222a1a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -2,11 +2,13 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.collection.CollectionUtil; import com.ruoyi.common.annotation.DataScope; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUserDept; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -66,6 +68,8 @@ public class SysUserServiceImpl implements ISysUserService { @Autowired protected Validator validator; + @Autowired + private RedisCache redisCache; /** * 根据条件分页查询用户列表 @@ -245,6 +249,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setCreateBy("admin"); user.setCreateTime(DateUtils.getNowDate()); int rows = userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); // 新增用户部门关联 if(CollectionUtil.isNotEmpty(user.getDeptIds())) { // 先删除用户与部门关联 @@ -273,7 +279,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public boolean registerUser(SysUser user) { - return userMapper.insertUser(user) > 0; + int i = userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i > 0; } /** @@ -308,6 +317,8 @@ public class SysUserServiceImpl implements ISysUserService { // 新增用户与岗位管理 insertUserPost(user); userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); return AjaxResult.success("更新用户成功"); } @@ -332,7 +343,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int updateUserStatus(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -343,7 +357,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int updateUserProfile(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -366,7 +383,10 @@ public class SysUserServiceImpl implements ISysUserService { */ @Override public int resetPwd(SysUser user) { - return userMapper.updateUser(user); + int i = userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + return i; } /** @@ -443,7 +463,10 @@ public class SysUserServiceImpl implements ISysUserService { userRoleMapper.deleteUserRoleByUserId(userId); // 删除用户与岗位表 userPostMapper.deleteUserPostByUserId(userId); - return userMapper.deleteUserById(userId); + int i = userMapper.deleteUserById(userId); + // 删除缓存 + redisCache.deleteObject(CacheConstants.USER_KEY+userId); + return i; } /** @@ -465,7 +488,12 @@ public class SysUserServiceImpl implements ISysUserService { userPostMapper.deleteUserPost(userIds); // 删除用户部门关联 userDeptMapper.deleteUserByIds(userIds); - return userMapper.deleteUserByIds(userIds); + int i = userMapper.deleteUserByIds(userIds); + for (Long userId : userIds) { + // 删除缓存 + redisCache.deleteObject(CacheConstants.USER_KEY+userId); + } + return i; } /** @@ -495,6 +523,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setPassword(SecurityUtils.encryptPassword(password)); user.setCreateBy(operName); userMapper.insertUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); successNum++; successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 导入成功"); } else if (isUpdateSupport) { @@ -504,6 +534,8 @@ public class SysUserServiceImpl implements ISysUserService { user.setUserId(u.getUserId()); user.setUpdateBy(operName); userMapper.updateUser(user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); successNum++; successMsg.append("
" + successNum + "、账号 " + user.getUserName() + " 更新成功"); } else { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java index 4e17d80..779f0fb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/sendrecord/SmsSendRecord.java @@ -42,12 +42,21 @@ public class SmsSendRecord extends BaseEntity { * 发送状态 */ private Integer sendStatus; + /** + * 短信sid,发送的唯一标识 + */ + private String sid; + /** + * 失败原因 + */ + private String reason; - public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent) { + public SmsSendRecord(Long caseId, String caseNum, String phone, Date sendTime, String sendContent,String sid) { this.caseId = caseId; this.caseNum = caseNum; this.phone = phone; this.sendTime = sendTime; this.sendContent = sendContent; + this.sid = sid; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java index 16c08cb..853ba65 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseApplication.java @@ -215,6 +215,11 @@ public class MsCaseApplication { */ @Column(name = "case_source") private String caseSource; + /** + * 是否需要用印,1-需要 + */ + @Column(name = "seal_flag") + private Integer sealFlag; /** * 拒绝原因 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java index 1628f50..8129d65 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/MsCaseApplicationReq.java @@ -120,5 +120,9 @@ public class MsCaseApplicationReq { */ private Integer roleType; private Long userId; - + /** + * 是否需要用印,0-不需要,1-需要 + */ + // todo 等会放开 + private Integer sealFlag=0; } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java index 1c9f18d..f4483d0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/sendrecord/SmsRecordMapper.java @@ -19,4 +19,6 @@ public interface SmsRecordMapper { * @return */ int batchSaveSmsSendRecord(@Param("list") List smsSendRecordList); + SmsSendRecord selectBySId(@Param("sid") String sid); + void updateStatus (SmsSendRecord smsSendRecord); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java index 6a82ca9..0c26f91 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/miniprogress/impl/WeChatUserServiceImpl.java @@ -2,11 +2,13 @@ package com.ruoyi.wisdomarbitrate.service.miniprogress.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONObject; import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; @@ -43,6 +45,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { private SysUserRoleMapper userRoleMapper; @Autowired private IdentityAuthenticationMapper identityAuthenticationMapper; + @Autowired + private RedisCache redisCache; @Override public AjaxResult sendCode(WeChatUserVO userVO) { @@ -58,8 +62,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { // 1954926 普通短信 短信验证码 验证码:,为了保证您的账户安全,请勿想他人泄露验证码信息。如非本人操作,请忽略本短信。 request.setPhone(userVO.getPhone()); request.setTemplateParamSet(new String[]{ code}); - Boolean flag = SmsUtils.sendSms(request); - if(flag){ + JSONObject resultObj = SmsUtils.sendSms(request); + if(resultObj.get("status")!=null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())){ setCodeCache(userVO.getPhone(),code); return AjaxResult.success("短信发送成功"); }else { @@ -136,6 +140,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { sysUser.setEmail(ientityAuthentication.getEmail()); sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord())); sysUserMapper.updateUser(sysUser); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); ientityAuthentication.setUserId(sysUser.getUserId()); int count=0; if(CollectionUtil.isNotEmpty(sysUser.getRoles()) && roleIdByName!=null){ @@ -169,6 +175,8 @@ public class WeChatUserServiceImpl implements WeChatUserService { if(row<1) { return AjaxResult.warn("注册失败"); } + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+sysUser.getUserId(),sysUser); if(roleIdByName!=null) { // 用户关联被申请人角色 userRoleMapper.insertUserRole(sysUser.getUserId(), roleIdByName); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java index e34709e..338faf2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsCaseApplicationService.java @@ -295,7 +295,7 @@ public interface MsCaseApplicationService { * @param affiliate 案件人员 * @param sendContent 发送内容 */ - public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); + public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent); /** * 发送邮件 * @param application 案件基本信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java index 7355d46..4a99039 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/VideoConferenceService.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -80,4 +81,13 @@ public interface VideoConferenceService { * @throws Exception */ AjaxResult reservedConference( MsReservedConferenceVO reservedConferenceVO) throws Exception; + + /** + * 短信回调 + * @param body + * @param request + */ + void smsRollBack(String body, HttpServletRequest request); + + AjaxResult selectRoleMenuByCaseId(Long caseId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java index c8f017b..92f4ebd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.wisdomarbitrate.service.mscase.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; @@ -297,19 +296,34 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("申请人") - && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName())) { + && affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getName()) + && !applicantName.toString().contains(affiliate.getName())) { applicantName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); } }else { // 组织机构 - if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())) { + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 1&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName()) + && !applicantName.toString().contains(affiliate.getApplicantOrgName())) { applicantName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); } } - if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") - && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ - respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + if(vo.getOrganizeFlag()==null || vo.getOrganizeFlag()!=1) { + if (StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") + && affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getName()) + && !respondentName.toString().contains(affiliate.getName())) { + + respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); + } + }else { + // 组织机构 + if ( affiliate.getRoleType() != null && affiliate.getRoleType() == 3&&StrUtil.isNotEmpty(affiliate.getApplicantOrgName())&& !respondentName.toString().contains(affiliate.getApplicantOrgName())) { + respondentName.append(affiliate.getApplicantOrgName()).append(Constants.CN_SPLIT_COMMA); + } } +// if(StrUtil.isNotEmpty(affiliate.getRoleName()) && affiliate.getRoleName().equals("被申请人") +// && affiliate.getRoleType()!=null && affiliate.getRoleType()==3&&StrUtil.isNotEmpty(affiliate.getName())){ +// respondentName.append(affiliate.getName()).append(Constants.CN_SPLIT_COMMA); +// } } vo.setApplicationName(removeLastComma(applicantName.toString(),Constants.CN_SPLIT_COMMA)); @@ -694,7 +708,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Transactional public void setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder) { - boolean b = caseApplication.getOrganizeFlag() != 1 && affiliate.getRoleType() == 1 && StrUtil.isEmpty(affiliate.getEmail()); + boolean b = caseApplication.getOrganizeFlag() != 1 && (affiliate.getRoleType() == 1||affiliate.getRoleType() == 3) && StrUtil.isEmpty(affiliate.getEmail()); if(affiliate==null ||b|| StrUtil.isEmpty(affiliate.getName())){ return; } @@ -753,13 +767,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { caseApplicationService.insertAfficateUser(affiliate, roleIdList); } else { // 申请机构 - if (affiliate.getRoleType() == 1) { + if (affiliate.getRoleType() == 1 || affiliate.getRoleType()==3) { affiliate.setOperatorFlag(0); // 申请人,从缓存中判断部门是否存在 - Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); - if (ObjectUtil.isEmpty(deptCache)) { +// Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName()); + SysDept dept = sysDeptMapper.selectDeptByName(affiliate.getName()); + if (dept==null) { // 不存在该部门,新增 - SysDept dept = new SysDept(); + dept = new SysDept(); dept.setParentId(0L); dept.setDeptName(affiliate.getName()); dept.setAncestors("0"); @@ -775,11 +790,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { dept.setNationality(affiliate.getNationality()); sysDeptMapper.insertDept(dept); // 更新缓存 - redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); + // redisCache.setCacheObject(CacheConstants.DEPT_KEY + dept.getDeptName(), dept.getDeptId()); }else { // 更新部门 - SysDept dept = new SysDept(); - dept.setDeptId((Long) deptCache); dept.setCode(affiliate.getCode()); dept.setCompLegalPerson(affiliate.getCompLegalPerson()); dept.setUpdateBy(getUsername()); @@ -789,7 +802,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { dept.setAddress(affiliate.getAddress()); sysDeptMapper.updateDept(dept); } - affiliate.setApplicantDeptId(redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName())); + affiliate.setApplicantDeptId(dept.getDeptId()); } else { caseApplicationService.insertAfficateUser(affiliate, roleIdList); } @@ -813,7 +826,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // Object userEmailCache = redisCache.getCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail()); SysUser user=null; // if(ObjectUtil.isEmpty(userEmailCache)){ - user = sysUserMapper.selectUserByUserName(affiliate.getEmail()); + user = sysUserMapper.selectUserByEmail(affiliate.getEmail()); // }else { // user=(SysUser)userEmailCache; // } @@ -838,7 +851,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { userMapper.insertUser(user); affiliate.setUserId(user.getUserId()); // 更新缓存 - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -863,8 +878,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { user.setEmail(affiliate.getEmail()); userMapper.updateUser(user); affiliate.setUserId(user.getUserId()); - // 更新缓存 - redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); + // redis缓存 + redisCache.setCacheObject(CacheConstants.USER_KEY+user.getUserId(),user); + // redisCache.setCacheObject(CacheConstants.USER_EMAIL_KEY + affiliate.getEmail(),user); // 查询该角色是否存在申请人角色 List roleIds = userRoleMapper.selectRoleIdsByUserId(user.getUserId()); for (Long roleId : roleIdList) { @@ -1663,8 +1679,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (StrUtil.isNotEmpty(affiliate.getPhone())) { // 发送短信 // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); - sendSMS(smsFlag,application, affiliate, sendContent); + // todo 短信 + // cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getPhone(), new String[]{application.getCaseNum()}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + sendSMS(jsonObject,application, affiliate, sendContent); } else { // 发送邮件 @@ -1681,10 +1699,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+rejectReason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。"; // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(affiliate.getPhone())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), - new String[]{application.getCaseNum(), rejectReason}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), "2065809", affiliate.getPhone(), +// new String[]{application.getCaseNum(), rejectReason}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - sendSMS(smsFlag,application, affiliate, sendContent); + sendSMS(jsonObject,application, affiliate, sendContent); } else { // 发送邮件 @@ -1732,13 +1752,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { */ @Override @Transactional - public void sendSMS(Boolean smsFlag ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent); - if (smsFlag) { + public void sendSMS(cn.hutool.json.JSONObject jsonObject ,MsCaseApplication application, MsCaseAffiliate affiliate, String sendContent) { + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getPhone(), new Date(), sendContent,jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { // 发送成功 - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -2245,14 +2265,16 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { } // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(sysUser.getPhonenumber())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), - new String[]{caseApplication.getCaseNum(),application.getHearDate()}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), templateId, sysUser.getPhonenumber(), +// new String[]{caseApplication.getCaseNum(), application.getHearDate()}); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - caseApplicationService.sendSMS(smsFlag, application, meditorAffliate, content); + caseApplicationService.sendSMS(jsonObject, caseApplication, meditorAffliate, content); } else { // 发送邮件 - caseApplicationService.sendEmail(application, meditorAffliate, subject, content); + caseApplicationService.sendEmail(caseApplication, meditorAffliate, subject, content); } } @@ -2338,10 +2360,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { if (notice != null) { // 电话号不为空,发送短信,否则发邮箱 if (StrUtil.isNotEmpty(affiliate.getPhone())) { - Boolean smsFlag = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), - notice.getTemplateParamSet()); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(application.getId(), notice.getTemplateId(), affiliate.getPhone(), +// notice.getTemplateParamSet()); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); // 发送短信 - caseApplicationService.sendSMS(smsFlag, application, affiliate, notice.getContent()); + caseApplicationService.sendSMS(jsonObject, application, affiliate, notice.getContent()); } else { // 发送邮件 @@ -2519,6 +2543,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { // int startIndex = prefix.length(); String annexPath = caseAttach.getAnnexPath(); // String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + if (annexPath.contains("/profile/upload")) { + annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + } String path = annexPath; //获取文件上传地址 EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); @@ -2567,17 +2594,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); // 设置用印账号 - DeptIdentify deptIdentify = new DeptIdentify(); - deptIdentify.setIsUse(1); - DeptIdentify deptIdentifyselect = new DeptIdentify(); - List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); - if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { - deptIdentifyselect = deptIdentifysnew.get(0); - sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); - sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); - sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); - } else { - return AjaxResult.error("没有用印时的机构名称及经办人信息"); + if (req.getSealFlag().equals(1)) { + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setIsUse(1); + DeptIdentify deptIdentifyselect = new DeptIdentify(); + List deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify); + if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) { + deptIdentifyselect = deptIdentifysnew.get(0); + sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName()); + sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone()); + sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName()); + } else { + return AjaxResult.error("没有用印时的机构名称及经办人信息"); + } } //解析文件签名印章位置 @@ -2585,7 +2614,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject3 = jsonArray.getJSONObject(i); String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { + if (keyword.equals("申请人(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -2598,9 +2627,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); + sealSignRecord.setPositionYpsn(positionY+40); } - } else if (keyword.equals("乙方(签字):")) { + } else if (keyword.equals("被申请人(签字):")) { //签名 JSONArray positionsArray = jsonObject3.getJSONArray("positions"); // 遍历 positionsArray 中的每个元素 @@ -2613,7 +2642,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); + sealSignRecord.setPositionYpsnRes(positionY+10 ); } } else if (keyword.equals("调解员(签字):")) { //签名 @@ -2628,385 +2657,62 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { double positionX = coordinateObj.getDoubleValue("positionX"); double positionY = coordinateObj.getDoubleValue("positionY"); sealSignRecord.setPositionXpsnMedi(positionX + 120); - sealSignRecord.setPositionYpsnMedi(positionY + 10); + sealSignRecord.setPositionYpsnMedi(positionY+10 ); } } else { - //用印 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXorg(positionX + 90); - sealSignRecord.setPositionYorg(positionY); + // 设置用印位置 + if (req.getSealFlag().equals(1)) { + //用印 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPageorg(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXorg(positionX + 90); + sealSignRecord.setPositionYorg(positionY); + } } } } - - String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 - String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 - String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 - //查询机构信息 - DeptIdentify deptIdentify1 = new DeptIdentify(); - deptIdentify1.setIdentifyName(orgnizeName); - deptIdentify1.setOperName(orgnizeNamepsnName); - deptIdentify1.setOperPhone(orgnizeNamePsnAccount); - List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); - if (deptIdentifies != null && deptIdentifies.size() > 0) { - Long iddeptIdent = deptIdentifies.get(0).getId(); - SealManage sealManage = new SealManage(); - sealManage.setIdentifyId(iddeptIdent); - List sealIdList = new ArrayList<>(); - List selectSealList = sealManageMapper.selectSealList(sealManage); - if (selectSealList != null && selectSealList.size() > 0) { - for (SealManage manage : selectSealList) { - Integer sealStatus = manage.getSealStatus(); - Integer isUse = manage.getIsUse(); - if (sealStatus == 1 && isUse == 1) { - sealIdList.add(manage.getSealId()); + EsignHttpResponse response3 = new EsignHttpResponse(); + // 设置用印位置 + if (req.getSealFlag().equals(1)) { + String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称 + String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名 + String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式 + //查询机构信息 + DeptIdentify deptIdentify1 = new DeptIdentify(); + deptIdentify1.setIdentifyName(orgnizeName); + deptIdentify1.setOperName(orgnizeNamepsnName); + deptIdentify1.setOperPhone(orgnizeNamePsnAccount); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + Long iddeptIdent = deptIdentifies.get(0).getId(); + SealManage sealManage = new SealManage(); + sealManage.setIdentifyId(iddeptIdent); + List sealIdList = new ArrayList<>(); + List selectSealList = sealManageMapper.selectSealList(sealManage); + if (selectSealList != null && selectSealList.size() > 0) { + for (SealManage manage : selectSealList) { + Integer sealStatus = manage.getSealStatus(); + Integer isUse = manage.getIsUse(); + if (sealStatus == 1 && isUse == 1) { + sealIdList.add(manage.getSealId()); + } } - } - EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList); + response3 = SignAward.createByFileSeal(sealSignRecord, sealIdList); - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); - if (jsonObject3 != null) { - if (jsonObject3.getIntValue("code") == 0) { - //获取签署流程ID - JSONObject data1 = jsonObject3.getJSONObject("data"); - String signFlowId = data1.getString("signFlowId"); - //保存案件id,文件id,文件名称.流程id到签署用印记录表里 - sealSignRecord.setCaseAppliId(application.getId()); - sealSignRecord.setSignFlowid(signFlowId); - sealSignRecord.setSignFlowStatus(1);//待签名 - MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); - BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); - msSealSignRecord.setFileId(sealSignRecord.getFileid()); - msSealSignRecord.setFileName(sealSignRecord.getFilename()); - msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); - msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); - msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); - sealSignRecordMapper.insert(msSealSignRecord); - - SealSignRecord sealSignRecordapply = new SealSignRecord(); - sealSignRecordapply.setSignFlowid(signFlowId); - // todo - // 设置申请人账户 - sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); - JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); - - //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2116857"); - // todo - // 申请人发送短信 - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), - applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord); - - SealSignRecord sealSignRecordRespon = new SealSignRecord(); - sealSignRecordRespon.setSignFlowid(signFlowId); - // 被申请人账户 - sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); - EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); - JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); - JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); - String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); - String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2116857"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBoolean1) { - resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); - // 调解员账户 - SealSignRecord sealSignRecordMedi = new SealSignRecord(); - sealSignRecordMedi.setSignFlowid(signFlowId); - sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); - EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); - JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); - JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); - String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); - String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); - - SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); - requestMedi.setTemplateId("2116857"); - requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); - requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); - Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi); - - SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信"); - // 新增短信记录 - if (aBooleanMedi) { - smsSendRecord1.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - smsSendRecord1.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(smsSendRecord1); - - } else { - throw new ServiceException(jsonObject3.getString("message")); - } - } else { - return AjaxResult.error(); } } } else { - return AjaxResult.error(); + // 不带用印 + response3 = SignAward.createByFileMediation(sealSignRecord); } - - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - } else { - return AjaxResult.error(); - } - } else { - return AjaxResult.error(); - } - } - break; - - } - } - } - - return AjaxResult.success(); - } else if (mediaResult.intValue() == 2) { - //未达成调解 - //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 - // 申请人短信 - SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2066725"); - request.setPhone(applicantAffiliateOpt.get().getPhone()); - request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); - Boolean aBoolean = SmsUtils.sendSms(request); - // 新增短信记录 - SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); - if (aBoolean) { - appSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - appSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); - // 被申请人短信 - SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2066725"); - request1.setPhone(resAffiliateOpt.get().getPhone()); - request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); - // 新增短信记录 - SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信"); - if (aBoolean1) { - resSmsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); - } else { - resSmsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); - } - smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 3) { - //未达成调解但不再争议 - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - } - return AjaxResult.success(); - } else if (mediaResult.intValue() == 4) { - //未达成调解但同意引入仲裁 - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); - - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); - // 修改案件状态为结束 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - // todo 新增结束日志 - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKey(application); - } - - return AjaxResult.success(); - } else if (mediaResult.intValue() == 5) { - // 达成和解 - List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); - if (caseAttachList != null && caseAttachList.size() > 0) { - for (MsCaseAttach caseAttach : caseAttachList) { - if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { - // String prefix = "/profile"; - // int startIndex = prefix.length(); - String annexPath = caseAttach.getAnnexPath(); -// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); - String path = annexPath; - //获取文件上传地址 - EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); - String body = response.getBody(); - if (body != null) { - JSONObject jsonObject = JSONObject.parseObject(body); - String fileId = jsonObject.getJSONObject("data").getString("fileId"); - String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); - //上传文件流 - EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); - JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); - if (jsonObject1.getIntValue("errCode") == 0) { - //查看文件上传状态 - Thread.sleep(1000); - EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); - JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); - JSONObject data = jsonObject2.getJSONObject("data"); - int fileStatus = data.getIntValue("fileStatus"); - if (fileStatus == 2 || fileStatus == 5) { - String fileName = data.getString("fileName"); - //上传成功,获取文件签名印章位置 - SealSignRecord sealSignRecord = new SealSignRecord(); - sealSignRecord.setFileid(fileId); - EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); - Gson gson = new Gson(); - JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); - JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); - String keywordPositions = positionsData.get("keywordPositions").toString(); - //发起签署 - sealSignRecord.setFilename(fileName); - - Long arbitratorId = application.getMediatorId(); - if (arbitratorId != null) { - SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); - if (sysUser == null) { - return AjaxResult.error(); - } - sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); - sealSignRecord.setPensonNameMedi(sysUser.getNickName()); - } - // todo 申请人账户 - sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); - // 被申账户 - sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); - sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); - //解析文件签名印章位置 - JSONArray jsonArray = JSONArray.parseArray(keywordPositions); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject3 = jsonArray.getJSONObject(i); - String keyword = jsonObject3.getString("keyword"); - if (keyword.equals("甲方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsn(positionX + 120); - sealSignRecord.setPositionYpsn(positionY); - } - } else if (keyword.equals("乙方(签字):")) { - //签名 - JSONArray positionsArray = jsonObject3.getJSONArray("positions"); - // 遍历 positionsArray 中的每个元素 - for (int j = 0; j < positionsArray.size(); j++) { - JSONObject positionObj = positionsArray.getJSONObject(j); - int pageNum = positionObj.getIntValue("pageNum"); - sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); - JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); - JSONObject coordinateObj = coordinatesArray.getJSONObject(0); - double positionX = coordinateObj.getDoubleValue("positionX"); - double positionY = coordinateObj.getDoubleValue("positionY"); - sealSignRecord.setPositionXpsnRes(positionX + 120); - sealSignRecord.setPositionYpsnRes(positionY + 10); - } - } - } - - EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); - JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); if (jsonObject3 != null) { if (jsonObject3.getIntValue("code") == 0) { @@ -3022,10 +2728,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msSealSignRecord.setFileId(sealSignRecord.getFileid()); msSealSignRecord.setFileName(sealSignRecord.getFilename()); msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount()); + msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName()); sealSignRecordMapper.insert(msSealSignRecord); - // 申请人签名记录 + + SealSignRecord sealSignRecordapply = new SealSignRecord(); sealSignRecordapply.setSignFlowid(signFlowId); + // todo + // 设置申请人账户 sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); @@ -3034,23 +2745,29 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 - // 申请人短信 SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); - request.setTemplateId("2047719"); + request.setTemplateId("2116857"); + + // 申请人发送短信 request.setPhone(applicantAffiliateOpt.get().getPhone()); request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); - Boolean aBoolean = SmsUtils.sendSms(request); - SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信"); + // todo 发送短信先注释掉 +// cn.hutool.json.JSONObject resultObj = SmsUtils.sendSms(request); + // todo + cn.hutool.json.JSONObject resultObj = new cn.hutool.json.JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), + applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObj.get("sid") != null ? resultObj.get("sid").toString() : null); // 新增短信记录 - if (aBoolean) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (resultObj.get("status") != null && !resultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); - // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); sealSignRecordRespon.setSignFlowid(signFlowId); + // 被申请人账户 sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); @@ -3059,19 +2776,47 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); - request1.setTemplateId("2047719"); + request1.setTemplateId("2116857"); request1.setPhone(resAffiliateOpt.get().getPhone()); request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); - Boolean aBoolean1 = SmsUtils.sendSms(request1); + // todo 短信记录 + // cn.hutool.json.JSONObject resultObjRes = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resultObjRes = new cn.hutool.json.JSONObject(); - SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信"); + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resultObjRes.get("sid") != null ? resultObjRes.get("sid").toString() : null); // 新增短信记录 - if (aBoolean1) { - resSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (resultObjRes.get("status") != null && !resultObjRes.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - resSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - smsRecordMapper.saveSmsSendRecord(resSendRecord); + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 调解员账户 + SealSignRecord sealSignRecordMedi = new SealSignRecord(); + sealSignRecordMedi.setSignFlowid(signFlowId); + sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi()); + EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi); + JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class); + JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data"); + String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString(); + String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest(); + requestMedi.setTemplateId("2116857"); + requestMedi.setPhone(sealSignRecord.getPensonAccountMedi()); + requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(), urlResponnewMedi}); + // todo 短信注释 +// cn.hutool.json.JSONObject mediaResultObj = SmsUtils.sendSms(requestMedi); + cn.hutool.json.JSONObject mediaResultObj = new cn.hutool.json.JSONObject(); + + SmsSendRecord smsSendRecord1 = new SmsSendRecord(application.getId(), application.getCaseNum(), sealSignRecord.getPensonAccountMedi(), new Date(), "尊敬的" + sealSignRecord.getPensonNameMedi() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnewMedi + ",请点击链接签名,如非本人操作,请忽略本短信", mediaResultObj.get("sid") != null ? mediaResultObj.get("sid").toString() : null); + // 新增短信记录 + if (mediaResultObj.get("status") != null && !mediaResultObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord1.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord1.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord1); } else { throw new ServiceException(jsonObject3.getString("message")); @@ -3080,105 +2825,94 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { return AjaxResult.error(); } - // 修改案件状态为待签名 - Example flowExample = new Example(MsCaseFlow.class); - flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); - MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); - if (caseFlow != null) { - application.setCaseFlowId(caseFlow.getId()); - application.setCaseStatusName(caseFlow.getCaseStatusName()); - // 新增日志 - CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - } - - application.setMediaResult(mediaResult); - msCaseApplicationMapper.updateByPrimaryKeySelective(application); - return AjaxResult.success(); } else { return AjaxResult.error(); } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); } else { return AjaxResult.error(); } + } else { + return AjaxResult.error(); } break; } + + } } } - - } else { - // 线下调解 - List attachList = req.getAttachList(); - if (CollectionUtil.isEmpty(attachList)) { - return AjaxResult.error("请上传调解资料"); + return AjaxResult.success(); + } else if (mediaResult.intValue() == 2) { + //未达成调解 + //todo 发送终止调解短信,尊敬的{1}用户,您的{2}调解案件已终止调解,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2066725"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum()}); + // todo 短信 +// cn.hutool.json.JSONObject jsonObject = SmsUtils.sendSms(request); + cn.hutool.json.JSONObject jsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord appSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", jsonObject.get("sid") != null ? jsonObject.get("sid").toString() : null); + if (jsonObject.get("status") != null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + appSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + appSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } + smsRecordMapper.saveSmsSendRecord(appSmsSendRecord); + // 被申请人短信 + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2066725"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum()}); +// todo 短信注释 +// cn.hutool.json.JSONObject resJsonObject = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resJsonObject = new cn.hutool.json.JSONObject(); + // 新增短信记录 + SmsSendRecord resSmsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件已终止调解,如非本人操作,请忽略本短信", resJsonObject.get("sid") != null ? resJsonObject.get("sid").toString() : null); + if (resJsonObject.get("status") != null && !resJsonObject.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSmsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSmsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - for (MsCaseAttach attach : attachList) { - attach.setCaseAppliId(req.getId()); - msCaseAttachMapper.updateCaseAttach(attach); - } - // todo 对接北明,调用上传附件接口 - List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { - for (MsCaseAttach msCaseAttach : msCaseAttaches) { - String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(),AttachmentOperateTypeEnum.ADD,DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttach(msCaseAttach); - } - } - } - // 修改案件状态为待送达 + smsRecordMapper.saveSmsSendRecord(resSmsSendRecord); + // 修改案件状态为结束 Example flowExample = new Example(MsCaseFlow.class); - if (mediaResult == 1 || mediaResult == 5) { - // 达成调解,达成和解,案件状态改为待送达 - flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); - } else if (mediaResult == 2 || mediaResult == 3) { - // 未达成调解,未达成调解但不在争议改为结束状态 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - } else if (mediaResult == 4) { - // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 - flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); - String accessSec = "mCFMA6ffe938v79m"; - MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); - BeanUtils.copyProperties(application, applicationVO); - - CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); - BeanUtils.copyProperties(applicationVO, caseApplicationVO); - boolean importFlag = applicationVO.isImportFlag(); - if (importFlag == true) { - caseApplicationVO.setImportFlag(1); - } else { - caseApplicationVO.setImportFlag(0); - } - String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); - long timestamp = System.currentTimeMillis(); - String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); - String urlstr = arbitrateUrl; - HttpResponse httpResponse = HttpRequest.post(urlstr) - .header("timestampstr", String.valueOf(timestamp)) - .header("signstr", signStr) - .body(paramsbody) - .execute(); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); } + return AjaxResult.success(); + } else if (mediaResult.intValue() == 3) { + //未达成调解但不再争议 + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); if (caseFlow != null) { application.setCaseFlowId(caseFlow.getId()); @@ -3187,18 +2921,345 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService { msCaseApplicationMapper.updateByPrimaryKey(application); // 新增日志 CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); - if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { - CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); - // todo 结束对接北明,为调解失败状态 - caseApplicationService. pushStatusToBM(application, PushCaseStatusEnum.FAIL); - } + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); } return AjaxResult.success(); + } else if (mediaResult.intValue() == 4) { + //未达成调解但同意引入仲裁 + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); + + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + // 修改案件状态为结束 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + // todo 新增结束日志 + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + } + + return AjaxResult.success(); + } else if (mediaResult.intValue() == 5) { + // 达成和解 + List caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId()); + if (caseAttachList != null && caseAttachList.size() > 0) { + for (MsCaseAttach caseAttach : caseAttachList) { + if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) { + // String prefix = "/profile"; + // int startIndex = prefix.length(); + String annexPath = caseAttach.getAnnexPath(); +// String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1); + if (annexPath.contains("/profile/upload")) { + annexPath = annexPath.replace("/profile/upload", "/home/ruoyi/uploadPath/upload"); + } + String path = annexPath; + //获取文件上传地址 + EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); + String body = response.getBody(); + if (body != null) { + JSONObject jsonObject = JSONObject.parseObject(body); + String fileId = jsonObject.getJSONObject("data").getString("fileId"); + String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl"); + //上传文件流 + EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path); + JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody()); + if (jsonObject1.getIntValue("errCode") == 0) { + //查看文件上传状态 + Thread.sleep(1000); + EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId); + JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody()); + JSONObject data = jsonObject2.getJSONObject("data"); + int fileStatus = data.getIntValue("fileStatus"); + if (fileStatus == 2 || fileStatus == 5) { + String fileName = data.getString("fileName"); + //上传成功,获取文件签名印章位置 + SealSignRecord sealSignRecord = new SealSignRecord(); + sealSignRecord.setFileid(fileId); + EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord); + Gson gson = new Gson(); + JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class); + JsonObject positionsData = positionsJsonObject.getAsJsonObject("data"); + String keywordPositions = positionsData.get("keywordPositions").toString(); + //发起签署 + sealSignRecord.setFilename(fileName); + + Long arbitratorId = application.getMediatorId(); + if (arbitratorId != null) { + SysUser sysUser = sysUserMapper.selectUserById(arbitratorId); + if (sysUser == null) { + return AjaxResult.error(); + } + sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber()); + sealSignRecord.setPensonNameMedi(sysUser.getNickName()); + } + // todo 申请人账户 + sealSignRecord.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonName(applicantAffiliateOpt.get().getName()); + // 被申账户 + sealSignRecord.setPensonAccountRes(resAffiliateOpt.get().getPhone()); + sealSignRecord.setPensonNameRes(resAffiliateOpt.get().getName()); + //解析文件签名印章位置 + JSONArray jsonArray = JSONArray.parseArray(keywordPositions); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObject3 = jsonArray.getJSONObject(i); + String keyword = jsonObject3.getString("keyword"); + if (keyword.equals("申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsn(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsn(positionX + 120); + sealSignRecord.setPositionYpsn(positionY); + } + } else if (keyword.equals("被申请人(签字):")) { + //签名 + JSONArray positionsArray = jsonObject3.getJSONArray("positions"); + // 遍历 positionsArray 中的每个元素 + for (int j = 0; j < positionsArray.size(); j++) { + JSONObject positionObj = positionsArray.getJSONObject(j); + int pageNum = positionObj.getIntValue("pageNum"); + sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum)); + JSONArray coordinatesArray = positionObj.getJSONArray("coordinates"); + JSONObject coordinateObj = coordinatesArray.getJSONObject(0); + double positionX = coordinateObj.getDoubleValue("positionX"); + double positionY = coordinateObj.getDoubleValue("positionY"); + sealSignRecord.setPositionXpsnRes(positionX + 120); + sealSignRecord.setPositionYpsnRes(positionY + 10); + } + } + } + + EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord); + + JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody()); + if (jsonObject3 != null) { + if (jsonObject3.getIntValue("code") == 0) { + //获取签署流程ID + JSONObject data1 = jsonObject3.getJSONObject("data"); + String signFlowId = data1.getString("signFlowId"); + //保存案件id,文件id,文件名称.流程id到签署用印记录表里 + sealSignRecord.setCaseAppliId(application.getId()); + sealSignRecord.setSignFlowid(signFlowId); + sealSignRecord.setSignFlowStatus(1);//待签名 + MsSealSignRecord msSealSignRecord = new MsSealSignRecord(); + BeanUtil.copyProperties(sealSignRecord, msSealSignRecord); + msSealSignRecord.setFileId(sealSignRecord.getFileid()); + msSealSignRecord.setFileName(sealSignRecord.getFilename()); + msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid()); + sealSignRecordMapper.insert(msSealSignRecord); + // 申请人签名记录 + SealSignRecord sealSignRecordapply = new SealSignRecord(); + sealSignRecordapply.setSignFlowid(signFlowId); + sealSignRecordapply.setPensonAccount(applicantAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply); + JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/") + 1); + + //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信 + // 申请人短信 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("2047719"); + request.setPhone(applicantAffiliateOpt.get().getPhone()); + request.setTemplateParamSet(new String[]{applicantAffiliateOpt.get().getName(), application.getCaseNum(), urlapplynew}); + // todo 短信 +// cn.hutool.json.JSONObject smsObj = SmsUtils.sendSms(request); + cn.hutool.json.JSONObject smsObj = new cn.hutool.json.JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), applicantAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + applicantAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlapplynew + ",请点击链接签名,如非本人操作,请忽略本短信", smsObj.get("sid") != null ? smsObj.get("sid").toString() : null); + // 新增短信记录 + if (smsObj.get("status") != null && !smsObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(smsSendRecord); + // 被申签名记录 + SealSignRecord sealSignRecordRespon = new SealSignRecord(); + sealSignRecordRespon.setSignFlowid(signFlowId); + sealSignRecordRespon.setPensonAccount(resAffiliateOpt.get().getPhone()); + EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon); + JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class); + JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data"); + String urlRespon = signUrlDataRespon.get("shortUrl").getAsString(); + String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/") + 1); + + SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest(); + request1.setTemplateId("2047719"); + request1.setPhone(resAffiliateOpt.get().getPhone()); + request1.setTemplateParamSet(new String[]{resAffiliateOpt.get().getName(), application.getCaseNum(), urlResponnew}); + // todo 短信 +// cn.hutool.json.JSONObject resObj = SmsUtils.sendSms(request1); + cn.hutool.json.JSONObject resObj = new cn.hutool.json.JSONObject(); + + SmsSendRecord resSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), resAffiliateOpt.get().getPhone(), new Date(), "尊敬的" + resAffiliateOpt.get().getName() + "用户,您的" + application.getCaseNum() + "调解案件,签名链接https://smlt.esign.cn/" + urlResponnew + ",请点击链接签名,如非本人操作,请忽略本短信", resObj.get("sid") != null ? resObj.get("sid").toString() : null); + // 新增短信记录 + if (resObj.get("status") != null && !resObj.get("status").equals(SMSStatusEnum.FAIL.getCode())) { + resSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); + } else { + resSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + } + smsRecordMapper.saveSmsSendRecord(resSendRecord); + + } else { + throw new ServiceException(jsonObject3.getString("message")); + } + } else { + return AjaxResult.error(); + } + + // 修改案件状态为待签名 + Example flowExample = new Example(MsCaseFlow.class); + flowExample.createCriteria().andEqualTo("caseStatusName", "待签名"); + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + } + + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKeySelective(application); + return AjaxResult.success(); + } else { + return AjaxResult.error(); + } + } else { + return AjaxResult.error(); + } + } + break; + } + } + } } + else + + { + // 线下调解 + List attachList = req.getAttachList(); + if (CollectionUtil.isEmpty(attachList)) { + return AjaxResult.error("请上传调解资料"); + } + // 先删除已经存在的调解书 + if (StrUtil.isEmpty(application.getCaseSource())) { + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (CollectionUtil.isNotEmpty(existAttach)) { + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if (StrUtil.isEmpty(msCaseAttach.getOtherSysFileId()) || StrUtil.isEmpty(msCaseAttach.getAnnexPath())) { + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + for (MsCaseAttach attach : attachList) { + attach.setCaseAppliId(req.getId()); + msCaseAttachMapper.updateCaseAttach(attach); + } + // todo 对接北明,调用上传附件接口 + List msCaseAttaches = msCaseAttachMapper.listCaseAttachByCaseIdAndType(req.getId(), AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if (StrUtil.isEmpty(application.getCaseSource()) && CollectionUtil.isNotEmpty(msCaseAttaches)) { + for (MsCaseAttach msCaseAttach : msCaseAttaches) { + String templatePath = "/home/ruoyi" + msCaseAttach.getAnnexPath(); + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, application.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); + // 更新附件表 + if (caseFileInfo != null && StrUtil.isNotEmpty(caseFileInfo.getFileId())) { + msCaseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttach(msCaseAttach); + } + } + } + // 修改案件状态为待送达 + Example flowExample = new Example(MsCaseFlow.class); + if (mediaResult == 1 || mediaResult == 5) { + // 达成调解,达成和解,案件状态改为待送达 + flowExample.createCriteria().andEqualTo("caseStatusName", "待送达"); + } else if (mediaResult == 2 || mediaResult == 3) { + // 未达成调解,未达成调解但不在争议改为结束状态 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + } else if (mediaResult == 4) { + // 未达成调解但同意引入仲裁系统,改为结束状态,并调仲裁新增接口 + flowExample.createCriteria().andEqualTo("caseStatusName", "结束"); + String accessSec = "mCFMA6ffe938v79m"; + MsCaseApplicationVO applicationVO = new MsCaseApplicationVO(); + BeanUtils.copyProperties(application, applicationVO); + + CaseApplicationVO caseApplicationVO = new CaseApplicationVO(); + BeanUtils.copyProperties(applicationVO, caseApplicationVO); + boolean importFlag = applicationVO.isImportFlag(); + if (importFlag == true) { + caseApplicationVO.setImportFlag(1); + } else { + caseApplicationVO.setImportFlag(0); + } + String paramsbody = JSONUtil.toJsonStr(caseApplicationVO); + long timestamp = System.currentTimeMillis(); + String signStr = SignCheckUtils.getSign(paramsbody, accessSec, timestamp); + String urlstr = arbitrateUrl; + HttpResponse httpResponse = HttpRequest.post(urlstr) + .header("timestampstr", String.valueOf(timestamp)) + .header("signstr", signStr) + .body(paramsbody) + .execute(); + } + MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample); + if (caseFlow != null) { + application.setCaseFlowId(caseFlow.getId()); + application.setCaseStatusName(caseFlow.getCaseStatusName()); + application.setMediaResult(mediaResult); + msCaseApplicationMapper.updateByPrimaryKey(application); + // 新增日志 + CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), ""); + if (mediaResult == 2 || mediaResult == 3 || mediaResult == 4) { + CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), null); + // todo 结束对接北明,为调解失败状态 + caseApplicationService.pushStatusToBM(application, PushCaseStatusEnum.FAIL); + } + } + return AjaxResult.success(); + } + return AjaxResult.success(); - } +} /** * 确定会议结果 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java index b90b50a..018dac9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCasePaymentServiceImpl.java @@ -11,10 +11,10 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.PaymentStatusEnum; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; @@ -384,22 +384,24 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { continue; } if (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2)) { - Boolean smsFlag = true; + JSONObject jsonObject = new JSONObject(); SmsSendRecord smsSendRecord = null; if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { // 缴费通过 - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } else { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("ststus")!=null && !jsonObject.get("ststus").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -412,22 +414,24 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { continue; } if (affiliate.getRoleType().equals(3) || affiliate.getRoleType().equals(4)) { - Boolean smsFlag = true; + JSONObject jsonObject = new JSONObject(); SmsSendRecord smsSendRecord = null; if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) { + // todo 短信 // 缴费通过 - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。"); +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", affiliate.getPhone(), new String[]{affiliate.getName()}); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + ",您的调解申请费用已缴费成功。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } else { - smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); + // todo 短信 +// jsonObject = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", affiliate.getPhone(), new String[]{affiliate.getName(), caseAppllication.getCaseNum(), dto.getReason()}); // 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信 - smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信"); + smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), affiliate.getPhone(), new Date(), "尊敬的" + affiliate.getName() + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); } // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); } @@ -469,13 +473,16 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService { @Transactional public void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) { // 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。 - Boolean smsFlag = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); - SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。"); + // todo 短信 + +// JSONObject jsonObject = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()}); + JSONObject jsonObject = new JSONObject(); + SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。",jsonObject.get("sid")!=null?jsonObject.get("sid").toString():null); // 新增短信记录 - if (smsFlag) { - smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); + if (jsonObject.get("status")!=null && !jsonObject.get("status").equals(SMSStatusEnum.FAIL)) { + smsSendRecord.setSendStatus(SMSStatusEnum.SENDING.getCode()); } else { - smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); } smsRecordMapper.saveSmsSendRecord(smsSendRecord); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java index 73f0135..93f19d8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java @@ -596,9 +596,13 @@ public class MsSignSealServiceImpl implements MsSignSealService { Gson gson = new Gson(); EsignHttpResponse signUrl = SignAward.signUrl(sealSignRecord); JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class); - JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); - String urlapply = signUrlData.get("shortUrl").getAsString(); - sealSignRecordres.setSealUrl(urlapply); + if(signUrlJsonObject.get("data")==null||signUrlJsonObject.get("data").isJsonNull()){ + throw new ServiceException("该用户和流程无关,不能查看当前流程"); + }else { + JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data"); + String urlapply = signUrlData.get("shortUrl").getAsString(); + sealSignRecordres.setSealUrl(urlapply); + } } return AjaxResult.success(sealSignRecordres); }else { @@ -722,7 +726,14 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(signStatusResponse!=null&&signStatusResponse.intValue()==1&& signStatusMediator!=null&&signStatusMediator.intValue()==1){ // 根据流程id查找下一个流程节点 - MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + MsCaseFlow nextFlow=null; + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + // 需要用印 + nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue()); + }else { + // 不需要用印 + nextFlow = caseFlowMapper.nextFlow1(caseApplicationselect.getCaseFlowId().intValue()); + } MsCaseApplication application = new MsCaseApplication(); application.setId(caseApplicationselect.getId()); application.setCaseFlowId(nextFlow.getId()); @@ -730,8 +741,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); + } + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountRes)){ //被申请人签名 @@ -755,8 +775,17 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); - sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); + // 下载调解书 + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); + } + } }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(pensonAccountMedi)){ //调解员签名 @@ -780,10 +809,16 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //修改"签署用印记录表"的状态为待用印 - sealSignRecordsel.setSignFlowStatus(2); + if(caseApplicationselect.getSealFlag()!=null&&caseApplicationselect.getSealFlag()==1) { + sealSignRecordsel.setSignFlowStatus(2); + }else { + // 否则为已完成 + sealSignRecordsel.setSignFlowStatus(3); + } sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); } - }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc)){ + }else if(StringUtils.isNotEmpty(accountMobile)&&accountMobile.equals(orgnNamePsnAcc) && caseApplicationselect.getSealFlag()!=null && caseApplicationselect.getSealFlag()==1 ){ + //需要用印 sealSignRecordsel.setSealStatus(1); sealSignRecordsel.setSignFlowStatus(3); sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel); @@ -804,73 +839,8 @@ public class MsSignSealServiceImpl implements MsSignSealService { caseApplicationMapper.updateByPrimaryKeySelective(application); //下载审核完成的调解书 - EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); - JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); - JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); - JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); - if (filesArray != null && filesArray.size() > 0) { - JsonObject fileObject = (JsonObject) filesArray.get(0); - String fileDownloadUrl = fileObject.get("downloadUrl").toString(); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - String month = String.format("%02d", now.getMonthValue()); - String day = String.format("%02d", now.getDayOfMonth()); - String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; - String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; -// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; -// String savePath = "/home/ruoyi/uploadPath/upload/"; - String saveName = fileName; - String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + downloadMediationBook(caseApplicationselect,signFlowId,gson,caseAppliId); - // 创建日期目录 - File saveFolder = new File(saveFolderPath); - if (!saveFolder.exists()) { - saveFolder.mkdirs(); - } - String resultFilePath = saveFolderPath + "/" + fileName; - File resultFilePathFile = new File(resultFilePath); - if (!resultFilePathFile.exists()) { - resultFilePathFile.createNewFile(); - } - - String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); - boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); - if (downLoadFile) { - // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ - List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - if(CollectionUtil.isNotEmpty(existAttach)){ - // todo 对接北明,同步案件状态,删除 - for (MsCaseAttach msCaseAttach : existAttach) { - if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ - continue; - } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); - } - } - } - msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); - MsCaseAttach caseAttach = new MsCaseAttach(); - caseAttach.setCaseAppliId(caseAppliId); - caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); - caseAttach.setAnnexPath(savePath); - caseAttach.setAnnexName(saveName); - caseAttachMapper.save(caseAttach); - // todo 对接北明,调用上传附件接口 - if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { - String templatePath = "/home/ruoyi" + savePath; - File file = new File(templatePath.replace("/profile", "/uploadPath")); - MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); - // 更新附件表 - if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ - caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); - msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } - - } - } - - } } }else if(mediaResult.intValue()==5){ @@ -932,7 +902,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ // todo 对接北明,同步案件状态,删除 @@ -940,7 +910,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } } } @@ -1024,7 +994,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); if (downLoadFile) { // 先删除已经存在的调解书 - if(StrUtil.isEmpty(application.getCaseSource())){ + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); if(CollectionUtil.isNotEmpty(existAttach)){ // todo 对接北明,同步案件状态,删除 @@ -1032,7 +1002,7 @@ public class MsSignSealServiceImpl implements MsSignSealService { if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ continue; } - beiMingInterfaceService.deleteAttachmentInfo(application.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); } } } @@ -1069,6 +1039,77 @@ public class MsSignSealServiceImpl implements MsSignSealService { return AjaxResult.success("success"); } + private void downloadMediationBook(MsCaseApplication caseApplicationselect, String signFlowId, Gson gson, Long caseAppliId) throws EsignDemoException, IOException { + EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId); + JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class); + JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data"); + JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray(); + if (filesArray != null && filesArray.size() > 0) { + JsonObject fileObject = (JsonObject) filesArray.get(0); + String fileDownloadUrl = fileObject.get("downloadUrl").toString(); + LocalDate now = LocalDate.now(); + String year = Integer.toString(now.getYear()); + String month = String.format("%02d", now.getMonthValue()); + String day = String.format("%02d", now.getDayOfMonth()); + String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day; + String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf"; +// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; +// String savePath = "/home/ruoyi/uploadPath/upload/"; + String saveName = fileName; + String savePath = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName; + + // 创建日期目录 + File saveFolder = new File(saveFolderPath); + if (!saveFolder.exists()) { + saveFolder.mkdirs(); + } + String resultFilePath = saveFolderPath + "/" + fileName; + File resultFilePathFile = new File(resultFilePath); + if (!resultFilePathFile.exists()) { + resultFilePathFile.createNewFile(); + } + + String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1); + boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath); + if (downLoadFile) { + // 先删除已经存在的调解书 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource())){ + List existAttach = msCaseAttachMapper.listCaseAttachByCaseIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + if(CollectionUtil.isNotEmpty(existAttach)){ + // todo 对接北明,同步案件状态,删除 + for (MsCaseAttach msCaseAttach : existAttach) { + if(StrUtil.isEmpty(msCaseAttach.getOtherSysFileId())||StrUtil.isEmpty(msCaseAttach.getAnnexPath())){ + continue; + } + beiMingInterfaceService.deleteAttachmentInfo(caseApplicationselect.getCaseNum(), msCaseAttach.getOtherSysFileId(), FileUtil.getName(msCaseAttach.getAnnexPath())); + } + } + } + msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAppliId, AnnexTypeEnum.MEDIATE_BOOK.getCode()); + MsCaseAttach caseAttach = new MsCaseAttach(); + caseAttach.setCaseAppliId(caseAppliId); + caseAttach.setAnnexType(AnnexTypeEnum.MEDIATE_BOOK.getCode()); + caseAttach.setAnnexPath(savePath); + caseAttach.setAnnexName(saveName); + caseAttachMapper.save(caseAttach); + // todo 对接北明,调用上传附件接口 + if(StrUtil.isEmpty(caseApplicationselect.getCaseSource()) ) { + String templatePath = "/home/ruoyi" + savePath; + File file = new File(templatePath.replace("/profile", "/uploadPath")); + MsCaseFileInfo caseFileInfo = beiMingInterfaceService.pushAttachmentInfo(BMUserName, BMPassword, file, BMSyncSource, caseApplicationselect.getCaseNum(), AttachmentOperateTypeEnum.ADD, DocumentTypeEnum.EVEDENT_AGREEMENT); + // 更新附件表 + if(caseFileInfo!=null && StrUtil.isNotEmpty(caseFileInfo.getFileId())){ + caseAttach.setOtherSysFileId(caseFileInfo.getFileId()); + msCaseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } + + } + } + + } + } + + @Override @Transactional(rollbackFor = Exception.class) public AjaxResult sealCheckCallback(String reqbodystr) throws EsignDemoException, IOException { diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java index 841af1f..ab44919 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/VideoConferenceServiceImpl.java @@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONArray; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.config.RuoYiConfig; @@ -13,6 +15,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.AttachmentOperateTypeEnum; import com.ruoyi.common.enums.DocumentTypeEnum; +import com.ruoyi.common.enums.SMSStatusEnum; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.PdfUtils; import com.ruoyi.common.utils.SecurityUtils; @@ -20,14 +23,18 @@ import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.service.impl.BeiMingInterfaceService; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.ReservedConference; +import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; +import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseFileInfo; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsReservedConferenceVO; +import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.ReservedConferenceMapper; +import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.service.mscase.VideoConferenceService; import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.exception.TencentCloudSDKException; @@ -45,12 +52,14 @@ import tk.mybatis.mapper.entity.Example; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import javax.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; +import static com.ruoyi.common.core.domain.AjaxResult.error; import static com.ruoyi.common.core.domain.AjaxResult.success; import static com.ruoyi.common.utils.file.FileUploadUtils.getAbsoluteFile; import static com.ruoyi.common.utils.file.FileUploadUtils.getPathFileName; @@ -80,6 +89,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { @Autowired private MsCaseAttachMapper caseAttachMapper; @Autowired + private MsCaseAffiliateMapper caseAffiliateMapper; + @Autowired private SysRoleMapper roleMapper; @Autowired private ReservedConferenceMapper reservedConferenceMapper; @@ -94,6 +105,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { private String BMSyncSource; @Autowired BeiMingInterfaceService beiMingInterfaceService; + @Autowired + private SmsRecordMapper smsRecordMapper; /** 视频回调 @@ -139,6 +152,83 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { return success("预约会议成功"); } + @Override + public void smsRollBack(String body, HttpServletRequest request) { + // 解析body + JSONArray jsonArray = JSONUtil.parseArray(body); + if (jsonArray != null && jsonArray.size() > 0) { + for (Object o : jsonArray) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(o); + if (jsonObject.get("sid") != null) { + Object description = jsonObject.get("description"); + System.out.println(description); + // 查询sid对应的短信,更新短信状态 + SmsSendRecord smsSendRecord = smsRecordMapper.selectBySId(jsonObject.getStr("sid")); + if (smsSendRecord != null) { + if (jsonObject.get("report_status") != null && jsonObject.getStr("report_status").equals("SUCCESS")) { + smsSendRecord.setSendStatus(SMSStatusEnum.SUCCESS.getCode()); + } else { + smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + smsSendRecord.setReason(description != null ? description.toString() : null); + } + smsRecordMapper.updateStatus(smsSendRecord); + } + } + } + } + } + + @Override + public AjaxResult selectRoleMenuByCaseId(Long caseId) { + AjaxResult result = success(); + // 根据案件id查询相关人员 + List msCaseAffiliates = caseAffiliateMapper.selectByCaseId(caseId); + if(CollectionUtil.isEmpty(msCaseAffiliates)){ + return error("未找到案件相关人员"); + } + Long userId = SecurityUtils.getUserId(); + if(userId==null){ + return error("未找到当前登录用户"); + } + for (MsCaseAffiliate affiliate : msCaseAffiliates) { + if(affiliate.getOperatorFlag()!=null && affiliate.getOperatorFlag()==1 && affiliate.getUserId()!=null&&affiliate.getUserId().equals(userId)&&affiliate.getRoleType()!=null){ + if(affiliate.getRoleType().equals(1)||affiliate.getRoleType().equals(2)){ + // 申请人操作人 + result.put("appFlag","1"); + } + if(affiliate.getRoleType().equals(3)||affiliate.getRoleType().equals(4)){ + // 被申请人操作人 + result.put("resFlag","1"); + } + } + } + return result; + } + + public static void main(String[] args) { + String body="[{\"mobile\":\"18792927508\",\"report_status\":\"FAIL\",\"description\":\"\\u8FD0\\u8425\\u5546\\u5173\\u952E\\u5B57\\u62E6\\u622A\",\"errmsg\":\"GB:0010\",\"user_receive_time\":\"2024-04-07 14:28:57\",\"sid\":\"9318:147045628317124713319032750\",\"nationcode\":\"86\"}]"; + JSONArray jsonArray = JSONUtil.parseArray(body); + if(jsonArray!=null && jsonArray.size()>0){ + for (Object o : jsonArray) { + cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(o); + if(jsonObject.get("sid")!=null){ + String reportStatus = jsonObject.getStr("report_status"); + String description = jsonObject.getStr("description"); + System.out.println(description); + // 查询sid对应的短信,更新短信状态 + // SmsSendRecord smsSendRecord= smsRecordMapper.selectBySId(jsonObject.getStr("sid")); + // if(smsSendRecord!=null){ + // if(jsonObject.get("report_status")!=null && jsonObject.getStr("report_status").equals("SUCCESS")){ + // smsSendRecord.setSendStatus(SMSStatusEnum.SUCCESS.getCode()); + // }else { + // smsSendRecord.setSendStatus(SMSStatusEnum.FAIL.getCode()); + // } + // } + } + } + } + } + /** * 根据案件id查询已预约的会议 * @@ -388,11 +478,11 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { if(caseApplication==null){ return AjaxResult.error("案件不存在"); } + List roles = roleMapper.selectRolePermissionByUserId(userId); JSONObject jsonObject = new JSONObject(); boolean isSecretaryRole=false; if(caseApplication.getMediatorId()!=null&& Objects.equals(userId, caseApplication.getMediatorId())){ // 是调解员 - List roles = roleMapper.selectRolePermissionByUserId(userId); if(CollectionUtil.isNotEmpty(roles)){ for (SysRole role : roles) { if("调解员".equals(role.getRoleName())){ @@ -401,6 +491,16 @@ public class VideoConferenceServiceImpl implements VideoConferenceService { } } } + }else { + // 是调解员 + if(CollectionUtil.isNotEmpty(roles)){ + for (SysRole role : roles) { + if("法律顾问".equals(role.getRoleName())){ + isSecretaryRole=true; + break; + } + } + } } jsonObject.put("isSecretaryRole",isSecretaryRole); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java index 76bbf20..3db8b3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java @@ -288,12 +288,12 @@ public class SignAward { } /** - * 发起签署 + * 发起带有用印签署 * * @return * @throws EsignDemoException */ - public static EsignHttpResponse createByFileMediation(SealSignRecord sealSignRecord ,List sealIdList) throws EsignDemoException { + public static EsignHttpResponse createByFileSeal(SealSignRecord sealSignRecord ,List sealIdList) throws EsignDemoException { String apiaddr = "/v3/sign-flow/create-by-file"; String fileId = sealSignRecord.getFileid(); @@ -488,6 +488,162 @@ public class SignAward { //发起接口请求 return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); } + /** + * 发起不带用印签署 + * + * @return + * @throws EsignDemoException + */ + public static EsignHttpResponse createByFileMediation(SealSignRecord sealSignRecord) throws EsignDemoException { + String apiaddr = "/v3/sign-flow/create-by-file"; + + String fileId = sealSignRecord.getFileid(); + String fileName = sealSignRecord.getFilename(); + + String psnAccount = sealSignRecord.getPensonAccount(); + String psnName = sealSignRecord.getPensonName(); + + String psnAccountRes = sealSignRecord.getPensonAccountRes(); + String psnNameRes = sealSignRecord.getPensonNameRes(); + + String psnAccountMedi = sealSignRecord.getPensonAccountMedi(); + String psnNameMedi = sealSignRecord.getPensonNameMedi(); + + + String positionPagepsn = sealSignRecord.getPositionPagepsn(); + double positionXpsn = sealSignRecord.getPositionXpsn(); + double positionYpsn = sealSignRecord.getPositionYpsn(); + + String positionPagepsnRes = sealSignRecord.getPositionPagepsnRes(); + double positionXpsnRes = sealSignRecord.getPositionXpsnRes(); + double positionYpsnRes = sealSignRecord.getPositionYpsnRes(); + + String positionPagepsnMedi = sealSignRecord.getPositionPagepsnMedi(); + double positionXpsnMedi = sealSignRecord.getPositionXpsnMedi(); + double positionYpsnMedi = sealSignRecord.getPositionYpsnMedi(); + + + String jsonParm = "{\n" + + " \"docs\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"fileName\": \"" + fileName + "\"\n" + + " }\n" + + " ],\n" + + " \"signFlowConfig\": {\n" + + " \"signFlowTitle\": \"测试合同\",\n" + + " \"autoStart\": true,\n" + + " \"authConfig\": {\n" + + " \"willingnessAuthModes\": [\n" + + " \"CODE_SMS\"\n" + + " ],\n" + + " \"psnAvailableAuthModes\": [\n" + + " \"PSN_MOBILE3\"\n" + + " ],\n" + + " \"orgAvailableAuthModes\": [\n" + + " \"ORG_LEGALREP\"\n" + + " ]\n" + + " },\n" + + + " \"signConfig\": {\n" + + " \"availableSignClientTypes\": \"1\"\n" + + " },\n" + +// " \"notifyUrl\": \"" + signSealCallbackUrl + "\",\n" + + " \"autoFinish\": true\n" + + " },\n" + + + " \"signers\": [\n" + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccount + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnName + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsn + "\",\n" + + " \"positionX\": " + positionXpsn + ",\n" + + " \"positionY\": " + positionYpsn + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " },\n" + + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccountRes + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnNameRes + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsnRes + "\",\n" + + " \"positionX\": " + positionXpsnRes + ",\n" + + " \"positionY\": " + positionYpsnRes + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " },\n" + + + + " {\n" + + " \"psnSignerInfo\": {\n" + + " \"psnAccount\": \"" + psnAccountMedi + "\",\n" + + " \"psnInfo\": {\n" + + " \"psnName\": \"" + psnNameMedi + "\"\n" + + " }\n" + + " },\n" + + " \"signFields\": [\n" + + " {\n" + + " \"fileId\": \"" + fileId + "\",\n" + + " \"normalSignFieldConfig\": {\n" + + " \"autoSign\": false,\n" + + " \"freeMode\": false,\n" + + " \"movableSignField\": false,\n" + + " \"signFieldPosition\": {\n" + + " \"positionPage\": \"" + positionPagepsnMedi + "\",\n" + + " \"positionX\": " + positionXpsnMedi + ",\n" + + " \"positionY\": " + positionYpsnMedi + "\n" + + " },\n" + + " \"signFieldStyle\": 1\n" + + " },\n" + + " \"signFieldType\": 0\n" + + " }\n" + + " ],\n" + + " \"signerType\": 0\n" + + " }\n" + + " ]\n" + + "}"; + + //请求方法 + EsignRequestType requestType = EsignRequestType.POST; + //生成请求签名鉴权方式的Header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false); + } /** * 发起签署 @@ -850,8 +1006,8 @@ public class SignAward { String apiaddr = "/v3/files/" + fileId + "/keyword-positions"; String jsonParm = "{\n" + " \"keywords\": [\n" + - " \"甲方(签字):\",\n" + - " \"乙方(签字):\",\n" + + " \"申请人(签字):\",\n" + + " \"被申请人(签字):\",\n" + " \"调解员(签字):\",\n" + " \"调解机构(盖章):\"\n" + " ]\n" + diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index ee6beed..5aa6050 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -230,4 +230,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ms_sys_dept set del_flag = '2' where dept_id = #{deptId} - \ No newline at end of file + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 3f1441b..1e24c66 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -182,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from ms_sys_user u left join ms_sys_user_role ur on u.user_id = ur.user_id left join ms_sys_role r on r.role_id = ur.role_id - where u.eamil = #{eamil} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 + where u.email = #{email} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1 - select id ,case_appli_id ,case_num ,phone ,send_time ,send_content,send_status + select * from ms_sms_send_record @@ -76,5 +82,14 @@ order by send_time desc + + + + + update ms_sms_send_record + set send_status= #{sendStatus} ,reason=#{reason} where sid=#{sid} +