文件资源上传至管理平台接口

This commit is contained in:
1378012178@qq.com 2025-10-09 14:50:44 +08:00
parent b98901dd35
commit 1beafa4faf
19 changed files with 309 additions and 124 deletions

View File

@ -16,5 +16,5 @@ public interface IOrgApplyInfoApi {
IPage<OrgAllInfoApiEntity> queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title); IPage<OrgAllInfoApiEntity> queryOrgAllInfo(Integer pageNo, Integer pageSize, String orgCode, String title);
List<OrgAllInfoApiEntity> getOrgByOpenId(String id,String status,String openId,String invited); List<OrgAllInfoApiEntity> getOrgByOpenId(String id, String status, String openId, String invited, String izHistory);
} }

View File

@ -310,4 +310,7 @@ public class OrgAllInfoApiEntity implements Serializable {
*/ */
private String modifyState; private String modifyState;
//0历史数据 1当前数据
private String izHistory;
} }

View File

@ -69,6 +69,25 @@ public class NuEmployeesAdvisoryInfoServiceImpl extends ServiceImpl<NuEmployeesA
EmployeesOrg employeesOrg = new EmployeesOrg(); EmployeesOrg employeesOrg = new EmployeesOrg();
employeesOrg.setModifyStatus("1"); employeesOrg.setModifyStatus("1");
employeesOrgService.update(employeesOrg,uw); employeesOrgService.update(employeesOrg,uw);
uw = new UpdateWrapper<EmployeesOrg>();
uw.eq("employees_id",dto.getId());
// uw.eq("iz_history","1");
uw.eq("org_code",dto.getOrgCode());
employeesOrg = new EmployeesOrg();
employeesOrg.setIzHistory("0");
employeesOrgService.update(employeesOrg,uw);
//插入数据
EmployeesOrg emAdd = new EmployeesOrg();
BeanUtils.copyProperties(dto, emAdd);
emAdd.setId(null);
emAdd.setEmployeesId(dto.getId());
emAdd.setIzHistory("1");
emAdd.setModifyStatus("1");
emAdd.setStatus("1");
emAdd.setApplyType("2");
employeesOrgService.save(emAdd);
//更新员工信息需要有审核流程 审核通过后才修改正式数据 //更新员工信息需要有审核流程 审核通过后才修改正式数据
//通知业务平台有员工信息变更 //通知业务平台有员工信息变更
EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto(); EmployeesApplyMQDto mqdto = new EmployeesApplyMQDto();

View File

@ -32,7 +32,7 @@
and billinfo.elder_id = #{dto.elderId} and billinfo.elder_id = #{dto.elderId}
</if> </if>
<if test="dto.nuId != null and dto.nuId != ''"> <if test="dto.nuId != null and dto.nuId != ''">
and billinfo.nu_id = #{nuId} and billinfo.nu_id = #{dto.nuId}
</if> </if>
</where> </where>
order by billinfo.create_time desc order by billinfo.create_time desc

View File

@ -192,4 +192,6 @@ public class OrgAllInfo implements Serializable {
private String auditTime; private String auditTime;
/**信息修改状态 空:没提交过修改 1修改申请中 2通过 3驳回*/ /**信息修改状态 空:没提交过修改 1修改申请中 2通过 3驳回*/
private String modifyState; private String modifyState;
//0历史数据 1当前数据
private String izHistory;
} }

View File

@ -20,5 +20,5 @@ public interface OrgApplyInfoMapper extends BaseMapper<OrgApplyInfo> {
IPage<OrgAllInfo> queryOrgInfo(@Param("page") IPage<OrgAllInfo> page, @Param("orgCode") String orgCode, @Param("title") String title); IPage<OrgAllInfo> queryOrgInfo(@Param("page") IPage<OrgAllInfo> page, @Param("orgCode") String orgCode, @Param("title") String title);
IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, @Param("id") String id, @Param("openId") String openId, @Param("status") String status, @Param("invited") String invited); IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, @Param("id") String id, @Param("openId") String openId, @Param("status") String status, @Param("invited") String invited, @Param("izHistory") String izHistory);
} }

View File

@ -92,7 +92,8 @@
eo.entry_time, eo.entry_time,
eo.create_time AS apply_time, eo.create_time AS apply_time,
eo.update_time AS audit_time, eo.update_time AS audit_time,
eo.modify_status AS modify_state eo.modify_status AS modify_state,
eo.iz_history
from sys_depart d from sys_depart d
inner join nu_org_apply_info o on d.id = o.pk_id inner join nu_org_apply_info o on d.id = o.pk_id
inner join nu_biz_employees_org eo on d.org_code = eo.org_code inner join nu_biz_employees_org eo on d.org_code = eo.org_code
@ -100,7 +101,9 @@
o.status = '2' o.status = '2'
and d.del_flag = '0' and d.del_flag = '0'
AND eo.open_id = #{openId} AND eo.open_id = #{openId}
AND eo.iz_history = '1' <if test="izHistory != null and izHistory != ''">
and eo.iz_history = #{izHistory}
</if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and eo.status in and eo.status in
<foreach collection="status.split(',')" item="item" open="(" separator="," close=")"> <foreach collection="status.split(',')" item="item" open="(" separator="," close=")">
@ -108,28 +111,32 @@
</foreach> </foreach>
</if> </if>
<if test="invited !=null and invited != ''"> <if test="invited !=null and invited != ''">
and eo.apply_type = #{invited} and eo.apply_type in
<foreach collection="invited.split(',')" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="id !=null and id != ''"> <if test="id !=null and id != ''">
and eo.id = #{id} and eo.id = #{id}
</if> </if>
</where> </where>
<choose> order by eo.create_time DESC
<when test='status != null and status == "2"'>
ORDER BY (d.org_code + 0) ASC
</when>
<otherwise>
ORDER BY
eo.iz_history desc,
CASE eo.status
WHEN '2' THEN 1
WHEN '1' THEN 2
WHEN '3' THEN 3
ELSE 4
END,
eo.create_time DESC
</otherwise>
</choose>
</select> </select>
<!-- <choose>-->
<!-- <when test='status != null and status == "2"'>-->
<!-- ORDER BY (d.org_code + 0) ASC-->
<!-- </when>-->
<!-- <otherwise>-->
<!-- ORDER BY-->
<!-- eo.iz_history desc,-->
<!-- CASE eo.status-->
<!-- WHEN '2' THEN 1-->
<!-- WHEN '1' THEN 2-->
<!-- WHEN '3' THEN 3-->
<!-- ELSE 4-->
<!-- END,-->
<!-- eo.create_time DESC-->
<!-- </otherwise>-->
<!-- </choose>-->
</mapper> </mapper>

View File

@ -348,7 +348,7 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
@Override @Override
public IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, String openId) { public IPage<OrgAllInfo> getOrgByOpenId(IPage<OrgAllInfo> page, String openId) {
return baseMapper.getOrgByOpenId(page, null, openId, "2", null); return baseMapper.getOrgByOpenId(page, null, openId, "2", null, null);
} }
@Override @Override
@ -372,9 +372,9 @@ public class OrgApplyInfoServiceImpl extends ServiceImpl<OrgApplyInfoMapper, Org
} }
@Override @Override
public List<OrgAllInfoApiEntity> getOrgByOpenId(String id, String status, String openId, String invited) { public List<OrgAllInfoApiEntity> getOrgByOpenId(String id, String status, String openId, String invited, String izHistory) {
IPage<OrgAllInfo> page = new Page<>(1, -1); IPage<OrgAllInfo> page = new Page<>(1, -1);
IPage<OrgAllInfo> r_ = baseMapper.getOrgByOpenId(page, id, openId, status, invited); IPage<OrgAllInfo> r_ = baseMapper.getOrgByOpenId(page, id, openId, status, invited, izHistory);
List<OrgAllInfo> records = r_.getRecords(); List<OrgAllInfo> records = r_.getRecords();
List<OrgAllInfoApiEntity> result = BeanUtil.copyToList(records, OrgAllInfoApiEntity.class); List<OrgAllInfoApiEntity> result = BeanUtil.copyToList(records, OrgAllInfoApiEntity.class);
return result; return result;

View File

@ -356,6 +356,15 @@ public class EmployeesMQListener {
EmployeesOrg eo = new EmployeesOrg(); EmployeesOrg eo = new EmployeesOrg();
eo.setModifyStatus("2"); eo.setModifyStatus("2");
employeesOrgService.update(eo, uw); employeesOrgService.update(eo, uw);
uw = new UpdateWrapper<>();
uw.eq("employees_id", dto.getEmployeeId());
uw.eq("org_code", dto.getOrgCode());
uw.eq("iz_history", "1");
eo = new EmployeesOrg();
eo.setStatus("2");
employeesOrgService.update(eo, uw);
//修改员工咨询表信息 //修改员工咨询表信息
NuEmployeesAdvisoryInfo employeeInfo = new NuEmployeesAdvisoryInfo(); NuEmployeesAdvisoryInfo employeeInfo = new NuEmployeesAdvisoryInfo();
BeanUtils.copyProperties(dto, employeeInfo); BeanUtils.copyProperties(dto, employeeInfo);
@ -399,6 +408,15 @@ public class EmployeesMQListener {
EmployeesOrg eo = new EmployeesOrg(); EmployeesOrg eo = new EmployeesOrg();
eo.setModifyStatus("3"); eo.setModifyStatus("3");
employeesOrgService.update(eo, uw); employeesOrgService.update(eo, uw);
uw = new UpdateWrapper<>();
uw.eq("employees_id", dto.getEmployeeId());
uw.eq("org_code", dto.getOrgCode());
uw.eq("iz_history", "1");
eo = new EmployeesOrg();
eo.setStatus("3");
eo.setAuditContent(dto.getAuditContent());
employeesOrgService.update(eo, uw);
} }
//增加机构邀请员工的消息通知 //增加机构邀请员工的消息通知

View File

@ -1,13 +1,12 @@
package com.nu.modules.common; package com.nu.modules.common;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.nu.entity.SysUploadPreEntity;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI; import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 通用接口 * 通用接口
@ -21,31 +20,35 @@ public class NuCommonApi {
@Autowired @Autowired
private ISysBaseAPI sysBaseAPI; private ISysBaseAPI sysBaseAPI;
@Autowired
private RedisUtil redisUtil;
/** /**
* 获取机构信息 * 获取机构信息
*
* @param orgCode 机构编码 * @param orgCode 机构编码
* @return * @return
*/ */
@GetMapping("/getOrgInfo") @GetMapping("/getOrgInfo")
public Result<JSONObject> getOrgInfo(@RequestParam("orgCode") String orgCode){ public Result<JSONObject> getOrgInfo(@RequestParam("orgCode") String orgCode) {
return Result.ok(sysBaseAPI.getOrgInfo(orgCode)); return Result.ok(sysBaseAPI.getOrgInfo(orgCode));
} }
//获取标准指令库机构信息 //获取标准指令库机构信息
@GetMapping("/getDMOrgInfo") @GetMapping("/getDMOrgInfo")
public Result<JSONObject> getDMOrgInfo(){ public Result<JSONObject> getDMOrgInfo() {
return Result.ok(sysBaseAPI.getDMOrgInfo()); return Result.ok(sysBaseAPI.getDMOrgInfo());
} }
//获取长者标准标签库机构信息 //获取长者标准标签库机构信息
@GetMapping("/getETMOrgInfo") @GetMapping("/getETMOrgInfo")
public Result<JSONObject> getETMOrgInfo(){ public Result<JSONObject> getETMOrgInfo() {
return Result.ok(sysBaseAPI.getETMOrgInfo()); return Result.ok(sysBaseAPI.getETMOrgInfo());
} }
/** /**
* 根据父id查询对应省/ 列表 * 根据父id查询对应省/ 列表
*
* @param id 父id * @param id 父id
* @return 列表 * @return 列表
*/ */
@ -56,6 +59,7 @@ public class NuCommonApi {
/** /**
* 根据id查询对应省市区县信息 * 根据id查询对应省市区县信息
*
* @param id * @param id
* @return 对应的一条数据 * @return 对应的一条数据
*/ */
@ -63,4 +67,18 @@ public class NuCommonApi {
public Result<Object> queryAreaNameById(@RequestParam("id") String id) { public Result<Object> queryAreaNameById(@RequestParam("id") String id) {
return Result.ok(sysBaseAPI.queryAreaNameById(id)); return Result.ok(sysBaseAPI.queryAreaNameById(id));
} }
/**
* 上传资源前置方法存储必要信息用于后续验证
*
* @param dto
* @return 对应的一条数据
*/
@PostMapping("/saveFileType")
public Result<?> saveFileType(@RequestBody SysUploadPreEntity dto) {
String fileName = dto.getFileName();
String fileSize = dto.getFileSize();
redisUtil.sSet("canuploadparams", fileName + "-" + fileSize);
return Result.ok(200);
}
} }

View File

@ -110,8 +110,12 @@ public class EmployessApplyApi {
* @return * @return
*/ */
@GetMapping(value = "/getEmployeesOrgRela") @GetMapping(value = "/getEmployeesOrgRela")
public Result<List<OrgAllInfoApiEntity>> getEmployeesOrgRela(@RequestParam(value = "id", required = false) String id, @RequestParam(value = "status", required = false) String status, @RequestParam(value = "invited", required = false) String invited, @RequestParam(value = "openId") String openId) { public Result<List<OrgAllInfoApiEntity>> getEmployeesOrgRela(@RequestParam(value = "id", required = false) String id,
List<OrgAllInfoApiEntity> result = orgApplyInfoApi.getOrgByOpenId(id, status, openId, invited); @RequestParam(value = "status", required = false) String status,
@RequestParam(value = "invited", required = false) String invited,
@RequestParam(value = "openId") String openId,
@RequestParam(value = "izHistory", required = false) String izHistory) {
List<OrgAllInfoApiEntity> result = orgApplyInfoApi.getOrgByOpenId(id, status, openId, invited, izHistory);
return Result.OK(result); return Result.OK(result);
} }

View File

@ -69,7 +69,7 @@ public class NuBaseInfoApi {
* @return * @return
*/ */
@GetMapping("/queryBillList") @GetMapping("/queryBillList")
public Result<List<NuBillEntity>> queryBillList(@RequestParam("openId") String openId, @RequestParam("orgCode") String orgCode) { public Result<List<NuBillEntity>> queryBillList(@RequestParam("openId") String openId, @RequestParam("nuId") String nuId, @RequestParam("orgCode") String orgCode) {
//护理单元信息 //护理单元信息
// List<NuBaseElderEntity> nuElderList = nuBaseElderApi.queryByOpenId(openId, null); // List<NuBaseElderEntity> nuElderList = nuBaseElderApi.queryByOpenId(openId, null);
// if (nuElderList == null || nuElderList.size() == 0) { // if (nuElderList == null || nuElderList.size() == 0) {
@ -93,6 +93,7 @@ public class NuBaseInfoApi {
DynamicDataSourceContextHolder.push(orgCode); DynamicDataSourceContextHolder.push(orgCode);
NuBillEntity params = new NuBillEntity(); NuBillEntity params = new NuBillEntity();
params.setOpenId(openId); params.setOpenId(openId);
params.setNuId(nuId);
List<NuBillEntity> list = nuBillApi.queryByOpenId(params); List<NuBillEntity> list = nuBillApi.queryByOpenId(params);
// if (list == null || list.size() == 0) { // if (list == null || list.size() == 0) {
// continue; // continue;

View File

@ -110,6 +110,8 @@ public class ShiroConfig {
//filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token //filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
//filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token //filterChainDefinitionMap.put("/sys/common/download/**", "anon");//文件下载不限制token
filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件 filterChainDefinitionMap.put("/generic/**", "anon");//pdf预览需要文件
filterChainDefinitionMap.put("/api/common/saveFileType", "anon");//上传文件前调用的前置接口存储文件信息用于验证
filterChainDefinitionMap.put("/sys/common/static/upload/export", "anon");//上传暴露接口
filterChainDefinitionMap.put("/sys/dict/getDictItems/**", "anon");//获取字典数据 filterChainDefinitionMap.put("/sys/dict/getDictItems/**", "anon");//获取字典数据
filterChainDefinitionMap.put("/sys/sysDepart/queryInstitutionsList", "anon");//授权接口排除 filterChainDefinitionMap.put("/sys/sysDepart/queryInstitutionsList", "anon");//授权接口排除

View File

@ -0,0 +1,19 @@
package com.nu.entity;
import lombok.Data;
import java.io.Serializable;
/**
* @Description: 文件上传前置参数
* @Author: zmy
* @Date: 2025-10-9 09:26:22
* @Version: V1.0
*/
@Data
public class SysUploadPreEntity implements Serializable {
private String fileName;
private String fileSubfix;
private String fileSize;
}

View File

@ -143,18 +143,18 @@ public class ElderTagController extends JeecgController<ElderTag, IElderTagServi
public Result<Map> syncElderTag(@RequestParam(name = "sourceOrgCode") String sourceOrgCode, @RequestBody ElderTagSyncDto dto) { public Result<Map> syncElderTag(@RequestParam(name = "sourceOrgCode") String sourceOrgCode, @RequestBody ElderTagSyncDto dto) {
//处理接口地址 //处理接口地址
String fullPath = ""; String fullPath = "";
if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) { // if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) {
JSONObject deptInfo = elderTagService.getDeptInfo("master", sourceOrgCode); // JSONObject deptInfo = elderTagService.getDeptInfo("master", sourceOrgCode);
String url = deptInfo.getString("url"); // String url = deptInfo.getString("url");
String contextPath = deptInfo.getString("contextPath"); // String contextPath = deptInfo.getString("contextPath");
String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url; // String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
String normalizedContextPath = contextPath.startsWith("/") ? contextPath : "/" + contextPath; // String normalizedContextPath = contextPath.startsWith("/") ? contextPath : "/" + contextPath;
normalizedContextPath = normalizedContextPath.endsWith("/") // normalizedContextPath = normalizedContextPath.endsWith("/")
? normalizedContextPath.substring(0, normalizedContextPath.length() - 1) // ? normalizedContextPath.substring(0, normalizedContextPath.length() - 1)
: normalizedContextPath; // : normalizedContextPath;
//接口协议域名上下文路径 // //接口协议域名上下文路径
fullPath = baseUrl + normalizedContextPath; // fullPath = baseUrl + normalizedContextPath;
} // }
//同步-新增服务指令 //同步-新增服务指令
if (StringUtils.isNotBlank(dto.getSyncIds())) { if (StringUtils.isNotBlank(dto.getSyncIds())) {

View File

@ -126,7 +126,7 @@ public class ElderTaggMQListener {
extend.put("orgCode", dto.getOrgCode()); extend.put("orgCode", dto.getOrgCode());
extend.put("dataId", dto.getId()); extend.put("dataId", dto.getId());
wxNoticeEntity.setExtend(JSONObject.toJSONString(extend)); wxNoticeEntity.setExtend(JSONObject.toJSONString(extend));
wxNoticeEntity.setClientType(WxClientType.EMPLOYEE.getCode()); wxNoticeEntity.setClientType(WxClientType.ELDER.getCode());
wxNoticeApi.addNotice(wxNoticeEntity); wxNoticeApi.addNotice(wxNoticeEntity);
wxNoticeApi.sendWechartMinMessage(wxNoticeEntity); wxNoticeApi.sendWechartMinMessage(wxNoticeEntity);
} }
@ -143,7 +143,7 @@ public class ElderTaggMQListener {
extend.put("orgCode", dto.getOrgCode()); extend.put("orgCode", dto.getOrgCode());
extend.put("dataId", dto.getId()); extend.put("dataId", dto.getId());
wxNoticeEntity.setExtend(JSONObject.toJSONString(extend)); wxNoticeEntity.setExtend(JSONObject.toJSONString(extend));
wxNoticeEntity.setClientType(WxClientType.EMPLOYEE.getCode()); wxNoticeEntity.setClientType(WxClientType.ELDER.getCode());
wxNoticeApi.addNotice(wxNoticeEntity); wxNoticeApi.addNotice(wxNoticeEntity);
wxNoticeApi.sendWechartMinMessage(wxNoticeEntity); wxNoticeApi.sendWechartMinMessage(wxNoticeEntity);
} }
@ -168,7 +168,7 @@ public class ElderTaggMQListener {
extend.put("orgCode", dto.getOrgCode()); extend.put("orgCode", dto.getOrgCode());
extend.put("dataId", dto.getId()); extend.put("dataId", dto.getId());
wxNoticeEntity.setExtend(JSONObject.toJSONString(extend)); wxNoticeEntity.setExtend(JSONObject.toJSONString(extend));
wxNoticeEntity.setClientType(WxClientType.EMPLOYEE.getCode()); wxNoticeEntity.setClientType(WxClientType.ELDER.getCode());
wxNoticeApi.addNotice(wxNoticeEntity); wxNoticeApi.addNotice(wxNoticeEntity);
wxNoticeApi.sendWechartMinMessage(wxNoticeEntity); wxNoticeApi.sendWechartMinMessage(wxNoticeEntity);
} }
@ -190,7 +190,7 @@ public class ElderTaggMQListener {
extend.put("orgCode", dto.getOrgCode()); extend.put("orgCode", dto.getOrgCode());
extend.put("dataId", dto.getId()); extend.put("dataId", dto.getId());
wxNoticeEntity.setExtend(JSONObject.toJSONString(extend)); wxNoticeEntity.setExtend(JSONObject.toJSONString(extend));
wxNoticeEntity.setClientType(WxClientType.EMPLOYEE.getCode()); wxNoticeEntity.setClientType(WxClientType.ELDER.getCode());
wxNoticeApi.addNotice(wxNoticeEntity); wxNoticeApi.addNotice(wxNoticeEntity);
wxNoticeApi.sendWechartMinMessage(wxNoticeEntity); wxNoticeApi.sendWechartMinMessage(wxNoticeEntity);
} }

View File

@ -442,18 +442,18 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
public Result<Map> syncDirective(@RequestParam(name = "dataSourceCode") String dataSourceCode, @RequestBody DirectiveSyncDto dto) { public Result<Map> syncDirective(@RequestParam(name = "dataSourceCode") String dataSourceCode, @RequestBody DirectiveSyncDto dto) {
//处理接口地址 //处理接口地址
String fullPath = ""; String fullPath = "";
if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) { // if ("all".equals(dto.getSyncOption()) || "media".equals(dto.getSyncOption()) || StringUtils.isNotBlank(dto.getUpIds())) {
JSONObject deptInfo = configServiceDirectiveService.getDeptInfo("master", dataSourceCode); // JSONObject deptInfo = configServiceDirectiveService.getDeptInfo("master", dataSourceCode);
String url = deptInfo.getString("url"); // String url = deptInfo.getString("url");
String contextPath = deptInfo.getString("contextPath"); // String contextPath = deptInfo.getString("contextPath");
String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url; // String baseUrl = url.endsWith("/") ? url.substring(0, url.length() - 1) : url;
String normalizedContextPath = contextPath.startsWith("/") ? contextPath : "/" + contextPath; // String normalizedContextPath = contextPath.startsWith("/") ? contextPath : "/" + contextPath;
normalizedContextPath = normalizedContextPath.endsWith("/") // normalizedContextPath = normalizedContextPath.endsWith("/")
? normalizedContextPath.substring(0, normalizedContextPath.length() - 1) // ? normalizedContextPath.substring(0, normalizedContextPath.length() - 1)
: normalizedContextPath; // : normalizedContextPath;
//接口协议域名上下文路径 // //接口协议域名上下文路径
fullPath = baseUrl + normalizedContextPath; // fullPath = baseUrl + normalizedContextPath;
} // }
//同步-新增服务指令 //同步-新增服务指令
if (StringUtils.isNotBlank(dto.getSyncIds())) { if (StringUtils.isNotBlank(dto.getSyncIds())) {

View File

@ -442,25 +442,25 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
if (directives != null && !directives.isEmpty()) { if (directives != null && !directives.isEmpty()) {
directives.stream().forEach(record -> { directives.stream().forEach(record -> {
//清空指令资源字段的值 //清空指令资源字段的值
if ("business".equals(syncOption)) { // if ("business".equals(syncOption)) {
record.setPreviewFile(null); // record.setPreviewFile(null);
record.setImmediateFile(null); // record.setImmediateFile(null);
record.setImmediateFileFocus(null); // record.setImmediateFileFocus(null);
record.setMp3File(null); // record.setMp3File(null);
record.setMp4File(null); // record.setMp4File(null);
record.setServiceContent(null); // record.setServiceContent(null);
record.setPreviewFileMd5(null); // record.setPreviewFileMd5(null);
record.setImmediateFileMd5(null); // record.setImmediateFileMd5(null);
record.setImmediateFileFocusMd5(null); // record.setImmediateFileFocusMd5(null);
record.setMp3FileMd5(null); // record.setMp3FileMd5(null);
record.setMp4FileMd5(null); // record.setMp4FileMd5(null);
} // }
List<DirectiveBodyTag> bodyTagList = record.getBodyTagList(); // List<DirectiveBodyTag> bodyTagList = record.getBodyTagList();
record.setBodyTags(bodyTagList.stream().map(DirectiveBodyTag::getId).collect(Collectors.joining(","))); // record.setBodyTags(bodyTagList.stream().map(DirectiveBodyTag::getId).collect(Collectors.joining(",")));
//
List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList(); // List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList();
record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(","))); // record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(",")));
}); });
} }
directiveMQDto.setDirectiveList(BeanUtil.copyToList(directives, DirectiveAsyncMQDto.class)); directiveMQDto.setDirectiveList(BeanUtil.copyToList(directives, DirectiveAsyncMQDto.class));
@ -502,13 +502,13 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
} }
} }
//体型标签 //体型标签
{ // {
directiveMQDto.setBodyTagList(BeanUtil.copyToList(bodyTagService.selectAll(directiveIds, null), BodyTagMQDto.class)); // directiveMQDto.setBodyTagList(BeanUtil.copyToList(bodyTagService.selectAll(directiveIds, null), BodyTagMQDto.class));
} // }
//情绪标签 //情绪标签
{ // {
directiveMQDto.setEmotionTagList(BeanUtil.copyToList(emotionTagService.selectAll(directiveIds, null), EmotionTagMQDto.class)); // directiveMQDto.setEmotionTagList(BeanUtil.copyToList(emotionTagService.selectAll(directiveIds, null), EmotionTagMQDto.class));
} // }
//给对应业务平台发送消息 //给对应业务平台发送消息
Arrays.stream(syncOrgCodes.split(",")).forEach(orgCode -> { Arrays.stream(syncOrgCodes.split(",")).forEach(orgCode -> {
AsyncMain asyncMain = new AsyncMain(); AsyncMain asyncMain = new AsyncMain();

View File

@ -5,13 +5,13 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.SymbolConstant; import org.jeecg.common.constant.SymbolConstant;
import org.jeecg.common.constant.enums.FileTypeEnum;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.CommonUtils; import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.common.util.filter.SsrfFileTypeFilter; import org.jeecg.common.util.filter.SsrfFileTypeFilter;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -43,20 +43,24 @@ public class CommonController {
/** /**
* 本地local miniominio 阿里alioss * 本地local miniominio 阿里alioss
*/ */
@Value(value="${jeecg.uploadType}") @Value(value = "${jeecg.uploadType}")
private String uploadType; private String uploadType;
@Autowired
private RedisUtil redisUtil;
/** /**
* @Author 政辉
* @return * @return
* @Author 政辉
*/ */
@GetMapping("/403") @GetMapping("/403")
public Result<?> noauth() { public Result<?> noauth() {
return Result.error("没有权限,请联系管理员分配权限!"); return Result.error("没有权限,请联系管理员分配权限!");
} }
/** /**
* 文件上传统一方法 * 文件上传统一方法
*
* @param request * @param request
* @param response * @param response
* @return * @return
@ -69,7 +73,7 @@ public class CommonController {
//LOWCOD-2580 sys/common/upload接口存在任意文件上传漏洞 //LOWCOD-2580 sys/common/upload接口存在任意文件上传漏洞
if (oConvertUtils.isNotEmpty(bizPath)) { if (oConvertUtils.isNotEmpty(bizPath)) {
if(bizPath.contains(SymbolConstant.SPOT_SINGLE_SLASH) || bizPath.contains(SymbolConstant.SPOT_DOUBLE_BACKSLASH)){ if (bizPath.contains(SymbolConstant.SPOT_SINGLE_SLASH) || bizPath.contains(SymbolConstant.SPOT_DOUBLE_BACKSLASH)) {
throw new JeecgBootException("上传目录bizPath格式非法"); throw new JeecgBootException("上传目录bizPath格式非法");
} }
} }
@ -77,44 +81,44 @@ public class CommonController {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// 获取上传文件对象 // 获取上传文件对象
MultipartFile file = multipartRequest.getFile("file"); MultipartFile file = multipartRequest.getFile("file");
if(oConvertUtils.isEmpty(bizPath)){ if (oConvertUtils.isEmpty(bizPath)) {
if(CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)){ if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
//未指定目录则用阿里云默认目录 upload //未指定目录则用阿里云默认目录 upload
bizPath = "upload"; bizPath = "upload";
//result.setMessage("使用阿里云文件上传时,必须添加目录!"); //result.setMessage("使用阿里云文件上传时,必须添加目录!");
//result.setSuccess(false); //result.setSuccess(false);
//return result; //return result;
}else{ } else {
bizPath = ""; bizPath = "";
} }
} }
if(CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)){ if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
//update-begin-author:liusq date:20221102 for: 过滤上传文件类型 //update-begin-author:liusq date:20221102 for: 过滤上传文件类型
SsrfFileTypeFilter.checkUploadFileType(file); SsrfFileTypeFilter.checkUploadFileType(file);
//update-end-author:liusq date:20221102 for: 过滤上传文件类型 //update-end-author:liusq date:20221102 for: 过滤上传文件类型
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传 //update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
savePath = this.uploadLocal(file,bizPath); savePath = this.uploadLocal(file, bizPath);
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传 //update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
/** 富文本编辑器及markdown本地上传时采用返回链接方式 /** 富文本编辑器及markdown本地上传时采用返回链接方式
//针对jeditor编辑器如何使 lcaol模式采用 base64格式存储 //针对jeditor编辑器如何使 lcaol模式采用 base64格式存储
String jeditor = request.getParameter("jeditor"); String jeditor = request.getParameter("jeditor");
if(oConvertUtils.isNotEmpty(jeditor)){ if(oConvertUtils.isNotEmpty(jeditor)){
result.setMessage(CommonConstant.UPLOAD_TYPE_LOCAL); result.setMessage(CommonConstant.UPLOAD_TYPE_LOCAL);
result.setSuccess(true); result.setSuccess(true);
return result; return result;
}else{ }else{
savePath = this.uploadLocal(file,bizPath); savePath = this.uploadLocal(file,bizPath);
} }
*/ */
}else{ } else {
//update-begin-author:taoyan date:20200814 for:文件上传改造 //update-begin-author:taoyan date:20200814 for:文件上传改造
savePath = CommonUtils.upload(file, bizPath, uploadType); savePath = CommonUtils.upload(file, bizPath, uploadType);
//update-end-author:taoyan date:20200814 for:文件上传改造 //update-end-author:taoyan date:20200814 for:文件上传改造
} }
if(oConvertUtils.isNotEmpty(savePath)){ if (oConvertUtils.isNotEmpty(savePath)) {
result.setMessage(savePath); result.setMessage(savePath);
result.setSuccess(true); result.setSuccess(true);
}else { } else {
result.setMessage("上传失败!"); result.setMessage("上传失败!");
result.setSuccess(false); result.setSuccess(false);
} }
@ -123,15 +127,16 @@ public class CommonController {
/** /**
* 本地文件上传 * 本地文件上传
* @param mf 文件 *
* @param bizPath 自定义路径 * @param mf 文件
* @param bizPath 自定义路径
* @return * @return
*/ */
private String uploadLocal(MultipartFile mf,String bizPath){ private String uploadLocal(MultipartFile mf, String bizPath) {
try { try {
String ctxPath = uploadpath; String ctxPath = uploadpath;
String fileName = null; String fileName = null;
File file = new File(ctxPath + File.separator + bizPath + File.separator ); File file = new File(ctxPath + File.separator + bizPath + File.separator);
if (!file.exists()) { if (!file.exists()) {
// 创建文件根目录 // 创建文件根目录
file.mkdirs(); file.mkdirs();
@ -139,18 +144,18 @@ public class CommonController {
// 获取文件名 // 获取文件名
String orgName = mf.getOriginalFilename(); String orgName = mf.getOriginalFilename();
orgName = CommonUtils.getFileName(orgName); orgName = CommonUtils.getFileName(orgName);
if(orgName.indexOf(SymbolConstant.SPOT)!=-1){ if (orgName.indexOf(SymbolConstant.SPOT) != -1) {
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf(".")); fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.lastIndexOf("."));
}else{ } else {
fileName = orgName+ "_" + System.currentTimeMillis(); fileName = orgName + "_" + System.currentTimeMillis();
} }
String savePath = file.getPath() + File.separator + fileName; String savePath = file.getPath() + File.separator + fileName;
File savefile = new File(savePath); File savefile = new File(savePath);
FileCopyUtils.copy(mf.getBytes(), savefile); FileCopyUtils.copy(mf.getBytes(), savefile);
String dbpath = null; String dbpath = null;
if(oConvertUtils.isNotEmpty(bizPath)){ if (oConvertUtils.isNotEmpty(bizPath)) {
dbpath = bizPath + File.separator + fileName; dbpath = bizPath + File.separator + fileName;
}else{ } else {
dbpath = fileName; dbpath = fileName;
} }
if (dbpath.contains(SymbolConstant.DOUBLE_BACKSLASH)) { if (dbpath.contains(SymbolConstant.DOUBLE_BACKSLASH)) {
@ -331,9 +336,9 @@ public class CommonController {
// } // }
/** /**
* @功能pdf预览Iframe
* @param modelAndView * @param modelAndView
* @return * @return
* @功能pdf预览Iframe
*/ */
@RequestMapping("/pdf/pdfPreviewIframe") @RequestMapping("/pdf/pdfPreviewIframe")
public ModelAndView pdfPreviewIframe(ModelAndView modelAndView) { public ModelAndView pdfPreviewIframe(ModelAndView modelAndView) {
@ -342,8 +347,9 @@ public class CommonController {
} }
/** /**
* 把指定URL后的字符串全部截断当成参数 * 把指定URL后的字符串全部截断当成参数
* 这么做是为了防止URL中包含中文或者特殊字符/匹配不了的问题 * 这么做是为了防止URL中包含中文或者特殊字符/匹配不了的问题
*
* @param request * @param request
* @return * @return
*/ */
@ -423,4 +429,90 @@ public class CommonController {
} }
} }
/**
* 文件上传统一方法 暴露接口
*
* @param request
* @param response
* @return
*/
@PostMapping(value = "/static/upload/export")
public Result<?> upload(@RequestParam(value = "name", defaultValue = "aaa") String secureKey, @RequestParam(value = "size",defaultValue = "1") String fileSize, HttpServletRequest request, HttpServletResponse response) throws Exception {
Result<?> result = new Result<>();
//先验证秘钥是否正确
if (!SafetyUtil.validateSecureKey(secureKey)) {
result.setMessage("上传失败!");
result.setSuccess(false);
return result;
}
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// 获取上传文件对象
MultipartFile file = multipartRequest.getFile("file");
//验证文件名称大小是否可具备存储资格
{
boolean contains = redisUtil.sGet("canuploadparams").contains(file.getOriginalFilename() + "-" + fileSize);
if (!contains) {
result.setMessage("上传失败!");
result.setSuccess(false);
return result;
} else {
//删除set中元素
redisUtil.setRemove("canuploadparams", file.getOriginalFilename() + "-" + fileSize);
}
}
String savePath = "";
String bizPath = request.getParameter("biz");
//LOWCOD-2580 sys/common/upload接口存在任意文件上传漏洞
if (oConvertUtils.isNotEmpty(bizPath)) {
if (bizPath.contains(SymbolConstant.SPOT_SINGLE_SLASH) || bizPath.contains(SymbolConstant.SPOT_DOUBLE_BACKSLASH)) {
throw new JeecgBootException("上传目录bizPath格式非法");
}
}
if (oConvertUtils.isEmpty(bizPath)) {
if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
//未指定目录则用阿里云默认目录 upload
bizPath = "upload";
//result.setMessage("使用阿里云文件上传时,必须添加目录!");
//result.setSuccess(false);
//return result;
} else {
bizPath = "";
}
}
if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
//update-begin-author:liusq date:20221102 for: 过滤上传文件类型
SsrfFileTypeFilter.checkUploadFileType(file);
//update-end-author:liusq date:20221102 for: 过滤上传文件类型
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
savePath = this.uploadLocal(file, bizPath);
//update-begin-author:lvdandan date:20200928 for:修改JEditor编辑器本地上传
/** 富文本编辑器及markdown本地上传时采用返回链接方式
//针对jeditor编辑器如何使 lcaol模式采用 base64格式存储
String jeditor = request.getParameter("jeditor");
if(oConvertUtils.isNotEmpty(jeditor)){
result.setMessage(CommonConstant.UPLOAD_TYPE_LOCAL);
result.setSuccess(true);
return result;
}else{
savePath = this.uploadLocal(file,bizPath);
}
*/
} else {
//update-begin-author:taoyan date:20200814 for:文件上传改造
savePath = CommonUtils.upload(file, bizPath, uploadType);
//update-end-author:taoyan date:20200814 for:文件上传改造
}
if (oConvertUtils.isNotEmpty(savePath)) {
result.setMessage(savePath);
result.setSuccess(true);
} else {
result.setMessage("上传失败!");
result.setSuccess(false);
}
return result;
}
} }