| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.business.third.SignService; |
| | | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | @Autowired |
| | | private ApplyChangeJoinMapper applyChangeJoinMapper; |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private SignService signService; |
| | | @Autowired |
| | | private ApplyChagneDetailJoinMapper applyChagneDetailJoinMapper; |
| | | |
| | |
| | | model.setChangeNum(model.getChangeDetailList().size()); |
| | | return model; |
| | | } |
| | | /** |
| | | * 导出换厂申请表 |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getSignLinkJiajiabao(ApplyChange param){ |
| | | ApplyChange model = exportJiajianBaoExcel(param); |
| | | return getOnlineSignLink(model); |
| | | } |
| | | /** |
| | | * 导出换厂申请表 |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getSignLinkChangeUnit(ApplyChange param){ |
| | | ApplyChange model = exportChangeUnitExcel(param); |
| | | return getOnlineSignLink(model); |
| | | } |
| | | |
| | | private String getOnlineSignLink(ApplyChange model) { |
| | | if(Objects.isNull(model) ||! Constants.equalsInteger(Constants.ZERO,model.getType())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | if(!Constants.equalsInteger(Constants.ZERO,model.getStatus())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该申请状态已流转,当前不支持签章操作!"); |
| | | } |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Company company = user.getCompany(); |
| | | if(company== null || StringUtils.isBlank( company.getEmail()) || !Constants.equalsInteger(company.getSignStatus(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,企业尚未具备在线签章条件,请联系平台管理员确认~"); |
| | | } |
| | | |
| | | String fileUrl = ExcelExporter.build(ApplyChange.class).exportChangeUnitExcelToPdf(model,"缓存申请表"); |
| | | String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode(); |
| | | notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString()); |
| | | String applyNo = signService.applySignLocalFile(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),null,company.getSignId(),notifyUrl); |
| | | if(StringUtils.isBlank(applyNo) ){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!"); |
| | | } |
| | | String link = signService.signLink(applyNo,company.getName(),company.getCode()); |
| | | if(StringUtils.isBlank(link) ){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!"); |
| | | } |
| | | ApplyChange update= new ApplyChange(); |
| | | update.setId(model.getId()); |
| | | update.setEditor(user.getId()); |
| | | update.setEditDate(new Date()); |
| | | update.setSignApplyNo(applyNo); |
| | | applyChangeMapper.updateById(update); |
| | | return link; |
| | | } |
| | | |
| | | |
| | | /** |