测试问题修改

This commit is contained in:
cwchen 2024-04-24 14:49:42 +08:00
parent b2c47fcf2c
commit e50241a467
12 changed files with 300 additions and 53 deletions

View File

@ -0,0 +1,100 @@
package com.securitycontrol.common.core.utils;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.Locale;
/**
* 文件上传校验的公共方法
*
* @authorcwchen
* @date2024-03-11-10:11
* @version1.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;
}
}

View File

@ -1,6 +1,5 @@
package com.securitycontrol.common.core.utils.aes; package com.securitycontrol.common.core.utils.aes;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -28,27 +27,28 @@ public class DateTimeHelper {
return df.format(d); return df.format(d);
} }
public static boolean compareMonth(String time,String now){ public static boolean compareMonth(String time, String now) {
try{ try {
int year=Integer.parseInt(time.split("-")[0].trim()) ; int year = Integer.parseInt(time.split("-")[0].trim());
int month=Integer.parseInt(time.split("-")[1].trim()) ; int month = Integer.parseInt(time.split("-")[1].trim());
int year1=Integer.parseInt(now.split("-")[0].trim()) ; int year1 = Integer.parseInt(now.split("-")[0].trim());
int month1=Integer.parseInt(now.split("-")[1].trim()) ; int month1 = Integer.parseInt(now.split("-")[1].trim());
if(year>year1){ if (year > year1) {
return false;
}
if (year == year1) {
if (month >= month1) {
return false; 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 * 增加 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 { try {
Integer year=Integer.parseInt(time.split("-")[0].trim()) ; Integer year = Integer.parseInt(time.split("-")[0].trim());
Integer month=Integer.parseInt(time.split("-")[1].trim()) ; Integer month = Integer.parseInt(time.split("-")[1].trim());
YearMonth yearMonth = YearMonth.of(year, month); YearMonth yearMonth = YearMonth.of(year, month);
YearMonth addedMonth = yearMonth.plusMonths(1); YearMonth addedMonth = yearMonth.plusMonths(1);
return addedMonth.toString(); return addedMonth.toString();
@ -394,7 +394,6 @@ public class DateTimeHelper {
} }
/** /**
* 得到前一个月 * 得到前一个月
* *
@ -843,7 +842,7 @@ public class DateTimeHelper {
* @author cwchen * @author cwchen
* @date 2024/3/16 15:11 * @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; Date date = null;
try { try {
SimpleDateFormat sdf = new SimpleDateFormat(format); SimpleDateFormat sdf = new SimpleDateFormat(format);
@ -857,6 +856,7 @@ public class DateTimeHelper {
/** /**
* 两个日期之间的差值 * 两个日期之间的差值
*
* @param startDate * @param startDate
* @param endDate * @param endDate
* @return Long * @return Long
@ -899,4 +899,22 @@ public class DateTimeHelper {
String endTime = sdfTwo.format(new Date()) + maxDate; String endTime = sdfTwo.format(new Date()) + maxDate;
return startTime + " - " + endTime; 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;
}
} }

View File

@ -129,10 +129,22 @@ public interface IProScheduleMapper {
/** /**
* 更新工序计划进度 * 更新工序计划进度
*
* @param vo * @param vo
* @description * @description
* @author cwchen * @author cwchen
* @date 2024/3/30 13:05 * @date 2024/3/30 13:05
*/ */
void updateGxPlan(GxPlanProgressVo vo); void updateGxPlan(GxPlanProgressVo vo);
/**
* 获取工程进度
* @param vo
* @return List<Map < Object>>
* @description
* @author cwchen
* @date 2024/4/24 13:41
*/
@MapKey("bidCode")
List<Map<String, Object>> efficiencyAnalysis(ProScheduleVo vo);
} }

View File

@ -9,6 +9,7 @@ import com.securitycontrol.common.core.constant.HttpStatus;
import com.securitycontrol.common.core.constant.SecurityConstants; import com.securitycontrol.common.core.constant.SecurityConstants;
import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.StringUtils; 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.AesCbcUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.utils.aes.ListHelper; import com.securitycontrol.common.core.utils.aes.ListHelper;
@ -108,6 +109,10 @@ public class HumanServiceImpl implements HumanService {
} }
// 上传文件 // 上传文件
if (file != null) { if (file != null) {
String isVerify = UploadCheckUtils.uploadImgVerify(file);
if(StringUtils.isNotBlank(isVerify)){
return AjaxResult.error(isVerify);
}
Result result = remoteFileService.singleUploadFile(file, SecurityConstants.INNER); Result result = remoteFileService.singleUploadFile(file, SecurityConstants.INNER);
if(result != null && result.getCode() == HttpStatus.ERROR) { if(result != null && result.getCode() == HttpStatus.ERROR) {
log.error("人员照片上传失败"); log.error("人员照片上传失败");

View File

@ -21,10 +21,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.stream.Collectors;
import java.util.Map;
import java.util.Objects;
/** /**
* @authorcwchen * @authorcwchen
@ -47,6 +45,30 @@ public class ProScheduleServiceImpl implements IProScheduleService {
List<ProScheduleVo> list = new ArrayList<>(); List<ProScheduleVo> list = new ArrayList<>();
try { try {
list = mapper.getProScheduleLists(dto); list = mapper.getProScheduleLists(dto);
list.forEach(vo->{
List<Map<String, Object>> valueList = new ArrayList<>();
valueList = mapper.efficiencyAnalysis(vo);
Map<String, List<Map<String, Object>>> map = valueList.stream().collect(Collectors.groupingBy(item -> {
return String.valueOf(item.get("bidCode"));
}));
map.forEach((k, v) -> {
// 根据每个工程的工序计划及进度填报计算效率
Map<String, Object> 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) { } catch (Exception e) {
log.error("获取工程进度列表", e); log.error("获取工程进度列表", e);
} }

View File

@ -10,6 +10,7 @@ import com.securitycontrol.common.core.constant.SecurityConstants;
import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.domain.Result;
import com.securitycontrol.common.core.utils.ImportExcelUtils; import com.securitycontrol.common.core.utils.ImportExcelUtils;
import com.securitycontrol.common.core.utils.StringUtils; 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.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.security.utils.ValidatorsUtils; import com.securitycontrol.common.security.utils.ValidatorsUtils;
@ -93,6 +94,16 @@ public class ProServiceImpl implements IProService {
if (StringUtils.isNotBlank(validResult)) { if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(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(); String proId = getuid();
int result = mapper.proIsExist(vo); int result = mapper.proIsExist(vo);
if (result > 0) { if (result > 0) {
@ -116,6 +127,12 @@ public class ProServiceImpl implements IProService {
} }
// 上传文件 // 上传文件
if (files != null && types != null) { 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); Result uploadResult = remoteFileService.mostUploadFile(files, SecurityConstants.INNER);
if (uploadResult != null && uploadResult.getCode() == HttpStatus.ERROR) { if (uploadResult != null && uploadResult.getCode() == HttpStatus.ERROR) {
log.error("工程文件上传失败"); log.error("工程文件上传失败");
@ -562,6 +579,10 @@ public class ProServiceImpl implements IProService {
if (StringUtils.isNotBlank(validResult)) { if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(validResult); return AjaxResult.error(validResult);
} }
boolean flag = DateTimeHelper.compareTime(vo.getPlanStartTime(), vo.getPlanEndTime());
if(!flag){
return AjaxResult.error("计划开始时间不能晚于计划结束时间");
}
int result = mapper.getTowerIsExist(vo); int result = mapper.getTowerIsExist(vo);
if(result > 0){ if(result > 0){
return AjaxResult.error("杆塔或工序不能重复选择"); return AjaxResult.error("杆塔或工序不能重复选择");

View File

@ -3,6 +3,7 @@ package com.securitycontrol.background.service.impl;
import com.securitycontrol.background.mapper.ISignProMapper; import com.securitycontrol.background.mapper.ISignProMapper;
import com.securitycontrol.background.service.ISignProService; import com.securitycontrol.background.service.ISignProService;
import com.securitycontrol.common.core.utils.StringUtils; 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.utils.uuid.IdUtils;
import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.security.utils.ValidatorsUtils; import com.securitycontrol.common.security.utils.ValidatorsUtils;
@ -50,6 +51,16 @@ public class SignProServiceImpl implements ISignProService {
public AjaxResult addOrUpdateProject(ProjectVo vo) { public AjaxResult addOrUpdateProject(ProjectVo vo) {
try { try {
String validResult = validatorsUtils.valid(vo, ProjectVo.Query.class); 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)) { if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(validResult); return AjaxResult.error(validResult);
} }
@ -129,6 +140,10 @@ public class SignProServiceImpl implements ISignProService {
if (StringUtils.isNotBlank(validResult)) { if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(validResult); return AjaxResult.error(validResult);
} }
boolean flag = DateTimeHelper.compareTime(vo.getStartDate(), vo.getCompleteDate());
if(!flag){
return AjaxResult.error("实际开工时间不能晚于实际竣工时间");
}
int result = mapper.isSignPro(vo); int result = mapper.isSignPro(vo);
if (result > 0) { if (result > 0) {
return AjaxResult.error("单项编码不能重复"); return AjaxResult.error("单项编码不能重复");

View File

@ -1,7 +1,9 @@
package com.securitycontrol.background.service.impl; package com.securitycontrol.background.service.impl;
import com.securitycontrol.background.mapper.HumanManageMapper;
import com.securitycontrol.background.mapper.TeamManageMapper; import com.securitycontrol.background.mapper.TeamManageMapper;
import com.securitycontrol.background.service.TeamService; 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.StringUtils;
import com.securitycontrol.common.core.utils.aes.AesCbcUtils; import com.securitycontrol.common.core.utils.aes.AesCbcUtils;
import com.securitycontrol.common.core.utils.uuid.IdUtils; import com.securitycontrol.common.core.utils.uuid.IdUtils;
@ -21,6 +23,7 @@ import java.util.*;
/** /**
* 班组-业务逻辑层 * 班组-业务逻辑层
*
* @author 10488 * @author 10488
*/ */
@Service(value = "TeamService") @Service(value = "TeamService")
@ -30,6 +33,9 @@ public class TeamServiceImpl implements TeamService {
@Resource(name = "TeamManageMapper") @Resource(name = "TeamManageMapper")
private TeamManageMapper mapper; private TeamManageMapper mapper;
@Resource(name = "HumanManageMapper")
private HumanManageMapper humanManageMapper;
@Resource(name = "ValidatorsUtils") @Resource(name = "ValidatorsUtils")
private ValidatorsUtils validatorsUtils; private ValidatorsUtils validatorsUtils;
@ -43,7 +49,7 @@ public class TeamServiceImpl implements TeamService {
vo.setTeamNum(String.valueOf(num)); vo.setTeamNum(String.valueOf(num));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("获取班组列表",e); log.error("获取班组列表", e);
} }
return list; return list;
} }
@ -58,7 +64,7 @@ public class TeamServiceImpl implements TeamService {
} }
List<Map<String, String>> list = mapper.isTeamExist(vo); List<Map<String, String>> list = mapper.isTeamExist(vo);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
Boolean result = teamIsExist(list,vo.getIdNumber()); Boolean result = teamIsExist(list, vo.getIdNumber());
if (result) { if (result) {
return AjaxResult.error("班组不能重复"); return AjaxResult.error("班组不能重复");
} }
@ -83,6 +89,7 @@ public class TeamServiceImpl implements TeamService {
/** /**
* 班组是否存在 * 班组是否存在
*
* @param list * @param list
* @param idNumber * @param idNumber
* @return Boolean * @return Boolean
@ -113,11 +120,11 @@ public class TeamServiceImpl implements TeamService {
try { try {
vo = mapper.getTeamDetailById(dto); vo = mapper.getTeamDetailById(dto);
String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber()); String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber());
if(decryptIdNumber != null){ if (decryptIdNumber != null) {
vo.setIdNumber(decryptIdNumber); vo.setIdNumber(decryptIdNumber);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("班组详情",e); log.error("班组详情", e);
} }
return AjaxResult.success(vo); return AjaxResult.success(vo);
} }
@ -127,13 +134,13 @@ public class TeamServiceImpl implements TeamService {
public AjaxResult delTeam(ParamDto dto) { public AjaxResult delTeam(ParamDto dto) {
try { try {
int result = mapper.isPeopleByTeam(dto); int result = mapper.isPeopleByTeam(dto);
if(result > 0){ if (result > 0) {
return AjaxResult.error("班组存在人员"); return AjaxResult.error("班组存在人员");
} }
mapper.delTeam(dto); mapper.delTeam(dto);
return AjaxResult.success(); return AjaxResult.success();
} catch (Exception e) { } catch (Exception e) {
log.error("删除班组",e); log.error("删除班组", e);
//手动回滚异常 //手动回滚异常
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error(); return AjaxResult.error();
@ -145,8 +152,24 @@ public class TeamServiceImpl implements TeamService {
List<HumanManageVo> list = new ArrayList<>(); List<HumanManageVo> list = new ArrayList<>();
try { try {
list = mapper.getTeamUserLists(dto); 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) { } catch (Exception e) {
log.error("获取班组人员列表",e); log.error("获取班组人员列表", e);
} }
return list; return list;
} }
@ -172,20 +195,20 @@ public class TeamServiceImpl implements TeamService {
List<Map<String, String>> noBandingUsers = new ArrayList<>(); List<Map<String, String>> noBandingUsers = new ArrayList<>();
try { try {
List<Map<String, String>> list = mapper.getTeamUserAndNoBandingUser(dto); List<Map<String, String>> list = mapper.getTeamUserAndNoBandingUser(dto);
if(CollectionUtils.isNotEmpty(list)){ if (CollectionUtils.isNotEmpty(list)) {
for (Map<String, String> stringMap : list) { for (Map<String, String> stringMap : list) {
if(Objects.equals(stringMap.get("type"),"1")){ if (Objects.equals(stringMap.get("type"), "1")) {
teamUsers.add(stringMap); teamUsers.add(stringMap);
}else if(Objects.equals(stringMap.get("type"),"2")){ } else if (Objects.equals(stringMap.get("type"), "2")) {
noBandingUsers.add(stringMap); noBandingUsers.add(stringMap);
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("获取班组组员和未加入班组人员",e); log.error("获取班组组员和未加入班组人员", e);
} }
map.put("teamUsers",teamUsers); map.put("teamUsers", teamUsers);
map.put("noBandingUsers",noBandingUsers); map.put("noBandingUsers", noBandingUsers);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
@ -193,16 +216,16 @@ public class TeamServiceImpl implements TeamService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult addTeamUser(ParamDto dto) { public AjaxResult addTeamUser(ParamDto dto) {
try { try {
if(StringUtils.isNotEmpty(dto.getBandingUsers())){ if (StringUtils.isNotEmpty(dto.getBandingUsers())) {
String[] bandingUserArr = dto.getBandingUsers().split(","); String[] bandingUserArr = dto.getBandingUsers().split(",");
for (String bandingUser : bandingUserArr) { 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(","); String[] unBandingUserArr = dto.getUnBandingUsers().split(",");
for (String unBandingUser : unBandingUserArr) { for (String unBandingUser : unBandingUserArr) {
mapper.addTeamUser(unBandingUser,null,2); mapper.addTeamUser(unBandingUser, null, 2);
} }
} }
return AjaxResult.success(); return AjaxResult.success();
@ -213,4 +236,22 @@ public class TeamServiceImpl implements TeamService {
return AjaxResult.error(); 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;
}
} }

View File

@ -121,14 +121,15 @@
</if> </if>
AND ttp.del_falge = '0' AND ttp.del_falge = '0'
</where> </where>
ORDER BY ttp.cratet_time DESC
</select> </select>
<!--人员是否存在--> <!--人员是否存在-->
<select id="userIsExist" resultType="java.util.Map"> <select id="userIsExist" resultType="java.util.Map">
<if test="userId == null or userId == ''"> <if test="userId == null or userId == ''">
SELECT user_id AS id,id_number AS value FROM t_team_people SELECT user_id AS id,id_number AS value FROM t_team_people WHERE del_falge = '0'
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
SELECT user_id AS id,id_number AS value FROM t_team_people WHERE user_id != #{userId} SELECT user_id AS id,id_number AS value FROM t_team_people WHERE user_id != #{userId} AND del_falge = '0'
</if> </if>
</select> </select>
<!--人员详情--> <!--人员详情-->

View File

@ -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 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} WHERE plan_id = #{planId}
</select> </select>
<!--获取工程进度-->
<select id="efficiencyAnalysis" resultType="java.util.Map">
SELECT tgp.gx_weight AS gxWeight,
IFNULL(tgp.plan_progress,'0') AS planProgress,
tgp.bid_code AS bidCode,
tgp.plan_id AS planId
FROM tb_gx_plan tgp
WHERE tgp.bid_code = #{bidCode} AND tgp.del_flag = 0
</select>
</mapper> </mapper>

View File

@ -244,8 +244,8 @@
tsp.vol_level AS volLevel, tsp.vol_level AS volLevel,
tsp.line_length AS lineLength, tsp.line_length AS lineLength,
tsp.subs_cap AS subsCap, tsp.subs_cap AS subsCap,
CASE tsp.pro_type WHEN '1' THEN '变电' WHEN '2' THEN '线路' END AS proType, tsp.pro_type AS proType,
CASE tsp.subs_type WHEN '1' THEN '土建' WHEN '2' THEN '电气' WHEN '3' THEN '变电' END AS subsType, tsp.subs_type AS subsType,
tsp.estimate_type AS estimateType, tsp.estimate_type AS estimateType,
tsp.start_date AS startDate, tsp.start_date AS startDate,
tsp.end_date AS endDate, tsp.end_date AS endDate,

View File

@ -103,18 +103,20 @@
</select> </select>
<!--班组是否存在班组人员--> <!--班组是否存在班组人员-->
<select id="isPeopleByTeam" resultType="java.lang.Integer"> <select id="isPeopleByTeam" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_team_people WHERE team_id = #{id} SELECT COUNT(*) FROM t_team_people WHERE team_id = #{id} AND del_falge = '0'
</select> </select>
<!--班组人员数量--> <!--班组人员数量-->
<select id="getTeamUserNum" resultType="java.lang.Integer"> <select id="getTeamUserNum" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_team_people WHERE team_id = #{teamId} SELECT COUNT(*) FROM t_team_people WHERE team_id = #{teamId} AND del_falge = '0'
</select> </select>
<!--获取班组人员列表--> <!--获取班组人员列表-->
<select id="getTeamUserLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo"> <select id="getTeamUserLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
SELECT SELECT
ttp.user_id AS userId, ttp.user_id AS userId,
ttp.user_name AS userName, ttp.user_name AS userName,
sd.dict_name AS userType sd.dict_name AS userType,
ttp.sex,
ttp.id_number AS idNumber
FROM t_team_people ttp FROM t_team_people ttp
LEFT JOIN sys_dict sd ON ttp.user_type = sd.dict_code LEFT JOIN sys_dict sd ON ttp.user_type = sd.dict_code
<where> <where>
@ -122,12 +124,13 @@
<if test="userName!=null and userName !=''"> <if test="userName!=null and userName !=''">
AND INSTR(ttp.user_name,#{userName}) > 0 AND INSTR(ttp.user_name,#{userName}) > 0
</if> </if>
AND ttp.del_falge = '0'
</where> </where>
</select> </select>
<!--获取班组组员和未加入班组人员--> <!--获取班组组员和未加入班组人员-->
<select id="getTeamUserAndNoBandingUser" resultType="java.util.Map"> <select id="getTeamUserAndNoBandingUser" resultType="java.util.Map">
SELECT user_id AS id,user_name AS userName,'1' AS type FROM t_team_people WHERE team_id = #{id} SELECT user_id AS id,user_name AS userName,'1' AS type FROM t_team_people WHERE team_id = #{id} AND del_falge = '0'
UNION ALL UNION ALL
SELECT user_id AS id,user_name AS userName,'2' AS type FROM t_team_people WHERE team_id IS NULL OR team_id = '' SELECT user_id AS id,user_name AS userName,'2' AS type FROM t_team_people WHERE team_id IS NULL OR team_id = '' AND (del_falge = '0')
</select> </select>
</mapper> </mapper>