Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
niohe·erbao 1 year ago
parent
commit
ce1266ccb3
8 changed files with 146 additions and 21 deletions
  1. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  2. +2
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/provincial/controller/TestController.java
  3. +120
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/SjApiResponse.java
  4. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/IJoinReviewProvincialBureauService.java
  5. +4
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java
  6. +2
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java
  7. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  8. +12
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java View File

@@ -143,7 +143,8 @@ public class UserInfoHelperImpl implements UserInfoHelper {


@Override @Override
public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) { public UserFullInfoDTO getUserFullInfoByEmployeeCode(String employeeCode) {
return getUserFullInfoByEmployeeCode(employeeCode);
UserInfo userInfo = userInfoService.getUserInfoByEmployeeCode(employeeCode);
return getUserFullInfo(userInfo);
} }


@Override @Override


+ 2
- 5
pmapi/src/main/java/com/ningdatech/pmapi/provincial/controller/TestController.java View File

@@ -1,15 +1,12 @@
package com.ningdatech.pmapi.provincial.controller; package com.ningdatech.pmapi.provincial.controller;


import cn.hutool.core.io.resource.ResourceUtil;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage; import com.ningdatech.pmapi.projectdeclared.manage.ReviewByProvincialDeptManage;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO;
import com.ningdatech.pmapi.provincial.model.res.SjApiResponse;
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;


import javax.validation.Valid; import javax.validation.Valid;
@@ -43,7 +40,7 @@ public class TestController {


@GetMapping("/detail") @GetMapping("/detail")
@ApiOperation("测试获取详情") @ApiOperation("测试获取详情")
private ApiResponse detail(@RequestParam String projectId){
private SjApiResponse detail(@RequestParam String projectId){
return joinReviewProvincialBureauService.processInfo(projectId); return joinReviewProvincialBureauService.processInfo(projectId);
} }




+ 120
- 0
pmapi/src/main/java/com/ningdatech/pmapi/provincial/model/res/SjApiResponse.java View File

@@ -0,0 +1,120 @@
package com.ningdatech.pmapi.provincial.model.res;

import com.ningdatech.basic.enumeration.Status;
import com.ningdatech.basic.model.ApiStatus;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* <p>
* ApiResponse - 省局统一的接口返回值封装
* </p>
*
* @author ZPF
* @since 14:29 2022/9/29
*/
@Data
@NoArgsConstructor
public class SjApiResponse<T> implements Serializable {
private static final long serialVersionUID = 532384723325394156L;

public static final int SUCCESS_CODE = 200;

public static final String SUCCESS_MSG = "success";

public static final int ERROR_CODE = 500;

public static final String ERROR_MSG = "Internal server error";

/**
* 状态码
*/
private Integer code;

/**
* 返回内容
*/
private String msg;

/**
* 返回数据
*/
private T data;

/**
* 全参构造函数
*
* @param code 状态码
* @param msg 返回内容
* @param data 返回数据
*/
private SjApiResponse(Integer code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}

/**
* 构造一个自定义的API返回
*
* @param code 状态码
* @param msg 返回内容
* @param data 返回数据
* @return ApiResponse
*/
public static <T> SjApiResponse<T> of(Integer code, String msg, T data) {
return new SjApiResponse<T>(code, msg, data);
}

/**
* 构造一个成功且不带数据的API返回
*
* @return ApiResponse
*/
public static <T> SjApiResponse<T> ofSuccess() {
return ofSuccess(null);
}

/**
* 构造一个成功且带数据的API返回
*
* @param data 返回数据
* @return ApiResponse
*/
public static <T> SjApiResponse<T> ofSuccess(T data) {
return ofStatus(Status.OK, data);
}

/**
* 构造一个成功且自定义消息的API返回
*
* @param msg 返回内容
* @return ApiResponse
*/
public static <T> SjApiResponse<T> ofMessage(String msg) {
return of(Status.OK.getCode(), msg, null);
}

/**
* 构造一个有状态的API返回
*
* @param status 状态 {@link Status}
* @return ApiResponse
*/
public static <T> SjApiResponse<T> ofStatus(ApiStatus status) {
return ofStatus(status, null);
}

/**
* 构造一个有状态且带数据的API返回
*
* @param status 状态 {@link Status}
* @param data 返回数据
* @return ApiResponse
*/
public static <T> SjApiResponse<T> ofStatus(ApiStatus status, T data) {
return of(status.getCode(), status.getReasonPhrase(), data);
}
}

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/IJoinReviewProvincialBureauService.java View File

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.provincial.service; package com.ningdatech.pmapi.provincial.service;


import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO;
import com.ningdatech.pmapi.provincial.model.res.SjApiResponse;


/** /**
* @Classname JointReviewProvincialBureauService * @Classname JointReviewProvincialBureauService
@@ -22,5 +22,5 @@ public interface IJoinReviewProvincialBureauService {
* 查看 本区域 省局联审 的项目审核详情 * 查看 本区域 省局联审 的项目审核详情
* @return * @return
*/ */
ApiResponse processInfo(String projectId);
SjApiResponse processInfo(String projectId);
} }

+ 4
- 3
pmapi/src/main/java/com/ningdatech/pmapi/provincial/service/impl/JoinReviewProvincialBureauServiceImpl.java View File

@@ -8,6 +8,7 @@ import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.config.ProvincialProperties; import com.ningdatech.pmapi.common.config.ProvincialProperties;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO;
import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes; import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes;
import com.ningdatech.pmapi.provincial.model.res.SjApiResponse;
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -80,13 +81,13 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc
* @return * @return
*/ */
@Override @Override
public ApiResponse processInfo(String projectId) {
public SjApiResponse processInfo(String projectId) {
Long timeStamp = System.currentTimeMillis()/1000; Long timeStamp = System.currentTimeMillis()/1000;
String url = provincialProperties.getHost() + provincialProperties.getDetailUrl() String url = provincialProperties.getHost() + provincialProperties.getDetailUrl()
+ "?timestamp=" + timeStamp; + "?timestamp=" + timeStamp;


log.info("省局获取审核详情 url {}",url); log.info("省局获取审核详情 url {}",url);
ResponseEntity<ApiResponse> responseEntity = null;
ResponseEntity<SjApiResponse> responseEntity = null;


String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(), String signature = getSha256(timeStamp,provincialProperties.getDetailUrl(),
HttpMethod.POST.name()); HttpMethod.POST.name());
@@ -104,7 +105,7 @@ public class JoinReviewProvincialBureauServiceImpl implements IJoinReviewProvinc
.body(jsonBaby); //也可以是DTO .body(jsonBaby); //也可以是DTO


try { try {
responseEntity = restTemplate.exchange(requestEntity,ApiResponse.class);
responseEntity = restTemplate.exchange(requestEntity,SjApiResponse.class);
log.info("获取审批详情 响应 :{}",responseEntity); log.info("获取审批详情 响应 :{}",responseEntity);
} catch (Exception e) { } catch (Exception e) {
log.error("[省局获取审核详情] http request error", e); log.error("[省局获取审核详情] http request error", e);


+ 2
- 5
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java View File

@@ -4,14 +4,13 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.http.HttpStatus; import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.projectdeclared.manage.PrequalificationDeclaredProjectManage;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.service.IProjectService; import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.provincial.enumeration.ProjectProvincialAuditStatusEnum; import com.ningdatech.pmapi.provincial.enumeration.ProjectProvincialAuditStatusEnum;
import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes; import com.ningdatech.pmapi.provincial.model.res.ProvincialProjectRes;
import com.ningdatech.pmapi.provincial.model.res.SjApiResponse;
import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService; import com.ningdatech.pmapi.provincial.service.IJoinReviewProvincialBureauService;
import com.ningdatech.pmapi.scheduler.contants.TaskContant; import com.ningdatech.pmapi.scheduler.contants.TaskContant;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -41,8 +40,6 @@ public class CheckProvincialReviewResultTask {
private final IProjectService projectService; private final IProjectService projectService;
private final StateMachineUtils stateMachineUtils; private final StateMachineUtils stateMachineUtils;


private final PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage;

@Scheduled(cron = "0 */2 * * * ?") @Scheduled(cron = "0 */2 * * * ?")
public void statusFlow() throws UnknownHostException { public void statusFlow() throws UnknownHostException {
//测试暂时用自己电脑HOST //测试暂时用自己电脑HOST
@@ -62,7 +59,7 @@ public class CheckProvincialReviewResultTask {
//遍历 //遍历
for(Project project: projectList){ for(Project project: projectList){
try{ try{
ApiResponse apiResponse = reviewProvincialBureauService.processInfo(project.getProjectCode());
SjApiResponse apiResponse = reviewProvincialBureauService.processInfo(project.getProjectCode());
log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse); log.info("项目 【{}】 去获取省局联审结果 :{}",project.getId(),apiResponse);
if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){ if(Objects.isNull(apiResponse) || !Integer.valueOf(HttpStatus.HTTP_OK).equals(apiResponse.getCode())){
log.info("项目 【{}】 去获取省局联审结果失败",project.getId()); log.info("项目 【{}】 去获取省局联审结果失败",project.getId());


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java View File

@@ -15,4 +15,6 @@ public interface IUserInfoService extends IService<UserInfo> {


UserInfo getUserInfoByPhoneNo(String phoneNo); UserInfo getUserInfoByPhoneNo(String phoneNo);


UserInfo getUserInfoByEmployeeCode(String employeeCode);

} }

+ 12
- 5
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.pmapi.user.service.impl; package com.ningdatech.pmapi.user.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.pmapi.user.entity.UserInfo; import com.ningdatech.pmapi.user.entity.UserInfo;
@@ -20,16 +21,22 @@ import org.springframework.stereotype.Service;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService { public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo> implements IUserInfoService {
private final NdUserInfoMapper userInfoMapper;


@Override @Override
public UserInfo getUserInfoByPhoneNo(String phoneNo) { public UserInfo getUserInfoByPhoneNo(String phoneNo) {
if (StringUtils.isEmpty(phoneNo)) { if (StringUtils.isEmpty(phoneNo)) {
return null; return null;
} }
UserInfo userInfo = userInfoMapper
.selectOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getMobile, phoneNo));
return userInfo;
LambdaQueryWrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getMobile, phoneNo);
return getOne(query);
} }

@Override
public UserInfo getUserInfoByEmployeeCode(String employeeCode) {
LambdaQueryWrapper<UserInfo> query = Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, employeeCode);
return getOne(query);
}

} }

Loading…
Cancel
Save