@@ -82,6 +82,36 @@ | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.ningdatech</groupId> | |||
<artifactId>nd-basic</artifactId> | |||
<exclusions> | |||
<exclusion> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>slf4j-log4j12</artifactId> | |||
</exclusion> | |||
<exclusion> | |||
<artifactId>spring-boot-starter-security</artifactId> | |||
<groupId>org.springframework.boot</groupId> | |||
</exclusion> | |||
<exclusion> | |||
<artifactId>spring-security-config</artifactId> | |||
<groupId>org.springframework.security</groupId> | |||
</exclusion> | |||
<exclusion> | |||
<artifactId>spring-security-web</artifactId> | |||
<groupId>org.springframework.security</groupId> | |||
</exclusion> | |||
<exclusion> | |||
<artifactId>spring-security-core</artifactId> | |||
<groupId>org.springframework.security</groupId> | |||
</exclusion> | |||
<exclusion> | |||
<groupId>com.baomidou</groupId> | |||
<artifactId>mybatis-plus-boot-starter</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
</dependencies> | |||
<!-- 打包 --> | |||
@@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; | |||
@EnableScheduling | |||
@EnableTransactionManagement | |||
@EnableAspectJAutoProxy(exposeProxy = true) | |||
@ComponentScan(basePackages = {"com.ningdatech.syndataapi.scheduler"}) | |||
@ComponentScan(basePackages = {"com.ningdatech.syndataapi.**"}) | |||
public class SynDataTaskApp { | |||
protected static final String MAPPER_PACKAGES = "com.ningdatech.syndataapi.**.mapper"; | |||
@@ -0,0 +1,100 @@ | |||
package com.ningdatech.syndataapi.common.constant; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import java.math.BigDecimal; | |||
/** | |||
* <p> | |||
* 业务常量 | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 13:42 2022/12/1 | |||
*/ | |||
public interface BizConst { | |||
/** | |||
* SQL查询一条 | |||
*/ | |||
String LIMIT_1 = "limit 1"; | |||
String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; | |||
/** | |||
* 一小时秒数 | |||
**/ | |||
BigDecimal SECONDS_BY_HOUR = new BigDecimal(60 * 60); | |||
/** | |||
* 十分钟的毫秒数 | |||
*/ | |||
long MILLS_10_MIN = 1000L * 60 * 10; | |||
/** | |||
* 中国行政区划编码 | |||
*/ | |||
long ROOT_REGION_CODE = 100000L; | |||
/** | |||
* 一级行政区划数量 | |||
*/ | |||
int NUM_PROVINCE = 34; | |||
/** | |||
* 默认的父id | |||
*/ | |||
long PARENT_ID = 0L; | |||
/** | |||
* 默认树层级 | |||
*/ | |||
int TREE_GRADE = 0; | |||
/** | |||
* 默认的排序 | |||
*/ | |||
int SORT_VALUE = 0; | |||
/** | |||
* 浙江省的region_id | |||
*/ | |||
long ZJ_REGION_CODE = 330000L; | |||
String NINE_AREA_CODE_LAST = "000"; | |||
/** | |||
* 省/直辖市 level | |||
*/ | |||
int GOV_L1 = 1; | |||
/** | |||
* 市 level | |||
*/ | |||
int GOV_L2 = 2; | |||
/** | |||
* 区/县 level | |||
*/ | |||
int GOV_L3 = 3; | |||
/** | |||
* 密码正则:长度8-20位且至少包含大写字母、小写字母、数字或特殊符号中的任意三种 | |||
*/ | |||
String REGEX_PASS = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,20}$"; | |||
ApiResponse<Void> UNAUTHENTICATED = ApiResponse.of(401, "用户未登录", null); | |||
int MAX_EXPORT_COUNT = 5000; | |||
String RESPONSE_KEY_DATA = "data"; | |||
String ORG_NAME = "organizationName"; | |||
String ORG_CODE = "organizationCode"; | |||
String DEV = "dev"; | |||
String PRE = "pre"; | |||
String PROD = "prod"; | |||
String SAVE_SUCCESS = "保存成功"; | |||
String OP_SUCCESS = "操作成功"; | |||
String SAVE_FAIL = "保存失败"; | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.ningdatech.syndataapi.open.controller; | |||
import com.ningdatech.basic.model.ApiResponse; | |||
import com.ningdatech.syndataapi.open.manage.ProjectReceiveManage; | |||
import com.ningdatech.syndataapi.scheduler.model.dto.ProjectSaveDTO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* @Classname ProjectCollectionController | |||
* @Description | |||
* @Date 2023/6/25 9:11 | |||
* @Author PoffyZhang | |||
*/ | |||
@RestController | |||
@RequiredArgsConstructor | |||
@Api(tags = "项目归集控制器") | |||
@RequestMapping("/open/api/v1/project-receive") | |||
public class ProjectReceiveController { | |||
private final ProjectReceiveManage receiveManage; | |||
@PostMapping("/save") | |||
@ApiOperation("项目归集接收") | |||
public ApiResponse<String> save(@Valid @RequestBody ProjectSaveDTO dto) { | |||
return ApiResponse.ofSuccess(receiveManage.save(dto)); | |||
} | |||
} |
@@ -0,0 +1,146 @@ | |||
package com.ningdatech.syndataapi.open.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.function.VUtils; | |||
import com.ningdatech.syndataapi.common.constant.BizConst; | |||
import com.ningdatech.syndataapi.scheduler.model.dto.ProjectSaveDTO; | |||
import com.ningdatech.syndataapi.scheduler.model.entity.*; | |||
import com.ningdatech.syndataapi.scheduler.service.*; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
* @Classname ProjectReceiveManage | |||
* @Description | |||
* @Date 2023/8/25 9:11 | |||
* @Author PoffyZhang | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ProjectReceiveManage { | |||
private final IProjectBaseInfoService baseInfoService; | |||
private final IProjectApplyService applyService; | |||
private final IProjectApproveService approveService; | |||
private final IProjectCimplementService cimplementService; | |||
private final IProjectMimplementService mimplementService; | |||
private final IProjectProcureService procureService; | |||
/** | |||
* 接收保存 项目 | |||
* @param dto | |||
* @return | |||
*/ | |||
public String save(ProjectSaveDTO dto) { | |||
//1.保存项目基本信息 | |||
ProjectBaseInfo baseInfo = dto.getBaseinfo(); | |||
String baseProjId = baseInfo.getBaseProjId(); | |||
VUtils.isTrue(StringUtils.isBlank(baseProjId)) | |||
.throwMessage("项目编号不能为空!"); | |||
ProjectBaseInfo oldBaseInfo = baseInfoService.getOne(Wrappers.lambdaQuery(ProjectBaseInfo.class) | |||
.eq(ProjectBaseInfo::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectBaseInfo saveBase = BeanUtil.copyProperties(baseInfo,ProjectBaseInfo.class); | |||
if(Objects.isNull(oldBaseInfo)){ | |||
saveBase.setTongTime(LocalDateTime.now()); | |||
} | |||
saveBase.setBizTime(LocalDateTime.now()); | |||
baseInfoService.saveOrUpdate(saveBase); | |||
// 2.保存 申报信息 | |||
ProjectApply apply = dto.getApply(); | |||
ProjectApply oldApply = applyService.getOne(Wrappers.lambdaQuery(ProjectApply.class) | |||
.eq(ProjectApply::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectApply saveApply = BeanUtil.copyProperties(apply,ProjectApply.class); | |||
saveApply.setBaseProjId(baseProjId); | |||
if(Objects.isNull(oldApply)){ | |||
saveApply.setTongTime(LocalDateTime.now()); | |||
} | |||
saveApply.setBizTime(LocalDateTime.now()); | |||
applyService.saveOrUpdate(saveApply); | |||
// 3.保存 审批信息 | |||
ProjectApprove approve = dto.getApprove(); | |||
ProjectApprove oldApprove = approveService.getOne(Wrappers.lambdaQuery(ProjectApprove.class) | |||
.eq(ProjectApprove::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectApprove saveApprove = BeanUtil.copyProperties(approve,ProjectApprove.class); | |||
saveApprove.setBaseProjId(baseProjId); | |||
if(Objects.isNull(oldApprove)){ | |||
saveApprove.setTongTime(LocalDateTime.now()); | |||
} | |||
saveApprove.setBizTime(LocalDateTime.now()); | |||
approveService.saveOrUpdate(saveApprove); | |||
// 4.保存 建设项目 实施信息 | |||
ProjectCimplement cimplement = dto.getCimplement(); | |||
if(Objects.nonNull(cimplement)){ | |||
ProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(ProjectCimplement.class) | |||
.eq(ProjectCimplement::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,ProjectCimplement.class); | |||
saveCimplement.setBaseProjId(baseProjId); | |||
if(Objects.isNull(oldCimplement)){ | |||
saveCimplement.setTongTime(LocalDateTime.now()); | |||
} | |||
saveCimplement.setBizTime(LocalDateTime.now()); | |||
cimplementService.saveOrUpdate(saveCimplement); | |||
} | |||
// 5.保存 运维项目 实施信息 | |||
ProjectMimplement mimplement = dto.getMimplement(); | |||
if(Objects.nonNull(mimplement)){ | |||
ProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(ProjectMimplement.class) | |||
.eq(ProjectMimplement::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,ProjectMimplement.class); | |||
saveMimplement.setBaseProjId(baseProjId); | |||
if(Objects.isNull(oldMimplement)){ | |||
saveMimplement.setTongTime(LocalDateTime.now()); | |||
} | |||
saveMimplement.setBizTime(LocalDateTime.now()); | |||
mimplementService.saveOrUpdate(saveMimplement); | |||
} | |||
// 6.保存 采购信息 | |||
ProjectProcure procure = dto.getProcure(); | |||
if(Objects.nonNull(procure)){ | |||
ProjectProcure oldProcure = procureService.getOne(Wrappers.lambdaQuery(ProjectProcure.class) | |||
.eq(ProjectProcure::getBaseProjId, baseProjId) | |||
.last(BizConst.LIMIT_1)); | |||
ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class); | |||
saveProcure.setBaseProjId(baseProjId); | |||
if(Objects.isNull(oldProcure)){ | |||
saveProcure.setTongTime(LocalDateTime.now()); | |||
} | |||
saveProcure.setBizTime(LocalDateTime.now()); | |||
procureService.saveOrUpdate(saveProcure); | |||
} | |||
return BizConst.SAVE_SUCCESS; | |||
} | |||
} |
@@ -0,0 +1,33 @@ | |||
package com.ningdatech.syndataapi.scheduler.model.dto; | |||
import com.ningdatech.syndataapi.scheduler.model.entity.*; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotNull; | |||
/** | |||
* @Classname ProjectSaveDTO | |||
* @Description | |||
* @Date 2023/8/25 9:45 | |||
* @Author PoffyZhang | |||
*/ | |||
@Data | |||
@ApiModel(value = "SProjectSaveDTO", description = "项目保存") | |||
public class ProjectSaveDTO { | |||
@NotNull(message = "项目基本信息不能为空") | |||
private ProjectBaseInfo baseinfo; | |||
@NotNull(message = "项目申报信息不能为空") | |||
private ProjectApply apply; | |||
@NotNull(message = "项目审批信息不能为空") | |||
private ProjectApprove approve; | |||
private ProjectCimplement cimplement; | |||
private ProjectMimplement mimplement; | |||
private ProjectProcure procure; | |||
} |