This commit is contained in:
parent
0597901404
commit
1824735546
|
|
@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
|
|
@ -189,10 +190,20 @@ public class MaterialBackApplyInfoController extends BaseController {
|
|||
@ApiOperation("导出工器具退料记录查询")
|
||||
@PostMapping("/exportBackInfoDetails")
|
||||
public void exportBackInfoDetails(HttpServletResponse response, MaterialBackApplyTotalInfo bean) {
|
||||
String fileName = "退料记录";
|
||||
if (bean.getStartTime() != null && bean.getEndTime() != null) {
|
||||
fileName = "退料记录"+ "(退料时间" +bean.getStartTime() + "至" + bean.getEndTime()+ ")";
|
||||
}
|
||||
bean.setIsExport(0);
|
||||
List<MaterialBackApplyTotalInfo> list = materialBackApplyInfoService.getBackInfoDetails(bean);
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSeq(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialBackApplyTotalInfo> util = new ExcelUtil<>(MaterialBackApplyTotalInfo.class);
|
||||
util.exportExcel(response, list, "综合查询--工器具退料记录查询");
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "班组退料记录汇总" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, fileName, title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -96,25 +96,14 @@ public class MaterialMachineController extends BaseController {
|
|||
@PostMapping("/exportRetainedEquipmentList")
|
||||
public void exportRetainedEquipmentList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
|
||||
if (list.size()>0){
|
||||
for (MaterialRetainedEquipmentInfo item : list) {
|
||||
// 根据 unitValue 决定 allNumStr 的格式
|
||||
if (item.getAllNum() != null) {
|
||||
if ("1".equals(item.getUnitValue())) {
|
||||
// 显示小数(例如保留2位)
|
||||
item.setAllNumStr(item.getAllNum().setScale(3, BigDecimal.ROUND_HALF_UP).toString());
|
||||
} else {
|
||||
// 不显示小数,转为整数
|
||||
item.setAllNumStr(item.getAllNum().setScale(0, BigDecimal.ROUND_HALF_UP).toString());
|
||||
}
|
||||
} else {
|
||||
// 处理 null 情况
|
||||
item.setAllNumStr("");
|
||||
}
|
||||
}
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSeq(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialRetainedEquipmentInfo> util = new ExcelUtil<>(MaterialRetainedEquipmentInfo.class);
|
||||
util.exportExcel(response, list, "综合查询--保有设备总量查询");
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "工器具台账" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, "工器具台账", title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -583,6 +572,7 @@ public class MaterialMachineController extends BaseController {
|
|||
dto.setSupplyNum(retainedEquipmentInfo.getSupplyNum());
|
||||
dto.setStoreNum(retainedEquipmentInfo.getStoreNum());
|
||||
dto.setUseNum(retainedEquipmentInfo.getUseNum());
|
||||
dto.setBackNum(retainedEquipmentInfo.getBackNum());
|
||||
}
|
||||
return AjaxResult.success(dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ public class MaterialBackApplyTotalInfo implements Serializable {
|
|||
/** ID */
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5, sort = 1)
|
||||
private Integer seq;
|
||||
|
||||
@ApiModelProperty(value = "工器具名称")
|
||||
@Excel(name = "工器具名称")
|
||||
private String materialName;
|
||||
|
|
@ -82,7 +86,6 @@ public class MaterialBackApplyTotalInfo implements Serializable {
|
|||
@ApiModelProperty(value = "退料人")
|
||||
private String backPerson;
|
||||
|
||||
@Excel(name = "操作人")
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,10 @@ public class MaterialProvideNumInfo {
|
|||
@Excel(name = "实际供应数量",align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||
private BigDecimal supplyNum;
|
||||
|
||||
@ApiModelProperty(value = "已退数量")
|
||||
@Excel(name = "已退数量",align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||
private BigDecimal backNum;
|
||||
|
||||
@ApiModelProperty(value = "在库数量")
|
||||
@Excel(name = "在库数量",align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
|
||||
private BigDecimal storeNum;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ public class MaterialRetainedEquipmentInfo {
|
|||
@ApiModelProperty(value = "是否app 0 是,1 否")
|
||||
private Integer isApp;
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5, sort = 1)
|
||||
private Integer seq;
|
||||
|
||||
@ApiModelProperty(value = "是否导出 0 是,1 否")
|
||||
private Integer isExport;
|
||||
|
||||
|
|
@ -87,16 +91,18 @@ public class MaterialRetainedEquipmentInfo {
|
|||
private BigDecimal usNum;
|
||||
|
||||
@ApiModelProperty(value = "数量")
|
||||
@Excel(name = "数量", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal allNum;
|
||||
|
||||
@Excel(name = "数量", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
//@Excel(name = "数量", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private String allNumStr;
|
||||
|
||||
@ApiModelProperty(value = "购置单价")
|
||||
@Excel(name = "购置单价", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@ApiModelProperty(value = "投入总价值")
|
||||
//@Excel(name = "总保有量资产(万元)")
|
||||
@ApiModelProperty(value = "原值")
|
||||
@Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "五年以内成新率")
|
||||
|
|
|
|||
|
|
@ -685,23 +685,21 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
|
|||
list = list.stream()
|
||||
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
|
||||
.collect(Collectors.toList());
|
||||
} /*else {
|
||||
// 材料员权限
|
||||
list = filterInfo(list, username);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (MaterialBackApplyTotalInfo materialRetainedEquipmentInfo : list) {
|
||||
/*for (MaterialBackApplyTotalInfo materialRetainedEquipmentInfo : list) {
|
||||
// 根据班组名称查询分包单位
|
||||
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
|
||||
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
|
||||
}
|
||||
if(info.getSubUnitName()!=null && !info.getSubUnitName().equals("") && !list.isEmpty()){
|
||||
if(StringUtils.isNotBlank(info.getSubUnitName()) && CollectionUtils.isNotEmpty(list)){
|
||||
// 根据传入的SubUnitName过滤列表
|
||||
list = list.stream()
|
||||
.filter(item -> com.alibaba.nacos.common.utils.StringUtils.equals(item.getSubUnitName(), info.getSubUnitName()))
|
||||
.filter(item -> item.getSubUnitName() != null
|
||||
&& item.getSubUnitName().equals(info.getSubUnitName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}*/
|
||||
|
||||
// 查询所有未结算的工程
|
||||
List<String> projectIdList = mapper.getUnsettledProId();
|
||||
|
|
|
|||
|
|
@ -1353,6 +1353,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
public List<MaterialProvideNumInfo> getDemandAndSupply(MaterialRetainedEquipmentInfo bean) {
|
||||
BigDecimal totalBusinessNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalSupplyNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalBackNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalStoreNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
BigDecimal totalUseNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
|
|
@ -1439,7 +1440,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
|
||||
// 4. 并行流处理大集合,计算总和并设置record的businessNum(内存操作并行化)
|
||||
// 用数组存储四个总和(比对象更高效,减少gc)
|
||||
BigDecimal[] totals = new BigDecimal[4];
|
||||
BigDecimal[] totals = new BigDecimal[5];
|
||||
Arrays.fill(totals, BigDecimal.ZERO);
|
||||
|
||||
recordList.parallelStream().forEach(record -> {
|
||||
|
|
@ -1455,6 +1456,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
totals[1] = totals[1].add(record.getSupplyNum());
|
||||
totals[2] = totals[2].add(record.getStoreNum());
|
||||
totals[3] = totals[3].add(record.getUseNum());
|
||||
totals[4] = totals[4].add(record.getBackNum());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1463,6 +1465,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
totalSupplyNum = totals[1];
|
||||
totalStoreNum = totals[2];
|
||||
totalUseNum = totals[3];
|
||||
totalBackNum = totals[4];
|
||||
|
||||
if (bean.getIsExport() == 0) {
|
||||
MaterialProvideNumInfo info = new MaterialProvideNumInfo();
|
||||
|
|
@ -1470,6 +1473,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
info.setSupplyNum(totalSupplyNum);
|
||||
info.setStoreNum(totalStoreNum);
|
||||
info.setUseNum(totalUseNum);
|
||||
info.setBackNum(totalBackNum);
|
||||
info.setUnit("合计");
|
||||
recordList.add(0, info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -655,7 +655,8 @@
|
|||
bai.`code` AS code,
|
||||
bp.external_id AS externalId,
|
||||
bp.imp_unit AS impUnit,
|
||||
bt.bzz_idcard AS idCard
|
||||
bt.bzz_idcard AS idCard,
|
||||
bz.ssfbdw AS subUnitName
|
||||
FROM
|
||||
clz_back_check_details bcd
|
||||
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id
|
||||
|
|
@ -672,6 +673,8 @@
|
|||
LEFT JOIN bm_unit bt ON bt.unit_id = bagi.unit_id
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
AND bt.del_flag = '0'
|
||||
LEFT JOIN (select project_id, bzmc, ssfbdw from `micro-tool`.bzgl_bz where bz_status = '3'
|
||||
GROUP BY project_id, bzmc) bz ON bz.bzmc = bt.unit_name
|
||||
WHERE
|
||||
bcd.is_finished = 1
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
|
|
@ -686,6 +689,9 @@
|
|||
<if test="teamName != null and teamName != ''">
|
||||
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
and bz.ssfbdw = #{subUnitName}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
<![CDATA[and DATE_FORMAT( bcd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -1291,7 +1291,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ELSE
|
||||
'施工机具'
|
||||
END jiJuType,
|
||||
'1' as bzFlag
|
||||
'1' as bzFlag,
|
||||
mt.buy_price AS buyPrice,
|
||||
(IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0)) * mt.buy_price / 10000 AS totalPrice
|
||||
FROM ma_type mt
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
|
|
@ -1476,7 +1478,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.unit_value AS unitValue,
|
||||
bz.ssfbdw AS subUnitName,
|
||||
CASE mt.jiju_type WHEN 2 THEN '安全工器具' ELSE '施工机具' END jiJuType,
|
||||
'0' as bzFlag
|
||||
'0' as bzFlag,
|
||||
mt.buy_price AS buyPrice,
|
||||
SUM(IFNULL(sai.num, 0)) * mt.buy_price / 10000 AS totalPrice
|
||||
FROM
|
||||
clz_slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
|
|
@ -1987,6 +1991,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IFNULL(subquery1.usNum, 0)
|
||||
END AS useNum,
|
||||
IFNULL(subquery1.supplyNum, 0) AS supplyNum,
|
||||
IFNULL(subquery1.backNum, 0) AS backNum,
|
||||
subquery1.proCenter AS departName,
|
||||
subquery1.departName AS impUnitName,
|
||||
CASE mt.manage_type
|
||||
|
|
@ -2015,6 +2020,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt2.type_id AS thirdTypeId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(CASE WHEN sai.`status` = '0' THEN IFNULL(sai.num, 0) ELSE 0 END) AS usNum,
|
||||
SUM(CASE WHEN sai.`status` = '1' THEN IFNULL(sai.num, 0) ELSE 0 END) AS backNum,
|
||||
SUM(IFNULL( sai.num, 0 )) AS supplyNum,
|
||||
bp.pro_name as proName,
|
||||
bp.pro_id as proId,
|
||||
|
|
@ -2179,6 +2185,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
subquery1.proId,
|
||||
mt.type_id
|
||||
ORDER BY
|
||||
subquery1.proId
|
||||
DESC
|
||||
</select>
|
||||
|
||||
<select id="getLeaseDemandNum" resultType="com.bonus.material.clz.domain.vo.MaterialProvideNumInfo">
|
||||
|
|
@ -2350,7 +2359,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
'编码'
|
||||
ELSE
|
||||
'数量'
|
||||
END manageType
|
||||
END manageType,
|
||||
mt.buy_price AS buyPrice,
|
||||
SUM(IFNULL( sai.num, 0 )) * mt.buy_price / 10000 AS totalPrice
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
|
|
|
|||
Loading…
Reference in New Issue