APP
This commit is contained in:
parent
d05efd92f4
commit
720223f788
|
|
@ -12,8 +12,8 @@ import java.util.List;
|
||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
public final static Integer PARENT_ID = 0;
|
public final static Integer PARENT_ID = 0;
|
||||||
public final static int addType = 1;
|
public final static int ID_CARD = 18;
|
||||||
public final static int editType = 2;
|
public final static int ID_CARD2 = 15;
|
||||||
|
|
||||||
public final static Integer MENU_TYPE = 2;
|
public final static Integer MENU_TYPE = 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.securitycontrol.common.core.utils.aes;
|
package com.securitycontrol.common.core.utils.aes;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
|
|
@ -358,7 +359,6 @@ public class DateTimeHelper {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -802,6 +802,7 @@ public class DateTimeHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日期解析为时间戳
|
* 日期解析为时间戳
|
||||||
|
*
|
||||||
* @param dateString
|
* @param dateString
|
||||||
* @param format
|
* @param format
|
||||||
* @return Long
|
* @return Long
|
||||||
|
|
@ -820,4 +821,32 @@ public class DateTimeHelper {
|
||||||
}
|
}
|
||||||
return date.getTime();
|
return date.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 两个日期之间的差值
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return Long
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 20:38
|
||||||
|
*/
|
||||||
|
public static Long getDayDifference(String startDate, String endDate) {
|
||||||
|
if (StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
try {
|
||||||
|
Date star = dft.parse(startDate);
|
||||||
|
Date endDay = dft.parse(endDate);
|
||||||
|
Long starTime = star.getTime();
|
||||||
|
Long endTime = endDay.getTime();
|
||||||
|
Long num = endTime - starTime;
|
||||||
|
System.out.println("相差天数为:" + num / 24 / 60 / 60 / 1000);
|
||||||
|
return (num / 24 / 60 / 60 / 1000) + 1;
|
||||||
|
} catch (ParseException e) {
|
||||||
|
log.error("两个日期之间的差值", e);
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,4 +34,22 @@ public class AppController {
|
||||||
public AjaxResult getProsByUser(ParamDto dto){
|
public AjaxResult getProsByUser(ParamDto dto){
|
||||||
return service.getProsByUser(dto);
|
return service.getProsByUser(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "人员管理")
|
||||||
|
@GetMapping("getPersonnelList")
|
||||||
|
public AjaxResult getPersonnelList(ParamDto dto){
|
||||||
|
return service.getPersonnelList(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "车辆管理")
|
||||||
|
@GetMapping("getCarList")
|
||||||
|
public AjaxResult getCarList(ParamDto dto){
|
||||||
|
return service.getCarList(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "项目进度")
|
||||||
|
@GetMapping("proProgress")
|
||||||
|
public AjaxResult proProgress(ParamDto dto){
|
||||||
|
return service.proProgress(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.securitycontrol.background.mapper;
|
package com.securitycontrol.background.mapper;
|
||||||
|
|
||||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||||
|
import com.securitycontrol.entity.background.vo.VehicleVo;
|
||||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||||
import org.apache.ibatis.annotations.MapKey;
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
|
|
@ -42,6 +44,7 @@ public interface IAppMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前登录人绑定的工程
|
* 当前登录人绑定的工程
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return List<Map < String>>
|
* @return List<Map < String>>
|
||||||
* @description
|
* @description
|
||||||
|
|
@ -50,4 +53,37 @@ public interface IAppMapper {
|
||||||
*/
|
*/
|
||||||
@MapKey("bidCode")
|
@MapKey("bidCode")
|
||||||
List<Map<String, String>> getProsByUser(ParamDto dto);
|
List<Map<String, String>> getProsByUser(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员管理
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return List<HumanManageVo>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 19:40
|
||||||
|
*/
|
||||||
|
List<HumanManageVo> getPersonnelList(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return List<VehicleVo>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 20:09
|
||||||
|
*/
|
||||||
|
List<VehicleVo> getCarList(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目进度
|
||||||
|
* @param dto
|
||||||
|
* @return List<Map<String, Object>>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 20:22
|
||||||
|
*/
|
||||||
|
@MapKey("bidCode")
|
||||||
|
List<Map<String, Object>> getProBasicInfo(ParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ public interface IAppService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前登录人绑定的工程
|
* 当前登录人绑定的工程
|
||||||
|
*
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return AjaxResult
|
* @return AjaxResult
|
||||||
* @description
|
* @description
|
||||||
|
|
@ -30,4 +31,36 @@ public interface IAppService {
|
||||||
* @date 2024/3/28 19:08
|
* @date 2024/3/28 19:08
|
||||||
*/
|
*/
|
||||||
AjaxResult getProsByUser(ParamDto dto);
|
AjaxResult getProsByUser(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员管理
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 19:38
|
||||||
|
*/
|
||||||
|
AjaxResult getPersonnelList(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆管理
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 20:08
|
||||||
|
*/
|
||||||
|
AjaxResult getCarList(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目进度
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/28 20:19
|
||||||
|
*/
|
||||||
|
AjaxResult proProgress(ParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,17 @@ import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.securitycontrol.background.mapper.IAppMapper;
|
import com.securitycontrol.background.mapper.IAppMapper;
|
||||||
import com.securitycontrol.background.service.IAppService;
|
import com.securitycontrol.background.service.IAppService;
|
||||||
|
import com.securitycontrol.common.core.constant.Constant;
|
||||||
import com.securitycontrol.common.core.constant.HttpStatus;
|
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.aes.AesCbcUtils;
|
||||||
|
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.entity.background.dto.ParamDto;
|
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||||
|
import com.securitycontrol.entity.background.vo.VehicleVo;
|
||||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||||
import com.securitycontrol.system.api.RemoteFileService;
|
import com.securitycontrol.system.api.RemoteFileService;
|
||||||
|
|
@ -18,9 +24,9 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author:cwchen
|
* @author:cwchen
|
||||||
|
|
@ -78,4 +84,91 @@ public class AppServiceImpl implements IAppService {
|
||||||
}
|
}
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getPersonnelList(ParamDto dto) {
|
||||||
|
List<HumanManageVo> list = new ArrayList();
|
||||||
|
try {
|
||||||
|
list = mapper.getPersonnelList(dto);
|
||||||
|
for (HumanManageVo vo : list) {
|
||||||
|
String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber());
|
||||||
|
if(decryptIdNumber != null){
|
||||||
|
vo.setIdNumber(decryptIdNumber);
|
||||||
|
vo.setSex(getGenderByIdCard(decryptIdNumber));
|
||||||
|
}else{
|
||||||
|
vo.setSex(getGenderByIdCard(vo.getIdNumber()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("人员管理",e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGenderByIdCard(String idCard) {
|
||||||
|
if (StringUtils.isNotEmpty(idCard)) {
|
||||||
|
if(idCard.length() == Constant.ID_CARD || idCard.length() == Constant.ID_CARD2){
|
||||||
|
idCard = idCard.length() == 15 ? idCard.substring(0, 6) + "19" + idCard.substring(6) : idCard;
|
||||||
|
char genderCode = idCard.charAt(16);
|
||||||
|
return (genderCode % 2) == 0 ? "女" : "男";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getCarList(ParamDto dto) {
|
||||||
|
List<VehicleVo> list = new ArrayList();
|
||||||
|
try {
|
||||||
|
list = mapper.getCarList(dto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("人员管理",e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult proProgress(ParamDto dto) {
|
||||||
|
Map<String, Object> dataMap = new HashMap<>(16);
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list= mapper.getProBasicInfo(dto);
|
||||||
|
Map<String, List<Map<String, Object>>> map = list.stream().collect(Collectors.groupingBy(item -> {
|
||||||
|
return String.valueOf(item.get("bidCode"));
|
||||||
|
}));
|
||||||
|
map.forEach((k, v) -> {
|
||||||
|
// 根据每个工程的工序计划及进度填报计算效率
|
||||||
|
BigDecimal value = new BigDecimal("0");
|
||||||
|
BigDecimal value2 = 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("gxProgress")) && 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("gxProgress")));
|
||||||
|
value = value.add(bigDecimal.multiply(bigDecimal2).divide(multipleValue, 3, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计划开始时间、计划结束时间、实际进度
|
||||||
|
String planStartTime = String.valueOf(v.get(0).get("planStartTime"));
|
||||||
|
String planEndTime = String.valueOf(v.get(0).get("planStartTime"));
|
||||||
|
String nowDate = DateTimeHelper.getNowDate();
|
||||||
|
dataMap.put("planStartTime",planStartTime);
|
||||||
|
dataMap.put("planEndTime",planEndTime);
|
||||||
|
dataMap.put("value", value.doubleValue());
|
||||||
|
|
||||||
|
// 计划进度、计划工期
|
||||||
|
Long dayDifference = DateTimeHelper.getDayDifference(planStartTime, planEndTime);
|
||||||
|
Long residueDay = DateTimeHelper.getDayDifference(planStartTime, nowDate);
|
||||||
|
BigDecimal dayDifferenceBd = BigDecimal.valueOf(dayDifference);
|
||||||
|
BigDecimal residueDayBd = BigDecimal.valueOf(residueDay);
|
||||||
|
// dayDifference
|
||||||
|
value2 = value2.add(residueDayBd.divide(dayDifferenceBd, 3, BigDecimal.ROUND_HALF_UP));
|
||||||
|
dataMap.put("value2",value2.doubleValue());
|
||||||
|
dataMap.put("durationDay", dayDifference);
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("项目进度");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(dataMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,42 @@
|
||||||
AND tp.org = #{orgId}
|
AND tp.org = #{orgId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<!--人员管理-->
|
||||||
|
<select id="getPersonnelList" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
|
||||||
|
SELECT ttp.user_name AS userName,
|
||||||
|
ttp.phone,
|
||||||
|
ttp.id_number AS idNumber,
|
||||||
|
IF(ttp.status = '1','在场','离场') AS status
|
||||||
|
FROM t_team_people ttp
|
||||||
|
LEFT JOIN tb_work_team twt on twt.team_id = ttp.team_id
|
||||||
|
WHERE twt.bid_code = #{bidCode} AND ttp.del_falge = '0'
|
||||||
|
ORDER BY cratet_time
|
||||||
|
</select>
|
||||||
|
<!--车辆管理-->
|
||||||
|
<select id="getCarList" resultType="com.securitycontrol.entity.background.vo.VehicleVo">
|
||||||
|
SELECT car_num AS carNum,
|
||||||
|
tc.phone,
|
||||||
|
tc.user_name AS userName
|
||||||
|
FROM tb_car tc
|
||||||
|
WHERE tc.bid_code = #{bidCode} AND del_flag = 0
|
||||||
|
</select>
|
||||||
|
<!--项目进度-->
|
||||||
|
<select id="getProBasicInfo" resultType="java.util.Map">
|
||||||
|
SELECT tp.bid_code AS bidCode,
|
||||||
|
tp.pro_name AS proName,
|
||||||
|
tp.plan_start_time AS planStartTime,
|
||||||
|
tp.plan_end_time AS planEndTime,
|
||||||
|
tgp.plan_id AS planId,
|
||||||
|
tgp.gx_weight AS gxWeight,
|
||||||
|
a.gxProgress
|
||||||
|
FROM tb_project tp
|
||||||
|
LEFT JOIN tb_gx_plan tgp ON tp.bid_code = tgp.bid_code AND tgp.del_flag = 0
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT tpp.plan_id AS planId,
|
||||||
|
tpp.gx_progress AS gxProgress
|
||||||
|
FROM tb_project_progress tpp
|
||||||
|
INNER JOIN (SELECT MAX( create_time ) AS create_time FROM tb_project_progress GROUP BY plan_id) tpp2 ON tpp.create_time = tpp2.create_time
|
||||||
|
)a ON tgp.plan_id = a.planId
|
||||||
|
WHERE tp.del_flag = 0 AND tp.bid_code = #{bidCode}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -287,7 +287,7 @@ public class ScIndexServiceImpl implements IScIndexService {
|
||||||
}));
|
}));
|
||||||
map.forEach((k, v) -> {
|
map.forEach((k, v) -> {
|
||||||
// 根据每个工程的工序计划及进度填报计算效率
|
// 根据每个工程的工序计划及进度填报计算效率
|
||||||
Map<String, Object> dataMap = new HashMap<>();
|
Map<String, Object> dataMap = new HashMap<>(16);
|
||||||
BigDecimal value = new BigDecimal("0");
|
BigDecimal value = new BigDecimal("0");
|
||||||
BigDecimal multipleValue = new BigDecimal("100");
|
BigDecimal multipleValue = new BigDecimal("100");
|
||||||
for (int i = 0; i < v.size(); i++) {
|
for (int i = 0; i < v.size(); i++) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue