| | |
| | | package com.zt.life.modules.configItemWarehouse.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.zt.common.service.BaseService; |
| | | import com.zt.common.utils.CommonUtils; |
| | | import com.zt.core.context.User; |
| | | import com.zt.core.context.UserContext; |
| | | import com.zt.life.export.dto.WordFile; |
| | | import com.zt.life.export.service.WordFileService; |
| | | import com.zt.life.modules.baselineRelease.model.BaselineReleaseRemark; |
| | | import com.zt.life.modules.configItemWarehouse.dao.ConfigItemWarehouseDao; |
| | | import com.zt.life.modules.configItemWarehouse.dto.ConfigItemWarehouseDto; |
| | | import com.zt.life.modules.configItemWarehouse.model.ConfigItemWarehouse; |
| | | import com.zt.life.modules.configItemWarehouse.model.WarehouseCmAudit; |
| | | import com.zt.life.modules.configItemWarehouse.model.WarehouseConfigItem; |
| | | import com.zt.life.modules.configItemWarehouse.model.WarehouseQaAudit; |
| | | import com.zt.life.modules.itemCirculatOrder.dto.ItemCirculatOrderDto; |
| | | import com.zt.life.modules.itemCirculatOrder.model.ItemCirculatOrder; |
| | | import com.zt.life.modules.itemCirculatOrder.model.ItemCirculatOrderTechnical; |
| | | import com.zt.life.modules.itemCirculatOrder.service.ItemCirculatOrderTechnicalService; |
| | | import com.zt.life.modules.project.model.SoftwareTestOrderDeliverable; |
| | | import com.zt.life.modules.project.model.SoftwareTestOrderMeasured; |
| | | import com.zt.life.modules.mainPart.utils.GetFilesPath; |
| | | import com.zt.life.modules.mainPart.utils.GetShowDictList; |
| | | import com.zt.life.modules.project.service.ProjectService; |
| | | import com.zt.life.modules.sysBaseInfo.service.TestAgencyInfoService; |
| | | import com.zt.life.modules.testCheckOrder.model.TestCheckOrder; |
| | | import com.zt.life.modules.testCheckOrder.service.TestCheckOrderService; |
| | | import com.zt.life.sys.dto.OssDto; |
| | | import com.zt.life.sys.service.SysOssConfigService; |
| | | import com.zt.modules.coderule.service.SysCodeRuleService; |
| | | import com.zt.modules.oss.service.SysOssService; |
| | | import com.zt.modules.workflow.dto.FlowInfoDto; |
| | | import com.zt.modules.workflow.service.WorkflowService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | /** |
| | | * config_item_warehouse |
| | | * |
| | | * @author zt generator |
| | | * @author zt generator |
| | | * @since 1.0.0 2023-11-27 |
| | | */ |
| | | @Service |
| | | public class ConfigItemWarehouseService extends BaseService<ConfigItemWarehouseDao, ConfigItemWarehouse> { |
| | | public class ConfigItemWarehouseService extends BaseService<ConfigItemWarehouseDao, ConfigItemWarehouse> { |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | |
| | |
| | | @Autowired |
| | | private WarehouseConfigItemService configItemService; |
| | | |
| | | @Autowired |
| | | private TestCheckOrderService testCheckOrderService; |
| | | |
| | | @Autowired |
| | | private GetShowDictList getShowDictList; |
| | | |
| | | @Autowired |
| | | private WordFileService wordFileService; |
| | | |
| | | @Autowired |
| | | private GetFilesPath getFilesPath; |
| | | |
| | | @Autowired |
| | | private ItemCirculatOrderTechnicalService technicalService; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | public List<ConfigItemWarehouse> page(QueryFilter queryFilter) { |
| | | return baseDao.getList(queryFilter.getQueryParams()); |
| | | User user = UserContext.getUser(); |
| | | Integer secretClass = user.getSecretClass(); |
| | | Long deptId = user.getDeptId(); |
| | | queryFilter.getQueryParams().put("secretClass",secretClass); |
| | | queryFilter.getQueryParams().put("deptId",deptId); |
| | | List<ConfigItemWarehouse> list = baseDao.getList(queryFilter.getQueryParams()); |
| | | if (list.size() > 0) { |
| | | workflowService.getRunFlow(list, "pzxrk"); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | |
| | | else { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "config_item_warehouse"); |
| | | map.put("projectId",configItemDto.getProjectId().toString()); |
| | | map.put("projectId", configItemDto.getProjectId().toString()); |
| | | configItemDto.getConfigItemWarehouse().setProjectId(configItemDto.getProjectId()); |
| | | configItemDto.getConfigItemWarehouse().setCode(sysCodeRuleService.getNewCode(map)); |
| | | baseDao.insert(configItemDto.getConfigItemWarehouse()); |
| | |
| | | |
| | | for (WarehouseConfigItem configItem : configItemDto.getConfigItemList()) { |
| | | configItem.setWarehouseId(warehouseId); |
| | | if (configItem.getId() != null) { |
| | | configItemService.update(configItem); |
| | | } else { |
| | | configItem.setWarehouseId(warehouseId); |
| | | configItemService.insert(configItem); |
| | | if (configItem.getItemName() != null) { |
| | | if (configItem.getId() != null) { |
| | | WarehouseConfigItem configItem2 = configItemService.get(configItem.getId()); |
| | | if (CommonUtils.isActureChangeData(configItem, configItem2)) { |
| | | configItemService.update(configItem); |
| | | } |
| | | if (CommonUtils.isActureChangeData(configItemDto.getConfigItemWarehouse().getLibraryType(), configItem.getLibraryType())) { |
| | | configItem.setLibraryType(configItemDto.getConfigItemWarehouse().getLibraryType()); |
| | | configItemService.update(configItem); |
| | | } |
| | | } else { |
| | | Map<String, String> map = new HashMap<>(); |
| | | String pageCode = configItem.getPageCode(); |
| | | if (StringUtils.isNotBlank(pageCode) && "plan,explain,record,report".contains(pageCode)) { |
| | | map.put("funCode", "test_" + pageCode); |
| | | configItem.setItemIdentify(sysCodeRuleService.getNewCode(map)); |
| | | } |
| | | configItem.setLibraryType(configItemDto.getConfigItemWarehouse().getLibraryType()); |
| | | configItem.setWarehouseId(warehouseId); |
| | | configItem.setProjectId(configItemDto.getConfigItemWarehouse().getProjectId()); |
| | | configItemService.insert(configItem); |
| | | } |
| | | Long checkId = configItem.getCheckId(); |
| | | if (checkId != null) { |
| | | TestCheckOrder testCheckOrder = testCheckOrderService.get(checkId); |
| | | if (testCheckOrder.getConfigItemId() == null) { |
| | | Long configItemId = configItem.getId(); |
| | | testCheckOrder.setConfigItemId(configItemId); |
| | | testCheckOrder.setConfigOrderId(warehouseId); |
| | | testCheckOrderService.update(testCheckOrder); |
| | | } |
| | | } |
| | | sysOssConfigService.updateOss(configItem.getId(), configItem.getFiles());// 保存附件 |
| | | } |
| | | sysOssConfigService.updateOss(configItem.getId(), configItem.getFiles());// 保存附件 |
| | | } |
| | | |
| | | for (WarehouseCmAudit cmAudit : configItemDto.getCmAuditList()) { |
| | |
| | | Long bizId = configItemDto.getConfigItemWarehouse().getId(); |
| | | FlowInfoDto flowInfoDto = configItemDto.getFlowInfoDto(); |
| | | |
| | | if (flowInfoDto != null && "tj,bl".contains(flowInfoDto.getSubmitType())) { |
| | | if (flowInfoDto != null && flowInfoDto.getSubmitType() != null && "tj,bl".contains(flowInfoDto.getSubmitType())) { |
| | | if ("tj".equals(flowInfoDto.getSubmitType())) { |
| | | workflowService.startFlow(flowInfoDto.getFlowCode(), bizId); |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | public ConfigItemWarehouseDto getDto(Long projectId, Long warehouseId) { |
| | | public ConfigItemWarehouseDto getDto(Long projectId, Long warehouseId, String libraryType) { |
| | | ConfigItemWarehouseDto data = new ConfigItemWarehouseDto(); |
| | | if (warehouseId != null) { |
| | | data.setId(warehouseId); |
| | | ConfigItemWarehouse configItemWarehouse = this.get(warehouseId); |
| | | data.setConfigItemWarehouse(configItemWarehouse); |
| | | |
| | | if (projectId==null) { |
| | | if (configItemWarehouse != null && projectId == null) { |
| | | projectId = configItemWarehouse.getProjectId(); |
| | | } |
| | | List<WarehouseCmAudit> CmAuditList = cmAuditService.getList(warehouseId); |
| | |
| | | data.setConfigItemList(ConfigItemList); |
| | | |
| | | } else { |
| | | ConfigItemWarehouse configItemWarehouse =new ConfigItemWarehouse(); |
| | | ConfigItemWarehouse configItemWarehouse = new ConfigItemWarehouse(); |
| | | configItemWarehouse.setLibraryType(libraryType); |
| | | data.setConfigItemWarehouse(configItemWarehouse); |
| | | List<?> cmList = baseDao.itemList("warehouse_cm_audit"); |
| | | List<?> CmAuditList = cmList; |
| | | data.setCmAuditList((List<WarehouseCmAudit>) CmAuditList); |
| | | List<?> qaList = baseDao.itemList("warehouse_qa_audit"); |
| | | List<?> QaAuditList = qaList; |
| | | data.setQaAuditList((List<WarehouseQaAudit>) QaAuditList); |
| | | List<?> resultList = configItemService.ConfigItemList(projectId); |
| | | List<?> ConfigItemList = resultList; |
| | | data.setConfigItemList((List<WarehouseConfigItem>) ConfigItemList); |
| | | List<?> cmList = this.itemCmList("warehouse_cm_audit"); |
| | | data.setCmAuditList((List<WarehouseCmAudit>) cmList); |
| | | List<?> qaList = this.itemQaList("warehouse_qa_audit"); |
| | | data.setQaAuditList((List<WarehouseQaAudit>) qaList); |
| | | List<WarehouseConfigItem> resultList = new ArrayList<>(); |
| | | if ("1".equals(libraryType)) { |
| | | List<String> srcId = technicalService.getsrcId(projectId); |
| | | /* String ids = String.join(", ", srcId.stream() |
| | | .map(id -> "\"" + id + "\"") |
| | | .collect(Collectors.toList()));*/ |
| | | String ids = String.join(", ", srcId); |
| | | resultList = configItemService.ConfigItemList(projectId, ids); |
| | | for (WarehouseConfigItem item :resultList){ |
| | | if (ids.contains(item.getSrcId().toString()) && item.getSrcId()!=null && StringUtils.isNotBlank(ids)){ |
| | | WarehouseConfigItem item2 = configItemService.getBySrc(projectId,item.getSrcId()); |
| | | item.setVersion(null); |
| | | item.setRetrospectVersion(item2.getVersion()); |
| | | } |
| | | } |
| | | } |
| | | data.setConfigItemList(resultList); |
| | | } |
| | | |
| | | if (projectId != null) { |
| | |
| | | return data; |
| | | } |
| | | |
| | | public List<WarehouseCmAudit> itemCmList(String dictType) { |
| | | return baseDao.itemCmList(dictType); |
| | | } |
| | | public List<WarehouseQaAudit> itemQaList(String dictType) { |
| | | return baseDao.itemQaList(dictType); |
| | | } |
| | | |
| | | public void exportWarehouseOrder(Long id, HttpServletRequest request, HttpServletResponse response, String libraryType) { |
| | | try { |
| | | ConfigItemWarehouseDto dataObj = this.getDto(null, id, libraryType); |
| | | |
| | | String qaAuditorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemWarehouse().getQaAuditorId())); |
| | | dataObj.getConfigItemWarehouse().setQaAuditor(qaAuditorPath); |
| | | String cmAuditorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemWarehouse().getCmAuditorId())); |
| | | dataObj.getConfigItemWarehouse().setCmAuditor(cmAuditorPath); |
| | | String approvalSignPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemWarehouse().getApprovalId())); |
| | | dataObj.getConfigItemWarehouse().setApprovalSign(approvalSignPath); |
| | | String operatorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemWarehouse().getOperatorId())); |
| | | dataObj.getConfigItemWarehouse().setOperator(operatorPath); |
| | | //通用字典列表字符串生成 |
| | | String libraryTypeStr = getShowDictList.getShowDictList(dataObj.getConfigItemWarehouse().getLibraryType(), "library_type", false); |
| | | dataObj.getConfigItemWarehouse().setLibraryType(libraryTypeStr); |
| | | |
| | | String QaAuditResultStr = getShowDictList.getShowDictList(dataObj.getConfigItemWarehouse().getQaAuditResults(), "is_pass", false); |
| | | dataObj.getConfigItemWarehouse().setQaAuditResults(QaAuditResultStr); |
| | | |
| | | String CmAuditResultStr = getShowDictList.getShowDictList(dataObj.getConfigItemWarehouse().getCmAuditResults(), "is_pass", false); |
| | | dataObj.getConfigItemWarehouse().setCmAuditResults(CmAuditResultStr); |
| | | |
| | | String ApprovalOpinionStr = getShowDictList.getShowDictList(dataObj.getConfigItemWarehouse().getApprovalOpinions(), "is_agree", false); |
| | | dataObj.getConfigItemWarehouse().setApprovalOpinions(ApprovalOpinionStr); |
| | | |
| | | for (WarehouseCmAudit cmAuditList : dataObj.getCmAuditList()) { |
| | | String value = cmAuditList.getExamineResult(); |
| | | String ExamineResultStr = getShowDictList.getShowDictList(value, "tristate2", false); |
| | | cmAuditList.setExamineResult(ExamineResultStr); |
| | | } |
| | | for (WarehouseQaAudit qaAuditList : dataObj.getQaAuditList()) { |
| | | String value = qaAuditList.getExamineResult(); |
| | | String ExamineResultStr = getShowDictList.getShowDictList(value, "tristate2", false); |
| | | qaAuditList.setExamineResult(ExamineResultStr); |
| | | } |
| | | for (WarehouseConfigItem configItemList : dataObj.getConfigItemList()) { |
| | | String value = configItemList.getSecretClass(); |
| | | String secretClassStr = getShowDictList.getShowDictList(value, "secret_class", false); |
| | | configItemList.setSecretClass(secretClassStr); |
| | | } |
| | | WordFile wordFile = new WordFile(); |
| | | wordFile.setModulePath("配置项入库申请单.docx"); |
| | | wordFile.setWordName(dataObj.getProject().getSoftwareName() + "_配置项入库申请单.docx"); |
| | | wordFileService.exportWordFile(request, dataObj, wordFile, response); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |