This commit is contained in:
mashuai 2025-08-30 16:37:08 +08:00
parent 50ed57eaa6
commit 9454d969aa
17 changed files with 178 additions and 52 deletions

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -32,11 +33,11 @@ public class ScrapRecordInfo {
private String typeModelName; private String typeModelName;
@ApiModelProperty(value = "报废数量") @ApiModelProperty(value = "报废数量")
@Excel(name = "报废数量") @Excel(name = "报废数量", align = HorizontalAlignment.RIGHT)
private BigDecimal scrapNum; private BigDecimal scrapNum;
@ApiModelProperty(value = "购置单价") @ApiModelProperty(value = "购置单价")
@Excel(name = "原值(元)") @Excel(name = "原值(元)", align = HorizontalAlignment.RIGHT)
private BigDecimal buyPrice; private BigDecimal buyPrice;
@ApiModelProperty(value = "设备编码") @ApiModelProperty(value = "设备编码")

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -38,7 +39,7 @@ public class BackInputInfo {
private String unitName; private String unitName;
@ApiModelProperty(value = "退料数量") @ApiModelProperty(value = "退料数量")
@Excel(name = "退料数量") @Excel(name = "退料数量", align = HorizontalAlignment.RIGHT)
private BigDecimal backNum; private BigDecimal backNum;
@ApiModelProperty(value = "退料日期") @ApiModelProperty(value = "退料日期")

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -57,7 +58,7 @@ public class MaterialBackApplyTotalInfo implements Serializable {
/** 退料数量 */ /** 退料数量 */
@ApiModelProperty(value = "退料数量") @ApiModelProperty(value = "退料数量")
@Excel(name = "退料数量") @Excel(name = "退料数量", align = HorizontalAlignment.RIGHT)
private BigDecimal backNum; private BigDecimal backNum;
@ApiModelProperty(value = "退料日期") @ApiModelProperty(value = "退料日期")

View File

@ -4,6 +4,7 @@ import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -36,6 +37,6 @@ public class MaterialTotalMentInfo {
private String proName; private String proName;
@ApiModelProperty(value = "总保有量") @ApiModelProperty(value = "总保有量")
@Excel(name = "总保有量") @Excel(name = "总保有量", align = HorizontalAlignment.RIGHT)
private BigDecimal allNum; private BigDecimal allNum;
} }

View File

@ -150,4 +150,11 @@ public interface MaterialMachineMapper {
* @return * @return
*/ */
List<MaterialRetainedEquipmentInfo> getTeamNumThirdList(MaterialRetainedEquipmentInfo bean); List<MaterialRetainedEquipmentInfo> getTeamNumThirdList(MaterialRetainedEquipmentInfo bean);
/**
* 查询保有总量详情
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getTotalInfoList(MaterialRetainedEquipmentInfo bean);
} }

View File

@ -6,6 +6,7 @@ import com.bonus.common.biz.domain.LeaseRecordInfo;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo; import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeasePublishInfo; import com.bonus.common.biz.domain.lease.LeasePublishInfo;
import com.bonus.common.core.utils.ServletUtils; import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.utils.poi.ExcelUtil; import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
@ -505,10 +506,12 @@ public class LeaseTaskController extends BaseController {
for (Map.Entry<String, String> entry : replacements.entrySet()) { for (Map.Entry<String, String> entry : replacements.entrySet()) {
String placeholder = entry.getKey(); String placeholder = entry.getKey();
String value = entry.getValue(); String value = entry.getValue();
if (text.contains(placeholder)) { if (StringUtils.isNotBlank(placeholder) && StringUtils.isNotBlank(value)) {
// 替换占位符为实际值 if (text.contains(placeholder)) {
text = text.replace(placeholder, value); // 替换占位符为实际值
run.setText(text, 0); text = text.replace(placeholder, value);
run.setText(text, 0);
}
} }
} }
} }

View File

@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity; import com.bonus.common.core.web.domain.BaseEntity;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -78,7 +79,7 @@ public class LeaseApplyDetails extends BaseEntity {
private String unitValue; private String unitValue;
/** 库存数量 */ /** 库存数量 */
@ApiModelProperty(value = "库存数量") @ApiModelProperty(value = "库存数量")
@Excel(name = "当前库存") @Excel(name = "当前库存", align = HorizontalAlignment.RIGHT)
private BigDecimal storageNum; private BigDecimal storageNum;
@ApiModelProperty(value = "已发布数量") @ApiModelProperty(value = "已发布数量")

View File

@ -691,27 +691,18 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
if (!CollectionUtils.isEmpty(leaseApplyOutList)) { if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
list.addAll(leaseApplyOutList); list.addAll(leaseApplyOutList);
} }
if (!CollectionUtils.isEmpty(list)) { // 使用Stream处理列表避免显式for循环
for (LeaseApplyInfo applyInfo : list) { list.stream()
// 根据id去查询总出库数量 .filter(Objects::nonNull) // 过滤null元素
LeaseApplyInfo totalInfo = leaseApplyInfoMapper.getOutList(applyInfo); .forEach(applyInfo -> {
// 根据id去查询确认总出库数量 LeaseApplyInfo totalInfo = leaseApplyInfoMapper.getOutList(applyInfo);
LeaseApplyInfo info = leaseApplyInfoMapper.getInfoList(applyInfo); LeaseApplyInfo info = leaseApplyInfoMapper.getInfoList(applyInfo);
if (totalInfo != null) {
if (info != null) { // 简化判断逻辑
if (info.getAlNum().compareTo(totalInfo.getAlNum()) == 0) { int isConfirm = (totalInfo != null && info != null
applyInfo.setIsConfirm(2); && info.getAlNum().compareTo(totalInfo.getAlNum()) == 0) ? 2 : 1;
} else { applyInfo.setIsConfirm(isConfirm);
applyInfo.setIsConfirm(1); });
}
} else {
applyInfo.setIsConfirm(1);
}
} else {
applyInfo.setIsConfirm(1);
}
}
}
if (leaseApplyInfo.getIsConfirm()!=null) { if (leaseApplyInfo.getIsConfirm()!=null) {
if (leaseApplyInfo.getIsConfirm() == 2) { if (leaseApplyInfo.getIsConfirm() == 2) {

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.ToString; import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity; import com.bonus.common.core.web.domain.BaseEntity;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -62,13 +63,13 @@ public class PartType extends BaseEntity
private String unitName; private String unitName;
/** 原值 */ /** 原值 */
@Excel(name = "购置价格(元)",sort=5) @Excel(name = "购置价格(元)",sort=5, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "原值") @ApiModelProperty(value = "原值")
@Size(max=10, message = "购置价格长度不能超过10") @Size(max=10, message = "购置价格长度不能超过10")
private BigDecimal buyPrice; private BigDecimal buyPrice;
/** 实时库存 */ /** 实时库存 */
@Excel(name = "数量",sort=6) @Excel(name = "数量",sort=6, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "实时库存") @ApiModelProperty(value = "实时库存")
private Long storageNum; private Long storageNum;

View File

@ -127,4 +127,15 @@ public class PartLeaseController extends BaseController {
} }
} }
/**
* 根据二级id查询三级列表
* @param partType
* @return
*/
@ApiOperation(value = "根据二级id查询三级列表")
@GetMapping("/selectPartList")
public AjaxResult selectPartList(PartType partType) {
return partLeaseService.selectPartList(partType);
}
} }

View File

@ -73,4 +73,11 @@ public interface PartLeaseService {
* @return * @return
*/ */
AjaxResult deleteTypeKeeper(List<MaPartTypeKeeper> typeKeepers); AjaxResult deleteTypeKeeper(List<MaPartTypeKeeper> typeKeepers);
/**
* 根据二级id查询三级列表
* @param partType
* @return
*/
AjaxResult selectPartList(PartType partType);
} }

View File

@ -503,4 +503,15 @@ public class PartLeaseServiceImpl implements PartLeaseService {
} }
return AjaxResult.success("解绑成功"); return AjaxResult.success("解绑成功");
} }
/**
* 根据二级id查询三级列表
* @param partType
* @return
*/
@Override
public AjaxResult selectPartList(PartType partType) {
List<PartType> list = partLeaseMapper.selectPartTreeList(partType);
return AjaxResult.success(list);
}
} }

View File

@ -108,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND bu.del_flag = '0' AND bu.del_flag = '0'
WHERE WHERE
sai.`status` = '0' sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL AND sai.end_time IS NULL
AND sai.back_id IS NULL AND sai.back_id IS NULL
GROUP BY mt.type_id, bp.pro_id GROUP BY mt.type_id, bp.pro_id
@ -863,4 +864,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.ma_id sai.ma_id
</select> </select>
<select id="getTotalInfoList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
SELECT
subquery1.externalId AS externalId,
subquery1.impUnit AS impUnit,
subquery1.idCard AS idCard,
IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) AS storeNum,
IFNULL(subquery3.usNum, 0) AS usNum,
IFNULL(subquery1.usNum, 0) AS allNum,
CASE mt.manage_type WHEN 0 THEN '编码' ELSE '数量' END AS manageType,
subquery1.proId AS proId,
subquery1.proName AS proName,
subquery1.proCenter AS proCenter
FROM ma_type mt
LEFT JOIN (
SELECT
mt.type_id,
SUM(IFNULL(sai.num, 0)) AS usNum,
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,
bp.pro_center AS proCenter
FROM slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_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'
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="proId != null">
AND bp.pro_id = #{proId}
</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>
GROUP BY mt.type_id, bp.pro_id, bp.pro_name, bp.external_id, bp.imp_unit, bu.bzz_idcard, bp.pro_center
) AS subquery1 ON mt.type_id = subquery1.type_id
LEFT JOIN (
SELECT
mt.type_id,
SUM(IFNULL(sai.num, 0)) AS usNum,
bp.pro_id AS proId
FROM clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN clz_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'
WHERE
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
<if test="proId != null">
AND bp.pro_id = #{proId}
</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>
GROUP BY mt.type_id, bp.pro_id
) AS subquery3
ON mt.type_id = subquery3.type_id
AND subquery1.proId IS NOT NULL
AND subquery1.proId = subquery3.proId
WHERE
mt.`level` = 4
AND mt.del_flag = '0'
AND subquery1.usNum > 0
<if test="impUnit != null and impUnit != ''">
AND subquery1.impUnit = #{impUnit}
</if>
</select>
</mapper> </mapper>

View File

@ -460,6 +460,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where lod.parent_id = #{id} where lod.parent_id = #{id}
and lod.out_num > 0 and lod.out_num > 0
and lod.lease_sign_id is not null and lod.lease_sign_id is not null
<if test="publishTask != null and publishTask != ''">
AND lod.publish_task = #{publishTask}
</if>
<if test="keyWord != null and keyWord != ''"> <if test="keyWord != null and keyWord != ''">
AND GROUP_CONCAT(DISTINCT mt2.type_name) LIKE CONCAT(CONCAT('%', #{keyWord}), '%') AND GROUP_CONCAT(DISTINCT mt2.type_name) LIKE CONCAT(CONCAT('%', #{keyWord}), '%')
</if> </if>
@ -729,7 +732,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id LEFT JOIN lease_apply_info lai ON lai.id = lpd.parent_id
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
GROUP BY parent_id) lod ON lpd.parent_id = lod.parent_id GROUP BY parent_id, publish_task) lod ON lpd.parent_id = lod.parent_id and lod.publish_task = lpd.publish_task
LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id LEFT JOIN bm_unit bu ON bu.unit_id = lpd.unit_id
LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id LEFT JOIN bm_project bp ON bp.pro_id = lpd.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
@ -766,6 +769,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lease_out_details lease_out_details
WHERE WHERE
parent_id = #{id} parent_id = #{id}
<if test="publishTask != null and publishTask != ''">
AND publish_task = #{publishTask}
</if>
HAVING HAVING
SUM( out_num ) > 0 SUM( out_num ) > 0
</select> </select>
@ -875,6 +881,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE WHERE
is_confirm = 2 is_confirm = 2
AND parent_id = #{id} AND parent_id = #{id}
<if test="publishTask != null and publishTask != ''">
AND publish_task = #{publishTask}
</if>
HAVING HAVING
SUM( out_num ) > 0 SUM( out_num ) > 0
</select> </select>

View File

@ -793,7 +793,7 @@
<select id="getPublishList" resultType="com.bonus.common.biz.domain.lease.LeasePublishInfo" <select id="getPublishList" resultType="com.bonus.common.biz.domain.lease.LeasePublishInfo"
resultMap="LeasePublishInfoResult"> resultMap="LeasePublishInfoResult">
select select
lai.id, lai.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code, lai.id, tt.code, lai.task_id, lai.lease_person, lai.phone, lai.type, lai.company_audit_by,lai.apply_code,
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time, lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark, lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id, lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,

View File

@ -216,19 +216,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getPartFilelist" resultType="com.bonus.material.part.domain.BmPartFileInfo"> <select id="getPartFilelist" resultType="com.bonus.material.part.domain.BmPartFileInfo">
select select
distinct task_type as taskType,task_id as taskId,model_id as modelId, file_type as fileType distinct task_type as taskType,task_id as taskId,model_id as modelId, file_type as fileType
from bm_file_info bfi from bm_file_info
where task_type = #{taskType} and task_id = #{taskId} and model_id = #{modelId} where task_type = #{taskType} and task_id = #{taskId} and model_id = #{modelId}
</select> </select>
<select id="getPartFileDetail" resultType="com.bonus.material.part.domain.BmPartFileDetail"> <select id="getPartFileDetail" resultType="com.bonus.material.part.domain.BmPartFileDetail">
select select
id,task_type as taskType,task_id as taskId,model_id as modelId, file_type as fileType,name,url id,task_type as taskType,task_id as taskId,model_id as modelId, file_type as fileType,name,url
from bm_file_info bfi from bm_file_info
where task_type = #{taskType} and task_id = #{taskId} and model_id = #{modelId} and file_type = #{fileType} where task_type = #{taskType} and task_id = #{taskId} and model_id = #{modelId} and file_type = #{fileType}
</select> </select>
<delete id="deleteBmFileList" parameterType="Long"> <delete id="deleteBmFileList" parameterType="Long">
delete from bm_file_info bfi where task_id = #{taskId} and task_type = 13 delete from bm_file_info where task_id = #{taskId} and task_type = 13
</delete> </delete>
<select id="getCheckInfoForm" resultType="com.bonus.material.part.domain.PartTypeCheckInfo"> <select id="getCheckInfoForm" resultType="com.bonus.material.part.domain.PartTypeCheckInfo">

View File

@ -154,22 +154,21 @@
</where> </where>
</select> </select>
<select id="selectPartTreeList" resultType="com.bonus.material.ma.domain.PartType"> <select id="selectPartTreeList" resultType="com.bonus.material.ma.domain.PartType">
select pa_id as id, pa_name as paName, storage_num as storageNum, select
level as level, mt.pa_id as id,
parent_id as parentId mt1.pa_name as partName,
from ma_part_type mt.pa_name as paName,
<where> mt.storage_num as storageNum,
del_flag = '0' mt.level as level,
<if test="level != null and level != ''"> mt.parent_id as parentId,
and level = #{level} mt.unit_name as unitName
</if> from ma_part_type mt
left join ma_part_type mt1 on mt.parent_id = mt1.pa_id
where
mt.del_flag = '0'
<if test="id != null"> <if test="id != null">
and parent_id = #{id} and mt.parent_id = #{id}
</if> </if>
<if test="paName != null and paName != ''">
and pa_name = #{partName}
</if>
</where>
</select> </select>
<select id="getMonthMaxOrderByDate" resultType="java.lang.Integer"> <select id="getMonthMaxOrderByDate" resultType="java.lang.Integer">