diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java index f0dd929..9ac564c 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/DevInfo.java @@ -363,4 +363,9 @@ public class DevInfo extends BaseEntity { private String lesseePerson; private String type; + + @ApiModelProperty(value = "资产原值", required = true) + private BigDecimal assetValue; + @ApiModelProperty(value = "购置费用来源", required = true) + private String purchaseSource; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/dto/InfoMotionDto.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/dto/InfoMotionDto.java index da671e4..3692f25 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/dto/InfoMotionDto.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/dto/InfoMotionDto.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + /** * @author syruan */ @@ -18,4 +20,7 @@ public class InfoMotionDto extends DevInfo { @ApiModelProperty(value = "纬度", required = true) private String lat; + + + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/EquipmentExternalController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/EquipmentExternalController.java new file mode 100644 index 0000000..e1bde06 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/EquipmentExternalController.java @@ -0,0 +1,69 @@ +package com.bonus.material.externalInterface.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.externalInterface.service.EquipmentExternalService; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * 装备管理 + */ +@RequestMapping("equipmentExternal") +public class EquipmentExternalController extends BaseController { + @Resource + private EquipmentExternalService equipmentExternalService; + + /** + * 查询指定装备的技术参数信息,支持参数分类和格式化显示 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @GetMapping("/specifications/{equipmentId}") + public AjaxResult specifications(@PathVariable String equipmentId) { + return equipmentExternalService.specifications(equipmentId); + } + + /** + * 更新装备技术参数,支持批量更新和参数校验 + * + * @param equipmentId 设备id + * @param specifications 技术参数 + * @return AjaxResult + */ + @PostMapping("/updateSpecifications") + public AjaxResult updateSpecifications(String equipmentId, List> specifications) { + return equipmentExternalService.updateSpecifications(equipmentId, specifications); + } + + /** + * 查询装备完整资质信息,包含所有证书文件和时间信息 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @GetMapping("/qualifications/{equipmentId}") + public AjaxResult qualifications(@PathVariable String equipmentId) { + return equipmentExternalService.qualifications(equipmentId); + } + + /** + * 删除指定资质文件,支持批量删除和安全校验 + * + * @param fileId 文件id + * @return AjaxResult + */ + @GetMapping("qualifications/file/{fileId}") + public AjaxResult delFile(@PathVariable String[] fileId) { + return equipmentExternalService.delFile(fileId); + } + + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/LargeScreenExternalController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/LargeScreenExternalController.java new file mode 100644 index 0000000..4595ae1 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/controller/LargeScreenExternalController.java @@ -0,0 +1,69 @@ +package com.bonus.material.externalInterface.controller; + +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.externalInterface.service.LargeScreenExternalService; +import org.aspectj.weaver.loadtime.Aj; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; + +/** + * 装备共享一张图 + */ +@RequestMapping("largeScreenExternal") +public class LargeScreenExternalController extends BaseController { + + @Resource + private LargeScreenExternalService largeScreenExternalService; + + /** + * 统计各种状态下的装备数量,用于大屏展示 + * + * @param accountId 用户id + * @return AjaxResult + */ + @GetMapping("/deviceStatusStatistics") + public AjaxResult deviceStatusStatistics(String accountId) { + return largeScreenExternalService.deviceStatusStatistics(accountId); + } + + /** + * 图表展示当前账号下装备的分级统计,可切换分布查看I、II、III类下的分级统计 + * + * @param accountId 用户id + * @param level 分级 + * @return AjaxResult + */ + @GetMapping("/deviceLevelStatistics") + public AjaxResult deviceLevelStatistics(String level, String accountId) { + return largeScreenExternalService.deviceLevelStatistics(level, accountId); + } + + /** + * 图表展示当前账号下每月租赁费用统计,包括内部费用、市场化费用及平台总费用 + * + * @param accountId 用户id + * @param startMonth 开始时间 + * @param endMonth 结束时间 + * @return AjaxResult + */ + @GetMapping("/deviceRentalCostStatistics") + public AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth) { + return largeScreenExternalService.deviceRentalCostStatistics(accountId, startMonth, endMonth); + } + + /** + * 图标展示当前账号下各工程在用的装备总数、自有装备数、市场化装备数 + * + * @param accountId 用户id + * @param projectId 工程id + * @return AjaxResult + */ + @GetMapping("/projectEquipmentStatistics") + public AjaxResult projectEquipmentStatistics(String accountId, String projectId) { + return largeScreenExternalService.projectEquipmentStatistics(accountId, projectId); + } + +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/EquipmentExternalMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/EquipmentExternalMapper.java new file mode 100644 index 0000000..4b43d62 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/EquipmentExternalMapper.java @@ -0,0 +1,54 @@ +package com.bonus.material.externalInterface.mapper; + +import io.swagger.models.auth.In; +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface EquipmentExternalMapper { + /** + * 查询指定装备的技术参数信息,支持参数分类和格式化显示 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @MapKey("id") + List> specifications(String equipmentId); + + /** + * 更新装备技术参数,支持批量更新和参数校验 + * + * @param equipmentId 设备id + * @param specifications 技术参数 + * @return AjaxResult + */ + Integer updateSpecifications(String equipmentId, List> specifications); + + /** + * 更新前删除原先数据 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + Integer deleteSpecifications(String equipmentId); + + /** + * 查询装备完整资质信息,包含所有证书文件和时间信息 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @MapKey("id") + List> qualifications(String equipmentId); + + /** + * 删除指定资质文件,支持批量删除和安全校验 + * + * @param fileId 文件id + * @return 数量 + */ + Integer delFile(String[] fileId); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/LargeScreenExternalMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/LargeScreenExternalMapper.java new file mode 100644 index 0000000..fc141db --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/mapper/LargeScreenExternalMapper.java @@ -0,0 +1,52 @@ +package com.bonus.material.externalInterface.mapper; + +import org.apache.ibatis.annotations.MapKey; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Map; + +/** + * 装备共享一张图 + */ +@Mapper +public interface LargeScreenExternalMapper { + /** + * 统计各种状态下的装备数量,用于大屏展示 + * + * @param accountId id + * @return 设备数据 + */ + @MapKey("name") + Map deviceStatusStatistics(String accountId); + + /** + * 图表展示当前账号下装备的分级统计,可切换分布查看I、II、III类下的分级统计 + * + * @param level 分级 + * @param accountId id + * @return 分级统计 + */ + @MapKey("name") + Map deviceLevelStatistics(@Param("level") String level, @Param("accountId") String accountId); + + /** + * 图表展示当前账号下每月租赁费用统计,包括内部费用、市场化费用及平台总费用 + * + * @param accountId id + * @param startMonth 开始时间 + * @param endMonth 结束时间 + * @return 平台总费用 + */ + @MapKey("name") + Map deviceRentalCostStatistics(@Param("accountId") String accountId, @Param("startMonth") String startMonth, @Param("endMonth") String endMonth); + + /** + * 图标展示当前账号下各工程在用的装备总数、自有装备数、市场化装备数 + * + * @param accountId 用户id + * @param projectId 工程id + * @return AjaxResult + */ + Map projectEquipmentStatistics(String accountId, String projectId); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/EquipmentExternalService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/EquipmentExternalService.java new file mode 100644 index 0000000..3044fe1 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/EquipmentExternalService.java @@ -0,0 +1,39 @@ +package com.bonus.material.externalInterface.service; + +import com.bonus.common.core.web.domain.AjaxResult; + +import java.util.List; +import java.util.Map; + +public interface EquipmentExternalService { + /** + * 查询指定装备的技术参数信息,支持参数分类和格式化显示 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + AjaxResult specifications(String equipmentId); + + /** + * 更新装备技术参数,支持批量更新和参数校验 + * + * @param equipmentId 设备id + * @param specifications 技术参数 + * @return AjaxResult + */ + AjaxResult updateSpecifications(String equipmentId, List> specifications); + /** + * 查询装备完整资质信息,包含所有证书文件和时间信息 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + AjaxResult qualifications(String equipmentId); + /** + * 删除指定资质文件,支持批量删除和安全校验 + * + * @param fileId 文件id + * @return AjaxResult + */ + AjaxResult delFile(String[] fileId); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/LargeScreenExternalService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/LargeScreenExternalService.java new file mode 100644 index 0000000..6a8480b --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/LargeScreenExternalService.java @@ -0,0 +1,44 @@ +package com.bonus.material.externalInterface.service; + +import com.bonus.common.core.web.domain.AjaxResult; + +/** + * 装备共享一张图 + */ +public interface LargeScreenExternalService { + /** + * 统计各种状态下的装备数量,用于大屏展示 + * + * @param accountId id + * @return 设备数据 + */ + AjaxResult deviceStatusStatistics(String accountId); + + /** + * 图表展示当前账号下装备的分级统计,可切换分布查看I、II、III类下的分级统计 + * + * @param accountId id + * @param level 分级 + * @return 分级统计 + */ + AjaxResult deviceLevelStatistics(String level, String accountId); + + /** + * 图表展示当前账号下每月租赁费用统计,包括内部费用、市场化费用及平台总费用 + * + * @param accountId id + * @param startMonth 开始时间 + * @param endMonth 结束时间 + * @return 平台总费用 + */ + AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth); + + /** + * 图标展示当前账号下各工程在用的装备总数、自有装备数、市场化装备数 + * + * @param accountId 用户id + * @param projectId 工程id + * @return AjaxResult + */ + AjaxResult projectEquipmentStatistics(String accountId, String projectId); +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/EquipmentExternalServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/EquipmentExternalServiceImpl.java new file mode 100644 index 0000000..b14b1c8 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/EquipmentExternalServiceImpl.java @@ -0,0 +1,89 @@ +package com.bonus.material.externalInterface.service.impl; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.externalInterface.mapper.EquipmentExternalMapper; +import com.bonus.material.externalInterface.service.EquipmentExternalService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service +@Slf4j +public class EquipmentExternalServiceImpl implements EquipmentExternalService { + @Resource + private EquipmentExternalMapper equipmentExternalMapper; + + /** + * 查询指定装备的技术参数信息,支持参数分类和格式化显示 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @Override + public AjaxResult specifications(String equipmentId) { + try { + List> specifications = equipmentExternalMapper.specifications(equipmentId); + return !specifications.isEmpty() ? AjaxResult.success(specifications) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 更新装备技术参数,支持批量更新和参数校验 + * + * @param equipmentId 设备id + * @param specifications 技术参数 + * @return AjaxResult + */ + @Override + public AjaxResult updateSpecifications(String equipmentId, List> specifications) { + try { + equipmentExternalMapper.deleteSpecifications(equipmentId); + Integer i = equipmentExternalMapper.updateSpecifications(equipmentId, specifications); + return i > 0 ? AjaxResult.success() : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 查询装备完整资质信息,包含所有证书文件和时间信息 + * + * @param equipmentId 设备id + * @return AjaxResult + */ + @Override + public AjaxResult qualifications(String equipmentId) { + try { + List> qualifications = equipmentExternalMapper.qualifications(equipmentId); + return !qualifications.isEmpty() ? AjaxResult.success(qualifications) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 删除指定资质文件,支持批量删除和安全校验 + * + * @param fileId 文件id + * @return AjaxResult + */ + @Override + public AjaxResult delFile(String[] fileId) { + try { + Integer num = equipmentExternalMapper.delFile(fileId); + return num > 0 ? AjaxResult.success() : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/LargeScreenExternalServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/LargeScreenExternalServiceImpl.java new file mode 100644 index 0000000..9968cdc --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/externalInterface/service/impl/LargeScreenExternalServiceImpl.java @@ -0,0 +1,94 @@ +package com.bonus.material.externalInterface.service.impl; + +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.material.externalInterface.mapper.LargeScreenExternalMapper; +import com.bonus.material.externalInterface.service.LargeScreenExternalService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * 装备共享一张图 + */ +@Service +@Slf4j +public class LargeScreenExternalServiceImpl implements LargeScreenExternalService { + + @Resource + private LargeScreenExternalMapper largeScreenExternalMapper; + + /** + * 统计各种状态下的装备数量,用于大屏展示 + * + * @param accountId id + * @return 设备数据 + */ + @Override + public AjaxResult deviceStatusStatistics(String accountId) { + try { + Map stringObjectMap = largeScreenExternalMapper.deviceStatusStatistics(accountId); + return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 图表展示当前账号下装备的分级统计,可切换分布查看I、II、III类下的分级统计 + * + * @param level 分级 + * @param accountId id + * @return 分级统计 + */ + @Override + public AjaxResult deviceLevelStatistics(String level, String accountId) { + try { + Map stringObjectMap = largeScreenExternalMapper.deviceLevelStatistics(level, accountId); + return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 图表展示当前账号下每月租赁费用统计,包括内部费用、市场化费用及平台总费用 + * + * @param accountId id + * @param startMonth 开始时间 + * @param endMonth 结束时间 + * @return 平台总费用 + */ + @Override + public AjaxResult deviceRentalCostStatistics(String accountId, String startMonth, String endMonth) { + try { + Map stringObjectMap = largeScreenExternalMapper.deviceRentalCostStatistics(accountId, startMonth, endMonth); + return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } + + /** + * 图标展示当前账号下各工程在用的装备总数、自有装备数、市场化装备数 + * + * @param accountId 用户id + * @param projectId 工程id + * @return AjaxResult + */ + @Override + public AjaxResult projectEquipmentStatistics(String accountId, String projectId) { + try { + Map stringObjectMap = largeScreenExternalMapper.projectEquipmentStatistics(accountId, projectId); + return ObjectUtils.isNotEmpty(stringObjectMap) ? AjaxResult.success(stringObjectMap) : AjaxResult.error(); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error(); + } + } +} diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml index 31c4b2f..9ffd4d5 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/DevInfoMapper.xml @@ -223,55 +223,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select - d.*, - mt4.type_name as typeName,mt4.unit_name as unitName, - mt3.type_id as thirdId,mt3.type_name as thirdName, - mt2.type_id as secondId,mt2.type_name as secondName, - mt1.type_id as firstId,mt1.type_name as firstName + d.*, + CASE + WHEN check_date IS NULL THEN '未设置检验日期' + WHEN check_date > CURDATE() THEN '已过期' + ELSE '有效' + END AS verifyStatus, + mt4.type_name as typeName,mt4.unit_name as unitName, + mt3.type_id as thirdId,mt3.type_name as thirdName, + mt2.type_id as secondId,mt2.type_name as secondName, + mt1.type_id as firstId,mt1.type_name as firstName from - ma_dev_info d + ma_dev_info d left join ma_up_off u on d.ma_id = u.ma_id left join ma_type mt4 ON mt4.type_id = d.type_id and mt4.del_flag = '0' left join ma_type mt3 ON mt3.type_id = mt4.parent_id and mt3.del_flag = '0' left join ma_type mt2 ON mt2.type_id = mt3.parent_id and mt2.del_flag = '0' left join ma_type mt1 ON mt1.type_id = mt2.parent_id and mt1.del_flag = '0' - and d.ma_id = #{maId} - and d.code = #{code} + and d.ma_id = #{maId} + and d.code = #{code} and d.device_name like concat('%',#{deviceName},'%') and d.type_id = #{typeId} - and d.ma_status = #{maStatus} - and d.lease_scope = #{leaseScope} - and d.area_id = #{areaId} - and d.brand = #{brand} - and d.model_name like concat('%', #{modelName}, '%') - and d.own_co = #{companyId} + and d.ma_status = #{maStatus} + and d.lease_scope = #{leaseScope} + and d.area_id = #{areaId} + and d.brand = #{brand} + and d.model_name like concat('%', #{modelName}, '%') + and d.own_co = #{companyId} and d.update_time between #{startTime} and #{endTime} diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/EquipmentExternalMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/EquipmentExternalMapper.xml new file mode 100644 index 0000000..d0b42a7 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/EquipmentExternalMapper.xml @@ -0,0 +1,52 @@ + + + + + insert into + ma_dev_info_properties(ma_id, property_name, property_value, create_time) + values + + ( + #{maId}, + #{item.propertyName}, + #{item.propertyValue}, + now() + ) + + + + delete + from ma_dev_info_properties + where ma_id = #{equipmentId} + + + DELETE FROM bm_file_info + WHERE id IN + + #{id} + + + + + + \ No newline at end of file diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/LargeScreenExternalMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/LargeScreenExternalMapper.xml new file mode 100644 index 0000000..74599da --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/externalInterface/LargeScreenExternalMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + \ No newline at end of file