+ * 创建人修改人基础字段 + *
+ * + * @author WendyYang + * @since 17:17 2023/01/29 + */ +public interface BaseFieldConst { + + String CREATE_BY = "createBy"; + String UPDATE_BY = "updateBy"; + String CREATE_ON = "createOn"; + String UPDATE_ON = "updateOn"; + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java new file mode 100644 index 0000000..0784b6f --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/BizConst.java @@ -0,0 +1,108 @@ +package com.ningdatech.kqapi.common.constant; + +import com.ningdatech.basic.model.ApiResponse; + +import java.math.BigDecimal; + +/** + *+ * 业务常量 + *
+ * + * @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+ * RegionConst + *
+ * + * @author WendyYang + * @since 13:57 2023/3/1 + */ +public interface RegionConst { + + //---------------------------------------地区层级(缩写RL)------------------------------------------------------------- + + int RL_PROVINCE = 1; + + int RL_CITY = 2; + + int RL_COUNTY = 3; + + //---------------------------------------地区编码(缩写RC)------------------------------------------------------------- + + /** + * 丽水行政区划编码 + */ + String RC_LS = "331100"; + //丽水开发区 + String LS_KF = "331118"; + String LS_KF_IRS = "331151"; + String RC_LS_SBJ_IRS = "331101"; + //遂昌县 + String RC_SC = "331123"; + String LS_KF_NAME = "开发区"; + + /** + * 中国行政区划编码 + */ + String RC_CHINA = "100000"; + + + /** + * 浙江行政区划编码 + */ + String RC_ZJ = "330000"; + + //----------------------------------------地区父级ID(缩写PID)--------------------------------------------------------- + + long PID_CHINA = 0; + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/StateMachineConst.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/StateMachineConst.java new file mode 100644 index 0000000..9cd0f1f --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/constant/StateMachineConst.java @@ -0,0 +1,14 @@ +package com.ningdatech.kqapi.common.constant; + +/** + * @author CMM + * @since 2023/02/07 16:24 + */ + +public class StateMachineConst { + + public static final String PROJECT_DECLARE = "projectDeclare"; + public static final String APPLICATION_DECLARE = "applicationDeclare"; + public static final String LI_SHUI_CITY_AREA_CODE = "331100"; + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/BoolDisplayEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/BoolDisplayEnum.java new file mode 100644 index 0000000..9c45703 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/BoolDisplayEnum.java @@ -0,0 +1,32 @@ +package com.ningdatech.kqapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author liuxinxin + * @date 2022/7/26 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum BoolDisplayEnum { + + /** + * true + */ + Y, + + /** + * false + */ + N; + + public static boolean judgeBoolean(String key) { + return Y.name().equals(key); + } + + public static BoolDisplayEnum judgeBoolean(boolean key) { + return key ? Y : N; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/CommonEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/CommonEnum.java new file mode 100644 index 0000000..753c33b --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/CommonEnum.java @@ -0,0 +1,39 @@ +package com.ningdatech.kqapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @author zpf + * @date 2023/3/12 上午9:21 + */ +@AllArgsConstructor +@Getter +public enum CommonEnum { + /** + * 公共的一些枚举 + */ + YES(1,"是",1), + NO(0,"否",1), + + LS_SBJ(331100,"市本级",2), + LS_LD(331102,"莲都区",2), + LS_QT(331121,"青田县",2), + LS_JY(331122,"缙云县",2), + LS_SC(331123,"遂昌县",2), + LS_SY(331124,"松阳县",2), + LS_YH(331125,"云和县",2), + LS_QY(331126,"庆元县",2), + LS_JN(331127,"景宁畲族自治县",2), + LS_LQ(331181,"龙泉市",2), + LS_KFQ(331199,"开发区",2), + ZWDD(0,"浙政钉",3), + MOBILE(1,"短信",3); + + private Integer code; + private String desc; + private Integer groupId; + + + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ExportOptionEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ExportOptionEnum.java new file mode 100644 index 0000000..9185c77 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ExportOptionEnum.java @@ -0,0 +1,157 @@ +package com.ningdatech.kqapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +/** + * 导出选项枚举 + * + * @author CMM + * @since 2023/02/10 16:38 + */ +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ExportOptionEnum { + /** + * 导出选项 + */ + id(1, "项目ID"), + + projectName(2, "项目名称"), + + areaCode(3, "行政区划编码"), + + area(4, "行政区划名称"), + + responsibleMan(5, "项目负责人"), + + responsibleManMobile(6, "项目负责人手机号"), + + contactName(7, "项目联系人"), + + contactPhone(8, "项目联系人手机号"), + + higherSuperOrg(9, "上级业务主管单位"), + + higherSuperOrgCode(10, "上级主管单位浙政钉ID"), + + superOrg(11, "本级主管部门"), + + superOrgCode(12, "本级主管部门浙政钉ID"), + + buildOrgName(13, "建设单位名称"), + + buildOrgZheJiangGovDingId(14, "建设单位浙政钉ID"), + + orgCreditCode(15, "建设单位统一信用代码"), + + projectType(16, "项目类型"), + + isFirst(17, "是否首次新建"), + + relatedExistsApplication(18, "关联应用"), + + relatedExistsApplicationCode(19, "关联应用IRS编码"), + + declareAmount(20, "申报金额"), + + approvedTotalInvestmentIncrease(21, "批复金额"), + + /** + * 表里没有 + */ + budgetSource(22, "预算来源"), + + projectYear(23, "预算年度"), + + projectIntroduction(24, "项目简介"), + + buildBasis(25, "立项依据"), + + buildLevel(26, "建设层级"), + + developCode(27, "发改编码"), + + financialCode(28, "财政编码"), + + /** + * 表里没有 + */ + informationValidity(29, "信息是否有效"), + + + isDigitalReform(30, "是否数字化改革项目"), + + bizDomain(31, "综合应用领域"), + + isCloud(32, "是否上云"), + + cloudType(33, "云类型"), + + fourSystems(34, "四大体系"), + isTemporaryAugment(35, "是否临时增补"), + + protectionLevel(36, "等保级别"), + + isSecretComments(37, "是否密评"), + + businessNumber(38, "业务编号"), + + businessName(39, "业务名称"), + + orgName(40, "单位名称"), + + softwareDevelopmentAmount(41, "软件开发"), + + cloudHardwarePurchaseAmount(42, "云资源、硬件购置"), + + thirdPartyAmount(43, "第三方服务"), + + safetyInputTitle(44, "投入项"), + + safetyInputDescribe(45, "内容描述"), + + safetyInputAmount(46, "金额"), + + annualPlanAmount(47, "年度支付金额"), + + annualPlanHaveAmount(48, "自有资金"), + + declareGovOwnFinanceAmount(49, "政府投资-本级财政资金"), + + declareGovSuperiorFinanceAmount(50, "政府投资-上级补助资金"), + + declareBankLendingAmount(51, "银行贷款"), + + declareOtherAmount(52, "其它资金"), + + engineeringSpeedOne(53, "第一季度"), + + engineeringSpeedTwo(54, "第二季度"), + + engineeringSpeedThree(55, "第三季度"), + + engineeringSpeedFour(56, "第四季度"), + + preliminaryPlanFile(57, "初步方案"), + + supportingMaterialsFile(58, "附件-佐证材料"), + + projectRemarks(59, "备注"), + processStatusName(60, "流程状态名称"), + processLaunchTime(61,"流程发起时间"), + processHandleTime(62,"流程处理时间"), + + projectStatusName(63,"项目状态名称"), + + createOn(64,"创建时间"), + + updateOn(65,"更新时间"); + + + private Integer code; + private String desc; +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ProjectProcessStageEnum.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ProjectProcessStageEnum.java new file mode 100644 index 0000000..8c2d16e --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/enumeration/ProjectProcessStageEnum.java @@ -0,0 +1,39 @@ +package com.ningdatech.kqapi.common.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public enum ProjectProcessStageEnum { + /** + * 项目流程配置 阶段枚举 + */ + ORG_INTERNAL_APPROVAL_PROCESS(1,"单位内部审批流程"), + PROJECT_PREQUALIFICATION_APPROVAL_PROCESS(2,"项目预审审批流程"), + DEPARTMENT_JOINT_APPROVAL_PROCESS(3,"部门联合审批流程"), + CONSTRUCTION_PROJECT_APPROVAL_PROCESS(4,"建设方案审批流程"), + ACCEPTANCE_DECLARATION_APPROVAL_PROCESS(5,"验收申报审批流程"), + APPLY_DELAY(6,"申请延期审批流程"), + APPLY_BORROW(7,"申请借阅审批流程"); + + private Integer code; + private String desc; + + public static String getDesc(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (ProjectProcessStageEnum t : ProjectProcessStageEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/errorcode/AppErrorCode.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/errorcode/AppErrorCode.java new file mode 100644 index 0000000..76df261 --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/errorcode/AppErrorCode.java @@ -0,0 +1,24 @@ +package com.ningdatech.kqapi.common.errorcode; + +import lombok.Getter; + +/** + * @author LiuXinXin + */ +@Getter +public enum AppErrorCode { + USER(100), + + AUTH(101); + + private final Integer code; + + AppErrorCode(Integer code) { + this.code = code; + } + + public Integer getCode() { + return code; + } + +} diff --git a/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..82a981e --- /dev/null +++ b/kqapi/src/main/java/com/ningdatech/kqapi/common/handler/GlobalExceptionHandler.java @@ -0,0 +1,62 @@ +package com.ningdatech.kqapi.common.handler; + +import com.ningdatech.basic.enumeration.Status; +import com.ningdatech.basic.model.ApiResponse; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.support.DefaultMessageSourceResolvable; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.servlet.NoHandlerFoundException; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.stream.Collectors; + +/** + * @description: 统一错误处理 + * @author: liuxinxin + * @date: 2023/01/03 11:39 + */ +@Slf4j +@ControllerAdvice +@ResponseStatus(HttpStatus.BAD_REQUEST) +public class GlobalExceptionHandler { + + @ResponseBody + @ExceptionHandler(value = NoHandlerFoundException.class) + public ApiResponse