大屏页面优化接口开发
This commit is contained in:
parent
6f2587611c
commit
e46bca6cdb
|
|
@ -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 = "单位不能为空")
|
||||
|
|
|
|||
|
|
@ -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<DevInfoVo> getMaTypeLeasingNumList(DevInfoVo devInfoVo);
|
||||
|
||||
List<DevInfoVo> getDevLeasingNumList(DevInfoVo devInfoVo);
|
||||
|
||||
Integer getRentToalNum();
|
||||
|
||||
List<LeaseInfo> getDevLeaseCount();
|
||||
|
||||
List<RentInfo> getDevRentCount();
|
||||
|
||||
List<DevInfoVo> getMaTypeLeasingDetail(DevInfoVo devInfoVo);
|
||||
|
||||
List<SysDept> getDemandUnit(DevInfoVo devInfoVo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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> leaseInfo = devInfoMapper.getDevLeaseCount();
|
||||
List<RentInfo> 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<DevInfoVo> list = devInfoMapper.getMaTypeLeasingNumList(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
@ApiOperation("装备租赁-累计数二级页面")
|
||||
@GetMapping("/getMaTypeLeasingDetail")
|
||||
public AjaxResult getMaTypeLeasingDetail(DevInfoVo devInfoVo) {
|
||||
startPage();
|
||||
List<DevInfoVo> list = devInfoMapper.getMaTypeLeasingDetail(devInfoVo);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
@ApiOperation("装备需求-需求单位二级页面")
|
||||
@GetMapping("/getDemandUnit")
|
||||
public AjaxResult getDemandUnit(DevInfoVo devInfoVo) {
|
||||
startPage();
|
||||
List<SysDept> 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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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<LeaseInfo> LeaseInfos;
|
||||
private List<RentInfo> RentInfos;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -183,4 +183,6 @@ public interface MaLeaseInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaDevRateInfo> getReturnDev(MaDevRateInfo dto);
|
||||
|
||||
Integer getDemandUnit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1026,14 +1026,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getLeaseCountByTypeName" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
select mt3.type_name, count(1) as device_count
|
||||
select mt1.type_name, count(1) as device_count
|
||||
from ma_order_details modd
|
||||
LEFT JOIN ma_dev_info mdi on modd.ma_id=mdi.ma_id
|
||||
LEFT JOIN ma_type mt4 on mt4.type_id=mdi.type_id
|
||||
LEFT JOIN ma_type mt3 on mt3.type_id=mt4.parent_id
|
||||
where mt3.type_name is not null
|
||||
LEFT JOIN ma_type mt2 on mt3.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_type mt1 on mt2.parent_id = mt1.type_id
|
||||
where mt1.type_name is not null
|
||||
and modd.order_status != 0 and modd.order_status != 99
|
||||
group by type_name
|
||||
group by mt1.type_name
|
||||
</select>
|
||||
|
||||
<select id="getDeviceShareRanking" resultType="com.bonus.material.device.domain.DevInfo">
|
||||
|
|
@ -1327,4 +1329,65 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mdi.is_active = '1'
|
||||
AND mdi.ma_status = '3'
|
||||
</select>
|
||||
<select id="getRentToalNum" resultType="java.lang.Integer">
|
||||
select sum(num)
|
||||
from ma_order_details
|
||||
where order_status NOT IN ( 0 , 99 )
|
||||
</select>
|
||||
<select id="getDevLeaseCount" resultType="com.bonus.material.largeScreen.entity.LeaseInfo">
|
||||
SELECT
|
||||
sum(hh.num) leaseNum,
|
||||
sd.dept_name leaseCompanyName
|
||||
FROM
|
||||
ma_order_info moi
|
||||
LEFT JOIN ma_order_details hh ON moi.order_id = hh.order_id
|
||||
LEFT JOIN sys_dept sd on moi.buyer_company = sd.dept_id
|
||||
WHERE hh.order_status NOT IN ( 0, 99 )
|
||||
GROUP BY moi.buyer_company
|
||||
</select>
|
||||
<select id="getDevRentCount" resultType="com.bonus.material.largeScreen.entity.RentInfo">
|
||||
SELECT
|
||||
sum( hh.num ) rentNum,
|
||||
sd.dept_name rentCompanyName
|
||||
FROM
|
||||
ma_order_details hh
|
||||
LEFT JOIN ma_dev_info mdi ON hh.ma_id = mdi.ma_id
|
||||
LEFT JOIN sys_dept sd ON mdi.own_co = sd.dept_id
|
||||
WHERE
|
||||
hh.order_status NOT IN ( 0, 99 )
|
||||
GROUP BY
|
||||
mdi.own_co
|
||||
</select>
|
||||
<select id="getMaTypeLeasingDetail" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
mdi.device_name AS deviceName,
|
||||
mt.type_name AS modelName,
|
||||
mdi.identify_code AS identifyCode,
|
||||
md.order_id AS orderId,
|
||||
sd.dept_name AS comName,
|
||||
mdi.person AS person,
|
||||
sd2.dept_name AS lessee,
|
||||
su.user_name AS lesseePerson,
|
||||
md.rent_begin_time AS startTime,
|
||||
md.rent_end_time AS endTime,
|
||||
md.costs AS cost
|
||||
FROM
|
||||
ma_order_details md
|
||||
LEFT JOIN ma_dev_info mdi ON mdi.ma_id = md.ma_id
|
||||
LEFT JOIN ma_type mt ON mdi.type_id = mt.type_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.own_co
|
||||
LEFT JOIN ma_order_info moi ON moi.order_id = md.order_id
|
||||
LEFT JOIN sys_dept sd2 ON moi.buyer_company = sd2.dept_id
|
||||
LEFT JOIN sys_user su ON moi.buyer_id = su.user_id
|
||||
WHERE
|
||||
mdi.is_active = '1'
|
||||
</select>
|
||||
<select id="getDemandUnit" resultType="com.bonus.common.biz.domain.SysDept">
|
||||
SELECT DISTINCT
|
||||
sd.dept_name deptName,
|
||||
sd.create_time createTime
|
||||
FROM
|
||||
ma_lease_info mli
|
||||
LEFT JOIN sys_dept sd ON mli.publish_company = sd.dept_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -683,4 +683,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
md.rent_over_time DESC
|
||||
</select>
|
||||
<select id="getDemandUnit" resultType="java.lang.Integer">
|
||||
SELECT COUNT(DISTINCT publish_company) FROM ma_lease_info
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue