Commit aba1c513 authored by wangxl's avatar wangxl

1

parent 84ede961
package com.yiboshi.science.dao;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yiboshi.science.base.BaseDAO;
......@@ -17,13 +18,21 @@ import java.util.List;
* @author lkl
* @version 2021-08-26
*/
public interface ComUnitDAO extends BaseMapper<ComUnit>, BaseDAO<ComUnitQueryVO, ComUnitDTO,ComUnit> {
String getMaxTreeCode (String Code);
public interface ComUnitDAO extends BaseMapper<ComUnit>, BaseDAO<ComUnitQueryVO, ComUnitDTO, ComUnit> {
String getMaxTreeCode(String Code);
ComUnitDTO getUnitById(String id);
ComUnitDTO getTopUnit(int len);
ComUnitDTO getUnitByTreeCode(String treeCode);
List<ComUnitDTO> getList();
List<ComUnitDTO> getListByUnitName(String UnitName);
DataStatisticsDTO getRegisterUnitCount(@Param("ew") Wrapper<ComProject> queryWrapper);
DataStatisticsDTO getRegisterUnitCountByDay(@Param("ew") Wrapper<ComProject> queryWrapper);
}
......@@ -24,6 +24,7 @@ import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Objects;
import static com.yiboshi.science.utils.StringUtil.hideAllIdCardNum;
......@@ -95,7 +96,7 @@ public class ComProjectAuditController extends BaseController<ComProjectAuditSer
if (null == unit)
throw new BusinessException("审核单位不存在!");
comProjectAuditDTO.setUnitLevel(unit.getTreeCode().length() / properties.getDefaultCodeLength());
}else
} else
throw new BusinessException("审核单位不存在!");
return ResponseDataModel.ok(comProjectAuditService.save(comProjectAuditDTO));
}
......@@ -144,17 +145,27 @@ public class ComProjectAuditController extends BaseController<ComProjectAuditSer
Pagination<ComProjectAuditDTO> page = comProjectAuditService.getAuditListByPage(vo);
if (null != page && null != page.getDataList() && page.getDataList().size() != 0) {
page.getDataList().forEach((e) -> {
if (null != e.getCertId())
e.setCertId(hideAllIdCardNum(e.getCertId()));
if (null != e.getMobile())
e.setMobile(hideAllPhoneNum(e.getMobile()));
if (null != e.getAuditResult())
e.setAuditResultName(CommonEnum.auditResult.getEnum(e.getAuditResult()).getDescription());
if(vo.getAuditMethod().equals(CommonEnum.auditMethod.last.getCode())){
if (vo.getAuditMethod().equals(CommonEnum.auditMethod.last.getCode())) {
// e.setAssignList(comProjectAssignService.getAssignExpertList(e.getAuditObjectId()));
e.setAge(IDCardUtil.getAge(e.getCertId()));
e.setSelfFunding(0);
BigDecimal total = new BigDecimal(0);
BigDecimal gov = new BigDecimal(0);
BigDecimal self = new BigDecimal(0);
if (Objects.nonNull(e.getTotalFunding())) {
total = e.getTotalFunding();
}
if (Objects.nonNull(e.getGovFunding())) {
gov = e.getGovFunding();
}
self = total.subtract(gov);
e.setSelfFunding(self);
}
if (null != e.getCertId())
e.setCertId(hideAllIdCardNum(e.getCertId()));
});
}
return ResponseDataModel.ok(page);
......
......@@ -75,7 +75,7 @@ public interface ComProjectAuditService extends BaseService<ComProjectAuditQuery
* @param auditUnitId
* @param treeCode
*/
void report(Integer reportYear, String reportObjectId, Integer auditType, String auditUnitId, String treeCode);
void report(Integer reportYear, String reportObjectId, Integer auditType,Integer auditMethod, String auditUnitId, String treeCode);
/** 项目/任务书/中期考核审核
*
* @param comProjectAudit
......
......@@ -17,6 +17,11 @@ import java.util.List;
*/
public interface ComUnitService extends BaseService<ComUnitQueryVO, ComUnitDTO, ComUnit> {
/** 获取最高级单位
*
* @return
*/
ComUnitDTO getTopUnit();
/** 根据单位编码获取单位信息
*
* @param treeCode 单位编码
......
......@@ -221,9 +221,11 @@ public class ComProjectAuditServiceImpl extends BaseServiceImpl<ComProjectAuditD
return page;
}
public void report(Integer reportYear, String auditObjectId, Integer auditType, String auditUnitId, String treeCode) {
public void report(Integer reportYear, String auditObjectId, Integer auditType,Integer auditMethod, String auditUnitId, String treeCode) {
if (null == auditMethod)
auditMethod = CommonEnum.auditMethod.audit.getCode();
int maxIndex = this.getMaxAuditIndex(auditObjectId);
ComProjectAudit comProjectAudit = this.getAudit(auditObjectId, auditUnitId, auditType, CommonEnum.auditMethod.audit.getCode(), null);
ComProjectAudit comProjectAudit = this.getAudit(auditObjectId, auditUnitId, auditType, auditMethod, null);
if (null != comProjectAudit) {
//更新上报表
this.updateAudit(comProjectAudit.getId(), CommonEnum.auditResult.waitAudit.getCode(), "", maxIndex + 1, SecurityUserHolder.getPersonId(), new Date(), null, null, null, null);
......
......@@ -153,7 +153,7 @@ public class ComProjectCheckServiceImpl extends BaseServiceImpl<ComProjectCheckD
throw new BusinessException("中期考核表不存在或已上报");
ComProjectCheck comProjectCheck = convert2Entity(comProjectCheckDTO);
comProjectResultsService.insertList(comProjectCheckDTO.getResults(), comProjectCheck.getId());
comProjectAuditService.report(comProjectCheckDTO.getCheckYear(), comProjectCheckDTO.getId(), 3, unitId, treeCode);
comProjectAuditService.report(comProjectCheckDTO.getCheckYear(), comProjectCheckDTO.getId(), 3,null, unitId, treeCode);
comProjectCheck.setCheckState(CommonEnum.checkState.review.getCode());
return this.update(comProjectCheck);
}
......
......@@ -193,7 +193,7 @@ public class ComProjectConclusionServiceImpl extends BaseServiceImpl<ComProjectC
modal.setState(CommonEnum.conclusionState.report.getCode());
modal.setThesisState(CommonEnum.thesisState.pass.getCode());
comProjectService.updateStateOrNo(conclusion.getProjId(), CommonEnum.projState.report.getCode(), null, null);
comProjectAuditService.report(DateUtils.getYear(), conclusion.getId(), 4, auditUnitId, treeCode);
comProjectAuditService.report(DateUtils.getYear(), conclusion.getId(), 4,null, auditUnitId, treeCode);
return this.update(modal);
}
......
......@@ -50,14 +50,17 @@ public class ComProjectServiceImpl extends BaseServiceImpl<ComProjectDAO, ComPro
private ComProjectMembersService comProjectMembersService;
@Autowired
private ComProjectCooperativeUnitsService comProjectCooperativeUnitsService;
@Autowired
private ComProjectResultsService comProjectResultsService;
@Autowired
private ComProjectBasicService comProjectBasicService;
@Autowired
private ComProjectStageGoalService comProjectStageGoalService;
@Autowired
private ComProjectFundCompositionService comProjectFundCompositionService;
@Autowired
private ComProjectBudgetService comProjectBudgetService;
@Autowired
......@@ -640,11 +643,18 @@ public class ComProjectServiceImpl extends BaseServiceImpl<ComProjectDAO, ComPro
ComProject comProject = this.entityById(model.getAuditObjectId());
if (null == comProject)
throw new BusinessException("项目不存在或已删除!");
if (!comProject.getProjState().equals(CommonEnum.projState.waitSubmit.getCode()) && !comProject.getProjState().equals(CommonEnum.projState.returnModify.getCode()))
if (!comProject.getProjState().equals(CommonEnum.projState.waitSubmit.getCode()) && !comProject.getProjState().equals(CommonEnum.projState.returnModify.getCode()) && !comProject.getProjState().equals(CommonEnum.projState.lastModify.getCode()))
throw new BusinessException("项目已上报!");
if (!checkMember(model.getAuditObjectId()))
throw new BusinessException("项目组成员简历未上传完整,上报失败!");
comProjectAuditService.report(comProject.getReportYear(), model.getAuditObjectId(), model.getAuditType(), unitId, treeCode);
// if (!checkMember(model.getAuditObjectId()))
// throw new BusinessException("项目组成员简历未上传完整,上报失败!");
Integer auditMethod = null;
if (comProject.getProjState().equals(CommonEnum.projState.lastModify.getCode())) {
auditMethod = CommonEnum.auditMethod.last.getCode();
ComUnitDTO unit= comUnitService.getTopUnit();
unitId = unit.getId();
treeCode = unit.getTreeCode();
}
comProjectAuditService.report(comProject.getReportYear(), model.getAuditObjectId(), model.getAuditType(), auditMethod, unitId, treeCode);
String versionNo = "";
if (null == comProject.getVersionNo())
versionNo = comProject.getAppNo() + "001";
......@@ -1119,7 +1129,7 @@ public class ComProjectServiceImpl extends BaseServiceImpl<ComProjectDAO, ComPro
return list;
}
public String updateDefenseScore (String id, BigDecimal defenseScore) {
public String updateDefenseScore(String id, BigDecimal defenseScore) {
ComProject e = new ComProject();
e.setId(id);
e.setDefenseScore(defenseScore);
......
......@@ -453,7 +453,7 @@ public class ComProjectTaskServiceImpl extends BaseServiceImpl<ComProjectTaskDAO
throw new BusinessException("合同书不存在!");
if (!ComProjectTask.getTaskState().equals(CommonEnum.taskState.waitSubmit.getCode()) && !ComProjectTask.getTaskState().equals(CommonEnum.taskState.returnModify.getCode()))
throw new BusinessException("合同书已上报");
comProjectAuditService.report(ComProjectTask.getReportYear(), model.getAuditObjectId(), model.getAuditType(), unitId, treeCode);
comProjectAuditService.report(ComProjectTask.getReportYear(), model.getAuditObjectId(), model.getAuditType(), null,unitId, treeCode);
// 更新任务书状态
this.updateState(model.getAuditObjectId(), CommonEnum.taskState.review.getCode());
}
......
......@@ -457,7 +457,7 @@ public class ComTalentApplyServiceImpl extends BaseServiceImpl<ComTalentApplyDAO
throw new BusinessException("人才申报记录不存在或已删除!");
if (!comTalentApply.getTalentState().equals(CommonEnum.talentState.waitSubmit.getCode()) && !comTalentApply.getTalentState().equals(CommonEnum.talentState.returnModify.getCode()))
throw new BusinessException("项目已上报!");
comProjectAuditService.report(comTalentApply.getReportYear(), model.getAuditObjectId(), model.getAuditType(), unitId, treeCode);
comProjectAuditService.report(comTalentApply.getReportYear(), model.getAuditObjectId(), model.getAuditType(), null,unitId, treeCode);
// 更新人才申报记录状态
comTalentApply.setTalentState(CommonEnum.projState.toAudit.getCode());
......
......@@ -115,6 +115,10 @@ public class ComUnitServiceImpl extends BaseServiceImpl<ComUnitDAO, ComUnitQuery
return new Pagination<>(dtoList, page.getTotal(), vo.getPageSize());
}
public ComUnitDTO getTopUnit() {
return comUnitDAO.getTopUnit(properties.getDefaultCodeLength());
}
public ComUnitDTO getByTreeCode(String treeCode) {
return comUnitDAO.getUnitByTreeCode(treeCode);
}
......
package com.yiboshi.science.utils;
import org.apache.commons.lang.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
......@@ -10,34 +11,35 @@ import java.util.Date;
* @Author: zdj
* @Date: Created in 2021-03-18
*/
public class IDCardUtil{
public class IDCardUtil {
/**
* 15位身份证号
*/
private static final Integer FIFTEEN_ID_CARD=15;
private static final Integer FIFTEEN_ID_CARD = 15;
/**
* 18位身份证号
*/
private static final Integer EIGHTEEN_ID_CARD=18;
private static final Integer EIGHTEEN_ID_CARD = 18;
private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
/**
* 根据身份证号获取性别
*
* @param IDCard
* @return
*/
public static String getSex(String IDCard){
String sex ="";
if (StringUtils.isNotBlank(IDCard)){
public static String getSex(String IDCard) {
String sex = "";
if (StringUtils.isNotBlank(IDCard)) {
//15位身份证号
if (IDCard.length() == FIFTEEN_ID_CARD){
if (IDCard.length() == FIFTEEN_ID_CARD) {
if (Integer.parseInt(IDCard.substring(14, 15)) % 2 == 0) {
sex = "女";
} else {
sex = "男";
}
//18位身份证号
}else if(IDCard.length() == EIGHTEEN_ID_CARD){
} else if (IDCard.length() == EIGHTEEN_ID_CARD) {
// 判断性别
if (Integer.parseInt(IDCard.substring(16).substring(0, 1)) % 2 == 0) {
sex = "女";
......@@ -51,15 +53,16 @@ public class IDCardUtil{
/**
* 根据身份证号获取年龄
*
* @param IDCard
* @return
*/
public static Integer getAge(String IDCard){
public static Integer getAge(String IDCard) {
Integer age = 0;
Date date = new Date();
if (StringUtils.isNotBlank(IDCard)&& isValid(IDCard)){
if (StringUtils.isNotBlank(IDCard) && isValid(IDCard)) {
//15位身份证号
if (IDCard.length() == FIFTEEN_ID_CARD){
if (IDCard.length() == FIFTEEN_ID_CARD) {
// 身份证上的年份(15位身份证为1980年前的)
String uyear = "19" + IDCard.substring(6, 8);
// 身份证上的月份
......@@ -69,13 +72,13 @@ public class IDCardUtil{
// 当前月份
String fyue = format.format(date).substring(5, 7);
if (Integer.parseInt(uyue) <= Integer.parseInt(fyue)) {
age = Integer.parseInt(fyear) - Integer.parseInt(uyear) + 1;
// 当前用户还没过生
} else {
age = Integer.parseInt(fyear) - Integer.parseInt(uyear);
// 当前月份还没出生
} else {
age = Integer.parseInt(fyear) - Integer.parseInt(uyear) - 1;
}
//18位身份证号
}else if(IDCard.length() == EIGHTEEN_ID_CARD){
} else if (IDCard.length() == EIGHTEEN_ID_CARD) {
// 身份证上的年份
String year = IDCard.substring(6).substring(0, 4);
// 身份证上的月份
......@@ -86,10 +89,10 @@ public class IDCardUtil{
String fyue = format.format(date).substring(5, 7);
// 当前月份大于用户出身的月份表示已过生日
if (Integer.parseInt(yue) <= Integer.parseInt(fyue)) {
age = Integer.parseInt(fyear) - Integer.parseInt(year) + 1;
age = Integer.parseInt(fyear) - Integer.parseInt(year);
// 当前用户还没过生日
} else {
age = Integer.parseInt(fyear) - Integer.parseInt(year);
age = Integer.parseInt(fyear) - Integer.parseInt(year)-1;
}
}
}
......@@ -98,51 +101,53 @@ public class IDCardUtil{
/**
* 获取出生日期 yyyy年MM月dd日
*
* @param IDCard
* @return
*/
public static String getBirthday(String IDCard){
String birthday="";
String year="";
String month="";
String day="";
if (StringUtils.isNotBlank(IDCard)){
public static String getBirthday(String IDCard) {
String birthday = "";
String year = "";
String month = "";
String day = "";
if (StringUtils.isNotBlank(IDCard)) {
//15位身份证号
if (IDCard.length() == FIFTEEN_ID_CARD){
if (IDCard.length() == FIFTEEN_ID_CARD) {
// 身份证上的年份(15位身份证为1980年前的)
year = "19" + IDCard.substring(6, 8);
//身份证上的月份
month = IDCard.substring(8, 10);
//身份证上的日期
day= IDCard.substring(10, 12);
day = IDCard.substring(10, 12);
//18位身份证号
}else if(IDCard.length() == EIGHTEEN_ID_CARD){
} else if (IDCard.length() == EIGHTEEN_ID_CARD) {
// 身份证上的年份
year = IDCard.substring(6).substring(0, 4);
// 身份证上的月份
month = IDCard.substring(10).substring(0, 2);
//身份证上的日期
day=IDCard.substring(12).substring(0,2);
day = IDCard.substring(12).substring(0, 2);
}
birthday=year+"年"+month+"月"+day+"日";
birthday = year + "年" + month + "月" + day + "日";
}
return birthday;
}
/**
* 身份证验证
*
* @param id 号码内容
* @return 是否有效
*/
public static boolean isValid(String id){
public static boolean isValid(String id) {
Boolean validResult = true;
//校验长度只能为15或18
int len = id.length();
if (len != FIFTEEN_ID_CARD && len != EIGHTEEN_ID_CARD){
if (len != FIFTEEN_ID_CARD && len != EIGHTEEN_ID_CARD) {
return false;
}
//校验生日
if (!validDate(id)){
if (!validDate(id)) {
validResult = false;
}
return validResult;
......@@ -150,22 +155,19 @@ public class IDCardUtil{
/**
* 校验生日
*
* @param id
* @return
*/
private static boolean validDate(String id)
{
try
{
private static boolean validDate(String id) {
try {
String birth = id.length() == 15 ? "19" + id.substring(6, 12) : id.substring(6, 14);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
Date birthDate = sdf.parse(birth);
if (!birth.equals(sdf.format(birthDate))){
if (!birth.equals(sdf.format(birthDate))) {
return false;
}
}
catch (ParseException e)
{
} catch (ParseException e) {
return false;
}
return true;
......
......@@ -31,6 +31,12 @@
where a.tree_code = #{treeCode}
</select>
<select id="getTopUnit" resultType="com.yiboshi.science.param.dto.ComUnitDTO">
select a.*
from com_unit a
where length(a.tree_code)=#{len}
</select>
<select id="getListByUnitName" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComUnitDTO">
select a.*
from com_unit a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment