代码提交
This commit is contained in:
parent
cf63ffa3a5
commit
9f93af7b13
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -450,7 +463,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTask(record);
|
||||
} else {
|
||||
long username = SecurityUtils.getLoginUser().getUserid();
|
||||
record.setCreateBy(username+"");
|
||||
record.setCreateBy(username + "");
|
||||
tmTaskList = tmTaskMapper.getAuditListByLeaseTmTaskByPeople(record);
|
||||
}
|
||||
for (TmTask tmTask : tmTaskList) {
|
||||
|
|
@ -539,7 +552,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
List<LeaseApplyDetails> arrayList = new ArrayList<>();
|
||||
if (leaseApplyDetails.size() > 0) {
|
||||
//查询同规格下预出库量
|
||||
if(leaseApplyDetails != null){
|
||||
if (leaseApplyDetails != null) {
|
||||
for (LeaseApplyDetails detail : leaseApplyDetails) {
|
||||
|
||||
LeaseApplyDetails needDetails = tmTaskMapper.getApplyNeedDetailsCq(detail);
|
||||
|
|
@ -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;
|
||||
|
|
@ -592,7 +624,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
if (roles.contains(STRING_ADMIN)) {
|
||||
tmTaskList = tmTaskMapper.getLeaseOutList(task);
|
||||
|
||||
}else{
|
||||
} else {
|
||||
tmTaskList = tmTaskMapper.getLeaseOutListByUser(task);
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -1428,10 +1470,10 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
|
||||
@Override
|
||||
public AjaxResult pushToIntelligentProject(List<TmTask> tmTasks) {
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备到智慧工程的推送逻辑==={}",tmTasks);
|
||||
log.info("MaMachineServiceImpl pushNotifications 开始处理设备到智慧工程的推送逻辑==={}", tmTasks);
|
||||
List<MaMachineIntelligentVO> intelVOList = new ArrayList<>();
|
||||
if (CollectionUtils.isEmpty(tmTasks)){
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG,"maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
if (CollectionUtils.isEmpty(tmTasks)) {
|
||||
throw new ServiceException(String.format(ExceptionDict.PARAM_IS_NULL_ERROR_MSG, "maMachineList"), ExceptionDict.PARAM_IS_NULL_ERROR);
|
||||
} else {
|
||||
//组装请求报文
|
||||
makeIntelligentVOList(tmTasks, intelVOList);
|
||||
|
|
@ -1447,7 +1489,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
log.info("token-=========:" + token);
|
||||
//调用推送的方法
|
||||
String intelligentUrl = configService.selectConfigByKey("intelligentUrl");
|
||||
String data = HttpHelper.sendHttpPost(intelligentUrl, token,content,intelligentAppKey);
|
||||
String data = HttpHelper.sendHttpPost(intelligentUrl, token, content, intelligentAppKey);
|
||||
log.info("dataString-=========:" + data);
|
||||
resultDataHandler(data);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -1455,7 +1497,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
return AjaxResult.error("推送失败!");
|
||||
}
|
||||
//更改推送的状态
|
||||
for (TmTask tmTask:tmTasks) {
|
||||
for (TmTask tmTask : tmTasks) {
|
||||
LeaseRecord leaseRecord = new LeaseRecord();
|
||||
leaseRecord.setId(Integer.valueOf(tmTask.getId()));
|
||||
leaseRecordMapper.updateLeaseRecord(leaseRecord);
|
||||
|
|
@ -1467,6 +1509,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
|
||||
/**
|
||||
* 查询库管员下拉信息
|
||||
*
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1536,9 +1579,9 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
for (TmTask subTask : subTasks) {
|
||||
MaMachineIntelligentVO intelVO = new MaMachineIntelligentVO();
|
||||
//getIntelligentCode 值为例:A101 获取门类码
|
||||
intelVO.setCategoryCode(subTask.getIntelligentCode().substring(0,1));
|
||||
intelVO.setCategoryCode(subTask.getIntelligentCode().substring(0, 1));
|
||||
//获取分类码
|
||||
intelVO.setClassifyCode(subTask.getIntelligentCode().substring(1,2));
|
||||
intelVO.setClassifyCode(subTask.getIntelligentCode().substring(1, 2));
|
||||
//获取机具码
|
||||
intelVO.setMachineryCode(subTask.getIntelligentCode().substring(2));
|
||||
intelVO.setInspectorUnitName("123");
|
||||
|
|
@ -1552,7 +1595,7 @@ public class TmTaskServiceImpl implements TmTaskService {
|
|||
intelVO.setValidityDate(DateUtils.getDate());
|
||||
//每个设备不同点的设置
|
||||
String ownerCode = loginUser.getSysUser().getDept().getEnterpriseOwnershipCode();
|
||||
if (StringUtils.isEmpty(ownerCode)){
|
||||
if (StringUtils.isEmpty(ownerCode)) {
|
||||
ownerCode = "CSG";
|
||||
}
|
||||
intelVO.setDeviceCode(StringUtils.getDeviceCode(ownerCode, subTask.getIntelligentCode(), subTask.getCreateTime(), subTask.getMaId()));
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class TreeNode {
|
|||
private float num;
|
||||
|
||||
private String modelCode;
|
||||
private String isStorage;
|
||||
|
||||
private String manageType;
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue