首页接口

This commit is contained in:
cwchen 2025-01-17 19:35:40 +08:00
parent cf7235f858
commit 51c246044f
8 changed files with 165 additions and 22 deletions

View File

@ -11,10 +11,7 @@ package com.bonus.gzcar.business.backstage.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.bonus.gzcar.business.backstage.entity.BackParamsDto;
import com.bonus.gzcar.business.backstage.entity.HomeDispatchDetailVo;
import com.bonus.gzcar.business.backstage.entity.HomePlanDetailVo;
import com.bonus.gzcar.business.backstage.entity.HomeProDetailVo;
import com.bonus.gzcar.business.backstage.entity.*;
import com.bonus.gzcar.business.backstage.service.HomeIndexService;
import com.bonus.gzcar.manager.annotation.DecryptAndVerify;
import com.bonus.gzcar.manager.core.entity.EncryptedReq;
@ -131,6 +128,43 @@ public class HomeIndexController {
}
}
@ApiOperation(value = "首页-二级页面-工程详情-需求计划详情")
@GetMapping("getProPlanDetails")
@DecryptAndVerify(decryptedClass = BackParamsDto.class)
public PageInfo<HomeProPlanDetailVo> getProPlanDetails(EncryptedReq<BackParamsDto> dto) {
PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
List<HomeProPlanDetailVo> list = service.getProPlanDetails(dto.getData());
return new PageInfo<>(list);
}
@ApiOperation(value = "首页-二级页面-工程详情-需求计划详情导出")
@PostMapping("exportProPlanDetails")
public void exportProPlanDetails(HttpServletResponse response, @RequestBody BackParamsDto dto) {
try {
List<HomeProPlanDetailVo> list = service.getProPlanDetails(dto);
final int[] num = {1};
list.forEach(vo -> {
vo.setSerialNum(num[0]);
if(Objects.equals(vo.getDispatchStatus(),"1")){
vo.setDispatchStatus("待派车");
}else if(Objects.equals(vo.getDispatchStatus(),"2")){
vo.setDispatchStatus("已派车");
}
num[0]++;
});
ExportParams exportParams = new ExportParams("需求计划详情", "需求计划详情", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, HomeProPlanDetailVo.class, list);
response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("需求计划详情" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error(e.toString(), e);
}
}
@ApiOperation(value = "首页-二级页面-需求计划详情")
@GetMapping("getPlanDetails")
@DecryptAndVerify(decryptedClass = BackParamsDto.class)
@ -149,7 +183,7 @@ public class HomeIndexController {
list.forEach(vo -> {
vo.setSerialNum(num[0]);
if(Objects.equals(vo.getDispatchStatus(),"1")){
vo.setDispatchStatus("派车");
vo.setDispatchStatus("派车");
}else if(Objects.equals(vo.getDispatchStatus(),"2")){
vo.setDispatchStatus("已派车");
}

View File

@ -40,5 +40,7 @@ public class BackParamsDto {
private String startTime;
/**结束日期*/
private String endTime;
/**工程ID*/
private String proId;
}

View File

@ -17,7 +17,7 @@ public class HomeDispatchDetailVo {
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int serialNum;
/**车辆类型 1.车辆 2.吊车*/
private int type;
private int typeName;
/**名称*/
@Excel(name = "名称", width = 20.0, orderNum = "1")
private String name;

View File

@ -0,0 +1,44 @@
package com.bonus.gzcar.business.backstage.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/**
* @className:HomeProDetailVo
* @author:cwchen
* @date:2025-01-16-16:34
* @version:1.0
* @description:首页-工程详情-需求计划详情-vo
*/
@Data
public class HomeProPlanDetailVo {
/**序号*/
@Excel(name = "序号", width = 10.0, orderNum = "0")
private int serialNum;
/**车辆类型 1.车辆 2.吊车*/
private int typeName;
/**计划id*/
private Long planId;
/**需求计划编号*/
@Excel(name = "需求计划编号", width = 20.0, orderNum = "1")
private String code;
/**申请人*/
@Excel(name = "申请人", width = 20.0, orderNum = "2")
private String userName;
/**申请时间*/
@Excel(name = "申请时间", width = 20.0, orderNum = "3")
private String applyTime;
/**备注*/
@Excel(name = "备注", width = 20.0, orderNum = "4")
private String remark;
/**派车状态*/
@Excel(name = "派车状态", width = 20.0, orderNum = "5")
private String dispatchStatus;
/**派车数量*/
@Excel(name = "派车数量", width = 20.0, orderNum = "6")
private String dispatchNum;
/**采购金额*/
@Excel(name = "采购金额", width = 20.0, orderNum = "7")
private double money;
}

View File

@ -107,6 +107,15 @@ public interface HomeIndexMapper {
*/
List<HomeProDetailVo> getProDetails(BackParamsDto dto);
/**
* 首页-二级页面-工程详情-需求计划详情
* @param dto
* @return List<HomeProPlanDetailVo>
* @author cwchen
* @date 2025/1/17 18:51
*/
List<HomeProPlanDetailVo> getProPlanDetails(BackParamsDto dto);
/**
* 首页-二级页面-需求计划详情
* @param dto
@ -125,7 +134,8 @@ public interface HomeIndexMapper {
*/
List<HomeDispatchDetailVo> getDispatchDetails(BackParamsDto dto);
IndexVo getPayMoney(@Param("params") BackParamsDto dto);
IndexVo getPayMoney(BackParamsDto dto);
IndexVo getNoPayMoney(BackParamsDto dto);
IndexVo getNoPayMoney(@Param("params") BackParamsDto dto);
}

View File

@ -1,9 +1,6 @@
package com.bonus.gzcar.business.backstage.service;
import com.bonus.gzcar.business.backstage.entity.BackParamsDto;
import com.bonus.gzcar.business.backstage.entity.HomeDispatchDetailVo;
import com.bonus.gzcar.business.backstage.entity.HomePlanDetailVo;
import com.bonus.gzcar.business.backstage.entity.HomeProDetailVo;
import com.bonus.gzcar.business.backstage.entity.*;
import com.bonus.gzcar.manager.webResult.ServerResponse;
import java.util.List;
@ -89,6 +86,16 @@ public interface HomeIndexService {
*/
List<HomeProDetailVo> getProDetails(BackParamsDto data);
/**
* 首页-二级页面-工程详情-需求计划详情
* @param data
* @return List<HomeProPlanDetailVo>
* @author cwchen
* @date 2025/1/17 18:49
*/
List<HomeProPlanDetailVo> getProPlanDetails(BackParamsDto data);
/**
* 首页-二级页面-需求计划详情
* @param data
@ -106,4 +113,5 @@ public interface HomeIndexService {
* @date 2025/1/17 14:17
*/
List<HomeDispatchDetailVo> getDispatchDetails(BackParamsDto data);
}

View File

@ -100,17 +100,17 @@ public class HomeIndexServiceImpl implements HomeIndexService {
Future<List<Object>> future5 = testTaskExecutor.submit(() -> {
log.info("数据概览-已付款金额{}", Thread.currentThread().getName());
List<Object> dataList = new ArrayList<>(2);
IndexVo indexVo = mapper.getPayMoney(dto);
dataList.add(0, indexVo.getMoney());
dataList.add(1, indexVo.getNum());
IndexVo indexVo = mapper.getPayMoney(dto);
dataList.add(0, indexVo != null ? Double.parseDouble(indexVo.getMoney()) : 0);
dataList.add(1, indexVo != null ? Integer.parseInt(indexVo.getNum()) : 0);
return dataList;
});
Future<List<Object>> future6 = testTaskExecutor.submit(() -> {
log.info("数据概览-应付款金额{}", Thread.currentThread().getName());
IndexVo indexVo = mapper.getNoPayMoney(dto);
IndexVo indexVo = mapper.getNoPayMoney(dto);
List<Object> dataList = new ArrayList<>(2);
dataList.add(0, indexVo.getMoney());
dataList.add(1, indexVo.getNum());
dataList.add(0, indexVo != null ? Double.parseDouble(indexVo.getMoney()) : 0);
dataList.add(1, indexVo != null ? Integer.parseInt(indexVo.getNum()) : 0);
return dataList;
});
fList = future.get();
@ -351,6 +351,20 @@ public class HomeIndexServiceImpl implements HomeIndexService {
return list;
}
@Override
public List<HomeProPlanDetailVo> getProPlanDetails(BackParamsDto dto) {
List<HomeProPlanDetailVo> list = new ArrayList<>();
try {
list = mapper.getProPlanDetails(dto);
for (HomeProPlanDetailVo vo : list) {
// 金额待计算
}
} catch (Exception e) {
log.error(e.toString(), e);
}
return list;
}
@Override
public List<HomePlanDetailVo> getPlanDetails(BackParamsDto dto) {
List<HomePlanDetailVo> list = new ArrayList<>();

View File

@ -152,6 +152,35 @@
ELSE '1' END = #{dispatchStatus})
</if>
</select>
<!--首页-二级页面-工程详情-需求计划详情-->
<select id="getProPlanDetails" resultType="com.bonus.gzcar.business.backstage.entity.HomeProPlanDetailVo">
SELECT cpa.id AS planId,
cpa.pro_id AS proId,
bp.name AS proName,
CASE WHEN cpa.dispatch_num = 0 THEN '1'
WHEN cpa.dispatch_num > 0 THEN '2'
END AS dispatchStatus,
cpa.code,
DATE_FORMAT(cpa.create_time,'%Y-%m-%d') AS appLyTime,
cpa.user_name AS userName,
cpa.remark,
cpa.dispatch_num AS dispatchNum,
cpa.type AS typeName
FROM car_plan_apply cpa
LEFT JOIN bm_project bp ON cpa.pro_id = bp.bid_id
<where>
AND cpa.pro_id = #{proId}
<if test="code!=null and code!=''">
AND INSTR(cpa.code,#{code}) > 0
</if>
<if test="dispatchStatus!='' and dispatchStatus!=null">
AND (CASE WHEN cpa.dispatch_num = 0 THEN '1'
WHEN cpa.dispatch_num > 0 THEN '2'
END = #{dispatchStatus})
</if>
AND cpa.`status` = '2' AND cpa.status_type = '1'
</where>
</select>
<!--首页-二级页面-需求计划详情-->
<select id="getPlanDetails" resultType="com.bonus.gzcar.business.backstage.entity.HomePlanDetailVo">
SELECT cpa.id AS planId,
@ -205,10 +234,11 @@
SELECT count(csp.plan_id) num,sum(csp.money) money
from car_slt_plan csp
left join car_slt_apply sla on csp.slt_id=sla.id
where sla.id is not null
<where>
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
AND DATE_FORMAT(sla.create_time,'%Y-%m-%d') BETWEEN #{params.startTime} AND #{params.endTime}
AND DATE_FORMAT(sla.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
<select id="getNoPayMoney" resultType="com.bonus.gzcar.business.backstage.entity.IndexVo">
SELECT sum(a.money),sum(a.num)
@ -218,7 +248,7 @@
left join car_slt_details csd on csd.out_id=cpo.id
where csd.id is null AND cpo.status=1
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{params.startTime} AND #{params.endTime}
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
union ALL
SELECT 0,count(DISTINCT cpo.apply_id) num
@ -226,8 +256,9 @@
left join car_slt_details csp on cpo.id=csp.out_id
where csp.id is null AND cpo.status=1
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{params.startTime} AND #{params.endTime}
AND DATE_FORMAT(cpo.create_time,'%Y-%m-%d') BETWEEN #{startTime} AND #{endTime}
</if>
)a
</select>
</mapper>