首页 接口
This commit is contained in:
parent
9119a1671e
commit
a996673914
|
|
@ -1,5 +1,6 @@
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -27,7 +28,27 @@ public class DateTimeHelper {
|
||||||
return df.format(d);
|
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){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(year==year1){
|
||||||
|
if(month>=month1){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 增加 LocalDateTime ==> Date
|
* 增加 LocalDateTime ==> Date
|
||||||
*/
|
*/
|
||||||
|
|
@ -340,6 +361,21 @@ public class DateTimeHelper {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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()) ;
|
||||||
|
YearMonth yearMonth = YearMonth.of(year, month);
|
||||||
|
YearMonth addedMonth = yearMonth.plusMonths(1); // 结果是2023年4月
|
||||||
|
return addedMonth.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(), e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取七周日期
|
* 获取七周日期
|
||||||
*
|
*
|
||||||
|
|
@ -358,9 +394,6 @@ public class DateTimeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 得到前一个月
|
* 得到前一个月
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.securitycontrol.entity.screen.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.poi.hpsf.Decimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程成本表
|
||||||
|
* @author 黑子
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProCostVo {
|
||||||
|
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 标段工程编码
|
||||||
|
*/
|
||||||
|
private String bidCode;
|
||||||
|
/**
|
||||||
|
* 工程造价
|
||||||
|
*/
|
||||||
|
private Decimal cost;
|
||||||
|
/**
|
||||||
|
* 成本备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
|
private String curryDay;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -90,4 +90,6 @@ public class SystemGlobal {
|
||||||
*/
|
*/
|
||||||
public final static int HJ_TYPE=351;
|
public final static int HJ_TYPE=351;
|
||||||
|
|
||||||
|
public final static int WEEK_DAY=7;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,36 @@ public class XcIndexController extends BaseController {
|
||||||
return service.getProJcData(dto);
|
return service.getProJcData(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程环境检测 实施数据
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询项目风险数据")
|
||||||
|
@GetMapping("getProRisk")
|
||||||
|
public AjaxResult getProRisk(ScreenParamDto dto){
|
||||||
|
return service.getProRisk(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程环境检测 实施数据
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询项目进度")
|
||||||
|
@GetMapping("getProcess")
|
||||||
|
public AjaxResult getProcess(ScreenParamDto dto){
|
||||||
|
return service.getProcess(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工程环境检测 实施数据
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "查询工程项目成本")
|
||||||
|
@GetMapping("getProMoney")
|
||||||
|
public AjaxResult getProMoney(ScreenParamDto dto){
|
||||||
|
return service.getProMoney(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@ package com.securitycontrol.screen.mapper;
|
||||||
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
||||||
import com.securitycontrol.entity.screen.vo.DeviceValueVo;
|
import com.securitycontrol.entity.screen.vo.DeviceValueVo;
|
||||||
import com.securitycontrol.entity.system.base.vo.ProVo;
|
import com.securitycontrol.entity.system.base.vo.ProVo;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工现场大屏 首页数据接口层
|
* 施工现场大屏 首页数据接口层
|
||||||
|
|
@ -28,4 +30,34 @@ public interface XcIndexMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DeviceValueVo> getProJcData(ScreenParamDto dto);
|
List<DeviceValueVo> getProJcData(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 周风险数量
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getWeekRiskNum(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询系统告警数量
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getWarnNum(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*查询工程进度
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@MapKey("bidCode")
|
||||||
|
List<Map<String, Object>> getProBasicInfo(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取工程成本
|
||||||
|
* @param times
|
||||||
|
* @param bidCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getProCost(@Param("time") String times,@Param("bidCode") String bidCode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,25 @@ public interface XcIndexService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getProJcData(ScreenParamDto dto);
|
AjaxResult getProJcData(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目风险数据
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getProRisk(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工程项目进度
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getProcess(ScreenParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询工程项目成本
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult getProMoney(ScreenParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import com.google.common.collect.Maps;
|
||||||
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.aes.DateTimeHelper;
|
||||||
|
import com.securitycontrol.common.core.utils.aes.StringHelper;
|
||||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||||
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
import com.securitycontrol.entity.screen.dto.ScreenParamDto;
|
||||||
import com.securitycontrol.entity.screen.vo.DeviceValueVo;
|
import com.securitycontrol.entity.screen.vo.DeviceValueVo;
|
||||||
|
|
@ -19,13 +21,14 @@ import com.securitycontrol.system.api.domain.SysFile;
|
||||||
import com.securitycontrol.system.api.domain.TbSourceFile;
|
import com.securitycontrol.system.api.domain.TbSourceFile;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.omg.CORBA.TIMEOUT;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 现场施工 大屏首页接口层
|
* 现场施工 大屏首页接口层
|
||||||
|
|
@ -95,4 +98,139 @@ public class XcIndexServiceImpl implements XcIndexService {
|
||||||
}
|
}
|
||||||
return AjaxResult.success(new ArrayList<DeviceValueVo>());
|
return AjaxResult.success(new ArrayList<DeviceValueVo>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目施工风险数据
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult getProRisk(ScreenParamDto dto) {
|
||||||
|
Map<String ,Object> map= Maps.newHashMap();
|
||||||
|
try{
|
||||||
|
List<String> dayList=new ArrayList<>();
|
||||||
|
List<Integer> weekRisk=new ArrayList<>();
|
||||||
|
List<Integer> warnList=new ArrayList<>();
|
||||||
|
String day=DateTimeHelper.getNowDay();
|
||||||
|
//获取近一周的数据
|
||||||
|
for (int i = 1; i <SystemGlobal.WEEK_DAY-1; i++) {
|
||||||
|
String nextDay=DateTimeHelper.getDayAddOrReduce(day,i-7);
|
||||||
|
dayList.add(nextDay);
|
||||||
|
}
|
||||||
|
dayList.add(day);
|
||||||
|
map.put("day",dayList);
|
||||||
|
for (String time:dayList) {
|
||||||
|
dto.setStartTime(time);
|
||||||
|
int weekNum=mapper.getWeekRiskNum(dto);
|
||||||
|
int warnNum=mapper.getWarnNum(dto);
|
||||||
|
weekRisk.add(weekNum);
|
||||||
|
warnList.add(warnNum);
|
||||||
|
}
|
||||||
|
map.put("week",weekRisk);
|
||||||
|
map.put("warn",warnList);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getProcess(ScreenParamDto dto) {
|
||||||
|
try{
|
||||||
|
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("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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计划开始时间、计划结束时间、实际进度、计划工期
|
||||||
|
String planStartTime = String.valueOf(v.get(0).get("planStartTime"));
|
||||||
|
String planEndTime = String.valueOf(v.get(0).get("planEndTime"));
|
||||||
|
String nowDate = DateTimeHelper.getNowDate();
|
||||||
|
Long dayDifference = DateTimeHelper.getDayDifference(planStartTime, planEndTime);
|
||||||
|
dataMap.put("planStartTime", planStartTime);
|
||||||
|
dataMap.put("planEndTime", planEndTime);
|
||||||
|
dataMap.put("value", value.doubleValue());
|
||||||
|
dataMap.put("durationDay", dayDifference);
|
||||||
|
|
||||||
|
Long planStartTimeTamp = DateTimeHelper.convertDateStringToTimestamp(planStartTime, "yyyy-MM-dd");
|
||||||
|
Long planEndTimeTamp = DateTimeHelper.convertDateStringToTimestamp(planEndTime, "yyyy-MM-dd");
|
||||||
|
Long nowDateTamp = DateTimeHelper.convertDateStringToTimestamp(nowDate, "yyyy-MM-dd");
|
||||||
|
// 计划进度
|
||||||
|
if (nowDateTamp < planStartTimeTamp) {
|
||||||
|
dataMap.put("value2", new Double(0));
|
||||||
|
} else if (nowDateTamp > planEndTimeTamp) {
|
||||||
|
dataMap.put("value2", new Double(100));
|
||||||
|
} else {
|
||||||
|
// 工程已施工天数
|
||||||
|
Long residueDay = DateTimeHelper.getDayDifference(planStartTime, nowDate);
|
||||||
|
// 剩余工期
|
||||||
|
Long residueDay2 = DateTimeHelper.getDayDifference(nowDate, planEndTime);
|
||||||
|
BigDecimal dayDifferenceBd = BigDecimal.valueOf(dayDifference);
|
||||||
|
BigDecimal residueDayBd = BigDecimal.valueOf(residueDay);
|
||||||
|
value2 = value2.add(residueDayBd.divide(dayDifferenceBd, 3, BigDecimal.ROUND_HALF_UP).multiply(multipleValue));
|
||||||
|
dataMap.put("value2", value2.doubleValue());
|
||||||
|
dataMap.put("residueDay", residueDay2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("项目进度");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(dataMap);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getProMoney(ScreenParamDto dto) {
|
||||||
|
Map<String, Object> dataMap = Maps.newHashMap();
|
||||||
|
try{
|
||||||
|
List<String> monList=new ArrayList<String>();
|
||||||
|
List<String> costList=new ArrayList<String>();
|
||||||
|
ProVo proVo=mapper.getProDetails(dto.getBidCode());
|
||||||
|
String startTime=proVo.getPlanStartTime();
|
||||||
|
String time=DateTimeHelper.getNowMonth();
|
||||||
|
String nowTime=startTime.substring(0,7);
|
||||||
|
if(DateTimeHelper.compareMonth(startTime,time)){
|
||||||
|
monList.add(nowTime);
|
||||||
|
while(!time.equals(nowTime)){
|
||||||
|
nowTime=DateTimeHelper.getAddMonth(nowTime,1);
|
||||||
|
monList.add(nowTime);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
monList.add(nowTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String times:monList) {
|
||||||
|
String cost=mapper.getProCost(times,dto.getBidCode());
|
||||||
|
if(StringHelper.isNotEmpty(cost)){
|
||||||
|
costList.add(cost);
|
||||||
|
}else{
|
||||||
|
costList.add("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataMap.put("time",monList);
|
||||||
|
dataMap.put("cost",costList);
|
||||||
|
return AjaxResult.success(dataMap);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(dataMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<mapper namespace="com.securitycontrol.screen.mapper.XcIndexMapper">
|
<mapper namespace="com.securitycontrol.screen.mapper.XcIndexMapper">
|
||||||
|
|
||||||
<select id="getProDetails" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
<select id="getProDetails" resultType="com.securitycontrol.entity.system.base.vo.ProVo">
|
||||||
select pro_brief AS proBrief,pro_id AS proId
|
select pro_brief AS proBrief,pro_id AS proId,plan_start_time planStartTime,plan_end_time planEndTime
|
||||||
from tb_project
|
from tb_project
|
||||||
where bid_code=#{bidCode}
|
where bid_code=#{bidCode}
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -19,6 +19,37 @@
|
||||||
where tdd.mode_name is not null and sd.dict_code=#{typeCode}
|
where tdd.mode_name is not null and sd.dict_code=#{typeCode}
|
||||||
and bd.bid_code=#{bidCode}
|
and bd.bid_code=#{bidCode}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getWeekRiskNum" resultType="java.lang.Integer">
|
||||||
|
select count(1) num
|
||||||
|
from jj_week_plan jwp
|
||||||
|
where #{startTime} BETWEEN jwp.start_date AND jwp.end_date
|
||||||
|
AND jwp.bid_no={bidCode}
|
||||||
|
</select>
|
||||||
|
<select id="getWarnNum" resultType="java.lang.Integer">
|
||||||
|
select count(1) num
|
||||||
|
from tb_warn
|
||||||
|
where DATE_FORMAT(warn_time, '%Y-%m-%d')=#{startTime}
|
||||||
|
</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,
|
||||||
|
tgp.plan_progress AS planProgress
|
||||||
|
FROM tb_project tp
|
||||||
|
LEFT JOIN tb_gx_plan tgp ON tp.bid_code = tgp.bid_code AND tgp.del_flag = 0
|
||||||
|
WHERE tp.del_flag = 0 AND tp.bid_code = #{bidCode}
|
||||||
|
</select>
|
||||||
|
<!--工程成本记录-->
|
||||||
|
<select id="getProCost" resultType="java.lang.String">
|
||||||
|
SELECT SUM(cost)
|
||||||
|
FROM tb_project_cost
|
||||||
|
where curry_day like concat('%',#{time},'%')
|
||||||
|
and bid_code=#{bidCode}
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue