畅写
This commit is contained in:
		| @ -122,12 +122,12 @@ security: | ||||
|     - /warm-flow-ui/** | ||||
|     - /warm-flow/** | ||||
|     - /other/ys7Device/webhook | ||||
|     # todo 仅测试 | ||||
|     - /facility/matrix/** | ||||
|     - /**/changxie/callback/** | ||||
|     - /progress/progressPlanDetail/insert/numberAI | ||||
|     - /gps/equipment/dataAcceptance | ||||
|     - /resource/oss/upload | ||||
|     - /progress/progressPlanDetail/insert/numberAI | ||||
|     # todo 仅测试 | ||||
|     - /facility/matrix/** | ||||
|  | ||||
| # 多租户配置 | ||||
| tenant: | ||||
|  | ||||
| @ -2,10 +2,13 @@ package org.dromara.test; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.io.FileUtil; | ||||
| import cn.hutool.core.util.IdcardUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import jakarta.annotation.Resource; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.dromara.common.utils.IdCardEncryptorUtil; | ||||
| import org.dromara.contractor.domain.SubConstructionUser; | ||||
| import org.dromara.contractor.service.ISubConstructionUserService; | ||||
| import org.dromara.contractor.service.ISubUserSalaryDetailService; | ||||
| @ -63,6 +66,24 @@ public class DemoTest { | ||||
|     @Resource | ||||
|     private ISubUserSalaryDetailService userSalaryDetailService; | ||||
|  | ||||
|     @Resource | ||||
|     private IdCardEncryptorUtil idCardEncryptorUtil; | ||||
|  | ||||
|     @Test | ||||
|     void setIdCardEncryptorUtil() { | ||||
|         List<SubConstructionUser> list = constructionUserService.list(); | ||||
|         List<SubConstructionUser> update = list.stream().filter(user -> StringUtils.isNotBlank(user.getSfzNumber())) | ||||
|             .filter(user -> IdcardUtil.isValidCard18(user.getSfzNumber())) | ||||
|             .toList().stream() | ||||
|             .map(user -> { | ||||
|                 SubConstructionUser updateUser = new SubConstructionUser(); | ||||
|                 updateUser.setId(user.getId()); | ||||
|                 updateUser.setSfzNumber(idCardEncryptorUtil.encrypt(user.getSfzNumber())); | ||||
|                 return updateUser; | ||||
|             }).toList(); | ||||
|         constructionUserService.updateBatchById(update); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|     void test() { | ||||
|         Boolean result = photovoltaicPanelPartsService | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package org.dromara.safety.controller; | ||||
|  | ||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | ||||
| import jakarta.servlet.http.HttpServletRequest; | ||||
| import jakarta.servlet.http.HttpServletResponse; | ||||
| import jakarta.validation.constraints.NotEmpty; | ||||
| import jakarta.validation.constraints.NotNull; | ||||
| @ -105,4 +106,13 @@ public class HseSafetyWeeklyReportController extends BaseController { | ||||
|                           @PathVariable Long[] ids) { | ||||
|         return toAjax(safetyWeeklyReportService.deleteWithValidByIds(List.of(ids), true)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 畅写在线修改保存回调 | ||||
|      */ | ||||
|     @PostMapping("/changxie/callback/{id}") | ||||
|     public void singleFileUploads(@NotNull(message = "主键不能为空") | ||||
|                                   @PathVariable Long id, HttpServletRequest request, HttpServletResponse response) { | ||||
|         safetyWeeklyReportService.singleFileUploads(id, request, response); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -64,7 +64,22 @@ public class HseSafetyWeeklyReportVo implements Serializable { | ||||
|     /** | ||||
|      * 文件位置 | ||||
|      */ | ||||
|     private String pathUrl; | ||||
|     private String fileUrl; | ||||
|  | ||||
|     /** | ||||
|      * 文件路径 | ||||
|      */ | ||||
|     private String filePath; | ||||
|  | ||||
|     /** | ||||
|      * 文件后缀 | ||||
|      */ | ||||
|     private String fileSuffix; | ||||
|  | ||||
|     /** | ||||
|      * 文件名 | ||||
|      */ | ||||
|     private String fileName; | ||||
|  | ||||
|     /** | ||||
|      * 备注 | ||||
|  | ||||
| @ -3,6 +3,8 @@ package org.dromara.safety.service; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.IService; | ||||
| import jakarta.servlet.http.HttpServletRequest; | ||||
| import jakarta.servlet.http.HttpServletResponse; | ||||
| import org.dromara.common.mybatis.core.page.PageQuery; | ||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||
| import org.dromara.safety.domain.HseSafetyWeeklyReport; | ||||
| @ -96,4 +98,12 @@ public interface IHseSafetyWeeklyReportService extends IService<HseSafetyWeeklyR | ||||
|      */ | ||||
|     Page<HseSafetyWeeklyReportVo> getVoPage(Page<HseSafetyWeeklyReport> safetyWeeklyReportPage); | ||||
|  | ||||
|     /** | ||||
|      * 畅写回调 | ||||
|      * | ||||
|      * @param id       主键 | ||||
|      * @param request  请求 | ||||
|      * @param response 响应 | ||||
|      */ | ||||
|     void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response); | ||||
| } | ||||
|  | ||||
| @ -31,7 +31,6 @@ import org.dromara.project.domain.BusProjectTeamMember; | ||||
| import org.dromara.project.service.IBusProjectService; | ||||
| import org.dromara.project.service.IBusProjectTeamMemberService; | ||||
| import org.dromara.project.service.IBusProjectTeamService; | ||||
| import org.dromara.quality.domain.QltQualityInspection; | ||||
| import org.dromara.safety.constant.HseSafetyConstant; | ||||
| import org.dromara.safety.domain.HseSafetyInspection; | ||||
| import org.dromara.safety.domain.HseTeamMeeting; | ||||
| @ -514,7 +513,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect | ||||
|         updateRecord.setId(id); | ||||
|         updateRecord.setReviewTime(new Date()); | ||||
|         updateRecord.setStatus(HseSafetyInspectionStatusEnum.REVIEW.getValue()); | ||||
|         if("2".equals(req.getReviewType())){ | ||||
|         if ("2".equals(req.getReviewType())) { | ||||
|             handleFail(req.getId()); | ||||
|         } | ||||
|         // 操作数据库 | ||||
| @ -529,7 +528,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect | ||||
|         add.setRectificationTime(null); | ||||
|         add.setRectificationFile(null); | ||||
|         add.setMeasure(null); | ||||
|         add.setVersion(add.getVersion()+1); | ||||
|         add.setVersion(add.getVersion() + 1); | ||||
|         save(add); | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -1,11 +1,15 @@ | ||||
| package org.dromara.safety.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.json.JSONObject; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||
| import jakarta.annotation.Resource; | ||||
| import jakarta.servlet.http.HttpServletRequest; | ||||
| import jakarta.servlet.http.HttpServletResponse; | ||||
| import org.dromara.common.core.constant.HttpStatus; | ||||
| import org.dromara.common.core.exception.ServiceException; | ||||
| import org.dromara.common.core.utils.ObjectUtils; | ||||
| @ -26,8 +30,11 @@ import org.springframework.beans.BeanUtils; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
|  | ||||
| import java.io.IOException; | ||||
| import java.io.PrintWriter; | ||||
| import java.util.Collection; | ||||
| import java.util.List; | ||||
| import java.util.Scanner; | ||||
|  | ||||
| /** | ||||
|  * 安全周报Service业务层处理 | ||||
| @ -179,7 +186,10 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl | ||||
|         String path = safetyWeeklyReport.getPath(); | ||||
|         if (StringUtils.isNotBlank(path)) { | ||||
|             SysOssVo ossVo = ossService.getById(Long.valueOf(path)); | ||||
|             safetyWeeklyReportVo.setPathUrl(ossVo.getUrl()); | ||||
|             safetyWeeklyReportVo.setFileUrl(ossVo.getUrl()); | ||||
|             safetyWeeklyReportVo.setFilePath(ossVo.getFileName()); | ||||
|             safetyWeeklyReportVo.setFileSuffix(ossVo.getFileSuffix()); | ||||
|             safetyWeeklyReportVo.setFileName(ossVo.getOriginalName()); | ||||
|         } | ||||
|         return safetyWeeklyReportVo; | ||||
|     } | ||||
| @ -238,4 +248,33 @@ public class HseSafetyWeeklyReportServiceImpl extends ServiceImpl<HseSafetyWeekl | ||||
|         safetyWeeklyReportVoPage.setRecords(safetyWeeklyReportVoList); | ||||
|         return safetyWeeklyReportVoPage; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 畅写回调 | ||||
|      * | ||||
|      * @param id       主键 | ||||
|      * @param request  请求 | ||||
|      * @param response 响应 | ||||
|      */ | ||||
|     @Override | ||||
|     public void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response) { | ||||
|         try { | ||||
|             PrintWriter writer = response.getWriter(); | ||||
|             Scanner scanner = new Scanner(request.getInputStream(), "GBK").useDelimiter("\\A"); | ||||
|             String body = scanner.hasNext() ? scanner.next() : ""; | ||||
|             JSONObject jsonObj = JSONUtil.parseObj(body); | ||||
|             if (jsonObj.getInt("status") == 2 || jsonObj.getInt("status") == 6) { | ||||
|                 String downloadUri = (String) jsonObj.get("url"); | ||||
|                 HseSafetyWeeklyReport document = this.getById(id); | ||||
|                 String filePath = document.getPath(); | ||||
|                 SysOssVo ossVo = ossService.getById(Long.valueOf(filePath)); | ||||
|                 ossService.uploadFileUrlWithNoSave(downloadUri, ossVo.getFileName()); | ||||
|             } else if (jsonObj.getInt("status") == 3 || jsonObj.getInt("status") == 7) { | ||||
|                 writer.write("{\"error\":-1}"); | ||||
|             } | ||||
|             writer.write("{\"error\":0}"); | ||||
|         } catch (IOException e) { | ||||
|             throw new ServiceException("安全周报在线修改文件失败," + e); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user