代码提交

This commit is contained in:
liang.chao 2025-03-12 17:19:09 +08:00
parent cf63ffa3a5
commit 9f93af7b13
8 changed files with 90 additions and 28 deletions

View File

@ -209,6 +209,8 @@ public class LeaseApplyDetails implements Serializable {
private Integer ctParentId;
@ApiModelProperty(value="是否是成套机具0是 1否")
private Integer isCt;
@ApiModelProperty(value="套数")
private Integer setsNum;
@ApiModelProperty(value="默认1,0不是库存管理")
private String isStorage;
}

View File

@ -44,6 +44,7 @@ public class TmTask implements Serializable {
private Integer taskType;
private List<TmTask> outboundType;
private List<Integer> wholeTypeName;
private String wholeName;
/**
* 任务状态(定义数据字典)
@ -170,8 +171,7 @@ public class TmTask implements Serializable {
@ApiModelProperty(value = "领料任务详情集合")
private List<LeaseApplyDetails> leaseApplyDetails;
/** 机具规格详情列表 */
@ApiModelProperty(value = "成套机具规格详情列表")
Map<String, List<LeaseApplyDetails>> ctLeaseApplyDetails;
private Map<String, List<LeaseApplyDetails>> ctLeaseApplyDetails;
private List<LeaseOutDetailRecord> leaseOutDetailRecord;
@ApiModelProperty(value = "协议id")
@ -337,8 +337,12 @@ public class TmTask implements Serializable {
private String maTypeUserName;
@ApiModelProperty(value = "成套机具三级typeId")
private Integer ctParentId;
@ApiModelProperty(value = "是否成套设备")
@ApiModelProperty(value = "是否成套设备(0是 1不是)")
private Integer isCt;
@ApiModelProperty(value = "套数")
private Integer setsNum;
@ApiModelProperty(value = "是否是主体设备")
private boolean isMain;
}

View File

@ -158,4 +158,8 @@ public interface TmTaskMapper {
List<PreNumInUse> getPreNumInUse(PreNumInUse typeId);
List<TmTask> getLeaseOutList(TmTask task);
String getParentNameById(Integer ctParentId);
String getAscriptionTypeByTypeId(TmTask tmTask);
}

View File

@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@ -258,6 +259,18 @@ public class TmTaskServiceImpl implements TmTaskService {
@Override
public List<TmTask> getLeaseAuditListByOne(TmTask record) {
List<TmTask> leaseDetailByParentId = tmTaskMapper.getLeaseDetailByParentId(record);
// 查询成套设备中哪个是主设备
for (TmTask tmTask : leaseDetailByParentId) {
if (tmTask.getIsCt() == 0) {
String wholeTypeName = tmTaskMapper.getAscriptionTypeByTypeId(tmTask);
if (StringUtils.isNotBlank(wholeTypeName)) {
tmTask.setWholeName(wholeTypeName);
tmTask.setMain(true);
} else {
tmTask.setMain(false);
}
}
}
/* for (TmTask tmTask : leaseDetailByParentId) {
if ("2".equals(tmTask.getManageType())) {
List<TmTask> manageTypeByTypeId = tmTaskMapper.getManageTypeByTypeId(tmTask);
@ -578,8 +591,27 @@ public class TmTaskServiceImpl implements TmTaskService {
}
}
}
Map<Integer, List<LeaseApplyDetails>> map = listLeaseDetails.stream()
.filter(detail -> detail.getIsCt() == 0)
.filter(detail -> detail.getCtParentId() != null)
.collect(Collectors.groupingBy(LeaseApplyDetails::getCtParentId));
Map<String, List<LeaseApplyDetails>> transformedMap = map.entrySet().stream()
.collect(Collectors.toMap(
entry -> {
Integer ctParentId = entry.getKey();
String typeName = getParentNameById(ctParentId);
return typeName;
},
Map.Entry::getValue // 获取分组后的LeaseApplyDetails列表
));
List<LeaseApplyDetails> collect = listLeaseDetails.stream()
.filter(detail -> detail.getIsCt() == 1)
.filter(detail -> detail.getCtParentId() == null)
.collect(Collectors.toList());
tmTask.setCtLeaseApplyDetails(transformedMap);
tmTask.setLeaseApplyDetails(collect);
// 塞入领料任务详情的集合中
tmTask.setLeaseApplyDetails(listLeaseDetails);
// tmTask.setLeaseApplyDetails(listLeaseDetails);
}
tmTaskList.add(tmTask);
return tmTaskList;
@ -1388,19 +1420,24 @@ public class TmTaskServiceImpl implements TmTaskService {
.distinct()
.collect(Collectors.toList());
tmTask.setWholeTypeName(wholeTypeName);
Map<String, List<LeaseApplyDetails>> list = leaseApplyDetails.stream()
Map<Integer, List<LeaseApplyDetails>> map = leaseApplyDetails.stream()
.filter(detail -> detail.getIsCt() == 0)
.filter(detail -> detail.getCtParentId() != null)
.collect(Collectors.groupingBy(LeaseApplyDetails::getTypeName));
/* for (LeaseApplyDetails applyDetails : list) {
String parentName = tmTaskMapper.getCtParentName(applyDetails);
applyDetails.setp
}*/
.collect(Collectors.groupingBy(LeaseApplyDetails::getCtParentId));
Map<String, List<LeaseApplyDetails>> transformedMap = map.entrySet().stream()
.collect(Collectors.toMap(
entry -> {
Integer ctParentId = entry.getKey();
String typeName = getParentNameById(ctParentId);
return typeName;
},
Map.Entry::getValue // 获取分组后的LeaseApplyDetails列表
));
List<LeaseApplyDetails> collect = leaseApplyDetails.stream()
.filter(detail -> detail.getIsCt() == 1)
.filter(detail -> detail.getCtParentId() == null)
.collect(Collectors.toList());
tmTask.setCtLeaseApplyDetails(list);
tmTask.setCtLeaseApplyDetails(transformedMap);
tmTask.setLeaseApplyDetails(collect);
}
}
@ -1411,6 +1448,11 @@ public class TmTaskServiceImpl implements TmTaskService {
return tmTaskList;
}
public String getParentNameById(Integer ctParentId) {
String parentName = tmTaskMapper.getParentNameById(ctParentId);
return parentName;
}
@Override
public void updateLeaseInfo(LeaseApplyInfo task) {
tmTaskMapper.updateLeaseInfo(task);
@ -1467,6 +1509,7 @@ public class TmTaskServiceImpl implements TmTaskService {
/**
* 查询库管员下拉信息
*
* @param leaseApplyDetails
* @return
*/

View File

@ -33,6 +33,7 @@ public class TreeNode {
private float num;
private String modelCode;
private String isStorage;
private String manageType;

View File

@ -120,11 +120,11 @@
insert into lease_apply_details (parennt_id, type_id, pre_num,
al_num, `status`, create_by,
create_time, update_by, update_time,
remark, company_id,type_name,model_name,lease_price,replace_type_id)
remark, company_id,type_name,model_name,lease_price,replace_type_id,ct_parent_id,is_ct,sets_num)
values (#{parenntId,jdbcType=INTEGER}, #{typeId,jdbcType=INTEGER}, #{preNum,jdbcType=FLOAT},
#{alNum,jdbcType=FLOAT}, #{status,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
NOW(), #{updateBy,jdbcType=VARCHAR}, NOW(),
#{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},#{typeName},#{maModel},#{leasePrice},#{replaceTypeId})
#{remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER},#{typeName},#{maModel},#{leasePrice},#{replaceTypeId},#{ctParentId},#{isCt},#{setsNum})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.app.domain.LeaseApplyDetails" useGeneratedKeys="true">
<!--@mbg.generated-->
@ -401,13 +401,13 @@
<!--@mbg.generated-->
insert into lease_apply_details
(parennt_id, type_id, pre_num, al_num, `status`, create_by, create_time, update_by,
update_time, remark, company_id,ct_parent_id,is_ct)
update_time, remark, company_id,ct_parent_id,is_ct,sets_num)
values
<foreach collection="list" item="item" separator=",">
(#{item.parenntId,jdbcType=INTEGER}, #{item.typeId,jdbcType=INTEGER}, #{item.preNum,jdbcType=INTEGER},
#{item.alNum,jdbcType=INTEGER}, #{item.status,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
NOW(), #{item.updateBy,jdbcType=VARCHAR}, NOW(),
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER}, #{item.ctParentId,jdbcType=INTEGER}, IFNULL(#{item.isCt}, '1'))
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER}, #{item.ctParentId,jdbcType=INTEGER}, IFNULL(#{item.isCt}, '1'),#{item.setsNum,jdbcType=INTEGER})
</foreach>
</insert>

View File

@ -1092,6 +1092,7 @@
lad.ct_parent_id as ctParentId,
lad.is_ct as isCt,
lad.replace_type_id as replaceTypeId,
lad.sets_num as setsNum,
lad.lease_price as leasePrice
FROM
lease_apply_details lad
@ -1327,4 +1328,10 @@
GROUP BY lai.id
ORDER BY tt.task_status,tt.create_time desc
</select>
<select id="getParentNameById" resultType="java.lang.String">
select whole_type_name from ma_whole_set where parent_id = #{ctParentId} limit 1
</select>
<select id="getAscriptionTypeByTypeId" resultType="java.lang.String">
select whole_type_name from ma_whole_set where parent_id = #{typeId} and ascription_type = 1 limit 1
</select>
</mapper>

View File

@ -140,7 +140,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
END as num,
mt.model_code AS modelCode,
mt.manage_type AS manageType,
mt.is_replace as isReplace
mt.is_replace as isReplace,
mt.is_storage as isStorage
FROM ma_type mt
left join (SELECT mt.type_id,
mt2.type_name AS typeName,