From c16ba37ecf389239010992f57c01ff7c378a1612 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Thu, 28 Mar 2024 15:18:49 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=9C=81=E4=BE=A7=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/screen/dto/ScreenParamDto.java | 6 + .../screen/controller/ScIndexController.java | 19 +++- .../screen/mapper/IScIndexMapper.java | 47 ++++++++ .../screen/service/IScIndexService.java | 33 ++++++ .../service/impl/ScIndexServiceImpl.java | 106 +++++++++++++++++- .../main/resources/mapper/ScIndexMapper.xml | 52 +++++++++ .../base/mapper/IProScheduleMapper.java | 11 ++ .../service/impl/ProScheduleServiceImpl.java | 11 +- .../mapper/base/ProScheduleMapper.xml | 8 ++ .../resources/mapper/base/SelectMapper.xml | 13 ++- 10 files changed, 297 insertions(+), 9 deletions(-) diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/dto/ScreenParamDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/dto/ScreenParamDto.java index c4133b7..4a5604e 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/dto/ScreenParamDto.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/screen/dto/ScreenParamDto.java @@ -14,4 +14,10 @@ public class ScreenParamDto extends ScreenDto{ @ApiModelProperty("参数") private String param; + + @ApiModelProperty("开始时间") + private String startTime; + + @ApiModelProperty("结束时间") + private String endTime; } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ScIndexController.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ScIndexController.java index adf072b..e1102db 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ScIndexController.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/controller/ScIndexController.java @@ -5,7 +5,6 @@ import com.securitycontrol.entity.screen.dto.ScreenParamDto; import com.securitycontrol.screen.service.IScIndexService; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -59,4 +58,22 @@ public class ScIndexController { public AjaxResult deviceStatus(ScreenParamDto dto){ return service.deviceStatus(dto); } + + @ApiOperation(value = "工程安全隐患分析") + @GetMapping("potentialSafetyHazard") + public AjaxResult potentialSafetyHazard(ScreenParamDto dto){ + return service.potentialSafetyHazard(dto); + } + + @ApiOperation(value = "资源利用") + @GetMapping("resourceUse") + public AjaxResult resourceUse(ScreenParamDto dto){ + return service.resourceUse(dto); + } + + @ApiOperation(value = "效率分析") + @GetMapping("efficiencyAnalysis") + public AjaxResult efficiencyAnalysis(ScreenParamDto dto){ + return service.efficiencyAnalysis(dto); + } } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IScIndexMapper.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IScIndexMapper.java index 49c69a0..1286581 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IScIndexMapper.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/IScIndexMapper.java @@ -77,6 +77,7 @@ public interface IScIndexMapper { /** * 设备状态 + * * @param dto * @return List> * @description @@ -85,4 +86,50 @@ public interface IScIndexMapper { */ @MapKey("bidCode") List> deviceStatus(ScreenParamDto dto); + + /** + * 工程安全隐患分析 + * + * @param dto + * @return List> + * @description + * @author cwchen + * @date 2024/3/28 9:13 + */ + @MapKey("orgId") + List> potentialSafetyHazard(ScreenParamDto dto); + + /** + * 获取班组人员/获取站班会人员 + * + * @param dto + * @return List + * @description + * @author cwchen + * @date 2024/3/28 11:05 + */ + List getPersonnel(ScreenParamDto dto); + + /** + * 设备 在线/不在线 数量 + * + * @param dto + * @return List> + * @description + * @author cwchen + * @date 2024/3/28 11:28 + */ + @MapKey("id") + List> allDeviceStatus(ScreenParamDto dto); + + /** + * 效率分析(工程进度分析) + * @param dto + * @return List> + * @description + * @author cwchen + * @date 2024/3/28 13:47 + */ + @MapKey("id") + List> efficiencyAnalysis(ScreenParamDto dto); } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IScIndexService.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IScIndexService.java index 16d1392..a9da2ec 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IScIndexService.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/IScIndexService.java @@ -67,6 +67,7 @@ public interface IScIndexService { /** * 设备状态 + * * @param dto * @return AjaxResult * @description @@ -74,4 +75,36 @@ public interface IScIndexService { * @date 2024/3/27 19:50 */ AjaxResult deviceStatus(ScreenParamDto dto); + + /** + * 工程安全隐患分析 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/27 20:49 + */ + AjaxResult potentialSafetyHazard(ScreenParamDto dto); + + /** + * 资源利用 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/28 10:51 + */ + AjaxResult resourceUse(ScreenParamDto dto); + + /** + * 效率分析(工程进度) + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/28 13:39 + */ + AjaxResult efficiencyAnalysis(ScreenParamDto dto); } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ScIndexServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ScIndexServiceImpl.java index c1408ba..2e06f34 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ScIndexServiceImpl.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/ScIndexServiceImpl.java @@ -1,6 +1,8 @@ package com.securitycontrol.screen.service.impl; import com.securitycontrol.common.core.constant.Constant; +import com.securitycontrol.common.core.utils.StringUtils; +import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.web.domain.AjaxResult; import com.securitycontrol.entity.screen.dto.ScreenParamDto; import com.securitycontrol.entity.screen.vo.ConstrQuality; @@ -10,11 +12,13 @@ import com.securitycontrol.screen.service.IScIndexService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.BeanUtils; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.Future; import java.util.stream.Collectors; /** @@ -30,6 +34,9 @@ public class ScIndexServiceImpl implements IScIndexService { @Resource(name = "IScIndexMapper") private IScIndexMapper mapper; + @Resource(name = "testTaskExecutor") + private ThreadPoolTaskExecutor testTaskExecutor; + @Override public AjaxResult proStatusStatistics(ScreenParamDto dto) { Map dataMap = new HashMap<>(16); @@ -153,9 +160,9 @@ public class ScIndexServiceImpl implements IScIndexService { @Override public AjaxResult deviceStatus(ScreenParamDto dto) { - HashMap returnMap = new HashMap<>(); + Map returnMap = new HashMap<>(16); List> dataList = new ArrayList<>(256); - List> list = new ArrayList<>(256); + List> list = new ArrayList<>(); int allTotalNum = 0, onlineTotalNum = 0, offTotalNum = 0; try { list = mapper.deviceStatus(dto); @@ -194,4 +201,99 @@ public class ScIndexServiceImpl implements IScIndexService { returnMap.put("offTotalNum", offTotalNum); return AjaxResult.success(returnMap); } + + @Override + public AjaxResult potentialSafetyHazard(ScreenParamDto dto) { + List> list = new ArrayList<>(16); + try { + String currentWeekTime = DateTimeHelper.getCurrentWeekTime(); + String[] timeArr = currentWeekTime.split(","); + dto.setStartTime(timeArr[0]); + dto.setEndTime(timeArr[1]); + list = mapper.potentialSafetyHazard(dto); + + } catch (Exception e) { + log.error("工程安全隐患分析", e); + } + return AjaxResult.success(list); + } + + @Override + public AjaxResult resourceUse(ScreenParamDto dto) { + Map map = new HashMap<>(3); + // 人员利用率 设备使用率 能源使用情况 + Double personnelRate = new Double(0),deviceRate = new Double(0),energyValue = new Double(1201); + try { + Future future = testTaskExecutor.submit(() -> { + log.info("人员利用率-执行线程{}", Thread.currentThread().getName()); + List personnelList = personnelList = mapper.getPersonnel(dto); + if(personnelList.get(0) == 0 || personnelList.get(1) == 0){ + return new Double(0); + } + BigDecimal value = new BigDecimal("0"); + BigDecimal multipleValue = new BigDecimal("100"); + BigDecimal classPeople = BigDecimal.valueOf(personnelList.get(0)); + BigDecimal teamPeople = BigDecimal.valueOf(personnelList.get(1)); + value = classPeople.divide(teamPeople, 3, BigDecimal.ROUND_HALF_UP); + value = value.multiply(multipleValue); + return value.doubleValue(); + }); + Future future2 = testTaskExecutor.submit(() -> { + log.info("设备使用率-执行线程{}", Thread.currentThread().getName()); + List> list = new ArrayList<>(); + list = mapper.allDeviceStatus(dto); + if(CollectionUtils.isEmpty(list)){ + return new Double(0); + } + int onlineNum = 0,totalNum = list.size(); + for (Map objectMap : list) { + if(Objects.equals(objectMap.get("status"),Constant.ONLINE)){ + onlineNum ++; + } + } + BigDecimal onlineValue = BigDecimal.valueOf(onlineNum); + BigDecimal totalValue = BigDecimal.valueOf(totalNum); + return onlineValue.divide(totalValue, 3, BigDecimal.ROUND_HALF_UP).doubleValue(); + }); + personnelRate = future.get(); + deviceRate = future2.get(); + } catch (Exception e) { + log.error("资源利用", e); + } + map.put("personnelRate",personnelRate); + map.put("deviceRate",deviceRate); + map.put("energyValue",energyValue); + return AjaxResult.success(map); + } + + @Override + public AjaxResult efficiencyAnalysis(ScreenParamDto dto) { + List> dataList = new ArrayList<>(); + List> list = new ArrayList<>(); + try { + list = mapper.efficiencyAnalysis(dto); + Map>> map = list.stream().collect(Collectors.groupingBy(item -> { + return String.valueOf(item.get("bidCode")); + })); + map.forEach((k, v) -> { + // 根据每个工程的工序计划及进度填报计算效率 + Map dataMap = new HashMap<>(); + 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("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)); + } + } + dataMap.put("proName",v.get(0).get("proName")); + dataMap.put("value",value.doubleValue()); + dataList.add(dataMap); + }); + } catch (Exception e) { + log.error("效率分析(工程进度分析)",e); + } + return AjaxResult.success(dataList); + } } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml index 326d725..eeff4f5 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/ScIndexMapper.xml @@ -79,4 +79,56 @@ INNER JOIN tb_project tp on tpb.bid_code = tp.bid_code AND tp.del_flag = 0 WHERE tbd.del_flage = 0 + + + + + + + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java index 3941506..7e3b5e1 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/mapper/IProScheduleMapper.java @@ -94,10 +94,21 @@ public interface IProScheduleMapper { /** * 工程为线路时 更新杆塔当前工序 + * * @param vo * @description * @author cwchen * @date 2024/3/16 15:40 */ void updateGtData(GxPlanProgressVo vo); + + /** + * 获取当前工序计划的填报进度 + * @param vo + * @return String + * @description + * @author cwchen + * @date 2024/3/28 14:10 + */ + String getGxPlanProgress(GxPlanProgressVo vo); } diff --git a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java index 0535d79..92ef3ad 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-system/src/main/java/com/securitycontrol/system/base/service/impl/ProScheduleServiceImpl.java @@ -99,6 +99,15 @@ public class ProScheduleServiceImpl implements IProScheduleService { vo.setType(1); mapper.updateGxPlanData(vo); } + // 获取当前工序计划的填报进度 + String nowGxPlanProgress = mapper.getGxPlanProgress(vo); + if(StringUtils.isNotEmpty(nowGxPlanProgress)){ + double aDouble = Double.parseDouble(nowGxPlanProgress); + double bDouble = Double.parseDouble(vo.getGxProgress()); + if(bDouble < aDouble){ + return AjaxResult.error("当前进度填报需大于上一次填报进度"); + } + } Long timestamp = DateTimeHelper.convertDateStringToTimestamp(vo.getPlanEndTime(), "yyyy-MM-dd"); if (timestamp == null) { return AjaxResult.error("计划结束时间格式不正确"); @@ -117,7 +126,7 @@ public class ProScheduleServiceImpl implements IProScheduleService { mapper.updateGxPlanData(vo); } // 填报工序计划 - vo.setCreateTime(DateTimeHelper.getNowDate()); + vo.setCreateTime(DateTimeHelper.getNowTime()); String progressId = IdUtils.getUUId(); vo.setProgressId(progressId); mapper.addGxPlanProgress(vo); diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml index 2b3fc34..787e871 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProScheduleMapper.xml @@ -125,4 +125,12 @@ + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/SelectMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/SelectMapper.xml index 202d365..7cec034 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/SelectMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/SelectMapper.xml @@ -65,7 +65,7 @@ SELECT gt_id AS id, gt_name AS name - FROM t_pro_gt WHERE bid_code = #{param} + FROM t_pro_gt WHERE bid_code = #{param} AND del_flag = 0 @@ -76,9 +76,12 @@ team_leader AS teamLeader, team_leader_phone AS teamLeaderPhone FROM tb_work_team - - bid_code = #{param} - + + + AND bid_code = #{param} + + + + + \ No newline at end of file From 5ec9e8ab60825aa257b4a1933b8d306cf5bf9bba Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Thu, 28 Mar 2024 16:45:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=BE=B9=E5=B8=A6=E5=AD=90=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=B7=BB=E5=8A=A0=E6=9D=86=E5=A1=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../securitycontrol/entity/background/vo/DeviceBdChildVo.java | 3 +++ .../src/main/resources/mapper/DeviceBdMapper.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/DeviceBdChildVo.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/DeviceBdChildVo.java index df2046c..c846862 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/DeviceBdChildVo.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/vo/DeviceBdChildVo.java @@ -72,6 +72,9 @@ public class DeviceBdChildVo { @ApiModelProperty(value = "区域名称") private String areaName; + + @ApiModelProperty(value = "杆塔ID") + private String gtId; /** * 查询条件限制 */ diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/DeviceBdMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/DeviceBdMapper.xml index 9fa9e62..49d8178 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/DeviceBdMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/DeviceBdMapper.xml @@ -66,6 +66,7 @@ device_model, bd_id, area_id, + gt_id, #{deviceId}, @@ -80,6 +81,7 @@ #{deviceModel}, #{bdId}, #{areaId}, + #{gtId}, @@ -94,6 +96,7 @@ device_model = #{deviceModel}, bd_id = #{bdId}, area_id = #{areaId}, + gt_id = #{gtId}, WHERE device_id = #{deviceId} From 7707baaca593fdffdd2a0a427b3879cda6438c09 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Thu, 28 Mar 2024 19:36:12 +0800 Subject: [PATCH 4/4] app --- .../entity/background/dto/ParamDto.java | 6 ++ .../background/controller/AppController.java | 37 +++++++++ .../background/mapper/IAppMapper.java | 53 ++++++++++++ .../background/service/IAppService.java | 33 ++++++++ .../service/impl/AppServiceImpl.java | 81 +++++++++++++++++++ .../src/main/resources/mapper/AppMapper.xml | 43 ++++++++++ .../src/main/resources/mapper/LoginMapper.xml | 7 +- .../main/resources/mapper/base/ProMapper.xml | 1 - 8 files changed, 257 insertions(+), 4 deletions(-) create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/AppController.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IAppMapper.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/IAppService.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/AppServiceImpl.java create mode 100644 securitycontrol-model/securitycontrol-background/src/main/resources/mapper/AppMapper.xml diff --git a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java index bf4748b..e62b43f 100644 --- a/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java +++ b/securitycontrol-commons/securitycontrol-commons-entity/src/main/java/com/securitycontrol/entity/background/dto/ParamDto.java @@ -44,4 +44,10 @@ public class ParamDto { @ApiModelProperty(value = "未绑定班组人员") private String unBandingUsers; + + @ApiModelProperty(value = "角色编码") + private String roleCode; + + @ApiModelProperty(value = "建管单位") + private String orgId; } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/AppController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/AppController.java new file mode 100644 index 0000000..9d62790 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/AppController.java @@ -0,0 +1,37 @@ +package com.securitycontrol.background.controller; + +import com.securitycontrol.background.service.IAppService; +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.entity.background.dto.ParamDto; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * @author:cwchen + * @date:2024-03-28-17:30 + * @version:1.0 + * @description:APP-web层 + */ +@RestController +@RequestMapping("/app/index/") +public class AppController { + + @Resource(name = "IAppService") + private IAppService service; + + @ApiOperation(value = "项目简介") + @GetMapping("getProBrief") + public AjaxResult getProBrief(ParamDto dto){ + return service.getProBrief(dto); + } + + @ApiOperation(value = "当前登录人绑定工程") + @GetMapping("getProsByUser") + public AjaxResult getProsByUser(ParamDto dto){ + return service.getProsByUser(dto); + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IAppMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IAppMapper.java new file mode 100644 index 0000000..8ab06e0 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/IAppMapper.java @@ -0,0 +1,53 @@ +package com.securitycontrol.background.mapper; + +import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.system.base.vo.ProVo; +import com.securitycontrol.entity.system.vo.ResourceFileVo; +import org.apache.ibatis.annotations.MapKey; +import org.springframework.stereotype.Repository; + +import java.util.List; +import java.util.Map; + +/** + * @author:cwchen + * @date:2024-03-28-17:37 + * @version:1.0 + * @description:app数据库访问层 + */ +@Repository(value = "IAppMapper") +public interface IAppMapper { + + /** + * 项目简介 + * + * @param dto + * @return ProVo + * @description + * @author cwchen + * @date 2024/3/28 17:58 + */ + ProVo getProBrief(ParamDto dto); + + /** + * 获取工程图片/平面图 + * + * @param proId + * @return List + * @description + * @author cwchen + * @date 2024/3/28 18:09 + */ + List getFiles(String proId); + + /** + * 当前登录人绑定的工程 + * @param dto + * @return List> + * @description + * @author cwchen + * @date 2024/3/28 19:11 + */ + @MapKey("bidCode") + List> getProsByUser(ParamDto dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/IAppService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/IAppService.java new file mode 100644 index 0000000..e1510b3 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/IAppService.java @@ -0,0 +1,33 @@ +package com.securitycontrol.background.service; + +import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.entity.background.dto.ParamDto; + +/** + * @author:cwchen + * @date:2024-03-28-17:35 + * @version:1.0 + * @description:app-业务层 + */ +public interface IAppService { + /** + * 项目简介 + * + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/28 17:50 + */ + AjaxResult getProBrief(ParamDto dto); + + /** + * 当前登录人绑定的工程 + * @param dto + * @return AjaxResult + * @description + * @author cwchen + * @date 2024/3/28 19:08 + */ + AjaxResult getProsByUser(ParamDto dto); +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/AppServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/AppServiceImpl.java new file mode 100644 index 0000000..dfd78bd --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/AppServiceImpl.java @@ -0,0 +1,81 @@ +package com.securitycontrol.background.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.securitycontrol.background.mapper.IAppMapper; +import com.securitycontrol.background.service.IAppService; +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.web.domain.AjaxResult; +import com.securitycontrol.entity.background.dto.ParamDto; +import com.securitycontrol.entity.system.base.vo.ProVo; +import com.securitycontrol.entity.system.vo.ResourceFileVo; +import com.securitycontrol.system.api.RemoteFileService; +import com.securitycontrol.system.api.domain.SysFile; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author:cwchen + * @date:2024-03-28-17:36 + * @version:1.0 + * @description:App业务逻辑层 + */ +@Service(value = "IAppService") +@Slf4j +public class AppServiceImpl implements IAppService { + + @Resource(name = "IAppMapper") + private IAppMapper mapper; + + @Resource + private RemoteFileService remoteFileService; + + @Override + public AjaxResult getProBrief(ParamDto dto) { + ProVo proVo = new ProVo(); + try { + proVo = mapper.getProBrief(dto); + List list = new ArrayList<>(); + List resourceFileVos = mapper.getFiles(proVo.getProId()); + if (CollectionUtils.isNotEmpty(resourceFileVos)) { + for (ResourceFileVo fileVo : resourceFileVos) { + String base64 = null; + Result result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER); + if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) { + String jsonString = JSON.toJSONString(result.getData()); + JSONObject item = JSON.parseObject(jsonString); + base64 = item.getString("url"); + } + ProVo.FileData fileData = new ProVo.FileData(); + fileData.setFileId(fileVo.getFileId()); + fileData.setBase64Url(base64); + fileData.setFileSourceType(fileVo.getSourceType()); + list.add(fileData); + } + } + proVo.setFileData(list); + } catch (Exception e) { + log.error("工程简介", e); + } + return AjaxResult.success(proVo); + } + + @Override + public AjaxResult getProsByUser(ParamDto dto) { + List> list = new ArrayList<>(); + try { + list = mapper.getProsByUser(dto); + } catch (Exception e) { + log.error("当前登录人绑定的工程"); + } + return AjaxResult.success(list); + } +} diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/AppMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/AppMapper.xml new file mode 100644 index 0000000..8b72580 --- /dev/null +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/AppMapper.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/LoginMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/LoginMapper.xml index 0d7a9de..442f369 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/LoginMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/LoginMapper.xml @@ -41,21 +41,22 @@ SELECT tp.bid_code AS bidCode, tp.pro_name AS proName FROM tb_project tp + WHERE del_flag = 0 ORDER BY plan_start_time SELECT tup.bid_cod AS bidCode, tp.pro_name AS proName FROM tb_user_pro tup - LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code - WHERE tup.user_id = #{param} + LEFT JOIN tb_project tp on tup.bid_cod = tp.bid_code AND tp.del_flag = 0 + WHERE tup.user_id = #{param} AND tup.del_flag = '0' ORDER BY tup.times SELECT tp.bid_code AS bidCode, tp.pro_name AS proName FROM tb_project tp - WHERE tp.org = #{param} + WHERE tp.org = #{param} AND tp.del_flag = 0 ORDER BY plan_start_time diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml index 54f5cd5..ae1d128 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/mapper/base/ProMapper.xml @@ -217,7 +217,6 @@