导出优化
This commit is contained in:
parent
434a330191
commit
20f399eb35
|
|
@ -10,6 +10,7 @@ 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.clz.domain.back.MaterialBackExportVO;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyTotalInfo;
|
||||
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
|
||||
|
|
@ -51,6 +52,27 @@ public class MaterialBackApplyInfoController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出退料任务列表")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "退料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出退料任务")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MaterialBackApplyInfo backApplyInfo) {
|
||||
backApplyInfo.setIsExport(true);
|
||||
String fileName = "退料记录";
|
||||
if (backApplyInfo.getStartTime() != null && backApplyInfo.getEndTime() != null) {
|
||||
fileName = "退料记录"+ "(退料时间" +backApplyInfo.getStartTime() + "至" + backApplyInfo.getEndTime()+ ")";
|
||||
}
|
||||
List<MaterialBackApplyInfo> list = materialBackApplyInfoService.selectBackApplyInfoList(backApplyInfo);
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSerialNumber(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialBackApplyInfo> util = new ExcelUtil<>(MaterialBackApplyInfo.class);
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "班组退料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, fileName, title);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询总站点退料记录数据
|
||||
* @param backApplyInfo
|
||||
|
|
@ -274,4 +296,22 @@ public class MaterialBackApplyInfoController extends BaseController {
|
|||
public AjaxResult getMachine(MaterialBackApplyInfo dto) {
|
||||
return materialBackApplyInfoService.getMachine(dto);
|
||||
}
|
||||
|
||||
@ApiOperation("导出材料站退料记录")
|
||||
@PostMapping("/exportBackInfoExcl")
|
||||
public void exportBackInfoExcl(HttpServletResponse response, MaterialBackApplyInfo bean) {
|
||||
String fileName = "退料记录";
|
||||
if (bean.getStartTime() != null && bean.getEndTime() != null) {
|
||||
fileName = "退料记录"+ "(退料时间" +bean.getStartTime() + "至" + bean.getEndTime()+ ")";
|
||||
}
|
||||
List<MaterialBackExportVO> list = materialBackApplyInfoService.exportBackInfoExcl(bean);
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSerialNumber(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialBackExportVO> util = new ExcelUtil<>(MaterialBackExportVO.class);
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "材料站退料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, fileName, title);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,9 +126,19 @@ public class MaterialLeaseInfoController extends BaseController {
|
|||
@SysLog(title = "领料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MaterialLeaseApplyInfo leaseApplyInfo) {
|
||||
String fileName = "领料记录";
|
||||
if (leaseApplyInfo.getStartTime() != null && leaseApplyInfo.getEndTime() != null) {
|
||||
fileName = "领料记录"+ "(领料时间" +leaseApplyInfo.getStartTime() + "至" + leaseApplyInfo.getEndTime()+ ")";
|
||||
}
|
||||
List<MaterialLeaseApplyInfo> list = materialLeaseInfoService.selectLeaseApplyInfoList(leaseApplyInfo);
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSerialNumber(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialLeaseApplyInfo> util = new ExcelUtil<>(MaterialLeaseApplyInfo.class);
|
||||
util.exportExcel(response, list, "领料任务数据");
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "班组领料记录" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, fileName, title);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public class MaterialBackApplyInfo implements Serializable {
|
|||
|
||||
private Boolean isExport;
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
|
||||
private Integer serialNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否退料 0 否,1 是")
|
||||
private Integer isBack;
|
||||
|
||||
|
|
@ -202,6 +206,7 @@ public class MaterialBackApplyInfo implements Serializable {
|
|||
private String backStyle;
|
||||
|
||||
@ApiModelProperty(value = "分公司")
|
||||
@Excel(name = "分公司",sort = 3)
|
||||
private String impUnitName;
|
||||
|
||||
@ApiModelProperty(value = "分包单位")
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import java.util.Date;
|
|||
public class MaterialBackExportVO {
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", isSequence = true, sort = 0)
|
||||
private String serialNumber;
|
||||
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
|
||||
private Integer serialNumber;
|
||||
|
||||
@Excel(name = "分公司")
|
||||
@ApiModelProperty(value = "分公司")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
|
||||
private Integer serialNumber;
|
||||
|
||||
@ApiModelProperty(value = "是否出库 0 否,1 是")
|
||||
private Integer isOut;
|
||||
|
||||
|
|
@ -64,7 +68,6 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
|
|||
@Excel(name = "领料班组",sort = 6)
|
||||
private String teamName;
|
||||
|
||||
@Excel(name = "租赁工程",sort = 7)
|
||||
@ApiModelProperty(value = "租赁工程")
|
||||
private String leaseProject;
|
||||
|
||||
|
|
@ -327,7 +330,6 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
|
|||
private String departName;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
@Excel(name = "工程名称")
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "是否人为修改:0:否,1:是")
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ public class MaterialRetainedEquipmentInfo {
|
|||
private String allNumStr;
|
||||
|
||||
@ApiModelProperty(value = "购置单价")
|
||||
@Excel(name = "购置单价", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
//@Excel(name = "购置单价", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@ApiModelProperty(value = "原值")
|
||||
@Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
//@Excel(name = "原值(万元)", cellType = Excel.ColumnType.NUMERIC,align = HorizontalAlignment.RIGHT)
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "五年以内成新率")
|
||||
|
|
@ -279,4 +279,7 @@ public class MaterialRetainedEquipmentInfo {
|
|||
|
||||
@ApiModelProperty(value = "是否班组标志(0 是 1 否)")
|
||||
private String bzFlag;
|
||||
|
||||
@ApiModelProperty(value = "租赁费用(万元)")
|
||||
private BigDecimal rentPrice;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.bonus.common.core.annotation.Excel;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
|
@ -83,4 +82,12 @@ public class MaterialTotalMentInfo {
|
|||
@ApiModelProperty(value = "绳索类在用数量")
|
||||
@Excel(name = "绳索类在用数量")
|
||||
private BigDecimal useRopeNum;
|
||||
|
||||
@ApiModelProperty(value = "投入费用(万元)")
|
||||
@Excel(name = "投入费用(万元)")
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
@ApiModelProperty(value = "租赁费用(万元)")
|
||||
@Excel(name = "租赁费用(万元)")
|
||||
private BigDecimal rentPrice;
|
||||
}
|
||||
|
|
@ -327,4 +327,11 @@ public interface MaterialMachineMapper {
|
|||
* @return
|
||||
*/
|
||||
List<MaterialStorageInfo> getSubList(MaterialStorageInfo bean);
|
||||
|
||||
/**
|
||||
* 租赁费用
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialRetainedEquipmentInfo> getLeaseInfo(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -896,6 +896,10 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
BigDecimal inCountNum = BigDecimal.ZERO;
|
||||
// 绳索类站内数量
|
||||
BigDecimal inRopeNum = BigDecimal.ZERO;
|
||||
// 投入总费用(万元),保留3位小数
|
||||
BigDecimal totalPrice = BigDecimal.ZERO;
|
||||
// 租赁总费用(万元),保留3位小数
|
||||
BigDecimal rentPrice = BigDecimal.ZERO;
|
||||
|
||||
// 获取在用量
|
||||
List<MaterialRetainedEquipmentInfo> useInfoList = materialMachineMapper.getUsInfoList(bean);
|
||||
|
|
@ -986,6 +990,13 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.count());
|
||||
// 合计list中的totalPrice费用至totalCost
|
||||
totalPrice = useInfoList.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getTotalPrice)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO)
|
||||
.setScale(3, RoundingMode.HALF_UP);
|
||||
} else {
|
||||
info.setProNum(0);
|
||||
info.setDepartNum(0);
|
||||
|
|
@ -1003,6 +1014,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
info.setCountNum(inCountNum.add(useCountNum).add(useCountNumSub));
|
||||
// 绳索类保有量
|
||||
info.setRopeNum(inRopeNum.add(useRopeNum).add(useRopeNumSub));
|
||||
// 投入费用(万元)
|
||||
info.setTotalPrice(totalPrice);
|
||||
/*// 租赁费用(万元)
|
||||
List<MaterialRetainedEquipmentInfo> leaseInfoList = materialMachineMapper.getLeaseInfo(bean);
|
||||
if (CollectionUtils.isNotEmpty(leaseInfoList)) {
|
||||
rentPrice = leaseInfoList.stream()
|
||||
.map(MaterialRetainedEquipmentInfo::getRentPrice)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal::add)
|
||||
.orElse(BigDecimal.ZERO)
|
||||
.setScale(3, RoundingMode.HALF_UP);
|
||||
} else {
|
||||
info.setRentPrice(BigDecimal.ZERO);
|
||||
}*/
|
||||
info.setRentPrice(rentPrice);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2577,4 +2577,98 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sai.type_id,
|
||||
sai.ma_id
|
||||
</select>
|
||||
|
||||
<select id="getLeaseInfo" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
|
||||
SELECT
|
||||
bp.pro_name as proName,
|
||||
bp.pro_id as proId,
|
||||
bp.external_id as externalId,
|
||||
bp.imp_unit AS impUnit,
|
||||
bu.bzz_idcard AS idCard,
|
||||
df.project_dept AS departName,
|
||||
sd.dept_name AS impUnitName,
|
||||
bu.unit_name AS teamName,
|
||||
mt.unit_name AS unit,
|
||||
mt.unit_value AS unitValue,
|
||||
CASE mt.jiju_type
|
||||
WHEN 2 THEN
|
||||
'安全工器具'
|
||||
ELSE
|
||||
'施工机具'
|
||||
END jiJuType,
|
||||
CASE mt.manage_type
|
||||
WHEN 0 THEN
|
||||
'编码'
|
||||
ELSE
|
||||
'数量'
|
||||
END manageType,
|
||||
(DATEDIFF(
|
||||
COALESCE(sai.end_time, NOW()), -- 若end_time为null则用当前时间
|
||||
sai.start_time
|
||||
) + 1) * sai.num * sai.lease_price / 10000 AS rentPrice,
|
||||
CASE
|
||||
WHEN bu.type_id IN (32, 33) THEN '分包直领'
|
||||
ELSE bz.ssfbdw
|
||||
END AS subUnitName
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id AND bz.bzmc = bu.unit_name
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.is_slt = '0'
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center like concat('%',#{departName},'%')
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND mt2.type_name like concat('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name like concat('%',#{typeModelName},'%')
|
||||
</if>
|
||||
<if test="projectIdList != null and projectIdList.size() > 0">
|
||||
AND bp.external_id in
|
||||
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND (
|
||||
(
|
||||
#{subUnitName} = '分包直领'
|
||||
AND bu.type_id IN (32, 33)
|
||||
)
|
||||
OR
|
||||
(
|
||||
#{subUnitName} != '分包直领'
|
||||
AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="teamName != null and teamName != ''">
|
||||
AND bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
|
||||
</if>
|
||||
GROUP BY
|
||||
sai.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue