From e50241a46722cb0206aa79f6f243667bcdbb96c2 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Wed, 24 Apr 2024 14:49:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/utils/UploadCheckUtils.java | 100 ++++++++++++++++++ .../common/core/utils/aes/DateTimeHelper.java | 64 +++++++---- .../background/mapper/IProScheduleMapper.java | 12 +++ .../service/impl/HumanServiceImpl.java | 5 + .../service/impl/ProScheduleServiceImpl.java | 30 +++++- .../service/impl/ProServiceImpl.java | 21 ++++ .../service/impl/SignProServiceImpl.java | 15 +++ .../service/impl/TeamServiceImpl.java | 75 ++++++++++--- .../resources/mapper/HumanManageMapper.xml | 5 +- .../resources/mapper/ProScheduleMapper.xml | 9 ++ .../main/resources/mapper/SignProMapper.xml | 4 +- .../resources/mapper/TeamManageMapper.xml | 13 ++- 12 files changed, 300 insertions(+), 53 deletions(-) create mode 100644 securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/UploadCheckUtils.java diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/UploadCheckUtils.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/UploadCheckUtils.java new file mode 100644 index 0000000..def9526 --- /dev/null +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/UploadCheckUtils.java @@ -0,0 +1,100 @@ +package com.securitycontrol.common.core.utils; + + +import org.springframework.web.multipart.MultipartFile; + +import java.util.Arrays; +import java.util.Locale; + +/** + * 文件上传校验的公共方法 + * + * @author:cwchen + * @date:2024-03-11-10:11 + * @version:1.0 + * @description:工程管理-业务逻辑层 + */ +public class UploadCheckUtils { + + /** + * 文件大小 10MB(可用于图片和视频区分) + */ + public static final long IMG_FILE_SIZE = 10 * 1024 * 1024; + + /** + * 只支持图片格式 + */ + public static final String[] YES_IMAGE_SUPPORT = {".jpg", ".jpeg", ".png"}; + + /** + * 只支持视频格式 + */ + public static final String[] YES_VIDEO_SUPPORT = {".mp4", ".avi", ".mp3"}; + + /** + * 只支持音频格式 + */ + public static final String[] YES_AUDIO_SUPPORT = {".mp3"}; + + /** + * 只支持文件格式 + */ + public static final String[] YES_FILE_SUPPORT = {".xlsx", ".xls", ".doc", ".docx", ".txt", ".csv"}; + + + /** + * 全部文件(普通文件,图片, 视频,音频)后缀 支持的类型 + */ + public static final String[] FILE_SUFFIX_SUPPORT = {".xlsx", ".xls", ".doc", ".docx", ".txt", ".csv", + ".jpg", ".jpeg", ".png", ".mp4", ".avi", ".mp3"}; + + /** + * 文件名字 需要排除的字符 + * 废弃: "(", ")","",".", "——", "_","-" + */ + public static final String[] FILE_NAME_EXCLUDE = { + "`", "!", "@", "#", "$", "%", "^", "&", "*", "=", "+", + "~", "·", "!", "¥", "……", "(", ")", + "?", ",", "<", ">", ":", ";", "[", "]", "{", "}", "/", "\\", "|", + "?", ",", "。", "《", "》", ":", ";", "【", "】", "、" + }; + + public static final String SUFFIX = "."; + + /** + * 图片上传文件校验大小、名字、后缀 + * + * @param multipartFile multipartFile + */ + public static String uploadImgVerify(MultipartFile multipartFile) { + // 校验文件是否为空 + if (multipartFile == null) { + return "上传图片不能为空"; + } + // 校验文件名字 + String originalFilename = multipartFile.getOriginalFilename(); + if (originalFilename == null) { + return "上传图片名字不能为空"; + } + for (String realKey : FILE_NAME_EXCLUDE) { + if (originalFilename.contains(realKey)) { + return "上传图片名称不允许出现"+realKey+"关键字"; + } + } + // 校验文件后缀 + if (!originalFilename.contains(SUFFIX)) { + return "图片不能没有后缀"; + } + String suffix = originalFilename.substring(originalFilename.lastIndexOf('.')); + /*校验: 文件格式是否符合要求*/ + if (!Arrays.asList(YES_IMAGE_SUPPORT).contains(suffix.toLowerCase(Locale.ROOT))) { + return "图片格式仅支持" + Arrays.asList(YES_IMAGE_SUPPORT).toString(); + } + Long fileSize = multipartFile.getSize(); + if (fileSize > IMG_FILE_SIZE) { + return "图片大小仅支持10MB以内"; + } + return null; + } + +} diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java index bfda97d..77f3555 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/utils/aes/DateTimeHelper.java @@ -1,6 +1,5 @@ package com.securitycontrol.common.core.utils.aes; -import com.sun.org.apache.bcel.internal.generic.RETURN; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -28,27 +27,28 @@ public class DateTimeHelper { return df.format(d); } - public static boolean compareMonth(String time,String now){ - try{ - int year=Integer.parseInt(time.split("-")[0].trim()) ; - int month=Integer.parseInt(time.split("-")[1].trim()) ; - int year1=Integer.parseInt(now.split("-")[0].trim()) ; - int month1=Integer.parseInt(now.split("-")[1].trim()) ; - if(year>year1){ + public static boolean compareMonth(String time, String now) { + try { + int year = Integer.parseInt(time.split("-")[0].trim()); + int month = Integer.parseInt(time.split("-")[1].trim()); + int year1 = Integer.parseInt(now.split("-")[0].trim()); + int month1 = Integer.parseInt(now.split("-")[1].trim()); + if (year > year1) { + return false; + } + if (year == year1) { + if (month >= month1) { return false; } - if(year==year1){ - if(month>=month1){ - return false; - } - } - return true; - - }catch (Exception e){ - log.error(e.toString(),e); } - return false; + return true; + + } catch (Exception e) { + log.error(e.toString(), e); + } + return false; } + /** * 增加 LocalDateTime ==> Date */ @@ -362,10 +362,10 @@ public class DateTimeHelper { } - public static String getAddMonth(String time,int num){ + public static String getAddMonth(String time, int num) { try { - Integer year=Integer.parseInt(time.split("-")[0].trim()) ; - Integer month=Integer.parseInt(time.split("-")[1].trim()) ; + Integer year = Integer.parseInt(time.split("-")[0].trim()); + Integer month = Integer.parseInt(time.split("-")[1].trim()); YearMonth yearMonth = YearMonth.of(year, month); YearMonth addedMonth = yearMonth.plusMonths(1); return addedMonth.toString(); @@ -394,7 +394,6 @@ public class DateTimeHelper { } - /** * 得到前一个月 * @@ -843,7 +842,7 @@ public class DateTimeHelper { * @author cwchen * @date 2024/3/16 15:11 */ - public static Long convertDateStringToTimestamp(String dateString, String format){ + public static Long convertDateStringToTimestamp(String dateString, String format) { Date date = null; try { SimpleDateFormat sdf = new SimpleDateFormat(format); @@ -857,6 +856,7 @@ public class DateTimeHelper { /** * 两个日期之间的差值 + * * @param startDate * @param endDate * @return Long @@ -899,4 +899,22 @@ public class DateTimeHelper { String endTime = sdfTwo.format(new Date()) + maxDate; return startTime + " - " + endTime; } + + /** + * 比较两个时间 + * @param startTime + * @param endTime + * @return boolean + * @description + * @author cwchen + * @date 2024/4/24 9:55 + */ + public static boolean compareTime(String startTime, String endTime) { + Long aLong = convertDateStringToTimestamp(startTime, "yyyy-MM-dd"); + Long bLong = convertDateStringToTimestamp(endTime, "yyyy-MM-dd"); + if (aLong > bLong) { + return false; + } + return true; + } } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IProScheduleMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IProScheduleMapper.java index adec17a..8960d88 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IProScheduleMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IProScheduleMapper.java @@ -129,10 +129,22 @@ public interface IProScheduleMapper { /** * 更新工序计划进度 + * * @param vo * @description * @author cwchen * @date 2024/3/30 13:05 */ void updateGxPlan(GxPlanProgressVo vo); + + /** + * 获取工程进度 + * @param vo + * @return List> + * @description + * @author cwchen + * @date 2024/4/24 13:41 + */ + @MapKey("bidCode") + List> efficiencyAnalysis(ProScheduleVo vo); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java index 593868c..7ec29af 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java @@ -9,6 +9,7 @@ import com.securitycontrol.common.core.constant.HttpStatus; import com.securitycontrol.common.core.constant.SecurityConstants; import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.UploadCheckUtils; import com.securitycontrol.common.core.utils.aes.AesCbcUtils; import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.utils.aes.ListHelper; @@ -108,6 +109,10 @@ public class HumanServiceImpl implements HumanService { } // 上传文件 if (file != null) { + String isVerify = UploadCheckUtils.uploadImgVerify(file); + if(StringUtils.isNotBlank(isVerify)){ + return AjaxResult.error(isVerify); + } Result result = remoteFileService.singleUploadFile(file, SecurityConstants.INNER); if(result != null && result.getCode() == HttpStatus.ERROR) { log.error("人员照片上传失败"); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProScheduleServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProScheduleServiceImpl.java index 1d6e315..013750b 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProScheduleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProScheduleServiceImpl.java @@ -21,10 +21,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport; import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; /** * @author:cwchen @@ -47,6 +45,30 @@ public class ProScheduleServiceImpl implements IProScheduleService { List list = new ArrayList<>(); try { list = mapper.getProScheduleLists(dto); + list.forEach(vo->{ + List> valueList = new ArrayList<>(); + valueList = mapper.efficiencyAnalysis(vo); + Map>> map = valueList.stream().collect(Collectors.groupingBy(item -> { + return String.valueOf(item.get("bidCode")); + })); + map.forEach((k, v) -> { + // 根据每个工程的工序计划及进度填报计算效率 + Map dataMap = new HashMap<>(16); + BigDecimal value = new BigDecimal("0"); + BigDecimal multipleValue = new BigDecimal("100"); + for (int i = 0; i < v.size(); i++) { + if (Objects.nonNull(v.get(i).get("planId")) && Objects.nonNull(v.get(i).get("planProgress")) && Objects.nonNull(v.get(i).get("gxWeight"))) { + BigDecimal bigDecimal = new BigDecimal(String.valueOf(v.get(i).get("gxWeight"))); + BigDecimal bigDecimal2 = new BigDecimal(String.valueOf(v.get(i).get("planProgress"))); + value = value.add(bigDecimal.multiply(bigDecimal2).divide(multipleValue, 3, BigDecimal.ROUND_HALF_UP)); + } + } + vo.setNowProSchedule(String.valueOf(value.doubleValue())); + }); + if(CollectionUtils.isEmpty(valueList)){ + vo.setNowProSchedule("0"); + } + }); } catch (Exception e) { log.error("获取工程进度列表", e); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProServiceImpl.java index e815dbc..7defe93 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/ProServiceImpl.java @@ -10,6 +10,7 @@ import com.securitycontrol.common.core.constant.SecurityConstants; import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.utils.ImportExcelUtils; import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.UploadCheckUtils; import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.security.utils.ValidatorsUtils; @@ -93,6 +94,16 @@ public class ProServiceImpl implements IProService { if (StringUtils.isNotBlank(validResult)) { return AjaxResult.error(validResult); } + boolean flag = DateTimeHelper.compareTime(vo.getPlanStartTime(), vo.getPlanEndTime()); + if(!flag){ + return AjaxResult.error("计划开工时间不能晚于计划结束时间"); + } + if(StringUtils.isNotBlank(vo.getStartTime()) && StringUtils.isNotBlank(vo.getEndTime())){ + boolean flag2 = DateTimeHelper.compareTime(vo.getStartTime(), vo.getEndTime()); + if(!flag2){ + return AjaxResult.error("实际开始时间不能晚于实际结束时间"); + } + } String proId = getuid(); int result = mapper.proIsExist(vo); if (result > 0) { @@ -116,6 +127,12 @@ public class ProServiceImpl implements IProService { } // 上传文件 if (files != null && types != null) { + for (MultipartFile file : files) { + String isVerify = UploadCheckUtils.uploadImgVerify(file); + if(StringUtils.isNotBlank(isVerify)){ + return AjaxResult.error(isVerify); + } + } Result uploadResult = remoteFileService.mostUploadFile(files, SecurityConstants.INNER); if (uploadResult != null && uploadResult.getCode() == HttpStatus.ERROR) { log.error("工程文件上传失败"); @@ -562,6 +579,10 @@ public class ProServiceImpl implements IProService { if (StringUtils.isNotBlank(validResult)) { return AjaxResult.error(validResult); } + boolean flag = DateTimeHelper.compareTime(vo.getPlanStartTime(), vo.getPlanEndTime()); + if(!flag){ + return AjaxResult.error("计划开始时间不能晚于计划结束时间"); + } int result = mapper.getTowerIsExist(vo); if(result > 0){ return AjaxResult.error("杆塔或工序不能重复选择"); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/SignProServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/SignProServiceImpl.java index 24fab1d..b8c354c 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/SignProServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/SignProServiceImpl.java @@ -3,6 +3,7 @@ package com.securitycontrol.background.service.impl; import com.securitycontrol.background.mapper.ISignProMapper; import com.securitycontrol.background.service.ISignProService; import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.utils.uuid.IdUtils; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.security.utils.ValidatorsUtils; @@ -50,6 +51,16 @@ public class SignProServiceImpl implements ISignProService { public AjaxResult addOrUpdateProject(ProjectVo vo) { try { String validResult = validatorsUtils.valid(vo, ProjectVo.Query.class); + boolean flag = DateTimeHelper.compareTime(vo.getPlanStartTime(), vo.getPlanEndTime()); + if(!flag){ + return AjaxResult.error("计划开始时间不能晚于计划开始时间"); + } + if(StringUtils.isNotBlank(vo.getStartTime()) && StringUtils.isNotBlank(vo.getEndTime())){ + boolean flag2 = DateTimeHelper.compareTime(vo.getStartTime(), vo.getEndTime()); + if(!flag2){ + return AjaxResult.error("实际开始时间不能晚于实际结束时间"); + } + } if (StringUtils.isNotBlank(validResult)) { return AjaxResult.error(validResult); } @@ -129,6 +140,10 @@ public class SignProServiceImpl implements ISignProService { if (StringUtils.isNotBlank(validResult)) { return AjaxResult.error(validResult); } + boolean flag = DateTimeHelper.compareTime(vo.getStartDate(), vo.getCompleteDate()); + if(!flag){ + return AjaxResult.error("实际开工时间不能晚于实际竣工时间"); + } int result = mapper.isSignPro(vo); if (result > 0) { return AjaxResult.error("单项编码不能重复"); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java index 47f0a17..0bc884e 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TeamServiceImpl.java @@ -1,7 +1,9 @@ package com.securitycontrol.background.service.impl; +import com.securitycontrol.background.mapper.HumanManageMapper; import com.securitycontrol.background.mapper.TeamManageMapper; import com.securitycontrol.background.service.TeamService; +import com.securitycontrol.common.core.constant.Constant; import com.securitycontrol.common.core.utils.StringUtils; import com.securitycontrol.common.core.utils.aes.AesCbcUtils; import com.securitycontrol.common.core.utils.uuid.IdUtils; @@ -21,6 +23,7 @@ import java.util.*; /** * 班组-业务逻辑层 + * * @author 10488 */ @Service(value = "TeamService") @@ -30,6 +33,9 @@ public class TeamServiceImpl implements TeamService { @Resource(name = "TeamManageMapper") private TeamManageMapper mapper; + @Resource(name = "HumanManageMapper") + private HumanManageMapper humanManageMapper; + @Resource(name = "ValidatorsUtils") private ValidatorsUtils validatorsUtils; @@ -43,7 +49,7 @@ public class TeamServiceImpl implements TeamService { vo.setTeamNum(String.valueOf(num)); } } catch (Exception e) { - log.error("获取班组列表",e); + log.error("获取班组列表", e); } return list; } @@ -58,7 +64,7 @@ public class TeamServiceImpl implements TeamService { } List> list = mapper.isTeamExist(vo); if (CollectionUtils.isNotEmpty(list)) { - Boolean result = teamIsExist(list,vo.getIdNumber()); + Boolean result = teamIsExist(list, vo.getIdNumber()); if (result) { return AjaxResult.error("班组不能重复"); } @@ -83,6 +89,7 @@ public class TeamServiceImpl implements TeamService { /** * 班组是否存在 + * * @param list * @param idNumber * @return Boolean @@ -113,11 +120,11 @@ public class TeamServiceImpl implements TeamService { try { vo = mapper.getTeamDetailById(dto); String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber()); - if(decryptIdNumber != null){ + if (decryptIdNumber != null) { vo.setIdNumber(decryptIdNumber); } } catch (Exception e) { - log.error("班组详情",e); + log.error("班组详情", e); } return AjaxResult.success(vo); } @@ -127,13 +134,13 @@ public class TeamServiceImpl implements TeamService { public AjaxResult delTeam(ParamDto dto) { try { int result = mapper.isPeopleByTeam(dto); - if(result > 0){ + if (result > 0) { return AjaxResult.error("班组存在人员"); } mapper.delTeam(dto); return AjaxResult.success(); } catch (Exception e) { - log.error("删除班组",e); + log.error("删除班组", e); //手动回滚异常 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return AjaxResult.error(); @@ -145,8 +152,24 @@ public class TeamServiceImpl implements TeamService { List list = new ArrayList<>(); try { list = mapper.getTeamUserLists(dto); + for (HumanManageVo vo : list) { + String data = humanManageMapper.getUserAccessStatus(vo.getUserId(), Constant.ACCESS_TYPE, 1); + if (StringUtils.isNotEmpty(data)) { + String value = humanManageMapper.getUserAccessStatus(data, Constant.ACCESS_TYPE, 2); + vo.setStatus(StringUtils.isEmpty(value) ? "离场" : value); + } else { + vo.setStatus("离场"); + } + String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber()); + if (decryptIdNumber != null) { + vo.setIdNumber(decryptIdNumber); + } + if(StringUtils.isNotBlank(vo.getIdNumber())){ + vo.setAge(String.valueOf(getAge(vo.getIdNumber()))); + } + } } catch (Exception e) { - log.error("获取班组人员列表",e); + log.error("获取班组人员列表", e); } return list; } @@ -172,20 +195,20 @@ public class TeamServiceImpl implements TeamService { List> noBandingUsers = new ArrayList<>(); try { List> list = mapper.getTeamUserAndNoBandingUser(dto); - if(CollectionUtils.isNotEmpty(list)){ + if (CollectionUtils.isNotEmpty(list)) { for (Map stringMap : list) { - if(Objects.equals(stringMap.get("type"),"1")){ + if (Objects.equals(stringMap.get("type"), "1")) { teamUsers.add(stringMap); - }else if(Objects.equals(stringMap.get("type"),"2")){ + } else if (Objects.equals(stringMap.get("type"), "2")) { noBandingUsers.add(stringMap); } } } } catch (Exception e) { - log.error("获取班组组员和未加入班组人员",e); + log.error("获取班组组员和未加入班组人员", e); } - map.put("teamUsers",teamUsers); - map.put("noBandingUsers",noBandingUsers); + map.put("teamUsers", teamUsers); + map.put("noBandingUsers", noBandingUsers); return AjaxResult.success(map); } @@ -193,16 +216,16 @@ public class TeamServiceImpl implements TeamService { @Transactional(rollbackFor = Exception.class) public AjaxResult addTeamUser(ParamDto dto) { try { - if(StringUtils.isNotEmpty(dto.getBandingUsers())){ + if (StringUtils.isNotEmpty(dto.getBandingUsers())) { String[] bandingUserArr = dto.getBandingUsers().split(","); for (String bandingUser : bandingUserArr) { - mapper.addTeamUser(bandingUser,dto.getId(),1); + mapper.addTeamUser(bandingUser, dto.getId(), 1); } } - if(StringUtils.isNotEmpty(dto.getUnBandingUsers())){ + if (StringUtils.isNotEmpty(dto.getUnBandingUsers())) { String[] unBandingUserArr = dto.getUnBandingUsers().split(","); for (String unBandingUser : unBandingUserArr) { - mapper.addTeamUser(unBandingUser,null,2); + mapper.addTeamUser(unBandingUser, null, 2); } } return AjaxResult.success(); @@ -213,4 +236,22 @@ public class TeamServiceImpl implements TeamService { return AjaxResult.error(); } } + + /** + * 根据身份证获取年龄 + * @param idCard + * @return int + * @description + * @author cwchen + * @date 2024/4/24 14:37 + */ + public static int getAge(String idCard) { + // 获取当前年份 + int currentYear = Calendar.getInstance().get(Calendar.YEAR); + // 将身份证号的前四位(即出生年份)截取出来 + int birthYear = Integer.parseInt(idCard.substring(6, 10)); + // 计算年龄 + int age = currentYear - birthYear; + return age; + } } diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml index c458627..ef139ba 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml @@ -121,14 +121,15 @@ AND ttp.del_falge = '0' + ORDER BY ttp.cratet_time DESC diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/ProScheduleMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/ProScheduleMapper.xml index 06beaa6..7acd61c 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/ProScheduleMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/ProScheduleMapper.xml @@ -149,4 +149,13 @@ INNER JOIN (SELECT MAX( create_time ) AS create_time FROM tb_project_progress WHERE plan_id = #{planId} GROUP BY gx_id) tpp2 ON tpp.create_time = tpp2.create_time WHERE plan_id = #{planId} + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/SignProMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/SignProMapper.xml index dd77896..f32edbd 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/SignProMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/SignProMapper.xml @@ -244,8 +244,8 @@ tsp.vol_level AS volLevel, tsp.line_length AS lineLength, tsp.subs_cap AS subsCap, - CASE tsp.pro_type WHEN '1' THEN '变电' WHEN '2' THEN '线路' END AS proType, - CASE tsp.subs_type WHEN '1' THEN '土建' WHEN '2' THEN '电气' WHEN '3' THEN '变电' END AS subsType, + tsp.pro_type AS proType, + tsp.subs_type AS subsType, tsp.estimate_type AS estimateType, tsp.start_date AS startDate, tsp.end_date AS endDate, diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml index 074a8ff..2b39741 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml @@ -103,18 +103,20 @@ \ No newline at end of file