From e46bca6cdb820d617820703acb1818409567ee2a Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Thu, 3 Jul 2025 17:06:46 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/material/device/domain/DevInfo.java | 2 +- .../material/device/mapper/DevInfoMapper.java | 12 ++++ .../controller/LargeScreenController.java | 51 ++++++++++++-- .../largeScreen/entity/LeaseAndRentInfo.java | 17 +++++ .../largeScreen/entity/LeaseInfo.java | 14 ++++ .../largeScreen/entity/OrderData.java | 6 ++ .../material/largeScreen/entity/RentInfo.java | 14 ++++ .../lease/mapper/MaLeaseInfoMapper.java | 2 + .../mapper/material/device/DevInfoMapper.xml | 69 ++++++++++++++++++- .../material/lease/MaLeaseInfoMapper.xml | 3 + 10 files changed, 179 insertions(+), 11 deletions(-) create mode 100644 bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseAndRentInfo.java create mode 100644 bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseInfo.java create mode 100644 bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/RentInfo.java 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 7e090e3..8cfcc4c 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 @@ -68,7 +68,7 @@ public class DevInfo extends BaseEntity { private String ratioRange; @ApiModelProperty(value = "比率,比如: 80%") - private double ratio; + private BigDecimal ratio; @ApiModelProperty(value = "单位") @NotBlank(message = "单位不能为空") diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index af29a4d..29703cd 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -10,6 +10,8 @@ import com.bonus.material.device.domain.dto.InfoMotionDto; import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.domain.vo.LeaseVo; +import com.bonus.material.largeScreen.entity.LeaseInfo; +import com.bonus.material.largeScreen.entity.RentInfo; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -262,5 +264,15 @@ public interface DevInfoMapper { List getMaTypeLeasingNumList(DevInfoVo devInfoVo); List getDevLeasingNumList(DevInfoVo devInfoVo); + + Integer getRentToalNum(); + + List getDevLeaseCount(); + + List getDevRentCount(); + + List getMaTypeLeasingDetail(DevInfoVo devInfoVo); + + List getDemandUnit(DevInfoVo devInfoVo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java index ff89bc9..5ec417d 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/controller/LargeScreenController.java @@ -1,6 +1,7 @@ package com.bonus.material.largeScreen.controller; import cn.hutool.core.collection.CollectionUtil; +import com.bonus.common.biz.domain.SysDept; import com.bonus.common.biz.utils.MathUtil; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.web.controller.BaseController; @@ -9,10 +10,7 @@ import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.device.mapper.DevInfoMapper; import com.bonus.material.device.service.DevInfoService; -import com.bonus.material.largeScreen.entity.MaDevRateInfo; -import com.bonus.material.largeScreen.entity.MaLeaseAnswerInfo; -import com.bonus.material.largeScreen.entity.MaLeaseOnlyInfo; -import com.bonus.material.largeScreen.entity.OrderData; +import com.bonus.material.largeScreen.entity.*; import com.bonus.material.largeScreen.service.LargeScreenService; import com.bonus.material.lease.domain.MaLeaseInfo; import com.bonus.material.lease.mapper.MaLeaseInfoMapper; @@ -76,7 +74,7 @@ public class LargeScreenController extends BaseController { try { DevInfo list = largeScreenService.getIdleDevRatio(); return AjaxResult.success(list); - }catch (Exception e){ + } catch (Exception e) { return AjaxResult.error("闲置装备分析异常"); } } @@ -89,7 +87,9 @@ public class LargeScreenController extends BaseController { list.forEach(item -> { double ratio = total == 0 ? 0 : (double) item.getDeviceCount() / total; double ratioPercent = ratio * 100; - item.setRatio(ratioPercent); + + BigDecimal bd = new BigDecimal(ratioPercent).setScale(2, RoundingMode.HALF_UP); + item.setRatio(bd); }); return AjaxResult.success(list); } @@ -139,13 +139,24 @@ public class LargeScreenController extends BaseController { orderData.setDevLeasingNum(devLeasingNum); Integer repairingDevNum = devInfoMapper.getRepairingDevNum(); orderData.setDevRepairingNum(repairingDevNum); + Integer rentToalNum = devInfoMapper.getRentToalNum(); + orderData.setRentToalNum(rentToalNum); DevInfo devInfo = devInfoMapper.getDevUsageRatio(); - if(devInfo != null){ + if (devInfo != null) { orderData.setDevUsageRatio(MathUtil.calculatePercentage(devInfo.getTotalLeaseDay(), devInfo.getTotalUpDay() + devInfo.getTotalLeaseDay())); } return AjaxResult.success(orderData); } + + @ApiOperation("公司出租/租赁数") + @GetMapping("/devLeaseAndRentCount") + public AjaxResult devLeaseAndRentCount() { + List leaseInfo = devInfoMapper.getDevLeaseCount(); + List rentInfo = devInfoMapper.getDevRentCount(); + return AjaxResult.success(new LeaseAndRentInfo(leaseInfo, rentInfo)); + } + @ApiOperation("装备需求统计") @GetMapping("/demandCount") public AjaxResult demandCount() { @@ -154,10 +165,12 @@ public class LargeScreenController extends BaseController { Integer leaseOrderNum = leaseInfoMapper.getLeaseOrderCount(); Integer maTypeCountFromLease = leaseInfoMapper.getMaTypeCountFromLease(); String topPopularTypeName = leaseInfoMapper.getTopPopularTypeName(); + Integer demandUnitNum = leaseInfoMapper.getDemandUnit(); orderData.setLeaseNum(leaseNum); orderData.setMaTypeCountFromLease(maTypeCountFromLease); orderData.setLeaseOrderRatio(MathUtil.calculatePercentage(leaseOrderNum, leaseNum)); orderData.setTopPopularTypeName(topPopularTypeName); + orderData.setDemandUnitNum(demandUnitNum); return AjaxResult.success(orderData); } @@ -266,6 +279,20 @@ public class LargeScreenController extends BaseController { List list = devInfoMapper.getMaTypeLeasingNumList(devInfoVo); return AjaxResult.success(getDataTable(list)); } + @ApiOperation("装备租赁-累计数二级页面") + @GetMapping("/getMaTypeLeasingDetail") + public AjaxResult getMaTypeLeasingDetail(DevInfoVo devInfoVo) { + startPage(); + List list = devInfoMapper.getMaTypeLeasingDetail(devInfoVo); + return AjaxResult.success(getDataTable(list)); + } + @ApiOperation("装备需求-需求单位二级页面") + @GetMapping("/getDemandUnit") + public AjaxResult getDemandUnit(DevInfoVo devInfoVo) { + startPage(); + List list = devInfoMapper.getDemandUnit(devInfoVo); + return AjaxResult.success(getDataTable(list)); + } @ApiOperation("在租赁装备数二级页面") @GetMapping("/getDevLeasingNum") @@ -309,6 +336,7 @@ public class LargeScreenController extends BaseController { /** * 应答率二级页面 + * * @param dto * @return */ @@ -339,6 +367,7 @@ public class LargeScreenController extends BaseController { /** * 总应答率二级页面 + * * @param dto * @return */ @@ -382,6 +411,7 @@ public class LargeScreenController extends BaseController { /** * 判断关键字 + * * @param item * @param keyWord * @return @@ -393,6 +423,7 @@ public class LargeScreenController extends BaseController { /** * 最需装备二级页面 + * * @param dto * @return */ @@ -411,6 +442,7 @@ public class LargeScreenController extends BaseController { /** * 需求装备种类 + * * @param dto * @return */ @@ -457,6 +489,7 @@ public class LargeScreenController extends BaseController { /** * 判断关键字 + * * @param item * @param keyWord * @return @@ -468,6 +501,7 @@ public class LargeScreenController extends BaseController { /** * 计算租赁天数差 + * * @param startTime * @param rentEndTime * @return @@ -488,6 +522,7 @@ public class LargeScreenController extends BaseController { /** * 将 java.util.Date 转换为 java.time.LocalDate + * * @param date * @return */ @@ -499,6 +534,7 @@ public class LargeScreenController extends BaseController { /** * 装备利用率 + * * @param dto * @return */ @@ -533,6 +569,7 @@ public class LargeScreenController extends BaseController { /** * 退租装备 + * * @param dto * @return */ diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseAndRentInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseAndRentInfo.java new file mode 100644 index 0000000..d0a7b00 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseAndRentInfo.java @@ -0,0 +1,17 @@ +package com.bonus.material.largeScreen.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.util.List; + +/** + * @Author:liang.chao + * @Date:2025/7/3 - 14:10 + */ +@Data +@AllArgsConstructor +public class LeaseAndRentInfo { + private List LeaseInfos; + private List RentInfos; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseInfo.java new file mode 100644 index 0000000..baffe60 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/LeaseInfo.java @@ -0,0 +1,14 @@ +package com.bonus.material.largeScreen.entity; + +import lombok.Data; + +/** + * @Author:liang.chao + * @Date:2025/7/3 - 14:10 + * 租赁信息 + */ +@Data +public class LeaseInfo { + private Integer leaseNum; + private String leaseCompanyName; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/OrderData.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/OrderData.java index d2ca3da..dbd2290 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/OrderData.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/OrderData.java @@ -67,6 +67,12 @@ public class OrderData { @ApiModelProperty(value = "订单总数") private Integer orderNum; + @ApiModelProperty(value = "租赁总数") + private Integer rentToalNum; + + @ApiModelProperty(value = "需求单位数") + private Integer demandUnitNum; + @ApiModelProperty(value = "装备利用率") private BigDecimal devUsageRatio; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/RentInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/RentInfo.java new file mode 100644 index 0000000..7052431 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/largeScreen/entity/RentInfo.java @@ -0,0 +1,14 @@ +package com.bonus.material.largeScreen.entity; + +import lombok.Data; + +/** + * @Author:liang.chao + * @Date:2025/7/3 - 14:10 + * 出租信息 + */ +@Data +public class RentInfo { + private Integer rentNum; + private String rentCompanyName; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/mapper/MaLeaseInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/mapper/MaLeaseInfoMapper.java index d8739f9..d7b2138 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/mapper/MaLeaseInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/lease/mapper/MaLeaseInfoMapper.java @@ -183,4 +183,6 @@ public interface MaLeaseInfoMapper { * @return */ List getReturnDev(MaDevRateInfo dto); + + Integer getDemandUnit(); } 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 b78e4e1..f50f466 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 @@ -1026,14 +1026,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml index 6a49ff5..8e00a56 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/lease/MaLeaseInfoMapper.xml @@ -683,4 +683,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY md.rent_over_time DESC + From 4085364894f7bf83d9b724880ec041abbd6ab843 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Fri, 4 Jul 2025 09:33:49 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8F=AF=E4=BF=AE=E6=94=B9=E8=A3=85=E5=A4=87=E7=A7=9F=E9=87=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/device/mapper/DevInfoMapper.java | 2 ++ .../service/impl/DevInfoServiceImpl.java | 24 +++++++++++++++---- .../mapper/material/device/DevInfoMapper.xml | 4 ++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java index 29703cd..75e1f97 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/DevInfoMapper.java @@ -274,5 +274,7 @@ public interface DevInfoMapper { List getMaTypeLeasingDetail(DevInfoVo devInfoVo); List getDemandUnit(DevInfoVo devInfoVo); + + int updateTypeLeasePrice(DevInfo devInfo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java index 9b9c8ee..0343581 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/service/impl/DevInfoServiceImpl.java @@ -210,6 +210,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 根据文件名截取文件名 + * * @param fileName */ private String extracted(String fileName) { @@ -410,9 +411,11 @@ public class DevInfoServiceImpl implements DevInfoService { devInfo.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId().toString()); devInfo.setDeviceCount(devInfo.getDeviceCount()); devInfo.setIdentifyCode(devInfo.getTableList().get(i).getIdentifyCode()); - if (devInfoMapper.insertDevInfo(devInfo) == 0) { + int num = devInfoMapper.insertDevInfo(devInfo); + if (num == 0) { return AjaxResult.error("设备信息SQL保存失败,请修改后重试"); } + devInfoMapper.updateTypeLeasePrice(devInfo); code = ""; //保存自定义属性值 if (!CollectionUtils.isEmpty(devInfo.getDevInfoProperties())) { @@ -594,6 +597,7 @@ public class DevInfoServiceImpl implements DevInfoService { String identifyCode = tableList.get(0).getIdentifyCode(); devInfo.setIdentifyCode(identifyCode); int i = devInfoMapper.updateDevInfo(devInfo); + devInfoMapper.updateTypeLeasePrice(devInfo); Integer id = tableList.get(0).getId(); if (id != null) { @@ -871,6 +875,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 在租装备信息查询 + * * @param devInfo * @return */ @@ -881,6 +886,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 设备批量导入模版下载 + * * @param response */ @Override @@ -888,7 +894,7 @@ public class DevInfoServiceImpl implements DevInfoService { //模板名称 String templateName = "MaDevTemplate.xlsx"; OutputStream out = null; - InputStream input =null; + InputStream input = null; try { input = this.getClass().getClassLoader().getResourceAsStream("template/MaDevTemplate.xlsx"); response.setCharacterEncoding("UTF-8"); @@ -914,6 +920,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 设备信息导入 + * * @param file * @return */ @@ -987,7 +994,7 @@ public class DevInfoServiceImpl implements DevInfoService { List devTemplateVos = entry.getValue(); for (DevTemplateVo templateVo : devTemplateVos) { if (StringUtils.isBlank(templateVo.getIdentifyCode()) && StringUtils.isBlank(templateVo.getCheckMan()) - && templateVo.getNextCheckDate() == null && templateVo.getCheckDate() == null) { + && templateVo.getNextCheckDate() == null && templateVo.getCheckDate() == null) { continue; } DevTemplateVo dto = new DevTemplateVo(); @@ -1015,6 +1022,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 读取Excel表格数据,做非空判断 + * * @param sheet * @param totalRows * @param totalCells @@ -1062,8 +1070,8 @@ public class DevInfoServiceImpl implements DevInfoService { case 10: checkDate(cellValue, r, c); break; - default: - break; + default: + break; } } } @@ -1071,6 +1079,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 检查数字格式是否为整数 + * * @param cellValue * @param r * @param c @@ -1088,6 +1097,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 检查日期格式 + * * @param cellValue * @param rowIndex * @param colIndex @@ -1104,6 +1114,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 判断日期格式是否正确 + * * @param dateStr * @return */ @@ -1150,6 +1161,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 检查数据是否为空 + * * @param cellValue * @param rowIndex * @param colIndex @@ -1163,6 +1175,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 检查电话号码格式 + * * @param cellValue * @param rowIndex * @param colIndex @@ -1178,6 +1191,7 @@ public class DevInfoServiceImpl implements DevInfoService { /** * 读取Excel表格数据,做非空及格式判断 + * * @param headerRow * @param totalCells */ 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 f50f466..31c4b2f 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 @@ -1008,6 +1008,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update ma_dev_info set total_lease_day = IFNULL(total_lease_day, 0) + 1 where is_active = '1' and ma_status = '3' + + update ma_type set lease_price = #{dayLeasePrice} + where type_id = #{typeId} + + + + + + + INSERT INTO ma_dept_config ( + dept_id, + type_id, + config_type, + config_value, + config_rate, + config_description, + remark + ) + VALUES + + ( + #{deptId}, + #{equipmentId}, + #{item.configurationType}, + #{item.basicConfig}, + #{item.configurationRate}, + #{item.configurationDescription}, + #{remark} + ) + + ON DUPLICATE KEY UPDATE + config_value = VALUES(config_value), + config_rate = VALUES(config_rate), + config_description = VALUES(config_description), + remark = VALUES(remark), + update_time = CURRENT_TIMESTAMP + + + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml new file mode 100644 index 0000000..a45b668 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -0,0 +1,231 @@ + + + + + select d.dept_id, + d.parent_id, + d.ancestors, + d.dept_name, + d.order_num, + d.leader, + d.phone, + d.email, + d.status, + d.del_flag, + d.create_by, + d.create_time + from sys_dept d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml new file mode 100644 index 0000000..82de6e7 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml @@ -0,0 +1,80 @@ + + + + + insert into ma_own_manage( + ma_type, ma_name, model_id, ma_model, ma_num, + creator, remark,company_id,type) + values(#{maType}, #{maName}, #{modelId}, #{maModel}, #{maNum}, #{creator}, #{remark}, #{companyId},#{type}) + + + update ma_own_manage set + ma_type = #{maType}, + ma_name = #{maNameId}, + model_id = #{modelId}, + ma_model = #{maModel}, + ma_num = #{maNum}, + creator = #{creator}, + remark = #{remark} + where id = #{id} + + + update ma_own_manage set + is_active =1 + where id = #{id} + + + + + From 3c694f2fd95c855dd23b5f0e01dbbbcdf61907e3 Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Mon, 7 Jul 2025 08:52:02 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysDeptServiceImpl.java | 265 ++++++++---------- .../material/equipment/SysDeptMapper.xml | 2 +- .../mapper/material/owner/OwnerMapper.xml | 2 +- 3 files changed, 120 insertions(+), 149 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index f930ba1..44a886f 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -75,146 +75,108 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override public List selectDeptConfigRatePivot(DeptConfigRateSummary entity) { - // 1. 查询配置率项(每条代表一个公司+设备+评分项) - List configList = mapper.selectDeptConfigRatePivot(entity); + // 1. 查询配置率项(每条代表一个公司+设备+评分项) + List configList = mapper.selectDeptConfigRatePivot(entity); - // 2. 查询 ma_own_manage 表中原始设备数据 - List ownListFromManage = ownerMapper.list(null); + // 2. 查询 ma_own_manage 表中原始设备数据 + List ownListFromManage = ownerMapper.list(null); - // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) - List ownListFromDevInfo = ownerMapper.listGrouped(); + // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) + List ownListFromDevInfo = ownerMapper.listGrouped(); - // 4. 构建设备索引 Map<公司ID_设备名, List> - Map> ownIndex = new HashMap<>(); + // 4. 构建设备索引 Map<公司ID_设备名, List> + Map> ownIndex = new HashMap<>(); - for (Ownerdomin device : ownListFromManage) { - String key = device.getCompanyId() + "_" + device.getMaName(); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); - } + for (Ownerdomin device : ownListFromManage) { + String key = device.getCompanyId() + "_" + device.getMaName(); + System.err.println("初始化的key:" + key+"-----------"+device.toString()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); + } - for (NewOwnerdomin dev : ownListFromDevInfo) { - String key = dev.getCompanyId() + "_" + dev.getMaName(); - List existList = ownIndex.get(key); - - if (existList != null && !existList.isEmpty()) { - for (Ownerdomin device : existList) { - device.setMaNum(device.getMaNum() + dev.getMaNum()); - } - } else { - Ownerdomin newDevice = new Ownerdomin(); - newDevice.setCompanyId((long) dev.getCompanyId()); - newDevice.setMaName(dev.getMaName()); - newDevice.setMaNum(dev.getMaNum()); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); + for (NewOwnerdomin dev : ownListFromDevInfo) { + String key = dev.getCompanyId() + "_" + dev.getMaName(); + List existList = ownIndex.get(key); + System.err.println("existList:" + existList); + System.err.println("key:" + key+"-----------"+dev.getCompanyName()); + if (existList != null && !existList.isEmpty()) { + for (Ownerdomin device : existList) { + /*是否需要累加 待验证*/ + device.setMaNum(device.getMaNum() ); + device.setType("2"); } + } else { + Ownerdomin newDevice = new Ownerdomin(); + newDevice.setCompanyId((long) dev.getCompanyId()); + newDevice.setMaName(dev.getMaName()); + newDevice.setType("2"); + newDevice.setMaNum(dev.getMaNum()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); } + } - // 5. 构建公司 → 汇总对象 Map - Map companyMap = new LinkedHashMap<>(); + // 5. 构建公司 → 汇总对象 Map + Map companyMap = new LinkedHashMap<>(); - for (DeptConfigRateSummary config : configList) { - String company = config.getCompanyName(); - String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 - String maName = config.getDeptName(); - BigDecimal orderCount = config.getOrderCount(); - Long configCompanyId = config.getCompanyId(); + for (DeptConfigRateSummary config : configList) { + String company = config.getCompanyName(); + System.err.println( company); + String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 + String maName = config.getDeptName(); + BigDecimal orderCount = config.getOrderCount(); + Long configCompanyId = config.getCompanyId(); - String key = configCompanyId + "_" + maName; - List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); - BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config); + String key = configCompanyId + "_" + maName; + List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); + BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config); - DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(company); - d.setCompanyId(configCompanyId); - d.setCompanyName(company); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); + DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { + DeptConfigRateSummary d = new DeptConfigRateSummary(); + d.setDeptName(config.getDeptName()); + d.setCompanyId(configCompanyId); + d.setCompanyName(company); + d.setValueA(BigDecimal.ZERO); + d.setValueB(BigDecimal.ZERO); + d.setValueC(BigDecimal.ZERO); + return d; + }); - switch (type) { - case "0": - dto.setValueA(dto.getValueA().add(score)); - break; - case "1": - dto.setValueB(dto.getValueB().add(score)); - break; - case "2": - dto.setValueC(dto.getValueC().add(score)); - break; - } + switch (type) { + case "0": + dto.setValueA(dto.getValueA().add(score)); + break; + case "1": + dto.setValueB(dto.getValueB().add(score)); + break; + case "2": + dto.setValueC(dto.getValueC().add(score)); + break; } + } - // 5.x:补充未出现在 configList 的公司/设备项 - Set configKeys = configList.stream() - .map(c -> c.getCompanyId() + "_" + c.getDeptName()) - .collect(Collectors.toSet()); - - for (Map.Entry> entry : ownIndex.entrySet()) { - String key = entry.getKey(); - if (configKeys.contains(key)) continue; - - List devices = entry.getValue(); - if (devices == null || devices.isEmpty()) continue; - - Ownerdomin first = devices.get(0); - Long companyId = first.getCompanyId(); - String maName = first.getMaName(); - - // 从 devInfo 中找公司名称 - Optional matchDev = ownListFromDevInfo.stream() - .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) - .findFirst(); - - String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); - - DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(companyName); - d.setCompanyId(companyId); - d.setCompanyName(companyName); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); - - // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) - BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null); - dto.setValueA(dto.getValueA().add(score)); - } - - // 6. 返回汇总结果 - return new ArrayList<>(companyMap.values()); - - } - - // ✅ 可选:添加没有配置项但有设备的公司 - private void addCompaniesWithoutConfig(List configList, - Map companyMap, - Map> ownIndex) { - // 获取所有配置表中出现的公司ID - Set configCompanyIds = configList.stream() - .map(DeptConfigRateSummary::getCompanyId) + // 5.x:补充未出现在 configList 的公司/设备项 + Set configKeys = configList.stream() + .map(c -> c.getCompanyId() + "_" + c.getDeptName()) .collect(Collectors.toSet()); - // 获取所有设备公司ID - Set deviceCompanyIds = ownIndex.keySet().stream() - .map(key -> Long.parseLong(key.split("_")[0])) - .collect(Collectors.toSet()); + for (Map.Entry> entry : ownIndex.entrySet()) { + String key = entry.getKey(); + if (configKeys.contains(key)) continue; - // 找出有设备但没配置的公司ID - Set missingCompanyIds = new HashSet<>(deviceCompanyIds); - missingCompanyIds.removeAll(configCompanyIds); + List devices = entry.getValue(); + if (devices == null || devices.isEmpty()) continue; - // 为这些公司创建空汇总对象 - for (Long companyId : missingCompanyIds) { - // 获取公司名称(需要查询或从设备中提取) - String companyName = "未知公司"; // 实际应从设备数据中获取 + Ownerdomin first = devices.get(0); + Long companyId = first.getCompanyId(); + String maName = first.getMaName(); - companyMap.computeIfAbsent(companyName, k -> { + // 从 devInfo 中找公司名称 + Optional matchDev = ownListFromDevInfo.stream() + .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) + .findFirst(); + + String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); + System.err.println("有关问题公司查看 "+companyName); + DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { DeptConfigRateSummary d = new DeptConfigRateSummary(); d.setDeptName(companyName); d.setCompanyId(companyId); @@ -224,45 +186,53 @@ public class SysDeptServiceImpl implements ISysDeptService { d.setValueC(BigDecimal.ZERO); return d; }); + + // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) + BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null); + dto.setValueA(dto.getValueA().add(score)); } + + // 6. 返回汇总结果 + return new ArrayList<>(companyMap.values()); + } -private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config) { - if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; + private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config) { + if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; - BigDecimal ownedTotal = BigDecimal.ZERO; - BigDecimal leasedTotal = BigDecimal.ZERO; + BigDecimal ownedTotal = BigDecimal.ZERO; + BigDecimal leasedTotal = BigDecimal.ZERO; - for (Ownerdomin own : owns) { - BigDecimal num = new BigDecimal(own.getMaNum()); - if ("2".equals(own.getType())) { - ownedTotal = ownedTotal.add(num); // 自有 - } else { - leasedTotal = leasedTotal.add(num); // 租赁 + for (Ownerdomin own : owns) { + BigDecimal num = new BigDecimal(own.getMaNum()); + if ("2".equals(own.getType())) { + ownedTotal = ownedTotal.add(num); // 自有 + } else if("1".equals(own.getType())) { + leasedTotal = leasedTotal.add(num); // 租赁 + } } - } - BigDecimal base = config.getConfigValue(); // 基本配置数量 - BigDecimal score = config.getConfigRate(); // 满分值 + BigDecimal base = config.getConfigValue(); // 基本配置数量 + BigDecimal score = config.getConfigRate(); // 满分值 - if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; + if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; - // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 - BigDecimal rate = ownedTotal - .add(leasedTotal.multiply(new BigDecimal("0.6"))) - .add(ordercount.multiply(new BigDecimal("0.9"))) - .divide(base, 4, RoundingMode.HALF_UP); + // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 + BigDecimal rate = ownedTotal + .add(leasedTotal.multiply(new BigDecimal("0.6"))) + .add(ordercount.multiply(new BigDecimal("0.9"))) + .divide(base, 4, RoundingMode.HALF_UP); // 判断是否超过满分 - if (rate.compareTo(BigDecimal.ONE) > 0) { - return score.setScale(2, RoundingMode.HALF_UP); - } else { - return rate.multiply(score).setScale(2, RoundingMode.HALF_UP); + if (rate.compareTo(BigDecimal.ONE) > 0) { + return score.setScale(2, RoundingMode.HALF_UP); + } else { + return rate.multiply(score).setScale(2, RoundingMode.HALF_UP); + } } -} @Override public List selectDeptConfigTypeSummary(DeptConfigTypeSummary entity) { @@ -300,7 +270,7 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o } } else { - // 不存在,新增一条 EquipmentDetail,赋值必要字段 + /* // 不存在,新增一条 EquipmentDetail,赋值必要字段 EquipmentDetail newItem = new EquipmentDetail(); newItem.setCompanyId(devItem.getCompanyId()); newItem.setName(devItem.getTypeName()); @@ -308,7 +278,7 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o // 其他字段可根据业务决定是否赋默认值 newItem.setDesc("来自装备配置管理"); equipmentDetails.add(newItem); - indexMap.put(key, newItem); + indexMap.put(key, newItem);*/ } } @@ -386,3 +356,4 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o return getChildList(list, t).size() > 0 ? true : false; } } + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index a45b668..eeeccab 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -221,7 +221,7 @@ LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id WHERE md.is_active = '1' - AND md.own_co = 221 + AND md.own_co = #{companyId} GROUP BY mt.type_id diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml index 82de6e7..151a26b 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml @@ -75,6 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" md.is_active = '1' GROUP BY md.own_co, - mt.type_name + mt2.type_id From 5bd24cec66f03b8f8acff014d9137212c4a2346e Mon Sep 17 00:00:00 2001 From: "liang.chao" <1360241448@qq.com> Date: Mon, 7 Jul 2025 10:06:32 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysDeptServiceImpl.java | 246 +++++++++--------- .../material/equipment/SysDeptMapper.xml | 41 +-- 2 files changed, 146 insertions(+), 141 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index 44a886f..eb9f197 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -25,7 +25,6 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; -import java.util.function.Function; import javax.annotation.Resource; import java.util.stream.Collectors; @@ -75,164 +74,164 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override public List selectDeptConfigRatePivot(DeptConfigRateSummary entity) { - // 1. 查询配置率项(每条代表一个公司+设备+评分项) - List configList = mapper.selectDeptConfigRatePivot(entity); + // 1. 查询配置率项(每条代表一个公司+设备+评分项) + List configList = mapper.selectDeptConfigRatePivot(entity); - // 2. 查询 ma_own_manage 表中原始设备数据 - List ownListFromManage = ownerMapper.list(null); + // 2. 查询 ma_own_manage 表中原始设备数据 + List ownListFromManage = ownerMapper.list(null); - // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) - List ownListFromDevInfo = ownerMapper.listGrouped(); + // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) + List ownListFromDevInfo = ownerMapper.listGrouped(); - // 4. 构建设备索引 Map<公司ID_设备名, List> - Map> ownIndex = new HashMap<>(); + // 4. 构建设备索引 Map<公司ID_设备名, List> + Map> ownIndex = new HashMap<>(); - for (Ownerdomin device : ownListFromManage) { - String key = device.getCompanyId() + "_" + device.getMaName(); - System.err.println("初始化的key:" + key+"-----------"+device.toString()); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); - } + for (Ownerdomin device : ownListFromManage) { + String key = device.getCompanyId() + "_" + device.getMaName(); + System.err.println("初始化的key:" + key+"-----------"+device.toString()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); + } - for (NewOwnerdomin dev : ownListFromDevInfo) { - String key = dev.getCompanyId() + "_" + dev.getMaName(); - List existList = ownIndex.get(key); - System.err.println("existList:" + existList); - System.err.println("key:" + key+"-----------"+dev.getCompanyName()); - if (existList != null && !existList.isEmpty()) { - for (Ownerdomin device : existList) { - /*是否需要累加 待验证*/ - device.setMaNum(device.getMaNum() ); - device.setType("2"); + for (NewOwnerdomin dev : ownListFromDevInfo) { + String key = dev.getCompanyId() + "_" + dev.getMaName(); + List existList = ownIndex.get(key); + System.err.println("existList:" + existList); + System.err.println("key:" + key+"-----------"+dev.getCompanyName()); + if (existList != null && !existList.isEmpty()) { + for (Ownerdomin device : existList) { + /*是否需要累加 待验证*/ + device.setMaNum(device.getMaNum() ); + device.setType("2"); + } + } else { + Ownerdomin newDevice = new Ownerdomin(); + newDevice.setCompanyId((long) dev.getCompanyId()); + newDevice.setMaName(dev.getMaName()); + newDevice.setType("2"); + newDevice.setMaNum(dev.getMaNum()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); } - } else { - Ownerdomin newDevice = new Ownerdomin(); - newDevice.setCompanyId((long) dev.getCompanyId()); - newDevice.setMaName(dev.getMaName()); - newDevice.setType("2"); - newDevice.setMaNum(dev.getMaNum()); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); } - } - // 5. 构建公司 → 汇总对象 Map - Map companyMap = new LinkedHashMap<>(); + // 5. 构建公司 → 汇总对象 Map + Map companyMap = new LinkedHashMap<>(); - for (DeptConfigRateSummary config : configList) { - String company = config.getCompanyName(); - System.err.println( company); - String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 - String maName = config.getDeptName(); - BigDecimal orderCount = config.getOrderCount(); - Long configCompanyId = config.getCompanyId(); + for (DeptConfigRateSummary config : configList) { + String company = config.getCompanyName(); + System.err.println( company); + String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 + String maName = config.getDeptName(); + BigDecimal orderCount = config.getOrderCount(); + Long configCompanyId = config.getCompanyId(); - String key = configCompanyId + "_" + maName; - List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); - BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config); + String key = configCompanyId + "_" + maName; + List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); + BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config); - DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(config.getDeptName()); - d.setCompanyId(configCompanyId); - d.setCompanyName(company); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); + DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { + DeptConfigRateSummary d = new DeptConfigRateSummary(); + d.setDeptName(config.getDeptName()); + d.setCompanyId(configCompanyId); + d.setCompanyName(company); + d.setValueA(BigDecimal.ZERO); + d.setValueB(BigDecimal.ZERO); + d.setValueC(BigDecimal.ZERO); + return d; + }); - switch (type) { - case "0": - dto.setValueA(dto.getValueA().add(score)); - break; - case "1": - dto.setValueB(dto.getValueB().add(score)); - break; - case "2": - dto.setValueC(dto.getValueC().add(score)); - break; + switch (type) { + case "0": + dto.setValueA(dto.getValueA().add(score)); + break; + case "1": + dto.setValueB(dto.getValueB().add(score)); + break; + case "2": + dto.setValueC(dto.getValueC().add(score)); + break; + } } - } - // 5.x:补充未出现在 configList 的公司/设备项 - Set configKeys = configList.stream() - .map(c -> c.getCompanyId() + "_" + c.getDeptName()) - .collect(Collectors.toSet()); + // 5.x:补充未出现在 configList 的公司/设备项 + Set configKeys = configList.stream() + .map(c -> c.getCompanyId() + "_" + c.getDeptName()) + .collect(Collectors.toSet()); - for (Map.Entry> entry : ownIndex.entrySet()) { - String key = entry.getKey(); - if (configKeys.contains(key)) continue; + for (Map.Entry> entry : ownIndex.entrySet()) { + String key = entry.getKey(); + if (configKeys.contains(key)) continue; - List devices = entry.getValue(); - if (devices == null || devices.isEmpty()) continue; + List devices = entry.getValue(); + if (devices == null || devices.isEmpty()) continue; - Ownerdomin first = devices.get(0); - Long companyId = first.getCompanyId(); - String maName = first.getMaName(); + Ownerdomin first = devices.get(0); + Long companyId = first.getCompanyId(); + String maName = first.getMaName(); - // 从 devInfo 中找公司名称 - Optional matchDev = ownListFromDevInfo.stream() - .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) - .findFirst(); + // 从 devInfo 中找公司名称 + Optional matchDev = ownListFromDevInfo.stream() + .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) + .findFirst(); - String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); - System.err.println("有关问题公司查看 "+companyName); - DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(companyName); - d.setCompanyId(companyId); - d.setCompanyName(companyName); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); + String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); + System.err.println("有关问题公司查看 "+companyName); + DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { + DeptConfigRateSummary d = new DeptConfigRateSummary(); + d.setDeptName(companyName); + d.setCompanyId(companyId); + d.setCompanyName(companyName); + d.setValueA(BigDecimal.ZERO); + d.setValueB(BigDecimal.ZERO); + d.setValueC(BigDecimal.ZERO); + return d; + }); - // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) - BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null); - dto.setValueA(dto.getValueA().add(score)); - } + // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) + BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null); + dto.setValueA(dto.getValueA().add(score)); + } - // 6. 返回汇总结果 - return new ArrayList<>(companyMap.values()); + // 6. 返回汇总结果 + return new ArrayList<>(companyMap.values()); } - private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config) { - if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; +private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config) { + if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; - BigDecimal ownedTotal = BigDecimal.ZERO; - BigDecimal leasedTotal = BigDecimal.ZERO; + BigDecimal ownedTotal = BigDecimal.ZERO; + BigDecimal leasedTotal = BigDecimal.ZERO; - for (Ownerdomin own : owns) { - BigDecimal num = new BigDecimal(own.getMaNum()); - if ("2".equals(own.getType())) { - ownedTotal = ownedTotal.add(num); // 自有 - } else if("1".equals(own.getType())) { - leasedTotal = leasedTotal.add(num); // 租赁 - } + for (Ownerdomin own : owns) { + BigDecimal num = new BigDecimal(own.getMaNum()); + if ("2".equals(own.getType())) { + ownedTotal = ownedTotal.add(num); // 自有 + } else if("1".equals(own.getType())) { + leasedTotal = leasedTotal.add(num); // 租赁 } + } - BigDecimal base = config.getConfigValue(); // 基本配置数量 - BigDecimal score = config.getConfigRate(); // 满分值 + BigDecimal base = config.getConfigValue(); // 基本配置数量 + BigDecimal score = config.getConfigRate(); // 满分值 - if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; + if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; - // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 - BigDecimal rate = ownedTotal - .add(leasedTotal.multiply(new BigDecimal("0.6"))) - .add(ordercount.multiply(new BigDecimal("0.9"))) - .divide(base, 4, RoundingMode.HALF_UP); + // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 + BigDecimal rate = ownedTotal + .add(leasedTotal.multiply(new BigDecimal("0.6"))) + .add(ordercount.multiply(new BigDecimal("0.9"))) + .divide(base, 4, RoundingMode.HALF_UP); // 判断是否超过满分 - if (rate.compareTo(BigDecimal.ONE) > 0) { - return score.setScale(2, RoundingMode.HALF_UP); - } else { - return rate.multiply(score).setScale(2, RoundingMode.HALF_UP); - } + if (rate.compareTo(BigDecimal.ONE) > 0) { + return score.setScale(2, RoundingMode.HALF_UP); + } else { + return rate.multiply(score).setScale(2, RoundingMode.HALF_UP); } +} @Override public List selectDeptConfigTypeSummary(DeptConfigTypeSummary entity) { @@ -356,4 +355,3 @@ public class SysDeptServiceImpl implements ISysDeptService { return getChildList(list, t).size() > 0 ? true : false; } } - diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index eeeccab..58e0865 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -43,9 +43,7 @@ - + + From beef2f79449317e1ab667e11e2eefe892d340df8 Mon Sep 17 00:00:00 2001 From: mashuai Date: Mon, 7 Jul 2025 19:14:16 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/SysDeptServiceImpl.java | 310 ++++++++++-------- .../material/equipment/SysDeptMapper.xml | 122 ++++--- 2 files changed, 233 insertions(+), 199 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index eb9f197..0261c84 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -25,6 +25,7 @@ import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; +import java.util.function.Function; import javax.annotation.Resource; import java.util.stream.Collectors; @@ -74,164 +75,180 @@ public class SysDeptServiceImpl implements ISysDeptService { @Override public List selectDeptConfigRatePivot(DeptConfigRateSummary entity) { - // 1. 查询配置率项(每条代表一个公司+设备+评分项) - List configList = mapper.selectDeptConfigRatePivot(entity); + // 1. 查询配置率项(每条代表一个公司+设备+评分项) + List configList = mapper.selectDeptConfigRatePivot(entity); - // 2. 查询 ma_own_manage 表中原始设备数据 - List ownListFromManage = ownerMapper.list(null); + // 2. 查询 ma_own_manage 表中原始设备数据 + List ownListFromManage = ownerMapper.list(null); - // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) - List ownListFromDevInfo = ownerMapper.listGrouped(); + // 3. 查询 ma_dev_info 表中聚合后的设备数据(包含公司名) + List ownListFromDevInfo = ownerMapper.listGrouped(); - // 4. 构建设备索引 Map<公司ID_设备名, List> - Map> ownIndex = new HashMap<>(); + // 4. 构建设备索引 Map<公司ID_设备名, List> + Map> ownIndex = new HashMap<>(); - for (Ownerdomin device : ownListFromManage) { - String key = device.getCompanyId() + "_" + device.getMaName(); - System.err.println("初始化的key:" + key+"-----------"+device.toString()); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); - } - - for (NewOwnerdomin dev : ownListFromDevInfo) { - String key = dev.getCompanyId() + "_" + dev.getMaName(); - List existList = ownIndex.get(key); - System.err.println("existList:" + existList); - System.err.println("key:" + key+"-----------"+dev.getCompanyName()); - if (existList != null && !existList.isEmpty()) { - for (Ownerdomin device : existList) { - /*是否需要累加 待验证*/ - device.setMaNum(device.getMaNum() ); - device.setType("2"); - } - } else { - Ownerdomin newDevice = new Ownerdomin(); - newDevice.setCompanyId((long) dev.getCompanyId()); - newDevice.setMaName(dev.getMaName()); - newDevice.setType("2"); - newDevice.setMaNum(dev.getMaNum()); - ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); - } - } - - // 5. 构建公司 → 汇总对象 Map - Map companyMap = new LinkedHashMap<>(); - - for (DeptConfigRateSummary config : configList) { - String company = config.getCompanyName(); - System.err.println( company); - String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 - String maName = config.getDeptName(); - BigDecimal orderCount = config.getOrderCount(); - Long configCompanyId = config.getCompanyId(); - - String key = configCompanyId + "_" + maName; - List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); - BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config); - - DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(config.getDeptName()); - d.setCompanyId(configCompanyId); - d.setCompanyName(company); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); - - switch (type) { - case "0": - dto.setValueA(dto.getValueA().add(score)); - break; - case "1": - dto.setValueB(dto.getValueB().add(score)); - break; - case "2": - dto.setValueC(dto.getValueC().add(score)); - break; - } - } - - // 5.x:补充未出现在 configList 的公司/设备项 - Set configKeys = configList.stream() - .map(c -> c.getCompanyId() + "_" + c.getDeptName()) - .collect(Collectors.toSet()); - - for (Map.Entry> entry : ownIndex.entrySet()) { - String key = entry.getKey(); - if (configKeys.contains(key)) continue; - - List devices = entry.getValue(); - if (devices == null || devices.isEmpty()) continue; - - Ownerdomin first = devices.get(0); - Long companyId = first.getCompanyId(); - String maName = first.getMaName(); - - // 从 devInfo 中找公司名称 - Optional matchDev = ownListFromDevInfo.stream() - .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) - .findFirst(); - - String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); - System.err.println("有关问题公司查看 "+companyName); - DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { - DeptConfigRateSummary d = new DeptConfigRateSummary(); - d.setDeptName(companyName); - d.setCompanyId(companyId); - d.setCompanyName(companyName); - d.setValueA(BigDecimal.ZERO); - d.setValueB(BigDecimal.ZERO); - d.setValueC(BigDecimal.ZERO); - return d; - }); - - // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) - BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null); - dto.setValueA(dto.getValueA().add(score)); - } - - // 6. 返回汇总结果 - return new ArrayList<>(companyMap.values()); - - } - - -private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config) { - if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; - - BigDecimal ownedTotal = BigDecimal.ZERO; - BigDecimal leasedTotal = BigDecimal.ZERO; - - for (Ownerdomin own : owns) { - BigDecimal num = new BigDecimal(own.getMaNum()); - if ("2".equals(own.getType())) { - ownedTotal = ownedTotal.add(num); // 自有 - } else if("1".equals(own.getType())) { - leasedTotal = leasedTotal.add(num); // 租赁 + for (Ownerdomin device : ownListFromManage) { + String key = device.getCompanyId() + "_" + device.getMaName(); + System.err.println("初始化的key:" + key+"-----------"+device.toString()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); } + + for (NewOwnerdomin dev : ownListFromDevInfo) { + String key = dev.getCompanyId() + "_" + dev.getMaName(); + List existList = ownIndex.get(key); + System.err.println("existList:" + existList); + System.err.println("key:" + key+"-----------"+dev.getCompanyName()); + if (existList != null && !existList.isEmpty()) { + for (Ownerdomin device : existList) { + /*是否需要累加 待验证*/ + device.setMaNum(device.getMaNum() ); + device.setType("2"); + } + } else { + Ownerdomin newDevice = new Ownerdomin(); + newDevice.setCompanyId((long) dev.getCompanyId()); + newDevice.setMaName(dev.getMaName()); + newDevice.setType("2"); + newDevice.setMaNum(dev.getMaNum()); + ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); + } + } + + // 5. 构建公司 → 汇总对象 Map + Map companyMap = new LinkedHashMap<>(); + + for (DeptConfigRateSummary config : configList) { + String company = config.getCompanyName(); + System.err.println( company); + String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 + String maName = config.getDeptName(); + BigDecimal orderCount = config.getOrderCount(); + Long configCompanyId = config.getCompanyId(); + + String key = configCompanyId + "_" + maName; + List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); + BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type); + + DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { + DeptConfigRateSummary d = new DeptConfigRateSummary(); + d.setDeptName(config.getDeptName()); + d.setCompanyId(configCompanyId); + d.setCompanyName(company); + d.setValueA(BigDecimal.ZERO); + d.setValueB(BigDecimal.ZERO); + d.setValueC(BigDecimal.ZERO); + return d; + }); + + switch (type) { + case "0": + case "3": + dto.setValueA(dto.getValueA().add(score)); + break; + case "1": + case "4": + dto.setValueB(dto.getValueB().add(score)); + break; + case "2": + case "5": + dto.setValueC(dto.getValueC().add(score)); + break; + } + } + + // 5.x:补充未出现在 configList 的公司/设备项 + Set configKeys = configList.stream() + .map(c -> c.getCompanyId() + "_" + c.getDeptName()) + .collect(Collectors.toSet()); + + for (Map.Entry> entry : ownIndex.entrySet()) { + String key = entry.getKey(); + if (configKeys.contains(key)) continue; + + List devices = entry.getValue(); + if (devices == null || devices.isEmpty()) continue; + + Ownerdomin first = devices.get(0); + Long companyId = first.getCompanyId(); + String maName = first.getMaName(); + + // 从 devInfo 中找公司名称 + Optional matchDev = ownListFromDevInfo.stream() + .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) + .findFirst(); + + String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); + //System.err.println("有关问题公司查看 "+companyName); + DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { + DeptConfigRateSummary d = new DeptConfigRateSummary(); + d.setDeptName(companyName); + d.setCompanyId(companyId); + d.setCompanyName(companyName); + d.setValueA(BigDecimal.ZERO); + d.setValueB(BigDecimal.ZERO); + d.setValueC(BigDecimal.ZERO); + return d; + }); + + // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) + BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null, "0"); + dto.setValueA(dto.getValueA().add(score)); + } + + // 6. 返回汇总结果 + return new ArrayList<>(companyMap.values()); + } - BigDecimal base = config.getConfigValue(); // 基本配置数量 - BigDecimal score = config.getConfigRate(); // 满分值 - if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; + private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config,String type) { + if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; + BigDecimal ownedTotal = BigDecimal.ZERO; + BigDecimal leasedTotal = BigDecimal.ZERO; + boolean limitedType = false; // 是否是 3/4/5 类型 - // 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 - BigDecimal rate = ownedTotal - .add(leasedTotal.multiply(new BigDecimal("0.6"))) - .add(ordercount.multiply(new BigDecimal("0.9"))) - .divide(base, 4, RoundingMode.HALF_UP); + for (Ownerdomin own : owns) { + BigDecimal num = new BigDecimal(own.getMaNum()); + // 判断是否为限制分数的类型 + if ("3".equals(own.getType()) || "4".equals(own.getType()) || "5".equals(own.getType())) { + limitedType = true; + } + + if ("2".equals(own.getType())) { + ownedTotal = ownedTotal.add(num); // 自有 + } else if ("1".equals(own.getType())) { + leasedTotal = leasedTotal.add(num); // 租赁 + } + } + + BigDecimal base = config.getConfigValue(); // 基本配置数量 + BigDecimal score = config.getConfigRate(); // 满分值 + + if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; + +// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 + BigDecimal rate = ownedTotal + .add(leasedTotal.multiply(new BigDecimal("0.6"))) + .add(ordercount.multiply(new BigDecimal("0.9"))) + .divide(base, 4, RoundingMode.HALF_UP); + +// 计算原始得分 + BigDecimal result = rate.multiply(score).setScale(2, RoundingMode.HALF_UP); + +// 限制得分不超过满分,且如果是 3/4/5 类型,不能超过 20 + if (rate.compareTo(BigDecimal.ONE) > 0) { + result = score.setScale(2, RoundingMode.HALF_UP); + } + + if (limitedType && result.compareTo(new BigDecimal("20")) > 0) { + result = new BigDecimal("20.00"); + } + + return result; -// 判断是否超过满分 - if (rate.compareTo(BigDecimal.ONE) > 0) { - return score.setScale(2, RoundingMode.HALF_UP); - } else { - return rate.multiply(score).setScale(2, RoundingMode.HALF_UP); } -} @Override public List selectDeptConfigTypeSummary(DeptConfigTypeSummary entity) { @@ -250,6 +267,7 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o Map indexMap = new LinkedHashMap<>(); for (EquipmentDetail item : equipmentDetails) { String key = item.getCompanyId() + "_" + item.getName(); + System.err.println("估计出错"+key); indexMap.put(key, item); } @@ -259,6 +277,7 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o EquipmentDetail existing = indexMap.get(key); if (existing != null) { + System.err.println("已存在"+key); // 已存在,累加自有数量 own if (existing.getOwn() == null) { existing.setOwn(devItem.getOwnCount()); @@ -355,3 +374,4 @@ private BigDecimal computeScoreByMaName(BigDecimal ordercount,List o return getChildList(list, t).size() > 0 ? true : false; } } + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index 58e0865..f96ff18 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -43,7 +43,9 @@ - + - + From 8af623096c34168d1f3774f492cb621c2fcbd762 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Wed, 9 Jul 2025 09:42:47 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/DeptConfigRateSummary.java | 1 + .../equipment/domain/EquipmentDetail.java | 1 + .../equipment/domain/NewOwnerdomin.java | 8 ++ .../service/impl/SysDeptServiceImpl.java | 132 +++++++++++++++--- .../material/owner/domain/Ownerdomin.java | 6 + .../material/equipment/SysDeptMapper.xml | 67 ++++----- .../mapper/material/owner/OwnerMapper.xml | 1 + 7 files changed, 157 insertions(+), 59 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java index a9fea56..a621d0b 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java @@ -32,4 +32,5 @@ public class DeptConfigRateSummary extends BaseEntity { //装备配置率赋值 private BigDecimal configRate; private BigDecimal orderCount; + private BigDecimal FullScore; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java index 7746e40..4dc0e08 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java @@ -52,6 +52,7 @@ public class EquipmentDetail { * */ private String ifExist; private String orderCount; + private String combinedName; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java index 4036d9e..23c1ce9 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java @@ -2,12 +2,18 @@ package com.bonus.material.equipment.domain; import lombok.Data; +import java.math.BigDecimal; + @Data public class NewOwnerdomin { private int companyId; // 公司ID private String maName; // 装备类型ID或名称 private String companyName; // 公司名称 private Integer maNum; // 数量 + private String configType; + private BigDecimal fullScore; + private BigDecimal baseNum; + private BigDecimal orderCount; public NewOwnerdomin() { // 必须有无参构造函数 @@ -20,4 +26,6 @@ public class NewOwnerdomin { this.companyName = o.companyName; } + + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index 0261c84..73739d6 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -87,28 +87,31 @@ public class SysDeptServiceImpl implements ISysDeptService { // 4. 构建设备索引 Map<公司ID_设备名, List> Map> ownIndex = new HashMap<>(); + /*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/ for (Ownerdomin device : ownListFromManage) { String key = device.getCompanyId() + "_" + device.getMaName(); - System.err.println("初始化的key:" + key+"-----------"+device.toString()); ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); } - + /*去ma_dev_info装置配置表里面获取可有重复装备的数据*/ for (NewOwnerdomin dev : ownListFromDevInfo) { String key = dev.getCompanyId() + "_" + dev.getMaName(); List existList = ownIndex.get(key); - System.err.println("existList:" + existList); - System.err.println("key:" + key+"-----------"+dev.getCompanyName()); if (existList != null && !existList.isEmpty()) { for (Ownerdomin device : existList) { - /*是否需要累加 待验证*/ - device.setMaNum(device.getMaNum() ); - device.setType("2"); + // 1. 累加设备数量 + device.setMaNum(device.getMaNum()+dev.getMaNum()); + + // 2. 只有当原类型不是 "1"(即不是“租赁”)时才改成 "2"自有 + if (!"1".equals(device.getType())) { + device.setType("2"); + } } } else { Ownerdomin newDevice = new Ownerdomin(); newDevice.setCompanyId((long) dev.getCompanyId()); newDevice.setMaName(dev.getMaName()); newDevice.setType("2"); + newDevice.setOrderCount(dev.getOrderCount()); newDevice.setMaNum(dev.getMaNum()); ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(newDevice); } @@ -119,7 +122,6 @@ public class SysDeptServiceImpl implements ISysDeptService { for (DeptConfigRateSummary config : configList) { String company = config.getCompanyName(); - System.err.println( company); String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 String maName = config.getDeptName(); BigDecimal orderCount = config.getOrderCount(); @@ -128,10 +130,16 @@ public class SysDeptServiceImpl implements ISysDeptService { String key = configCompanyId + "_" + maName; List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type); - + BigDecimal newscore = null; + //针对订单数量大于0的进行计算(需要给外租也就是type=1的进行赋值) + if (orderCount.compareTo(BigDecimal.ZERO) > 0 + && (sameCompanyDevices == null || sameCompanyDevices.isEmpty())) { + newscore = computeScoreByOrder(config); + } DeptConfigRateSummary dto = companyMap.computeIfAbsent(company, k -> { DeptConfigRateSummary d = new DeptConfigRateSummary(); d.setDeptName(config.getDeptName()); + d.setConfigType(config.getConfigType()); d.setCompanyId(configCompanyId); d.setCompanyName(company); d.setValueA(BigDecimal.ZERO); @@ -144,14 +152,27 @@ public class SysDeptServiceImpl implements ISysDeptService { case "0": case "3": dto.setValueA(dto.getValueA().add(score)); + dto.setValueA( + (dto.getValueA() == null ? BigDecimal.ZERO : dto.getValueA()) + .add(newscore == null ? BigDecimal.ZERO : newscore) + ); + break; case "1": case "4": dto.setValueB(dto.getValueB().add(score)); + dto.setValueB( + (dto.getValueB() == null ? BigDecimal.ZERO : dto.getValueB()) + .add(newscore == null ? BigDecimal.ZERO : newscore) + ); break; case "2": case "5": dto.setValueC(dto.getValueC().add(score)); + dto.setValueC( + (dto.getValueC() == null ? BigDecimal.ZERO : dto.getValueC()) + .add(newscore == null ? BigDecimal.ZERO : newscore) + ); break; } } @@ -174,14 +195,16 @@ public class SysDeptServiceImpl implements ISysDeptService { // 从 devInfo 中找公司名称 Optional matchDev = ownListFromDevInfo.stream() - .filter(d -> d.getCompanyId()==(new Long(companyId).intValue()) && d.getMaName().equals(maName)) + .filter(d -> d.getCompanyId() == companyId.intValue() && d.getMaName().equals(maName)) .findFirst(); String companyName = matchDev.map(NewOwnerdomin::getCompanyName).orElse("未知公司"); - //System.err.println("有关问题公司查看 "+companyName); + + // 获取或创建公司维度的汇总对象 如果这个公司没统计对象,就创建一个 DeptConfigRateSummary dto = companyMap.computeIfAbsent(companyName, k -> { DeptConfigRateSummary d = new DeptConfigRateSummary(); d.setDeptName(companyName); +// d.setConfigType(entry.getValue().get(0).getCompanyId()); d.setCompanyId(companyId); d.setCompanyName(companyName); d.setValueA(BigDecimal.ZERO); @@ -190,16 +213,70 @@ public class SysDeptServiceImpl implements ISysDeptService { return d; }); - // 默认作为线路设备记入 valueA,或根据 maName 判断类型再分类(可拓展) - BigDecimal score = computeScoreByMaName(BigDecimal.ZERO, devices, null, "0"); + // 汇总订单数量 + BigDecimal orderCount = devices.stream() + .map(d -> Optional.ofNullable(d.getOrderCount()).orElse(BigDecimal.ZERO)) + .reduce(BigDecimal.ZERO, BigDecimal::add); + + // 构造“临时配置项”用于计算 + DeptConfigRateSummary dummyConfig = new DeptConfigRateSummary(); + // 假设你已经找到了匹配的 NewOwnerdomin 对象 matchDev + BigDecimal fullScore = matchDev.map(NewOwnerdomin::getFullScore).orElse(BigDecimal.TEN); + BigDecimal baseNum = matchDev.map(NewOwnerdomin::getBaseNum).orElse(BigDecimal.ONE); + dummyConfig.setFullScore(fullScore); + dummyConfig.setOrderCount(orderCount); + dummyConfig.setDeptName(maName); + dummyConfig.setCompanyId(companyId); + dummyConfig.setCompanyName(companyName); + + // 计算得分 + BigDecimal score = computeScoreByMaName(orderCount, devices, dummyConfig, "0"); + + // 默认计入线路类 valueA dto.setValueA(dto.getValueA().add(score)); } + // 6. 返回汇总结果 return new ArrayList<>(companyMap.values()); } + private BigDecimal computeScoreByOrder(DeptConfigRateSummary config) { + + BigDecimal leaseNum ; + BigDecimal orderCount = config.getOrderCount() != null ? config.getOrderCount() : BigDecimal.ZERO; // 订单数量 + leaseNum =orderCount; + // BigDecimal configValue = config.getConfigValue();//自有人员数量 + BigDecimal configValue = BigDecimal.valueOf(0); + BigDecimal baseNum = config.getConfigValue(); // 基本配置数量(F列) + BigDecimal configRate = config.getConfigRate(); // 满分值(K列) + + // 权重 + BigDecimal leaseWeight = new BigDecimal("0.6"); + BigDecimal orderWeight = new BigDecimal("0.9"); + + // 实际值 = 自有 + 租赁×0.6 + 订单×0.9 + BigDecimal actual = configValue + .add(leaseNum.multiply(leaseWeight)) + .add(orderCount.multiply(orderWeight)); + + if (baseNum == null || baseNum.compareTo(BigDecimal.ZERO) == 0) { + return BigDecimal.ZERO; // 避免除以 0,可按需调整为 configRate + } + + // 计算比例 + BigDecimal ratio = actual.divide(baseNum, 4, RoundingMode.HALF_UP); + + // 最终得分 + if (ratio.compareTo(BigDecimal.ONE) >= 0) { + System.err.println("比例大于1,得分为满分"+config.getDeptName()+" "+config.toString()); + return configRate; // 满分 + } else { + System.err.println("比例 × 满分"+config.getDeptName()+" "+config.toString()); + return ratio.multiply(configRate).setScale(2, RoundingMode.HALF_UP); // 比例 × 满分 + } + } private BigDecimal computeScoreByMaName(BigDecimal ordercount,List owns, DeptConfigRateSummary config,String type) { if (config == null || owns == null || owns.isEmpty()) return BigDecimal.ZERO; @@ -207,7 +284,6 @@ public class SysDeptServiceImpl implements ISysDeptService { BigDecimal ownedTotal = BigDecimal.ZERO; BigDecimal leasedTotal = BigDecimal.ZERO; boolean limitedType = false; // 是否是 3/4/5 类型 - for (Ownerdomin own : owns) { BigDecimal num = new BigDecimal(own.getMaNum()); @@ -215,7 +291,10 @@ public class SysDeptServiceImpl implements ISysDeptService { if ("3".equals(own.getType()) || "4".equals(own.getType()) || "5".equals(own.getType())) { limitedType = true; } - + //如果ordercount大于0,则计算得分leasedTotal+ordercount + if (ordercount.compareTo(BigDecimal.ZERO) > 0) { + leasedTotal = leasedTotal.add(ordercount); + } if ("2".equals(own.getType())) { ownedTotal = ownedTotal.add(num); // 自有 } else if ("1".equals(own.getType())) { @@ -226,9 +305,12 @@ public class SysDeptServiceImpl implements ISysDeptService { BigDecimal base = config.getConfigValue(); // 基本配置数量 BigDecimal score = config.getConfigRate(); // 满分值 - if (base == null || base.compareTo(BigDecimal.ZERO) == 0) return BigDecimal.ZERO; + if (base == null || base.compareTo(BigDecimal.ZERO) == 0) { + return BigDecimal.ZERO; + } -// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置数 + +// 计算比例 = (自有 + 租赁×0.6 + 订单×0.9) / 基本配置标准数量 BigDecimal rate = ownedTotal .add(leasedTotal.multiply(new BigDecimal("0.6"))) .add(ordercount.multiply(new BigDecimal("0.9"))) @@ -245,6 +327,19 @@ public class SysDeptServiceImpl implements ISysDeptService { if (limitedType && result.compareTo(new BigDecimal("20")) > 0) { result = new BigDecimal("20.00"); } + System.out.println("【配置率计算明细】"); + System.err.println("类型:" + config.getConfigType()); + System.out.println("设备名:" + config.getDeptName()); + System.out.println("配置类型:" + config.getConfigType()); + System.out.println("自有数量合计(ownedTotal):" + ownedTotal); + System.out.println("租赁数量合计(leasedTotal):" + leasedTotal); + System.out.println("订单数量(ordercount):" + ordercount); + System.out.println("基本配置数量(base):" + base); + System.out.println("满分值(score):" + score); + System.out.println("得分比例(rate):" + rate); + System.out.println("是否为限制类型(3/4/5):" + limitedType); + System.out.println("最终得分(result):" + result); + System.out.println("--------------------------------------------------"); return result; @@ -267,7 +362,6 @@ public class SysDeptServiceImpl implements ISysDeptService { Map indexMap = new LinkedHashMap<>(); for (EquipmentDetail item : equipmentDetails) { String key = item.getCompanyId() + "_" + item.getName(); - System.err.println("估计出错"+key); indexMap.put(key, item); } @@ -277,7 +371,6 @@ public class SysDeptServiceImpl implements ISysDeptService { EquipmentDetail existing = indexMap.get(key); if (existing != null) { - System.err.println("已存在"+key); // 已存在,累加自有数量 own if (existing.getOwn() == null) { existing.setOwn(devItem.getOwnCount()); @@ -374,4 +467,3 @@ public class SysDeptServiceImpl implements ISysDeptService { return getChildList(list, t).size() > 0 ? true : false; } } - diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java index 2a37144..5a69029 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java @@ -1,11 +1,14 @@ package com.bonus.material.owner.domain; +import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.core.annotation.Excel; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; +import java.util.List; /** * @Author:liang.chao @@ -53,4 +56,7 @@ public class Ownerdomin { @ApiModelProperty(value = "装备名称id") private String maNameId; + private BigDecimal orderCount; + } + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index f96ff18..39d65aa 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -142,7 +142,7 @@ ) order_stat ON order_stat.dept_id = grouped.dept_id AND order_stat.parent_type_id = grouped.type_id - WHERE 1 = 1 + WHERE 1 = 1 @@ -161,48 +161,38 @@ From ef087b8e4add46746a9a63a3b5c21032d9c018ca Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Wed, 9 Jul 2025 12:32:07 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/domain/ConfigEntity.java | 7 +++ .../impl/DeptEquipmentConfigServiceImpl.java | 63 ++++++++++++++++--- .../equipment/DeptEquipmentConfigMapper.xml | 2 +- 3 files changed, 62 insertions(+), 10 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/ConfigEntity.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/ConfigEntity.java index 20adf90..7120d94 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/ConfigEntity.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/ConfigEntity.java @@ -13,4 +13,11 @@ public class ConfigEntity { private String configurationDescription; + private Long deptId; + + private String remark; + + private String typeId; + + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java index b842351..f7037cf 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java @@ -1,12 +1,16 @@ package com.bonus.material.equipment.service.impl; +import com.bonus.material.equipment.domain.ConfigEntity; import com.bonus.material.equipment.domain.DeptEquipmentConfig; import com.bonus.material.equipment.mapper.DeptEquipmentConfigMapper; import com.bonus.material.equipment.service.IDeptEquipmentConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; @Service public class DeptEquipmentConfigServiceImpl implements IDeptEquipmentConfigService { @@ -20,15 +24,56 @@ public class DeptEquipmentConfigServiceImpl implements IDeptEquipmentConfigServi } @Override - public int saveBatch(DeptEquipmentConfig configList) { - configList.setTypeId(configList.getEquipmentId()); - configList.setConfigValue(configList.getBasicConfig()); - //直接先删除对应的设备信息 通过公司id 和设备id进行删除 - DeptEquipmentConfig team = new DeptEquipmentConfig(); - team.setDeptId(configList.getDeptId()); - team.setTypeId(configList.getTypeId()); - mapper.deleteByDeptIdAndTypeId(team); + public int saveBatch(DeptEquipmentConfig configList) { + configList.setTypeId(configList.getEquipmentId()); + configList.setConfigValue(configList.getBasicConfig()); + DeptEquipmentConfig team = new DeptEquipmentConfig(); + team.setDeptId(configList.getDeptId()); + team.setTypeId(configList.getTypeId()); + mapper.deleteByDeptIdAndTypeId(team); - return mapper.insertOrUpdateBatch(configList); + List originalConfigs = configList.getConfigs(); + if (originalConfigs == null || originalConfigs.isEmpty()) { + return 1; // 只删除,无新增 + } + // 合并逻辑:以 deptId + typeId + configType 为 key,configValue 累加 + Map mergedMap = new LinkedHashMap<>(); + for (ConfigEntity item : originalConfigs) { + item.setDeptId(configList.getDeptId()); + item.setTypeId(configList.getTypeId()); + item.setRemark(configList.getRemark()); + String key = item.getDeptId() + "_" + item.getTypeId() + "_" + item.getConfigurationType(); + + if (mergedMap.containsKey(key)) { + ConfigEntity existing = mergedMap.get(key); + // configValue 是 String,需转数字再相加 + try { + double newVal = parseDoubleOrZero(item.getBasicConfig()); + double oldVal = parseDoubleOrZero(existing.getBasicConfig()); + double newrateVal = parseDoubleOrZero(item.getConfigurationRate()); + double oldrateVal = parseDoubleOrZero(existing.getConfigurationRate()); + existing.setBasicConfig(String.valueOf(newVal + oldVal)); + existing.setConfigurationRate(String.valueOf(newrateVal+oldrateVal)); + } catch (NumberFormatException e) { + e.printStackTrace(); + } + } else { + mergedMap.put(key, item); + } + } + + configList.setConfigs(new ArrayList<>(mergedMap.values())); + return mapper.insertOrUpdateBatch(configList); + } + private double parseDoubleOrZero(String value) { + if (value == null || value.trim().isEmpty()) { + return 0.0; + } + try { + return Double.parseDouble(value.trim()); + } catch (NumberFormatException e) { + return 0.0; + } } + } diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml index 5500109..fc6098c 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml @@ -26,7 +26,7 @@ ( #{deptId}, - #{equipmentId}, + #{typeId}, #{item.configurationType}, #{item.basicConfig}, #{item.configurationRate}, From 9d0d798e1a1c3c81fe751835696636855185a066 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Thu, 10 Jul 2025 10:46:43 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../material/device/domain/vo/DevInfoVo.java | 4 ++ .../DeptEquipmentConfigController.java | 47 ++++++++++++++++++ .../equipment/domain/EquipmentDetail.java | 1 + .../mapper/DeptEquipmentConfigMapper.java | 2 + .../service/IDeptEquipmentConfigService.java | 3 ++ .../impl/DeptEquipmentConfigServiceImpl.java | 13 +++-- .../equipment/DeptEquipmentConfigMapper.xml | 48 +++++++++++++++++++ .../material/equipment/SysDeptMapper.xml | 4 +- 8 files changed, 115 insertions(+), 7 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java index 96177ec..60d806a 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/domain/vo/DevInfoVo.java @@ -174,4 +174,8 @@ public class DevInfoVo extends DevInfo { @ApiModelProperty(value = "订单金额") private BigDecimal cost; + private String devicenewName; + + private String deviceTypeName; + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/controller/DeptEquipmentConfigController.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/controller/DeptEquipmentConfigController.java index 223c4ad..ce64eec 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/controller/DeptEquipmentConfigController.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/controller/DeptEquipmentConfigController.java @@ -1,12 +1,25 @@ package com.bonus.material.equipment.controller; +import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +import com.bonus.material.basic.domain.BmCompanyAddress; +import com.bonus.material.common.annotation.PreventRepeatSubmit; +import com.bonus.material.device.domain.vo.DevInfoVo; +import com.bonus.material.equipment.domain.DeptConfigTypeSummary; import com.bonus.material.equipment.domain.DeptEquipmentConfig; +import com.bonus.material.equipment.domain.EquipmentDetail; import com.bonus.material.equipment.service.IDeptEquipmentConfigService; +import com.bonus.material.equipment.service.ISysDeptService; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + @RestController @RequestMapping("/equipmentConfig") @@ -16,6 +29,8 @@ public class DeptEquipmentConfigController extends BaseController { @Autowired private IDeptEquipmentConfigService service; + @Autowired + private ISysDeptService isyservice; @GetMapping("/{deptId}") public AjaxResult getConfigByDept(@PathVariable Long deptId) { return AjaxResult.success(service.selectByDeptId(deptId)); @@ -30,4 +45,36 @@ public class DeptEquipmentConfigController extends BaseController { return AjaxResult.error("操作失败"); } } + /** + * 导出企业信息列表 + */ + @ApiOperation(value = "导出机械化施工装备配置率") + @PreventRepeatSubmit + @SysLog(title = "机械化施工装备配置率信息", businessType = OperaType.EXPORT, logType = 1,module = "出租方管理->机械化施工装备配置率信息") + @PostMapping("/export") + public void export(HttpServletResponse response, @RequestBody EquipmentDetail equipmentDetail) { + try { + List list = isyservice.detailsInfo(equipmentDetail); + ExcelUtil util = new ExcelUtil(EquipmentDetail.class); + util.exportExcel(response, list, "装备详情数据"); + } catch (Exception e) { + logger.error(e.toString(), e); + } + + } + + /** + * + * 查询机械化施工装备 + * + * 自有装备数据的数量 + * @param devInfoVo + * @return + */ + @PostMapping("/getdeviceInfo") + public AjaxResult getdeviceInfo( @RequestBody DevInfoVo devInfoVo) { + List list = service.selectDevInfoLists(devInfoVo); + return AjaxResult.success(list); + } + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java index 4dc0e08..6b5aa74 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/EquipmentDetail.java @@ -53,6 +53,7 @@ public class EquipmentDetail { private String ifExist; private String orderCount; private String combinedName; + private String labelVol; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/mapper/DeptEquipmentConfigMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/mapper/DeptEquipmentConfigMapper.java index f0fd3c5..cdcdfa3 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/mapper/DeptEquipmentConfigMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/mapper/DeptEquipmentConfigMapper.java @@ -1,5 +1,6 @@ package com.bonus.material.equipment.mapper; +import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.equipment.domain.DeptEquipmentConfig; import java.util.List; @@ -11,4 +12,5 @@ public interface DeptEquipmentConfigMapper { int deleteByDeptIdAndTypeId(DeptEquipmentConfig team); + List selectDevInfoLists(DevInfoVo devInfoVo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/IDeptEquipmentConfigService.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/IDeptEquipmentConfigService.java index ebfc6d1..9f26ce6 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/IDeptEquipmentConfigService.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/IDeptEquipmentConfigService.java @@ -1,5 +1,6 @@ package com.bonus.material.equipment.service; +import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.equipment.domain.DeptEquipmentConfig; import java.util.List; @@ -7,4 +8,6 @@ import java.util.List; public interface IDeptEquipmentConfigService { List selectByDeptId(Long deptId); int saveBatch( DeptEquipmentConfig configList); + + List selectDevInfoLists(DevInfoVo devInfoVo); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java index f7037cf..7a3c9c9 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/DeptEquipmentConfigServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.material.equipment.service.impl; +import com.bonus.material.device.domain.vo.DevInfoVo; import com.bonus.material.equipment.domain.ConfigEntity; import com.bonus.material.equipment.domain.DeptEquipmentConfig; import com.bonus.material.equipment.mapper.DeptEquipmentConfigMapper; @@ -7,10 +8,7 @@ import com.bonus.material.equipment.service.IDeptEquipmentConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service public class DeptEquipmentConfigServiceImpl implements IDeptEquipmentConfigService { @@ -65,6 +63,13 @@ public class DeptEquipmentConfigServiceImpl implements IDeptEquipmentConfigServi configList.setConfigs(new ArrayList<>(mergedMap.values())); return mapper.insertOrUpdateBatch(configList); } + + @Override + public List selectDevInfoLists(DevInfoVo devInfoVo) { + List list = mapper.selectDevInfoLists(devInfoVo); + return list; + } + private double parseDoubleOrZero(String value) { if (value == null || value.trim().isEmpty()) { return 0.0; diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml index fc6098c..4cb732e 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/DeptEquipmentConfigMapper.xml @@ -11,6 +11,54 @@ + INSERT INTO ma_dept_config ( diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index 39d65aa..ab768c3 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -161,6 +161,7 @@ From 9af0b8e332fae49aa7e73b4ff177eab9e4662080 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Thu, 10 Jul 2025 17:11:43 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/material/equipment/SysDeptMapper.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index ab768c3..1b5191f 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -162,6 +162,7 @@ SELECT d.dept_id AS companyId, d.vol as labelVol, + mt3.type_id as typeId, mt3.type_name AS NAME,-- 使用层级表当前类型作为名称 d.config_description AS `desc`, d.config_rate AS `value`, @@ -232,7 +233,7 @@ AND md.own_co = #{companyId} GROUP BY - mt.type_id + mt2.type_id From e4d2e7abf8847b1dd62d3fa68f0644ea3c17e090 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Thu, 10 Jul 2025 18:41:40 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equipment/domain/DeptConfigRateSummary.java | 2 ++ .../material/equipment/domain/NewOwnerdomin.java | 1 + .../equipment/service/impl/SysDeptServiceImpl.java | 13 +++++++------ .../mapper/material/equipment/SysDeptMapper.xml | 1 + .../resources/mapper/material/owner/OwnerMapper.xml | 1 + 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java index a621d0b..a9c27c6 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/DeptConfigRateSummary.java @@ -33,4 +33,6 @@ public class DeptConfigRateSummary extends BaseEntity { private BigDecimal configRate; private BigDecimal orderCount; private BigDecimal FullScore; + + private String typeId; } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java index 23c1ce9..b076f41 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/domain/NewOwnerdomin.java @@ -11,6 +11,7 @@ public class NewOwnerdomin { private String companyName; // 公司名称 private Integer maNum; // 数量 private String configType; + private String typeId; private BigDecimal fullScore; private BigDecimal baseNum; private BigDecimal orderCount; diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java index 73739d6..325ce05 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/equipment/service/impl/SysDeptServiceImpl.java @@ -89,12 +89,12 @@ public class SysDeptServiceImpl implements ISysDeptService { /*从自己配置的自有、外租表里面进行遍历 目的是放到对应的键里面去*/ for (Ownerdomin device : ownListFromManage) { - String key = device.getCompanyId() + "_" + device.getMaName(); + String key = device.getCompanyId() + "_" + device.getMaNameId(); ownIndex.computeIfAbsent(key, k -> new ArrayList<>()).add(device); } /*去ma_dev_info装置配置表里面获取可有重复装备的数据*/ for (NewOwnerdomin dev : ownListFromDevInfo) { - String key = dev.getCompanyId() + "_" + dev.getMaName(); + String key = dev.getCompanyId() + "_" + dev.getTypeId(); List existList = ownIndex.get(key); if (existList != null && !existList.isEmpty()) { for (Ownerdomin device : existList) { @@ -124,10 +124,11 @@ public class SysDeptServiceImpl implements ISysDeptService { String company = config.getCompanyName(); String type = config.getConfigType().toPlainString(); // 0:线路 1:电缆 2:变电 String maName = config.getDeptName(); + String typeId = config.getTypeId(); BigDecimal orderCount = config.getOrderCount(); Long configCompanyId = config.getCompanyId(); - String key = configCompanyId + "_" + maName; + String key = configCompanyId + "_" + typeId; List sameCompanyDevices = ownIndex.getOrDefault(key, Collections.emptyList()); BigDecimal score = computeScoreByMaName(orderCount, sameCompanyDevices, config,type); BigDecimal newscore = null; @@ -179,7 +180,7 @@ public class SysDeptServiceImpl implements ISysDeptService { // 5.x:补充未出现在 configList 的公司/设备项 Set configKeys = configList.stream() - .map(c -> c.getCompanyId() + "_" + c.getDeptName()) + .map(c -> c.getCompanyId() + "_" + c.getTypeId()) .collect(Collectors.toSet()); for (Map.Entry> entry : ownIndex.entrySet()) { @@ -361,13 +362,13 @@ public class SysDeptServiceImpl implements ISysDeptService { // 3. 建立原有设备索引,key = companyId + "_" + name Map indexMap = new LinkedHashMap<>(); for (EquipmentDetail item : equipmentDetails) { - String key = item.getCompanyId() + "_" + item.getName(); + String key = item.getCompanyId() + "_" + item.getTypeId(); indexMap.put(key, item); } // 4. 遍历 devInfoList,合并到 equipmentDetails for (NewmydevInfo devItem : devInfoList) { - String key = devItem.getCompanyId() + "_" + devItem.getTypeName(); + String key = devItem.getCompanyId() + "_" + devItem.getTypeId() ; EquipmentDetail existing = indexMap.get(key); if (existing != null) { diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml index 1b5191f..afed426 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/equipment/SysDeptMapper.xml @@ -105,6 +105,7 @@ resultType="com.bonus.material.equipment.domain.DeptConfigRateSummary"> SELECT my.type_name AS deptName, + my.type_id AS typeId, sd.dept_name AS companyName, grouped.dept_id AS companyId, grouped.config_type AS configType, diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml index 8dfd95c..6ce3417 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml @@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" md.own_co AS companyId, sd.dept_name as companyName, mt2.type_name AS maName, + mt2.type_id as typeId, COUNT(*) AS maNum FROM ma_dev_info md From 252136cfeb8e2a16da1b8fd2f2bf040256fe7d67 Mon Sep 17 00:00:00 2001 From: lizhenhua <1075222162@qq.com> Date: Sat, 12 Jul 2025 14:37:38 +0800 Subject: [PATCH 14/15] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=AE=A1=E7=90=86=20yo?= =?UTF-8?q?uhua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/mapper/BmFileInfoMapper.java | 3 + .../bonus/material/owner/domain/FileInfo.java | 13 +++++ .../material/owner/domain/Ownerdomin.java | 6 ++ .../material/owner/mapper/OwnerMapper.java | 2 + .../owner/service/impl/OwnerServiceImpl.java | 25 ++++++++- .../material/device/BmFileInfoMapper.xml | 36 ++++++++---- .../mapper/material/owner/OwnerMapper.xml | 56 ++++++++++++++----- 7 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/FileInfo.java diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/BmFileInfoMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/BmFileInfoMapper.java index c905c02..3a7ecc7 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/BmFileInfoMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/device/mapper/BmFileInfoMapper.java @@ -3,6 +3,7 @@ package com.bonus.material.device.mapper; import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.biz.domain.TypeInfo; import com.bonus.material.device.domain.MaDevQc; +import com.bonus.material.owner.domain.Ownerdomin; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -86,4 +87,6 @@ public interface BmFileInfoMapper { Integer deleteBmFileInfoByFileId(@Param("fileId") Integer fileId, @Param("fileType") Integer fileType); List getInfoByMaIdAndTaskId(MaDevQc qc); + + int insertRentInfo(Ownerdomin ownerdomin); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/FileInfo.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/FileInfo.java new file mode 100644 index 0000000..634cde5 --- /dev/null +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/FileInfo.java @@ -0,0 +1,13 @@ +package com.bonus.material.owner.domain; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class FileInfo { + @ApiModelProperty(value = "文件名称") + private String fileName; + + @ApiModelProperty(value = "文件 URL") + private String fileUrl; +} diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java index 5a69029..efd5f77 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/domain/Ownerdomin.java @@ -2,11 +2,13 @@ package com.bonus.material.owner.domain; import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.core.annotation.Excel; +import com.bonus.material.device.domain.vo.DevInfoPropertyVo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -58,5 +60,9 @@ public class Ownerdomin { private BigDecimal orderCount; + @ApiModelProperty(value = "文件列表") + private List mainFileList = new ArrayList<>(); + + } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/mapper/OwnerMapper.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/mapper/OwnerMapper.java index ef54380..2f72fd9 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/mapper/OwnerMapper.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/mapper/OwnerMapper.java @@ -18,4 +18,6 @@ public interface OwnerMapper { Integer del(Ownerdomin ownerdomin); List listGrouped(); + + void deleteFileInfo(Integer id); } diff --git a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/service/impl/OwnerServiceImpl.java b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/service/impl/OwnerServiceImpl.java index 38a5f09..f87dbe7 100644 --- a/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/service/impl/OwnerServiceImpl.java +++ b/bonus-modules/bonus-material-mall/src/main/java/com/bonus/material/owner/service/impl/OwnerServiceImpl.java @@ -1,5 +1,6 @@ package com.bonus.material.owner.service.impl; +import com.bonus.common.biz.domain.BmFileInfo; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.bean.BeanUtils; @@ -7,6 +8,8 @@ import com.bonus.common.core.utils.bean.BeanValidators; import com.bonus.common.security.utils.SecurityUtils; import com.bonus.material.device.domain.DevInfo; import com.bonus.material.device.domain.dto.DevInfoImpDto; +import com.bonus.material.device.mapper.BmFileInfoMapper; +import com.bonus.material.owner.domain.FileInfo; import com.bonus.material.owner.domain.Ownerdomin; import com.bonus.material.owner.mapper.OwnerMapper; import com.bonus.material.owner.service.OwnerService; @@ -26,6 +29,9 @@ public class OwnerServiceImpl implements OwnerService { @Resource private OwnerMapper ownerMapper; + @Resource + private BmFileInfoMapper bmFileInfoMapper; + @Resource protected Validator validator; @@ -41,12 +47,27 @@ public class OwnerServiceImpl implements OwnerService { public Integer add(Ownerdomin ownerdomin) { ownerdomin.setCreator(SecurityUtils.getLoginUser().getSysUser().getUserId()+""); ownerdomin.setCompanyId(SecurityUtils.getLoginUser().getSysUser().getCompanyId()); - return ownerMapper.add(ownerdomin); + Integer add = ownerMapper.add(ownerdomin); + //判断是否存在图片等 + if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) { + bmFileInfoMapper.insertRentInfo(ownerdomin); + } + return add; } @Override public Integer edit(Ownerdomin ownerdomin) { - return ownerMapper.edit(ownerdomin); + Integer edit = ownerMapper.edit(ownerdomin); + //删除对应保存到表里面的信息 + ownerMapper.deleteFileInfo(ownerdomin.getId()); + if (ownerdomin.getMainFileList() != null && ownerdomin.getMainFileList().size() > 0) { + BmFileInfo bmFileInfo = new BmFileInfo(); + bmFileInfo.setTaskId(Long.valueOf(ownerdomin.getId())); + bmFileInfo.setFileName(bmFileInfo.getFileName()); + bmFileInfo.setFileUrl(bmFileInfo.getFileUrl()); + bmFileInfoMapper.insertRentInfo(ownerdomin); + } + return edit; } @Override diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/BmFileInfoMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/BmFileInfoMapper.xml index ab466c5..20d12b5 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/BmFileInfoMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/device/BmFileInfoMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and file_type = #{fileType} - + @@ -67,11 +67,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, task_type, task_id, model_id, name fileName, url fileUrl, file_type, create_by, create_time from bm_file_info - WHERE + WHERE model_id = #{maId} - and task_id = #{id} - and task_type = 17 - and file_type = 4 + and task_id = #{id} + and task_type = 17 + and file_type = 4 @@ -85,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" file_type, create_by, create_time - + #{taskType}, #{taskId}, @@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{fileType}, #{createBy}, now() - + @@ -114,6 +114,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) + + INSERT INTO bm_rent_info(task_id,name,url,create_time) + VALUES + + ( + #{id}, + #{item.fileName}, + #{item.fileUrl}, + now() + ) + + update bm_file_info @@ -135,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from bm_file_info where id in + delete from bm_file_info where id in #{id} @@ -165,4 +177,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from bm_file_info where id = #{fileId} and task_type = 17 and file_type = #{fileType} - \ No newline at end of file + diff --git a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml index 6ce3417..68f5bcb 100644 --- a/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml +++ b/bonus-modules/bonus-material-mall/src/main/resources/mapper/material/owner/OwnerMapper.xml @@ -3,7 +3,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + + + + + + + + + + + + + + + insert into ma_own_manage( ma_type, ma_name, model_id, ma_model, ma_num, creator, remark,company_id,type) @@ -25,23 +41,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" is_active =1 where id = #{id} - - + SELECT + id, + name AS fileName, + url AS fileUrl + FROM + bm_rent_info + WHERE + task_id = #{id} + + SELECT COUNT(DISTINCT publish_company) FROM ma_lease_info + + + +