| | |
| | | package com.zt.life.modules.configItemChange.service; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import com.zt.common.service.BaseService; |
| | | import com.zt.life.export.dto.WordFile; |
| | | import com.zt.life.export.service.WordFileService; |
| | | import com.zt.life.modules.configItemChange.dao.ConfigItemChangeDao; |
| | | import com.zt.life.modules.configItemChange.dto.ConfigItemChangeDto; |
| | | import com.zt.life.modules.configItemChange.model.ConfigItemChange; |
| | | import com.zt.life.modules.configItemWarehouse.dto.ConfigItemWarehouseDto; |
| | | 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.configItemWarehouse.service.WarehouseCmAuditService; |
| | | import com.zt.life.modules.configItemWarehouse.service.WarehouseConfigItemService; |
| | | import com.zt.life.modules.configItemWarehouse.service.WarehouseQaAuditService; |
| | | 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.testCheckOrder.model.TestCheckOrder; |
| | | import com.zt.life.modules.testCheckOrder.service.TestCheckOrderService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Autowired |
| | | private TestCheckOrderService testCheckOrderService; |
| | | |
| | | @Autowired |
| | | private GetShowDictList getShowDictList; |
| | | |
| | | @Autowired |
| | | private WordFileService wordFileService; |
| | | |
| | | @Autowired |
| | | private GetFilesPath getFilesPath; |
| | | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | |
| | | * @return |
| | | */ |
| | | public List<ConfigItemChange> page(QueryFilter queryFilter) { |
| | | return baseDao.getList(queryFilter.getQueryParams()); |
| | | List<ConfigItemChange> list = baseDao.getList(queryFilter.getQueryParams()); |
| | | if (list.size() > 0) { |
| | | workflowService.getRunFlow(list, "pzxbg"); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | public Boolean save(ConfigItemChangeDto configItemDto) { |
| | | Long warehouseId = configItemDto.getConfigItemChange().getId(); |
| | | if (warehouseId != null) |
| | | Long changeId = configItemDto.getConfigItemChange().getId(); |
| | | if (changeId != null) |
| | | baseDao.updateById(configItemDto.getConfigItemChange()); |
| | | else { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "config_item_Change"); |
| | | map.put("funCode", "config_item_change"); |
| | | map.put("projectId", configItemDto.getProjectId().toString()); |
| | | configItemDto.getConfigItemChange().setProjectId(configItemDto.getProjectId()); |
| | | configItemDto.getConfigItemChange().setCode(sysCodeRuleService.getNewCode(map)); |
| | | baseDao.insert(configItemDto.getConfigItemChange()); |
| | | warehouseId = configItemDto.getConfigItemChange().getId(); |
| | | changeId = configItemDto.getConfigItemChange().getId(); |
| | | |
| | | } |
| | | |
| | | for (WarehouseConfigItem configItem : configItemDto.getConfigItemList()) { |
| | | configItem.setWarehouseId(warehouseId); |
| | | for (WarehouseConfigItem configItem : configItemDto.getConfigChangeList()) { |
| | | configItem.setWarehouseId(changeId); |
| | | if (configItem.getId() != null) { |
| | | if (configItem.getCheckId()!=null){ |
| | | String code ="719CTC-09-ST"; |
| | | String projectCode = configItemDto.getProject().getCode(); |
| | | if (configItem.getItemName().equals("软件测试计划")){ |
| | | code=code+"P"; |
| | | }else if (configItem.getItemName().equals("软件测试说明")){ |
| | | code=code+"D"; |
| | | }else if (configItem.getItemName().equals("软件测试记录")){ |
| | | code=code+"H"; |
| | | }else if (configItem.getItemName().equals("软件测试报告")){ |
| | | code=code+"R"; |
| | | } |
| | | configItem.setItemIdentify(code+"-"+projectCode); |
| | | } |
| | | configItemService.update(configItem); |
| | | } else { |
| | | configItem.setWarehouseId(warehouseId); |
| | | configItem.setWarehouseId(changeId); |
| | | configItem.setProjectId(configItemDto.getConfigItemChange().getProjectId()); |
| | | configItemService.insert(configItem); |
| | | } |
| | | Long checkId = configItem.getCheckId(); |
| | |
| | | } |
| | | |
| | | for (WarehouseCmAudit cmAudit : configItemDto.getCmAuditList()) { |
| | | cmAudit.setWarehouseId(warehouseId); |
| | | cmAudit.setWarehouseId(changeId); |
| | | if (cmAudit.getId() != null) { |
| | | cmAuditService.update(cmAudit); |
| | | } else { |
| | | cmAudit.setWarehouseId(warehouseId); |
| | | cmAudit.setWarehouseId(changeId); |
| | | cmAuditService.insert(cmAudit); |
| | | } |
| | | } |
| | | |
| | | for (WarehouseQaAudit qaAudit : configItemDto.getQaAuditList()) { |
| | | qaAudit.setWarehouseId(warehouseId); |
| | | qaAudit.setWarehouseId(changeId); |
| | | if (qaAudit.getId() != null) { |
| | | qaAuditService.update(qaAudit); |
| | | } else { |
| | | qaAudit.setWarehouseId(warehouseId); |
| | | qaAudit.setWarehouseId(changeId); |
| | | qaAuditService.insert(qaAudit); |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | public ConfigItemChangeDto getDto(Long projectId, Long warehouseId) { |
| | | public ConfigItemChangeDto getDto(Long projectId, Long changeId) { |
| | | ConfigItemChangeDto data = new ConfigItemChangeDto(); |
| | | if (warehouseId != null) { |
| | | data.setId(warehouseId); |
| | | ConfigItemChange configItemChange = this.get(warehouseId); |
| | | if (changeId != null) { |
| | | data.setId(changeId); |
| | | ConfigItemChange configItemChange = this.get(changeId); |
| | | data.setConfigItemChange(configItemChange); |
| | | |
| | | if (projectId == null) { |
| | | projectId = configItemChange.getProjectId(); |
| | | } |
| | | List<WarehouseCmAudit> CmAuditList = cmAuditService.getList(warehouseId); |
| | | List<WarehouseCmAudit> CmAuditList = cmAuditService.getList(changeId); |
| | | data.setCmAuditList(CmAuditList); |
| | | List<WarehouseQaAudit> QaAuditList = qaAuditService.getList(warehouseId); |
| | | List<WarehouseQaAudit> QaAuditList = qaAuditService.getList(changeId); |
| | | data.setQaAuditList(QaAuditList); |
| | | List<WarehouseConfigItem> ConfigItemList = configItemService.getList(warehouseId); |
| | | data.setConfigItemList(ConfigItemList); |
| | | List<WarehouseConfigItem> configChangeList = configItemService.getList(changeId); |
| | | data.setConfigChangeList(configChangeList); |
| | | |
| | | } else { |
| | | ConfigItemChange configItemChange = new ConfigItemChange(); |
| | | data.setConfigItemChange(configItemChange); |
| | | List<?> cmList = baseDao.itemList("warehouse_cm_audit"); |
| | | List<?> cmList = baseDao.itemList("change_cm_audit"); |
| | | List<?> CmAuditList = cmList; |
| | | data.setCmAuditList((List<WarehouseCmAudit>) CmAuditList); |
| | | List<?> qaList = baseDao.itemList("warehouse_qa_audit"); |
| | | List<?> qaList = baseDao.itemList("change_qa_audit"); |
| | | List<?> QaAuditList = qaList; |
| | | data.setQaAuditList((List<WarehouseQaAudit>) QaAuditList); |
| | | List<?> resultList = configItemService.ConfigItemList(projectId); |
| | | List<?> ConfigItemList = resultList; |
| | | data.setConfigItemList((List<WarehouseConfigItem>) ConfigItemList); |
| | | } |
| | | |
| | | if (projectId != null) { |
| | |
| | | return data; |
| | | } |
| | | |
| | | public void exportConfigChange(Long id, HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | ConfigItemChangeDto dataObj = this.getDto(null, id); |
| | | |
| | | String qaAuditorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getQaAuditorId())); |
| | | dataObj.getConfigItemChange().setQaAuditor(qaAuditorPath); |
| | | String cmAuditorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getCmAuditorId())); |
| | | dataObj.getConfigItemChange().setCmAuditor(cmAuditorPath); |
| | | String implementerPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getImplementerId())); |
| | | dataObj.getConfigItemChange().setImplementer(implementerPath); |
| | | String approvalSignPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getApprovalId())); |
| | | dataObj.getConfigItemChange().setApprovalSign(approvalSignPath); |
| | | String warehouseOperatorPath = "文件图片:" + getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getWarehouseOperatorId())); |
| | | dataObj.getConfigItemChange().setWarehouseOperator(warehouseOperatorPath); |
| | | /*String outboundOperatorPath = "文件图片:"+getFilesPath.getSignPath(Convert.toLong(dataObj.getConfigItemChange().getOutboundOperatorId())); |
| | | dataObj.getConfigItemChange().setOutboundOperator(outboundOperatorPath);*/ |
| | | //通用字典列表字符串生成 |
| | | String libraryTypeStr = getShowDictList.getShowDictList(dataObj.getConfigItemChange().getLibraryType(), "library_type", false); |
| | | dataObj.getConfigItemChange().setLibraryType(libraryTypeStr); |
| | | |
| | | String QaAuditResultStr = getShowDictList.getShowDictList(dataObj.getConfigItemChange().getQaAuditResults(), "is_pass", false); |
| | | dataObj.getConfigItemChange().setQaAuditResults(QaAuditResultStr); |
| | | |
| | | String CmAuditResultStr = getShowDictList.getShowDictList(dataObj.getConfigItemChange().getCmAuditResults(), "is_pass", false); |
| | | dataObj.getConfigItemChange().setCmAuditResults(CmAuditResultStr); |
| | | |
| | | String ApprovalOpinionStr = getShowDictList.getShowDictList(dataObj.getConfigItemChange().getApprovalOpinions(), "is_agree", false); |
| | | dataObj.getConfigItemChange().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.getConfigChangeList()) { |
| | | 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(); |
| | | } |
| | | } |
| | | } |