Compare commits

...

23 Commits

Author SHA1 Message Date
shusir
9244510903 Merge remote-tracking branch 'origin/test' into test 2026-03-25 18:08:52 +08:00
shusir
4fa4371f0c fix:物料抽象出实例的入库方法 2026-03-25 18:08:06 +08:00
YBP
f09bb8f904 文件记录-重构-通用申请流程 2026-03-25 18:03:25 +08:00
FCL
d33c3b5803 Merge remote-tracking branch 'origin/test' into test 2026-03-25 17:53:07 +08:00
FCL
6a2b9048b5 fix:期间核查、检定校准接口调整 2026-03-25 17:53:01 +08:00
wxr
c9b85e563d 文件排序修改 2026-03-25 17:22:52 +08:00
FCL
809088d9b3 feat:意见读取方法;检定校准、期间核查增加意见返回 2026-03-25 15:28:23 +08:00
shusir
58aa53eb68 fix:物料盘点出入库;修复循环依赖。 2026-03-25 14:30:03 +08:00
FCL
32387301ac fix:iwork用印发起方式调整 2026-03-25 13:58:32 +08:00
wxr
ea5bf45a48 第三方对接 2026-03-25 11:09:13 +08:00
FCL
92b3494fb7 fix:细节修复 2026-03-25 08:38:37 +08:00
YBP
89ebf4437c 文件记录-重构-通用申请 2026-03-24 18:21:01 +08:00
shusir
a227770ec1 fix:物料盘点 todo 库存数量需要带上仓库或库位条件。 2026-03-24 18:04:22 +08:00
FCL
f253ea4f39 fix:期间核查、检定校准增加formId字段 2026-03-24 16:19:16 +08:00
FCL
05cd6869a9 fix:设备微调 2026-03-24 15:35:52 +08:00
FCL
da0ad407dc feat:设备期间核查基础逻辑 2026-03-24 15:08:51 +08:00
FCL
629092ffbe fix:设备检定校准细节调整 2026-03-24 11:50:08 +08:00
FCL
6077ee78f0 fix:报告细节调整 2026-03-24 10:26:03 +08:00
YBP
418932d546 文件记录-重构 2026-03-23 18:36:50 +08:00
shusir
26486fb1d6 fix:物料盘点 2026-03-23 18:03:22 +08:00
FCL
007a60d437 fix:iwork用印及回调调试 2026-03-23 17:59:10 +08:00
FCL
d644149a94 fix:iwork用印及回调调试 2026-03-23 16:50:05 +08:00
shusir
09730d4b8f fix:物料准备盘点接口及修复其他接口问题 2026-03-20 17:57:20 +08:00
156 changed files with 4845 additions and 2131 deletions

View File

@@ -142,6 +142,12 @@ public interface ErrorCodeConstants {
ErrorCode BUSINESS_XRF_DATA_NOT_EXISTS = new ErrorCode(1_032_100_000, "荧光采集记录不存在"); ErrorCode BUSINESS_XRF_DATA_NOT_EXISTS = new ErrorCode(1_032_100_000, "荧光采集记录不存在");
//第三方对接
ErrorCode OTHER_SYSTEM_CONFIG_NOT_EXISTS = new ErrorCode(1_032_100_000, "第三方系统配置不存在");
ErrorCode OTHER_BASE_SAMPLE_NOT_EXISTS = new ErrorCode(1_032_100_000, "第三方系统样品大类对应不存在");
ErrorCode OTHER_DICTIONARY_PROJECT_NOT_EXISTS = new ErrorCode(1_032_100_000, "第三方系统检测项目字典对应不存在");
ErrorCode OTHER_SYSTEM_USER_NOT_EXISTS = new ErrorCode(1_032_100_000, "第三方系统用户信息对应不存在");
//检测报告 //检测报告
ErrorCode REPORT_DOCUMENT_MAIN_NOT_EXISTS = new ErrorCode(1_032_100_000, "检测报告业务不存在"); ErrorCode REPORT_DOCUMENT_MAIN_NOT_EXISTS = new ErrorCode(1_032_100_000, "检测报告业务不存在");
@@ -198,8 +204,7 @@ public interface ErrorCodeConstants {
ErrorCode SYSTEM_VERSION_MANAGEMENT_NOT_EXISTS = new ErrorCode(1_032_160_000, "客户端版本管理不存在"); ErrorCode SYSTEM_VERSION_MANAGEMENT_NOT_EXISTS = new ErrorCode(1_032_160_000, "客户端版本管理不存在");
ErrorCode MATERIAL_INVENTORY_CHECK_NOT_EXISTS = new ErrorCode(1_032_160_000, "库存盘点不存在"); ErrorCode MATERIAL_INVENTORY_CHECK_ITEM_NOT_EXISTS = new ErrorCode(1_032_160_000, "库存盘点不存在");
ErrorCode MATERIAL_INVENTORY_CHECK_BATCH_NOT_EXISTS = new ErrorCode(1_032_160_000, "库存盘点项不存在");
ErrorCode MATERIAL_INVENTORY_CHECK_DETAIL_NOT_EXISTS = new ErrorCode(1_032_160_000, "库存盘点明细不存在"); ErrorCode MATERIAL_INVENTORY_CHECK_DETAIL_NOT_EXISTS = new ErrorCode(1_032_160_000, "库存盘点明细不存在");
ErrorCode MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS = new ErrorCode(1_032_160_000, "出库不存在"); ErrorCode MATERIAL_INVENTORY_OUTBOUND_NOT_EXISTS = new ErrorCode(1_032_160_000, "出库不存在");
ErrorCode MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS = new ErrorCode(1_032_160_000, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等不存在"); ErrorCode MATERIAL_INVENTORY_OUTBOUND_DETAIL_NOT_EXISTS = new ErrorCode(1_032_160_000, "出库明细,出库明细,含领用出库、退货出库、盘亏出库、销毁出库等不存在");
@@ -249,6 +254,7 @@ public interface ErrorCodeConstants {
/*================================= 部门信息、用户信息 ==================================*/ /*================================= 部门信息、用户信息 ==================================*/
ErrorCode CURRENT_USER_COMPANY_NOT_EXISTS = new ErrorCode(1_032_350_000, "当前用户公司不存在"); ErrorCode CURRENT_USER_COMPANY_NOT_EXISTS = new ErrorCode(1_032_350_000, "当前用户公司不存在");
ErrorCode CURRENT_USER_DEPT_NOT_EXISTS = new ErrorCode(1_032_350_000, "当前用户部门不存在"); ErrorCode CURRENT_USER_DEPT_NOT_EXISTS = new ErrorCode(1_032_350_000, "当前用户部门不存在");
ErrorCode CURRENT_USER_NOT_EXISTS = new ErrorCode(1_032_350_000, "当前用户部门不存在");
// ========== 文件记录分发号,记录文件分发与线下对应的分发号对应,且标记到目标人物 TODO 补充编号 ========== // ========== 文件记录分发号,记录文件分发与线下对应的分发号对应,且标记到目标人物 TODO 补充编号 ==========
ErrorCode RECORD_ASSIGN_NOT_EXISTS = new ErrorCode(1_032_450_000, "文件记录分发号,记录文件分发与线下对应的分发号对应,且标记到目标人物不存在"); ErrorCode RECORD_ASSIGN_NOT_EXISTS = new ErrorCode(1_032_450_000, "文件记录分发号,记录文件分发与线下对应的分发号对应,且标记到目标人物不存在");

View File

@@ -36,6 +36,7 @@ public interface BusinessSampleEntrustFileMapper extends BaseMapperX<BusinessSam
.eqIfPresent(BusinessSampleEntrustFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(BusinessSampleEntrustFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(BusinessSampleEntrustFileDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(BusinessSampleEntrustFileDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(BusinessSampleEntrustFileDO::getRemark, reqVO.getRemark()) .eqIfPresent(BusinessSampleEntrustFileDO::getRemark, reqVO.getRemark())
.orderByDesc(BusinessSampleEntrustFileDO::getFileCategory)
.orderByDesc(BusinessSampleEntrustFileDO::getId)); .orderByDesc(BusinessSampleEntrustFileDO::getId));
} }
@@ -55,6 +56,7 @@ public interface BusinessSampleEntrustFileMapper extends BaseMapperX<BusinessSam
.eqIfPresent(BusinessSampleEntrustFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(BusinessSampleEntrustFileDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(BusinessSampleEntrustFileDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(BusinessSampleEntrustFileDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(BusinessSampleEntrustFileDO::getRemark, reqVO.getRemark()) .eqIfPresent(BusinessSampleEntrustFileDO::getRemark, reqVO.getRemark())
.orderByDesc(BusinessSampleEntrustFileDO::getFileCategory)
.orderByDesc(BusinessSampleEntrustFileDO::getId)); .orderByDesc(BusinessSampleEntrustFileDO::getId));
} }

View File

@@ -1,12 +1,15 @@
package com.zt.plat.module.qms.business.config.dal.mapper; package com.zt.plat.module.qms.business.config.dal.mapper;
import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX; import com.zt.plat.framework.mybatis.core.query.MPJLambdaWrapperX;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleDispatchDetailDO; import com.zt.plat.module.qms.business.bus.dal.dataobject.BusinessSampleDispatchDetailDO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigPermissionDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationDO;
import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationParDO; import com.zt.plat.module.qms.business.config.dal.dataobject.ConfigWarehouseLocationParDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -26,7 +29,9 @@ public interface ConfigWarehouseLocationMapper extends BaseMapperX<ConfigWarehou
MPJLambdaWrapperX<ConfigWarehouseLocationDO> wrapper = new MPJLambdaWrapperX<>(); MPJLambdaWrapperX<ConfigWarehouseLocationDO> wrapper = new MPJLambdaWrapperX<>();
//仓库 //仓库
wrapper.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId); wrapper.leftJoin(ConfigWarehouseLocationParDO.class, ConfigWarehouseLocationParDO::getId, ConfigWarehouseLocationDO::getParentId)
// 权限
.leftJoin(ConfigPermissionDO.class, ConfigPermissionDO::getSourceId, ConfigWarehouseLocationDO::getId);
wrapper.selectAll(ConfigWarehouseLocationDO.class) wrapper.selectAll(ConfigWarehouseLocationDO.class)
.selectAs(ConfigWarehouseLocationParDO::getName, ConfigWarehouseLocationRespVO::getWarehouseName) .selectAs(ConfigWarehouseLocationParDO::getName, ConfigWarehouseLocationRespVO::getWarehouseName)
.selectAs(ConfigWarehouseLocationParDO::getCode, ConfigWarehouseLocationRespVO::getWarehouseCode) .selectAs(ConfigWarehouseLocationParDO::getCode, ConfigWarehouseLocationRespVO::getWarehouseCode)
@@ -43,6 +48,11 @@ public interface ConfigWarehouseLocationMapper extends BaseMapperX<ConfigWarehou
.eqIfPresent(ConfigWarehouseLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode()) .eqIfPresent(ConfigWarehouseLocationDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
.betweenIfPresent(ConfigWarehouseLocationDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(ConfigWarehouseLocationDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(ConfigWarehouseLocationDO::getRemark, reqVO.getRemark()) .eqIfPresent(ConfigWarehouseLocationDO::getRemark, reqVO.getRemark())
// 角色权限
.and(CollUtil.isNotEmpty(reqVO.getRoleIds()), wrapper1 ->
wrapper1.in(ConfigPermissionDO::getTargetId, reqVO.getRoleIds())
.or()
.eqIfExists(ConfigWarehouseLocationDO::getCreator, SecurityFrameworkUtils.getLoginUserId()))
.orderByDesc(ConfigWarehouseLocationDO::getSortNo); .orderByDesc(ConfigWarehouseLocationDO::getSortNo);
return selectJoinPage(reqVO, ConfigWarehouseLocationRespVO.class, wrapper); return selectJoinPage(reqVO, ConfigWarehouseLocationRespVO.class, wrapper);

View File

@@ -79,4 +79,12 @@ public interface ConfigWarehouseLocationService {
* @return 存放位置列表 * @return 存放位置列表
*/ */
List<ConfigWarehouseLocationDO> getListByIds(List<Long> ids); List<ConfigWarehouseLocationDO> getListByIds(List<Long> ids);
/**
* 获得存放位置列表
*
* @param warehouseIds 仓库id集合
* @return 存放位置列表
*/
List<ConfigWarehouseLocationDO> getLocationsByWarehouseIds(List<Long> warehouseIds);
} }

View File

@@ -2,12 +2,17 @@ package com.zt.plat.module.qms.business.config.service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigPermissionSaveReqVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationPageReqVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationRespVO;
import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationSaveReqVO; import com.zt.plat.module.qms.business.config.controller.vo.ConfigWarehouseLocationSaveReqVO;
import com.zt.plat.module.qms.enums.QmsPermissionConstant; import com.zt.plat.module.qms.enums.QmsPermissionConstant;
import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant; import com.zt.plat.module.qms.enums.QmsWarehouseLocationConstant;
import com.zt.plat.module.system.api.permission.PermissionApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@@ -38,6 +43,9 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati
@Resource @Resource
private ConfigWarehouseLocationMapper configWarehouseLocationMapper; private ConfigWarehouseLocationMapper configWarehouseLocationMapper;
@Autowired
private PermissionApi permissionApi;
@Override @Override
public ConfigWarehouseLocationRespVO save(ConfigWarehouseLocationSaveReqVO reqVo) { public ConfigWarehouseLocationRespVO save(ConfigWarehouseLocationSaveReqVO reqVo) {
Long id = reqVo.getId(); Long id = reqVo.getId();
@@ -171,6 +179,9 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati
@Override @Override
public PageResult<ConfigWarehouseLocationRespVO> getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO) { public PageResult<ConfigWarehouseLocationRespVO> getConfigWarehouseLocationPage(ConfigWarehouseLocationPageReqVO pageReqVO) {
// 获取当前用户角色
CommonResult<Set<Long>> userRoleIds = permissionApi.getUserRoleIdListByUserId(SecurityFrameworkUtils.getLoginUserId());
pageReqVO.setRoleIds(userRoleIds.getData());
return configWarehouseLocationMapper.selectPage(pageReqVO); return configWarehouseLocationMapper.selectPage(pageReqVO);
} }
@@ -184,4 +195,12 @@ public class ConfigWarehouseLocationServiceImpl implements ConfigWarehouseLocati
return configWarehouseLocationMapper.selectByIds(ids); return configWarehouseLocationMapper.selectByIds(ids);
} }
@Override
public List<ConfigWarehouseLocationDO> getLocationsByWarehouseIds(List<Long> warehouseIds) {
if (CollUtil.isEmpty(warehouseIds)) return Collections.emptyList();
return configWarehouseLocationMapper.selectList(Wrappers.lambdaQuery(ConfigWarehouseLocationDO.class)
.eq(ConfigWarehouseLocationDO::getDataType, QmsWarehouseLocationConstant.DATA_TYPE_LOCATION)
.in(ConfigWarehouseLocationDO::getParentId, warehouseIds));
}
} }

View File

@@ -2,11 +2,13 @@ package com.zt.plat.module.qms.business.reportdoc.controller.admin;
import com.zt.plat.module.infra.api.file.FileApi; import com.zt.plat.module.infra.api.file.FileApi;
import com.zt.plat.module.infra.api.file.dto.FileRespDTO; import com.zt.plat.module.infra.api.file.dto.FileRespDTO;
import com.zt.plat.module.qms.business.reportdoc.constant.ReportDocConstant;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO; import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFilePageReqVO;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO; import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileRespVO;
import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO; import com.zt.plat.module.qms.business.reportdoc.controller.vo.ReportDocumentFileSaveReqVO;
import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO; import com.zt.plat.module.qms.business.reportdoc.dal.dataobject.ReportDocumentMainDO;
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService; import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -110,9 +112,17 @@ public class ReportDocumentFileController extends AbstractFileUploadController i
Integer version = vo.getVersion(); Integer version = vo.getVersion();
if(version == null){ if(version == null){
ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId); ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId);
version = mainDO.getDocumentVersion(); // version = mainDO.getDocumentVersion();
}
// if(type != null)
// entity
if(ObjectUtils.isEmpty(vo.getType()))
vo.setType(ReportDocConstant.REPORT_DOCUMENT_BUSINESS_FILE_SOURCE_IWORK);
ReportDocumentFileDO entity = reportDocumentFileService.getByQueryVO(vo);
if(entity == null){
vo.setType("");
entity = reportDocumentFileService.getByQueryVO(vo);
} }
ReportDocumentFileDO entity = reportDocumentFileService.getByMainIdAndVersion(mainId, version);
if(entity == null){ if(entity == null){
return CommonResult.success(null); return CommonResult.success(null);
} }

View File

@@ -36,9 +36,9 @@ public interface ReportDocumentMainMapper extends BaseMapperX<ReportDocumentMain
wrapper.eqIfPresent(ReportDocumentMainDO::getFlowKey, reqVO.getFlowKey()); wrapper.eqIfPresent(ReportDocumentMainDO::getFlowKey, reqVO.getFlowKey());
wrapper.eqIfPresent(ReportDocumentMainDO::getFlowSerialNumber, reqVO.getFlowSerialNumber()); wrapper.eqIfPresent(ReportDocumentMainDO::getFlowSerialNumber, reqVO.getFlowSerialNumber());
wrapper.eqIfPresent(ReportDocumentMainDO::getCurrentNode, reqVO.getCurrentNode()); wrapper.eqIfPresent(ReportDocumentMainDO::getCurrentNode, reqVO.getCurrentNode());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentCode, reqVO.getDocumentCode()); wrapper.likeIfPresent(ReportDocumentMainDO::getDocumentCode, reqVO.getDocumentCode());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentType, reqVO.getDocumentType()); wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentType, reqVO.getDocumentType());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentTitle, reqVO.getDocumentTitle()); wrapper.likeIfPresent(ReportDocumentMainDO::getDocumentTitle, reqVO.getDocumentTitle());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentConfig, reqVO.getDocumentConfig()); wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentConfig, reqVO.getDocumentConfig());
wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentSignature, reqVO.getDocumentSignature()); wrapper.eqIfPresent(ReportDocumentMainDO::getDocumentSignature, reqVO.getDocumentSignature());
wrapper.betweenIfPresent(ReportDocumentMainDO::getDocumentStartTime, reqVO.getDocumentStartTime()); wrapper.betweenIfPresent(ReportDocumentMainDO::getDocumentStartTime, reqVO.getDocumentStartTime());

View File

@@ -1,18 +1,34 @@
package com.zt.plat.module.qms.business.reportdoc.listener; package com.zt.plat.module.qms.business.reportdoc.listener;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.zt.plat.framework.common.enums.UserTypeEnum;
import com.zt.plat.framework.security.core.LoginUser;
import com.zt.plat.framework.web.core.util.WebFrameworkUtils;
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentAssistService; import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentAssistService;
import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService; import com.zt.plat.module.qms.business.reportdoc.service.ReportDocumentMainService;
import com.zt.plat.module.qms.common.dic.controller.vo.DictionaryBusinessRespVO;
import com.zt.plat.module.qms.common.dic.dal.dataobject.DictionaryBusinessDO;
import com.zt.plat.module.qms.common.dic.service.DictionaryBusinessService;
import com.zt.plat.module.system.api.permission.RoleApi; import com.zt.plat.module.system.api.permission.RoleApi;
import com.zt.plat.module.system.mq.iwork.IWorkBizCallbackMessage; import com.zt.plat.module.system.mq.iwork.IWorkBizCallbackMessage;
import com.zt.plat.module.system.mq.iwork.IWorkBizCallbackResultMessage; import com.zt.plat.module.system.mq.iwork.IWorkBizCallbackResultMessage;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener; import org.apache.rocketmq.spring.core.RocketMQListener;
import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@Slf4j @Slf4j
@Component @Component
@@ -27,6 +43,7 @@ public class IWorkBizCallbackListener implements RocketMQListener<IWorkBizCallba
@Resource private ReportDocumentAssistService reportDocumentAssistService; @Resource private ReportDocumentAssistService reportDocumentAssistService;
@Resource private ReportDocumentMainService reportDocumentMainService; @Resource private ReportDocumentMainService reportDocumentMainService;
@Resource private DictionaryBusinessService dictionaryBusinessService;
@Override @Override
public void onMessage(IWorkBizCallbackMessage message) { public void onMessage(IWorkBizCallbackMessage message) {
log.info("收到 iWork 回调: requestId={}", message.getRequestId()); log.info("收到 iWork 回调: requestId={}", message.getRequestId());
@@ -34,6 +51,8 @@ public class IWorkBizCallbackListener implements RocketMQListener<IWorkBizCallba
IWorkBizCallbackResultMessage result; IWorkBizCallbackResultMessage result;
try { try {
LoginUser loginUser = initLoginUser();
setLoginUser(loginUser);
// 处理业务逻辑 // 处理业务逻辑
processCallback(message); processCallback(message);
@@ -62,6 +81,50 @@ public class IWorkBizCallbackListener implements RocketMQListener<IWorkBizCallba
rocketMQTemplate.syncSend(IWorkBizCallbackResultMessage.TOPIC, result); rocketMQTemplate.syncSend(IWorkBizCallbackResultMessage.TOPIC, result);
} }
private LoginUser initLoginUser(){
DictionaryBusinessRespVO dicDO = dictionaryBusinessService.getDataByDataKey("report_doc_iwork_conf").getData();
if(dicDO == null || ObjectUtils.isEmpty(dicDO.getCustomConfig())){
String msg = "业务参数字典缺少用印iwork配置配置keyreport_doc_iwork_conf";
log.error(msg);
throw new RuntimeException(msg);
}
String report_doc_iwork_conf = dicDO.getCustomConfig();
JSONObject jsonObject = JSONObject.parseObject(report_doc_iwork_conf);
LoginUser loginUser = new LoginUser();
loginUser.setId(jsonObject.getLong("qms_user_id"));
loginUser.setVisitDeptId(jsonObject.getLong("qms_dept_id"));
loginUser.setVisitCompanyId(jsonObject.getLong("qms_company_id"));
loginUser.setId(jsonObject.getLong("qms_user_id"));
loginUser.setUserType(UserTypeEnum.ADMIN.getValue());
loginUser.setTenantId(jsonObject.getLong("qms_tenant_id"));
loginUser.setExpiresTime(LocalDateTime.now().plusHours(1));
//设置用户信息
Map<String, String> info = new HashMap<>();
info.put(LoginUser.INFO_KEY_NICKNAME, jsonObject.getString("qms_user_name"));
info.put(LoginUser.INFO_KEY_TENANT_ID, jsonObject.getString("qms_tenant_id"));
loginUser.setInfo( info);
return loginUser;
}
private void setLoginUser(LoginUser loginUser){
//设置到Spring Security上下文
Authentication authentication = new UsernamePasswordAuthenticationToken(loginUser, null, Collections.emptyList());
SecurityContextHolder.getContext().setAuthentication(authentication);
//设置到web请求上下文供DefaultDBFieldHandler使用
HttpServletRequest request = WebFrameworkUtils.getRequest();
if(request != null){
WebFrameworkUtils.setLoginUserId(request, loginUser.getId());
WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType());
}
}
/** /**
* 处理报告用印iwork回调逻辑 * 处理报告用印iwork回调逻辑
* 1. 解析 payload 获取回调数据 * 1. 解析 payload 获取回调数据

View File

@@ -1,7 +0,0 @@
package com.zt.plat.module.qms.business.reportdoc.service;
/**
* 动态报表数据接口
* */
public interface DynamicReportDataService {
}

Some files were not shown because too many files have changed in this diff Show More