日报
This commit is contained in:
@ -2,6 +2,7 @@ package org.dromara.progress.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
@ -102,4 +103,15 @@ public class PgsProcessDailyReportController extends BaseController {
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(pgsProcessDailyReportService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 畅写在线修改保存回调
|
||||
*/
|
||||
@PostMapping("/changxie/callback/{id}")
|
||||
public void singleFileUploads(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id, HttpServletRequest request, HttpServletResponse response) {
|
||||
pgsProcessDailyReportService.singleFileUploads(id, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package org.dromara.progress.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.progress.domain.vo.PgsProcessDailyReportVo;
|
||||
import org.dromara.progress.domain.bo.PgsProcessDailyReportBo;
|
||||
import org.dromara.progress.domain.PgsProcessDailyReport;
|
||||
@ -67,4 +69,13 @@ public interface IPgsProcessDailyReportService extends IService<PgsProcessDailyR
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 畅写回调
|
||||
*
|
||||
* @param id 主键
|
||||
* @param request 请求
|
||||
* @param response 响应
|
||||
*/
|
||||
void singleFileUploads(Long id, HttpServletRequest request, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
package org.dromara.progress.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -9,6 +14,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.safety.domain.HseSafetyWeeklyReport;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.progress.domain.bo.PgsProcessDailyReportBo;
|
||||
import org.dromara.progress.domain.vo.PgsProcessDailyReportVo;
|
||||
@ -16,9 +24,12 @@ import org.dromara.progress.domain.PgsProcessDailyReport;
|
||||
import org.dromara.progress.mapper.PgsProcessDailyReportMapper;
|
||||
import org.dromara.progress.service.IPgsProcessDailyReportService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
* 进度日报Service业务层处理
|
||||
@ -32,6 +43,8 @@ public class PgsProcessDailyReportServiceImpl extends ServiceImpl<PgsProcessDail
|
||||
|
||||
private final PgsProcessDailyReportMapper baseMapper;
|
||||
|
||||
private final ISysOssService ossService;
|
||||
|
||||
/**
|
||||
* 查询进度日报
|
||||
*
|
||||
@ -132,4 +145,25 @@ public class PgsProcessDailyReportServiceImpl extends ServiceImpl<PgsProcessDail
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@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");
|
||||
PgsProcessDailyReport byId = this.getById(id);
|
||||
SysOssVo ossVo = ossService.getById(byId.getOssId());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.safety.domain.HseSafetyInspection;
|
||||
import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
|
||||
/**
|
||||
* 安全巡检工单Mapper接口
|
||||
@ -12,4 +17,6 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface HseSafetyInspectionMapper extends BaseMapperPlus<HseSafetyInspection, HseSafetyInspectionVo> {
|
||||
|
||||
Page<HseSafetyInspection> webPage(@Param("page")Page<HseSafetyInspection> page, @Param(Constants.WRAPPER) Wrapper<HseSafetyInspection> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@ -4,4 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseSafetyInspectionMapper">
|
||||
|
||||
|
||||
<select id="webPage" resultType="org.dromara.safety.domain.HseSafetyInspection">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user