@@ -137,10 +137,10 @@ public class ProjectStateChangeAction { | |||
project.setStatus(ProjectStatus.ON_ADAPTING.getCode()); | |||
} | |||
@OnTransition(source = "ON_PURCHASING", target = "TO_BE_FIRST_INSPECTED") | |||
@OnTransition(source = "ON_PURCHASING", target = "ACCEPTED") | |||
public void SUBMIT_PURCHASE_CONTRACT_RECORD_TO_FIRST_ACCEPT(Message<ProjectStateChangeEvent> message) { | |||
Project project = getProject(message); | |||
project.setStatus(ProjectStatus.TO_BE_FIRST_INSPECTED.getCode()); | |||
project.setStatus(ProjectStatus.ACCEPTED.getCode()); | |||
} | |||
@OnTransition(source = "ON_ADAPTING", target = "TO_BE_FIRST_INSPECTED") | |||
@@ -41,10 +41,10 @@ public class TenderStateChangeAction { | |||
* | |||
* @param message \ | |||
*/ | |||
@OnTransition(source = "TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO", target = "TO_BE_SUBMIT_FIRST_INSPECTED_INFO") | |||
@OnTransition(source = "TO_BE_SUBMIT_PURCHASE_CONSTRUCTION_INFO", target = "FINALLY_INSPECTED_PASSED") | |||
public void SUBMIT_PURCHASE_CONSTRUCTION_INFO_SKIP_TO_FINAL_INSPECT(Message<TenderStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
purchase.setStatus(TenderMainStatus.TO_BE_SUBMIT_FIRST_INSPECTED_INFO.getCode()); | |||
purchase.setStatus(TenderMainStatus.FINALLY_INSPECTED_PASSED.getCode()); | |||
} | |||
/** | |||
@@ -1,10 +1,8 @@ | |||
package com.hz.pm.api.projectdeclared.model.vo; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
@@ -1,41 +0,0 @@ | |||
package com.hz.pm.api.projectlib.controller; | |||
import com.hz.pm.api.projectlib.manage.ApplicationManage; | |||
import com.hz.pm.api.projectlib.model.dto.ApplicationAppCodeSaveDTO; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* @Classname ProjectApplicationController | |||
* @Description | |||
* @Date 2023/6/27 11:32 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "项目应用控制器") | |||
@RequestMapping("/api/v1/application") | |||
public class ProjectApplicationController { | |||
private final ApplicationManage applicationManage; | |||
@GetMapping("/get-report/{appCode}") | |||
@ApiOperation("获取应用 试运行报告") | |||
@WebLog("获取应用 试运行报告") | |||
public String getReport(@PathVariable String appCode) { | |||
return applicationManage.getReport(appCode); | |||
} | |||
@PostMapping("/save-appcode") | |||
@ApiOperation("保存应用注册的appCode") | |||
@WebLog("保存应用注册的appCode") | |||
public String saveAppCode(@Valid @RequestBody ApplicationAppCodeSaveDTO dto) { | |||
return applicationManage.saveAppCode(dto); | |||
} | |||
} |
@@ -1,123 +0,0 @@ | |||
package com.hz.pm.api.projectlib.manage; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.lang.Assert; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONArray; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.util.HmacAuthUtil; | |||
import com.hz.pm.api.projectlib.model.dto.ApplicationAppCodeSaveDTO; | |||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||
import com.hz.pm.api.projectlib.service.IProjectApplicationService; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.http.*; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.util.MultiValueMap; | |||
import org.springframework.web.client.RestTemplate; | |||
import java.time.LocalDateTime; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
/** | |||
* <p> | |||
* ApplicationManage | |||
* </p> | |||
* | |||
* @author ZPF | |||
* @since 14:19 2023/2/1 | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ApplicationManage { | |||
@Value("${irs.app-report.url:}") | |||
private String url; | |||
@Value("${irs.app-report.appKey:}") | |||
private String appKey; | |||
@Value("${irs.app-report.appScret:}") | |||
private String appScret; | |||
private final IProjectApplicationService applicationService; | |||
private final IProjectService projectService; | |||
/** | |||
* 保存 appCode | |||
* | |||
* @param dto | |||
* @return | |||
*/ | |||
public String saveAppCode(ApplicationAppCodeSaveDTO dto) { | |||
Long userId = LoginUserUtil.getUserId(); | |||
ProjectApplication app = applicationService.getById(dto.getId()); | |||
Assert.notNull(app, "该应用不存在"); | |||
app.setAppCode(dto.getAppCode()); | |||
app.setUpdateOn(LocalDateTime.now()); | |||
app.setUpdateBy(userId); | |||
if (applicationService.updateById(app)) { | |||
return BizConst.SAVE_SUCCESS; | |||
} | |||
return BizConst.SAVE_FAIL; | |||
} | |||
/** | |||
* 获取试运行报告 | |||
* | |||
* @param appCode | |||
* @return | |||
*/ | |||
public String getReport(String appCode) { | |||
String method = HttpMethod.GET.name(); | |||
String appUrl = url + "?appCode=" + appCode; | |||
Map<String, String> header = HmacAuthUtil.generateHeader(appUrl, method, appKey, appScret); | |||
//请求头 | |||
HttpHeaders headers = new HttpHeaders(); | |||
for (Map.Entry<String, String> entry : header.entrySet()) { | |||
headers.add(entry.getKey(), entry.getValue()); | |||
} | |||
//封装请求头 | |||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<>(headers); | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<ApiResponse> forEntity = restTemplate.exchange(appUrl, HttpMethod.GET, formEntity, ApiResponse.class); | |||
log.info("forEntity:{}", JSON.toJSONString(forEntity)); | |||
log.info("body:{}", forEntity.getBody()); | |||
ApiResponse body = forEntity.getBody(); | |||
if (!body.getCode().equals(HttpStatus.OK.value())) { | |||
throw new BizException(body.getMessage()); | |||
} | |||
Object data = body.getData(); | |||
if (Objects.nonNull(data)) { | |||
JSONObject dataJson = JSON.parseObject(JSON.toJSONString(data)); | |||
JSONArray resourceList = dataJson.getJSONArray("resourceList"); | |||
if (CollUtil.isNotEmpty(resourceList)) { | |||
JSONObject resource = JSON.parseObject(JSON.toJSONString(resourceList.get(0))); | |||
if (StringUtils.isBlank(resource.getString("reportOss"))) { | |||
//暂时没有 appCode 所以先返回测试数据 | |||
return "https://irs-yyyw.oss-cn-hangzhou-zwynet-d01-a.internet.cloud.zj.gov.cn/tmp/%E6%B8%A9%E5%B7%9E%E5%B8%82%E4%B9%90%E6%B8%85%E5%B8%82%E5%8C%BA%E5%9F%9F%E4%BD%93%E6%A3%80%E4%BF%A1%E6%81%AF%E7%B3%BB%E7%BB%9F_9cf0b901f2ca4fbf8ff274da359ad219.html?Expires=1687833685&OSSAccessKeyId=wMhEw2BhpIDc1xwO&Signature=UPAbMdDy23FI1sNemszg5WH%2BG40%3D"; | |||
} else { | |||
return resource.getString("reportOss"); | |||
} | |||
} | |||
} | |||
throw new BizException("获取报告失败!"); | |||
} | |||
} |
@@ -58,7 +58,6 @@ import com.hz.pm.api.projectlib.helper.ProjectManageUtil; | |||
import com.hz.pm.api.projectlib.model.constant.ProjectConstant; | |||
import com.hz.pm.api.projectlib.model.dto.GovSystemReplaceInfoDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectGovSystemReplaceInfosDTO; | |||
import com.hz.pm.api.projectlib.model.dto.ProjectPaymentPlanDTO; | |||
import com.hz.pm.api.projectlib.model.entity.*; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
@@ -751,8 +750,7 @@ public class ProjectLibManage { | |||
if (tmpPersons != null) { | |||
purchaseFullInfo.setFirstInspectedPersons(convertPersons(tmpPersons)); | |||
} | |||
List<ProjectGovSystemReplaceInfosDTO> replaceInfos = BeanUtil.copyToList(replaceInfosMap.get(k), ProjectGovSystemReplaceInfosDTO.class); | |||
purchaseFullInfo.setSystemReplaceInfos(replaceInfos); | |||
purchaseFullInfo.setSystemReplaceInfos(replaceInfosMap.get(k)); | |||
retProjectDetail.getPurchaseDetails().add(purchaseFullInfo); | |||
}); | |||
// 建设方案 | |||
@@ -1229,9 +1227,7 @@ public class ProjectLibManage { | |||
List<Long> childUnitIds = mhUnitCache.getViewChildIdsRecursion(user.getMhUnitId()); | |||
List<String> viewUnitIdList = CollUtils.convert(childUnitIds, String::valueOf); | |||
//单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 | |||
query.and(q1 -> q1.in(Project::getBuildOrgCode, viewUnitIdList) | |||
.or(q2 -> q2.eq(Project::getStage, ProjectStatus.NOT_APPROVED.getCode()) | |||
.in(Project::getSuperOrgCode, viewUnitIdList))); | |||
query.in(Project::getBuildOrgCode, viewUnitIdList); | |||
break; | |||
case SUPER_ADMIN: | |||
//超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 | |||