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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ 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;
@ -36,6 +37,6 @@ public class MaterialTotalMentInfo {
private String proName;
@ApiModelProperty(value = "总保有量")
@Excel(name = "总保有量")
@Excel(name = "总保有量", align = HorizontalAlignment.RIGHT)
private BigDecimal allNum;
}

View File

@ -150,4 +150,11 @@ public interface MaterialMachineMapper {
* @return
*/
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.LeasePublishInfo;
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.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -505,6 +506,7 @@ public class LeaseTaskController extends BaseController {
for (Map.Entry<String, String> entry : replacements.entrySet()) {
String placeholder = entry.getKey();
String value = entry.getValue();
if (StringUtils.isNotBlank(placeholder) && StringUtils.isNotBlank(value)) {
if (text.contains(placeholder)) {
// 替换占位符为实际值
text = text.replace(placeholder, value);
@ -516,6 +518,7 @@ public class LeaseTaskController extends BaseController {
}
}
}
}
} catch (IndexOutOfBoundsException e) {
throw new RuntimeException("模板表处理异常,请检查合同信息");

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@ -62,13 +63,13 @@ public class PartType extends BaseEntity
private String unitName;
/** 原值 */
@Excel(name = "购置价格(元)",sort=5)
@Excel(name = "购置价格(元)",sort=5, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "原值")
@Size(max=10, message = "购置价格长度不能超过10")
private BigDecimal buyPrice;
/** 实时库存 */
@Excel(name = "数量",sort=6)
@Excel(name = "数量",sort=6, align = HorizontalAlignment.RIGHT)
@ApiModelProperty(value = "实时库存")
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
*/
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("解绑成功");
}
/**
* 根据二级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'
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY mt.type_id, bp.pro_id
@ -863,4 +864,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sai.ma_id
</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>

View File

@ -460,6 +460,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where lod.parent_id = #{id}
and lod.out_num > 0
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 != ''">
AND GROUP_CONCAT(DISTINCT mt2.type_name) LIKE CONCAT(CONCAT('%', #{keyWord}), '%')
</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 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
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_project bp ON bp.pro_id = lpd.project_id
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
WHERE
parent_id = #{id}
<if test="publishTask != null and publishTask != ''">
AND publish_task = #{publishTask}
</if>
HAVING
SUM( out_num ) > 0
</select>
@ -875,6 +881,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
is_confirm = 2
AND parent_id = #{id}
<if test="publishTask != null and publishTask != ''">
AND publish_task = #{publishTask}
</if>
HAVING
SUM( out_num ) > 0
</select>

View File

@ -793,7 +793,7 @@
<select id="getPublishList" resultType="com.bonus.common.biz.domain.lease.LeasePublishInfo"
resultMap="LeasePublishInfoResult">
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.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,

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
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}
</select>
<select id="getPartFileDetail" resultType="com.bonus.material.part.domain.BmPartFileDetail">
select
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}
</select>
<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>
<select id="getCheckInfoForm" resultType="com.bonus.material.part.domain.PartTypeCheckInfo">

View File

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