@@ -108,4 +108,5 @@ public class BeanConfig { | |||||
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) | .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) | ||||
.build(); | .build(); | ||||
} | } | ||||
} | } |
@@ -19,7 +19,7 @@ public interface BizConst { | |||||
*/ | */ | ||||
String LIMIT_1 = "limit 1"; | String LIMIT_1 = "limit 1"; | ||||
String COOKIE_KEY = "ND_PROJECT_MANAGEMENT_JSESSION"; | |||||
String COOKIE_KEY = "HZPM_SESSION"; | |||||
/** | /** | ||||
* 一小时秒数 | * 一小时秒数 | ||||
@@ -0,0 +1,17 @@ | |||||
package com.hz.pm.api.common.constant; | |||||
/** | |||||
* <p> | |||||
* BooleanBit | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 16:12 2023/12/15 | |||||
*/ | |||||
public interface BooleanBit { | |||||
int TRUE = 1; | |||||
int FALSE = 0; | |||||
} |
@@ -0,0 +1,58 @@ | |||||
package com.hz.pm.api.common.handler; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.apache.ibatis.type.BaseTypeHandler; | |||||
import org.apache.ibatis.type.JdbcType; | |||||
import org.apache.ibatis.type.MappedJdbcTypes; | |||||
import org.apache.ibatis.type.MappedTypes; | |||||
import java.sql.CallableStatement; | |||||
import java.sql.PreparedStatement; | |||||
import java.sql.ResultSet; | |||||
import java.sql.SQLException; | |||||
/** | |||||
* <p> | |||||
* BooleanBitTypeHandler | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 15:39 2023/12/15 | |||||
*/ | |||||
@Slf4j | |||||
@MappedJdbcTypes(value = JdbcType.BIT) | |||||
@MappedTypes(value = {Boolean.class, boolean.class}) | |||||
public class BooleanBitTypeHandler extends BaseTypeHandler<Boolean> { | |||||
public BooleanBitTypeHandler() { | |||||
log.info(this.getClass().getSimpleName()); | |||||
} | |||||
@Override | |||||
public void setNonNullParameter(PreparedStatement ps, int i, Boolean parameter, JdbcType jdbcType) throws SQLException { | |||||
if (parameter == null) { | |||||
ps.setInt(i, 1); | |||||
} else { | |||||
ps.setInt(i, parameter ? 1 : 0); | |||||
} | |||||
} | |||||
@Override | |||||
public Boolean getNullableResult(ResultSet rs, String columnName) throws SQLException { | |||||
Byte man = rs.getObject(columnName, Byte.class); | |||||
return man == null ? null : (man == 1); | |||||
} | |||||
@Override | |||||
public Boolean getNullableResult(ResultSet rs, int columnIndex) throws SQLException { | |||||
Byte man = rs.getObject(columnIndex, Byte.class); | |||||
return man == null ? null : (man == 1); | |||||
} | |||||
@Override | |||||
public Boolean getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { | |||||
Byte man = cs.getObject(columnIndex, Byte.class); | |||||
return man == null ? null : (man == 1); | |||||
} | |||||
} |
@@ -15,7 +15,7 @@ | |||||
sum(CASE WHEN a.password_grade = 5 THEN 1 ELSE 0 end) monitorPasswordGrade5Num | sum(CASE WHEN a.password_grade = 5 THEN 1 ELSE 0 end) monitorPasswordGrade5Num | ||||
FROM nd_project_application a | FROM nd_project_application a | ||||
LEFT JOIN nd_project p ON a."project_code" = p."project_code" AND a."project_version" = p.version | LEFT JOIN nd_project p ON a."project_code" = p."project_code" AND a."project_version" = p.version | ||||
WHERE p."newest" = TRUE | |||||
WHERE p."newest" = 1 | |||||
<if test="regionCode != null and regionCode != 'TOTAL'"> | <if test="regionCode != null and regionCode != 'TOTAL'"> | ||||
AND p."area_code" =#{regionCode} | AND p."area_code" =#{regionCode} | ||||
</if> | </if> | ||||
@@ -84,11 +84,11 @@ | |||||
<sql id="reviewedByHeadman"> | <sql id="reviewedByHeadman"> | ||||
<if test="p.reviewed"> | <if test="p.reviewed"> | ||||
exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = | exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = | ||||
me.expert_id and is_final = true) | |||||
me.expert_id and is_final = 1) | |||||
</if> | </if> | ||||
<if test="!p.reviewed"> | <if test="!p.reviewed"> | ||||
not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = | not exists(select 1 from nd_expert_review ner where ner.meeting_id = m.id and ner.project_id = np.id and ner.create_by = | ||||
me.expert_id and is_final = true) | |||||
me.expert_id and is_final = 1) | |||||
</if> | </if> | ||||
</sql> | </sql> | ||||
@@ -111,9 +111,9 @@ | |||||
from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id | from nd_project np inner join meeting_inner_project mip on mip.project_id = np.id | ||||
inner join meeting m on m.id = mip.meeting_id | inner join meeting m on m.id = mip.meeting_id | ||||
inner join meeting_expert me on m.id = me.meeting_id | inner join meeting_expert me on m.id = me.meeting_id | ||||
where m.is_inner_project = true and m.status != 3 and me.status = 3 and m.confirmed_roster = true | |||||
where m.is_inner_project = 1 and m.status != 3 and me.status = 3 and m.confirmed_roster = 1 | |||||
<if test="p.reviewed != null"> | <if test="p.reviewed != null"> | ||||
and if(me.is_headman,<include refid="reviewedByHeadman"/>,<include refid="reviewedByNotHeadman"/>) | |||||
and if(me.is_headman,'<include refid="reviewedByHeadman"/>','<include refid="reviewedByNotHeadman"/>') | |||||
</if> | </if> | ||||
and me.expert_id = #{p.userId} | and me.expert_id = #{p.userId} | ||||
<if test="p.projectName != null and p.projectName.length > 0"> | <if test="p.projectName != null and p.projectName.length > 0"> | ||||
@@ -16,7 +16,7 @@ | |||||
sum(p.approval_amount) approvalAmount | sum(p.approval_amount) approvalAmount | ||||
FROM | FROM | ||||
nd_project p | nd_project p | ||||
WHERE build_org_code = #{orgCode} and project_year = #{year} and newest = true | |||||
WHERE build_org_code = #{orgCode} and project_year = #{year} and newest = 1 | |||||
</select> | </select> | ||||
<select id="getRegionStatistics" resultType="com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | <select id="getRegionStatistics" resultType="com.hz.pm.api.projectdeclared.model.po.DeclaredProjectStatisticsPO"> | ||||
@@ -33,6 +33,6 @@ | |||||
sum(p.approval_amount) approvalAmount | sum(p.approval_amount) approvalAmount | ||||
FROM | FROM | ||||
nd_project p | nd_project p | ||||
WHERE area_code = #{regionCode} and project_year = #{year} and newest = true | |||||
WHERE area_code = #{regionCode} and project_year = #{year} and newest = 1 | |||||
</select> | </select> | ||||
</mapper> | </mapper> |
@@ -19,5 +19,5 @@ public interface ProjectMapper extends BaseMapper<Project> { | |||||
Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req); | Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req); | ||||
Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req); | |||||
Page<ProjectPO> pageLibWithPermission(Page<ProjectPO> page, @Param("req") ProjectListReq req); | |||||
} | } |
@@ -49,7 +49,7 @@ | |||||
create_on, | create_on, | ||||
update_on | update_on | ||||
FROM nd_project p | FROM nd_project p | ||||
WHERE p.newest = TRUE | |||||
WHERE p.newest = 1 | |||||
<if test="req.id != null"> | <if test="req.id != null"> | ||||
and p.id = #{req.id} | and p.id = #{req.id} | ||||
</if> | </if> | ||||
@@ -140,7 +140,7 @@ | |||||
FROM gov_biz_project_baseinfo b | FROM gov_biz_project_baseinfo b | ||||
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | ||||
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | ||||
WHERE b.deleted = false | |||||
WHERE b.deleted = 0 | |||||
<if test="req.id != null"> | <if test="req.id != null"> | ||||
and b.id = #{req.id} | and b.id = #{req.id} | ||||
</if> | </if> | ||||
@@ -231,7 +231,7 @@ | |||||
FROM gov_operation_project_baseinfo b | FROM gov_operation_project_baseinfo b | ||||
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | ||||
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | ||||
WHERE b.deleted = false | |||||
WHERE b.deleted = 0 | |||||
<if test="req.id != null"> | <if test="req.id != null"> | ||||
and b.id = #{req.id} | and b.id = #{req.id} | ||||
</if> | </if> | ||||
@@ -298,7 +298,7 @@ | |||||
) ORDER BY update_on DESC | ) ORDER BY update_on DESC | ||||
</select> | </select> | ||||
<select id="pagelibWithPermission" resultType="com.hz.pm.api.projectlib.model.po.ProjectPO" | |||||
<select id="pageLibWithPermission" resultType="com.hz.pm.api.projectlib.model.po.ProjectPO" | |||||
parameterType="com.hz.pm.api.projectlib.model.req.ProjectListReq"> | parameterType="com.hz.pm.api.projectlib.model.req.ProjectListReq"> | ||||
SELECT | SELECT | ||||
from_type, | from_type, | ||||
@@ -346,7 +346,7 @@ | |||||
create_on, | create_on, | ||||
update_on | update_on | ||||
FROM nd_project p | FROM nd_project p | ||||
WHERE p.newest = TRUE | |||||
WHERE p.newest = 1 | |||||
<if test="req.id != null"> | <if test="req.id != null"> | ||||
and p.id = #{req.id} | and p.id = #{req.id} | ||||
</if> | </if> | ||||
@@ -437,7 +437,7 @@ | |||||
FROM gov_operation_project_baseinfo b | FROM gov_operation_project_baseinfo b | ||||
LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | LEFT JOIN gov_biz_project_apply apply ON b.base_proj_id = apply.base_proj_id | ||||
LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | LEFT JOIN gov_biz_project_approve approve ON b.base_proj_id = approve.base_proj_id | ||||
WHERE b.deleted = false and b.base_proj_type in ('04','05') | |||||
WHERE b.deleted = 0 and b.base_proj_type in ('04','05') | |||||
<if test="req.id != null"> | <if test="req.id != null"> | ||||
and b.id = #{req.id} | and b.id = #{req.id} | ||||
</if> | </if> | ||||
@@ -21,10 +21,10 @@ | |||||
else ob.base_build_deprt end) build_org_name, | else ob.base_build_deprt end) build_org_name, | ||||
prfd.project_code | prfd.project_code | ||||
from nd_project_renewal_fund_declaration prfd | from nd_project_renewal_fund_declaration prfd | ||||
left join nd_project p on prfd.project_code = p.project_code and p.newest = true | |||||
left join nd_project p on prfd.project_code = p.project_code and p.newest = 1 | |||||
left join gov_biz_project_baseinfo b on prfd.project_code = b.base_proj_id and b.deleted = false | left join gov_biz_project_baseinfo b on prfd.project_code = b.base_proj_id and b.deleted = false | ||||
left join gov_operation_project_baseinfo ob on prfd.project_code = ob.base_proj_id and ob.deleted = false | left join gov_operation_project_baseinfo ob on prfd.project_code = ob.base_proj_id and ob.deleted = false | ||||
where prfd.deleted = false | |||||
where prfd.deleted = 0 | |||||
<if test="param.projectName != null and param.projectName != ''"> | <if test="param.projectName != null and param.projectName != ''"> | ||||
and (p.project_name like concat('%',#{param.projectName},'%') or | and (p.project_name like concat('%',#{param.projectName},'%') or | ||||
b.base_proj_name like concat('%',#{param.projectName},'%') or | b.base_proj_name like concat('%',#{param.projectName},'%') or | ||||
@@ -19,8 +19,8 @@ import java.time.LocalDateTime; | |||||
* @since 2023-02-03 | * @since 2023-02-03 | ||||
*/ | */ | ||||
@Data | @Data | ||||
@TableName("nd_project") | |||||
@ApiModel(value = "NdProject对象", description = "") | |||||
@TableName(value = "nd_project") | |||||
@ApiModel(value = "NdProject对象") | |||||
public class Project implements Serializable { | public class Project implements Serializable { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@@ -4,15 +4,14 @@ import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 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.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.hz.pm.api.common.constant.BizConst; | import com.hz.pm.api.common.constant.BizConst; | ||||
import com.hz.pm.api.performance.model.entity.ProjectCoreBusinessIndicators; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | |||||
import com.hz.pm.api.common.constant.BooleanBit; | |||||
import com.hz.pm.api.projectlib.mapper.ProjectMapper; | import com.hz.pm.api.projectlib.mapper.ProjectMapper; | ||||
import com.hz.pm.api.projectlib.model.entity.ProjectApplication; | |||||
import com.hz.pm.api.projectlib.model.entity.Project; | |||||
import com.hz.pm.api.projectlib.model.po.ProjectPO; | import com.hz.pm.api.projectlib.model.po.ProjectPO; | ||||
import com.hz.pm.api.projectlib.model.req.ProjectListReq; | import com.hz.pm.api.projectlib.model.req.ProjectListReq; | ||||
import com.hz.pm.api.projectlib.service.IProjectService; | import com.hz.pm.api.projectlib.service.IProjectService; | ||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@@ -23,7 +22,7 @@ import java.util.stream.Collectors; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 服务实现类 | |||||
* 服务实现类 | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author WendyYang | * @author WendyYang | ||||
@@ -43,21 +42,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl | |||||
List<Project> projects = list(Wrappers.lambdaQuery(Project.class) | List<Project> projects = list(Wrappers.lambdaQuery(Project.class) | ||||
.eq(Project::getProjectCode, projectCode)); | .eq(Project::getProjectCode, projectCode)); | ||||
if(CollUtil.isEmpty(projects)){ | |||||
if (CollUtil.isEmpty(projects)) { | |||||
return Collections.emptyList(); | return Collections.emptyList(); | ||||
} | } | ||||
return projects.stream().map(Project::getId).collect(Collectors.toList()); | return projects.stream().map(Project::getId).collect(Collectors.toList()); | ||||
} | } | ||||
@Override | @Override | ||||
public List<Long> getAllVersionProjectId(Long projectId) { | public List<Long> getAllVersionProjectId(Long projectId) { | ||||
Project project = getById(projectId); | Project project = getById(projectId); | ||||
if(Objects.isNull(project)){ | |||||
return null; | |||||
if (Objects.isNull(project)) { | |||||
return Collections.emptyList(); | |||||
} | } | ||||
return getAllVersionProjectId(project); | return getAllVersionProjectId(project); | ||||
} | } | ||||
@@ -65,7 +61,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl | |||||
public Project getNewProject(Long projectId) { | public Project getNewProject(Long projectId) { | ||||
Project project = getById(projectId); | Project project = getById(projectId); | ||||
if(Objects.isNull(project)){ | |||||
if (Objects.isNull(project)) { | |||||
return null; | return null; | ||||
} | } | ||||
@@ -75,47 +71,44 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl | |||||
.eq(Project::getNewest, Boolean.TRUE) | .eq(Project::getNewest, Boolean.TRUE) | ||||
.eq(Project::getProjectCode, projectCode) | .eq(Project::getProjectCode, projectCode) | ||||
.last(BizConst.LIMIT_1); | .last(BizConst.LIMIT_1); | ||||
Project newest = getOne(last); | |||||
return newest; | |||||
return getOne(last); | |||||
} | } | ||||
@Override | @Override | ||||
public Project getNewConstructProject(Long projectId) { | public Project getNewConstructProject(Long projectId) { | ||||
Project project = getById(projectId); | Project project = getById(projectId); | ||||
if(Objects.isNull(project)){ | |||||
if (Objects.isNull(project)) { | |||||
return null; | return null; | ||||
} | } | ||||
String projectCode = project.getProjectCode(); | String projectCode = project.getProjectCode(); | ||||
LambdaQueryWrapper<Project> last = Wrappers.lambdaQuery(Project.class) | LambdaQueryWrapper<Project> last = Wrappers.lambdaQuery(Project.class) | ||||
.eq(Project::getNewest, Boolean.TRUE) | |||||
.eq(Project::getNewest, BooleanBit.TRUE) | |||||
.eq(Project::getProjectCode, projectCode) | .eq(Project::getProjectCode, projectCode) | ||||
.eq(Project::getIsConstruct, Boolean.TRUE) | |||||
.eq(Project::getIsConstruct, BooleanBit.TRUE) | |||||
.last(BizConst.LIMIT_1); | .last(BizConst.LIMIT_1); | ||||
Project newest = getOne(last); | |||||
return newest; | |||||
return getOne(last); | |||||
} | } | ||||
@Override | @Override | ||||
public Project getProjectByCode(String projectCode) { | public Project getProjectByCode(String projectCode) { | ||||
Project project = this.getOne(Wrappers.lambdaQuery(Project.class) | |||||
return this.getOne(Wrappers.lambdaQuery(Project.class) | |||||
.eq(Project::getProjectCode, projectCode) | .eq(Project::getProjectCode, projectCode) | ||||
.eq(Project::getNewest,Boolean.TRUE) | |||||
.eq(Project::getNewest, BooleanBit.TRUE) | |||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
return project; | |||||
} | } | ||||
@Override | @Override | ||||
public Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, ProjectListReq req) { | public Page<ProjectPO> pageAllWithPermission(Page<ProjectPO> page, ProjectListReq req) { | ||||
return projectMapper.pageAllWithPermission(page,req); | |||||
return projectMapper.pageAllWithPermission(page, req); | |||||
} | } | ||||
@Override | @Override | ||||
public Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, ProjectListReq req) { | public Page<ProjectPO> pagelibWithPermission(Page<ProjectPO> page, ProjectListReq req) { | ||||
return projectMapper.pagelibWithPermission(page,req); | |||||
return projectMapper.pageLibWithPermission(page, req); | |||||
} | } | ||||
} | } |
@@ -30,7 +30,7 @@ | |||||
and id in ( | and id in ( | ||||
SELECT authority_id FROM nd_role_authority ra INNER JOIN nd_user_role ur on ra.role_id = ur.role_id | SELECT authority_id FROM nd_role_authority ra INNER JOIN nd_user_role ur on ra.role_id = ur.role_id | ||||
INNER JOIN c_role r on r.id = ra.role_id | INNER JOIN c_role r on r.id = ra.role_id | ||||
where ur.user_id = #{userId, jdbcType=BIGINT} and r.`state` = true | |||||
where ur.user_id = #{userId, jdbcType=BIGINT} and r.`state` = 1 | |||||
and ra.authority_type = 'RESOURCE' | and ra.authority_type = 'RESOURCE' | ||||
) | ) | ||||
</select> | </select> | ||||
@@ -13,9 +13,8 @@ import org.springframework.session.web.http.DefaultCookieSerializer; | |||||
* 设置session的过期时间为一天 | * 设置session的过期时间为一天 | ||||
* </p> | * </p> | ||||
* | * | ||||
* @Author LiuXinXin | |||||
* @Date 2020/7/29 9:46 上午 | |||||
* @Version 1.0 | |||||
* @author LiuXinXin | |||||
* @since 2020/7/29 9:46 上午 | |||||
**/ | **/ | ||||
@Configuration | @Configuration | ||||
@EnableRedisHttpSession | @EnableRedisHttpSession | ||||
@@ -1,5 +1,5 @@ | |||||
server: | server: | ||||
port: 68888 | |||||
port: 8002 | |||||
servlet: | servlet: | ||||
context-path: /hzpm | context-path: /hzpm | ||||
@@ -16,7 +16,7 @@ spring: | |||||
timeout: 5000 | timeout: 5000 | ||||
host: 47.98.125.47 | host: 47.98.125.47 | ||||
port: 26379 | port: 26379 | ||||
database: 4 | |||||
database: 5 | |||||
password: Ndkj1234 | password: Ndkj1234 | ||||
jedis: | jedis: | ||||
pool: | pool: | ||||
@@ -25,7 +25,7 @@ spring: | |||||
min-idle: 8 | min-idle: 8 | ||||
max-wait: 10000 | max-wait: 10000 | ||||
application: | application: | ||||
name: pm | |||||
name: hzpm | |||||
jackson: | jackson: | ||||
default-property-inclusion: non_null | default-property-inclusion: non_null | ||||
time-zone: GMT+8 | time-zone: GMT+8 | ||||
@@ -74,8 +74,8 @@ mybatis-plus: | |||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl | ||||
global-config: | global-config: | ||||
db-config: | db-config: | ||||
logic-delete-value: true | |||||
logic-not-delete-value: false | |||||
logic-delete-value: 1 | |||||
logic-not-delete-value: 0 | |||||
logging: | logging: | ||||
config: classpath:logback-spring.xml | config: classpath:logback-spring.xml | ||||
#日志配置 | #日志配置 | ||||