领料单,出库单成套设备明细,编码结算合并
This commit is contained in:
parent
07572859f7
commit
8deba884a6
|
|
@ -231,4 +231,8 @@ public class SltAgreementInfo {
|
||||||
private Integer leaseType;
|
private Integer leaseType;
|
||||||
private List<SltAgreementInfo> node;
|
private List<SltAgreementInfo> node;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private String endTimeTemp;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,18 @@ public class TmTaskController extends BaseController {
|
||||||
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAllCq(task);
|
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAllCq(task);
|
||||||
return getDataTable(leaseAuditList);
|
return getDataTable(leaseAuditList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "重庆获取领料管理-详情列表", businessType = BusinessType.QUERY)
|
||||||
|
@GetMapping("/getLeaseListAllCqTwo")
|
||||||
|
@RequiresPermissions(value = {"picking:auditing:view", "picking:auditing:list"}, logical = Logical.OR)
|
||||||
|
public TableDataInfo getLeaseListAllCqTwo(@RequestParam(value = "taskId", required = false, defaultValue = "") String taskId,
|
||||||
|
@RequestParam(value = "maTypeUserId", required = false, defaultValue = "") String maTypeUserId) {
|
||||||
|
TmTask task = new TmTask();
|
||||||
|
task.setTaskId(Long.parseLong(taskId));
|
||||||
|
task.setMaTypeUserId(maTypeUserId);
|
||||||
|
List<TmTask> leaseAuditList = tmTaskService.getLeaseListAllCqTwo(task);
|
||||||
|
return getDataTable(leaseAuditList);
|
||||||
|
}
|
||||||
@Log(title = "查询差缺量在哪些工程上申请", businessType = BusinessType.QUERY)
|
@Log(title = "查询差缺量在哪些工程上申请", businessType = BusinessType.QUERY)
|
||||||
@GetMapping("/getPreNumInUse")
|
@GetMapping("/getPreNumInUse")
|
||||||
public AjaxResult getPreNumInUse(PreNumInUse tmTask) {
|
public AjaxResult getPreNumInUse(PreNumInUse tmTask) {
|
||||||
|
|
|
||||||
|
|
@ -219,4 +219,6 @@ public class LeaseApplyDetails implements Serializable {
|
||||||
private Integer setsNum;
|
private Integer setsNum;
|
||||||
@ApiModelProperty(value="默认1,0不是库存管理")
|
@ApiModelProperty(value="默认1,0不是库存管理")
|
||||||
private String isStorage;
|
private String isStorage;
|
||||||
|
|
||||||
|
private List<LeaseApplyDetails> ctList;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
package com.bonus.sgzb.app.domain;
|
package com.bonus.sgzb.app.domain;
|
||||||
|
|
||||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||||
|
import com.bonus.sgzb.material.domain.MaWholeVo;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:liang.chao
|
* @Author:liang.chao
|
||||||
* @Date:2024/9/26 - 18:01
|
* @Date:2024/9/26 - 18:01
|
||||||
|
|
@ -10,6 +13,11 @@ import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class LeaseOutDetailRecord {
|
public class LeaseOutDetailRecord {
|
||||||
|
|
||||||
|
private Integer taskId;
|
||||||
|
|
||||||
|
private Integer typeId;
|
||||||
|
|
||||||
@Excel(name = "规格型号")
|
@Excel(name = "规格型号")
|
||||||
private String typeModelName;
|
private String typeModelName;
|
||||||
|
|
||||||
|
|
@ -41,4 +49,8 @@ public class LeaseOutDetailRecord {
|
||||||
|
|
||||||
//计量单位
|
//计量单位
|
||||||
private String unitNames;
|
private String unitNames;
|
||||||
|
|
||||||
|
//成套设备信息
|
||||||
|
private List<MaWholeVo> maWholeVos;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,7 @@ public class TmTask implements Serializable {
|
||||||
private List<LeaseApplyDetails> leaseApplyDetails;
|
private List<LeaseApplyDetails> leaseApplyDetails;
|
||||||
/** 机具规格详情列表 */
|
/** 机具规格详情列表 */
|
||||||
private Map<String, List<LeaseApplyDetails>> ctLeaseApplyDetails;
|
private Map<String, List<LeaseApplyDetails>> ctLeaseApplyDetails;
|
||||||
|
private List<LeaseApplyDetails> ctList;
|
||||||
private List<LeaseOutDetailRecord> leaseOutDetailRecord;
|
private List<LeaseOutDetailRecord> leaseOutDetailRecord;
|
||||||
|
|
||||||
@ApiModelProperty(value = "协议id")
|
@ApiModelProperty(value = "协议id")
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.bonus.sgzb.app.domain.LeaseApplyDetails;
|
||||||
import com.bonus.sgzb.app.domain.LeaseOutDetailRecord;
|
import com.bonus.sgzb.app.domain.LeaseOutDetailRecord;
|
||||||
import com.bonus.sgzb.app.domain.TmTask;
|
import com.bonus.sgzb.app.domain.TmTask;
|
||||||
import com.bonus.sgzb.base.api.domain.BackApplyInfo;
|
import com.bonus.sgzb.base.api.domain.BackApplyInfo;
|
||||||
|
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||||
|
import com.bonus.sgzb.material.domain.MaWholeVo;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -56,6 +58,8 @@ public interface LeaseApplyDetailsMapper {
|
||||||
|
|
||||||
List<LeaseOutDetailRecord> getOrderBody(@Param("parentId") String parentId,@Param("typeId") String typeId);
|
List<LeaseOutDetailRecord> getOrderBody(@Param("parentId") String parentId,@Param("typeId") String typeId);
|
||||||
|
|
||||||
|
List<MaWholeVo> getCtList(LeaseOutDetailRecord record);
|
||||||
|
|
||||||
List<com.bonus.sgzb.material.domain.LeaseApplyDetails> getLeaseApplyDetailsTypeCount(BackApplyInfo bean);
|
List<com.bonus.sgzb.material.domain.LeaseApplyDetails> getLeaseApplyDetailsTypeCount(BackApplyInfo bean);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -171,4 +171,6 @@ public interface TmTaskMapper {
|
||||||
String getLeaseInfoId(String taskId);
|
String getLeaseInfoId(String taskId);
|
||||||
|
|
||||||
int deleteDetailsById(String id);
|
int deleteDetailsById(String id);
|
||||||
|
|
||||||
|
LeaseApplyDetails getCtBean(Integer typeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ public interface TmTaskService{
|
||||||
|
|
||||||
List<TmTask> getLeaseListAllCq(TmTask task);
|
List<TmTask> getLeaseListAllCq(TmTask task);
|
||||||
|
|
||||||
|
List<TmTask> getLeaseListAllCqTwo(TmTask task);
|
||||||
|
|
||||||
List<TmTask> getLeaseOutListByUser(TmTask task);
|
List<TmTask> getLeaseOutListByUser(TmTask task);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import com.bonus.sgzb.common.core.utils.DateUtils;
|
||||||
import com.bonus.sgzb.common.core.utils.StringUtils;
|
import com.bonus.sgzb.common.core.utils.StringUtils;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.sgzb.material.domain.MaWholeVo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -149,11 +150,20 @@ public class LeaseOutDetailsServiceImpl implements LeaseOutDetailsService {
|
||||||
public TmTask getLeaseOutOrder(String parentId, String typeId) {
|
public TmTask getLeaseOutOrder(String parentId, String typeId) {
|
||||||
TmTask orderHead = leaseApplyDetailsMapper.getOrderHead(parentId);
|
TmTask orderHead = leaseApplyDetailsMapper.getOrderHead(parentId);
|
||||||
List<LeaseOutDetailRecord> list = leaseApplyDetailsMapper.getOrderBody(parentId, typeId);
|
List<LeaseOutDetailRecord> list = leaseApplyDetailsMapper.getOrderBody(parentId, typeId);
|
||||||
|
for (LeaseOutDetailRecord record : list) {
|
||||||
|
List<MaWholeVo> maWholeVoList = leaseApplyDetailsMapper.getCtList(record);
|
||||||
|
if (CollUtil.isNotEmpty(maWholeVoList)) {
|
||||||
|
record.setOutNum(String.valueOf(maWholeVoList.get(0).getSetsNum()));
|
||||||
|
record.setMaWholeVos(maWholeVoList);
|
||||||
|
record.setMaCode(null);
|
||||||
|
record.setRemark(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
// 获取第一个创建时间
|
// 获取第一个创建时间
|
||||||
String createTime = list.get(0).getCreateTime();
|
String createTime = list.get(0).getCreateTime();
|
||||||
// 将createTime转换为date类型,保留年月日
|
// 将createTime转换为date类型,保留年月日
|
||||||
Date date = DateUtil.parse(createTime, "yyyy-MM-dd");
|
Date date = DateUtil.parse(createTime, "yyyy-MM-dd HH:mm:ss");
|
||||||
orderHead.setOutTime(date);
|
orderHead.setOutTime(date);
|
||||||
}
|
}
|
||||||
orderHead.setLeaseOutDetailRecord(list);
|
orderHead.setLeaseOutDetailRecord(list);
|
||||||
|
|
|
||||||
|
|
@ -617,6 +617,90 @@ public class TmTaskServiceImpl implements TmTaskService {
|
||||||
return tmTaskList;
|
return tmTaskList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TmTask> getLeaseListAllCqTwo(TmTask task) {
|
||||||
|
List<TmTask> tmTaskList = new ArrayList<>();
|
||||||
|
TmTask tmTask = tmTaskMapper.getLeaseListTmTask(task);
|
||||||
|
if (tmTask != null) {
|
||||||
|
List<LeaseApplyInfo> leaseApplyInfoList = tmTaskMapper.getLeaseListByLeaseInfo(task);
|
||||||
|
tmTask.setLeaseApplyInfoList(leaseApplyInfoList);
|
||||||
|
|
||||||
|
List<LeaseApplyDetails> listLeaseDetails = new ArrayList<>();
|
||||||
|
for (LeaseApplyInfo leaseApplyInfo : leaseApplyInfoList) {
|
||||||
|
if (leaseApplyInfo != null) {
|
||||||
|
// 去查询领料任务详情表
|
||||||
|
List<LeaseApplyDetails> leaseApplyDetails = tmTaskMapper.getLeaseApplyDetailsCq(leaseApplyInfo);
|
||||||
|
List<LeaseApplyDetails> arrayList = new ArrayList<>();
|
||||||
|
if (leaseApplyDetails.size() > 0) {
|
||||||
|
//查询同规格下预出库量
|
||||||
|
if (leaseApplyDetails != null) {
|
||||||
|
for (LeaseApplyDetails detail : leaseApplyDetails) {
|
||||||
|
|
||||||
|
LeaseApplyDetails needDetails = tmTaskMapper.getApplyNeedDetailsCq(detail);
|
||||||
|
detail.setOutNum(needDetails.getOutNum());
|
||||||
|
if (StringUtils.isNotBlank(task.getMaTypeUserId())) {
|
||||||
|
if (StringUtils.isNotBlank(detail.getMaTypeUserId())) {
|
||||||
|
// 将detail.getMaTypeUserId()转换为集合
|
||||||
|
String[] maTypeUserIds = detail.getMaTypeUserId().split(",");
|
||||||
|
// 判断maTypeUserIds如果不包含task.getMaTypeUserId(),直接从leaseApplyDetails中移除
|
||||||
|
if (Arrays.asList(maTypeUserIds).contains(task.getMaTypeUserId())) {
|
||||||
|
arrayList.add(detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(arrayList)) {
|
||||||
|
listLeaseDetails.addAll(arrayList);
|
||||||
|
} else {
|
||||||
|
listLeaseDetails.addAll(leaseApplyDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<LeaseApplyDetails> ctAllList = new ArrayList<>();
|
||||||
|
Map<Integer, List<LeaseApplyDetails>> map = listLeaseDetails.stream()
|
||||||
|
.filter(detail -> detail.getIsCt() == 0)
|
||||||
|
.filter(detail -> detail.getCtParentId() != null)
|
||||||
|
.collect(Collectors.groupingBy(LeaseApplyDetails::getCtParentId));
|
||||||
|
for (Map.Entry<Integer, List<LeaseApplyDetails>> entry : map.entrySet()) {
|
||||||
|
int num = entry.getValue().get(0).getSetsNum();
|
||||||
|
List<LeaseApplyDetails> listTemp = entry.getValue();
|
||||||
|
|
||||||
|
Integer ctParentId = entry.getKey();
|
||||||
|
LeaseApplyDetails lease = tmTaskMapper.getCtBean(ctParentId);
|
||||||
|
lease.setManageTypeName(null);
|
||||||
|
lease.setSetsNum(num);
|
||||||
|
lease.setPreNum(num);
|
||||||
|
String typeName = getParentNameById(ctParentId);
|
||||||
|
List<LeaseApplyDetails> ctList = entry.getValue();
|
||||||
|
lease.setCtList(ctList);
|
||||||
|
ctAllList.add(lease);
|
||||||
|
}
|
||||||
|
// 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.setCtList(ctAllList);
|
||||||
|
tmTask.setLeaseApplyDetails(collect);
|
||||||
|
// 塞入领料任务详情的集合中
|
||||||
|
// tmTask.setLeaseApplyDetails(listLeaseDetails);
|
||||||
|
}
|
||||||
|
tmTaskList.add(tmTask);
|
||||||
|
return tmTaskList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TmTask> getLeaseOutListByUser(TmTask task) {
|
public List<TmTask> getLeaseOutListByUser(TmTask task) {
|
||||||
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
return AjaxResult.success(bean);
|
return AjaxResult.success(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据协议获取月结算清单
|
* 根据协议获取月结算清单
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -173,4 +173,5 @@ public class AgreementInfo extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "是否显示")
|
@ApiModelProperty(value = "是否显示")
|
||||||
private String isView;
|
private String isView;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,4 +86,10 @@ public class MaWholeVo {
|
||||||
@ApiModelProperty(value = "预领数量")
|
@ApiModelProperty(value = "预领数量")
|
||||||
private Integer applyNum;
|
private Integer applyNum;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预领数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "成套数量")
|
||||||
|
private Integer setsNum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ public interface SltAgreementInfoMapper {
|
||||||
|
|
||||||
int updateTrimDay(SltAgreementInfo sltAgreementInfo);
|
int updateTrimDay(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
List<SltAgreementInfo> getCtList(SltAgreementInfo bean);
|
||||||
|
|
||||||
int updateInfoOneStatus(@Param("agreementIds") List<String> agreementIds,@Param("costBearingParty") String costBearingParty);
|
int updateInfoOneStatus(@Param("agreementIds") List<String> agreementIds,@Param("costBearingParty") String costBearingParty);
|
||||||
|
|
||||||
int updateAgreementStatus(SltAgreementInfo apply);
|
int updateAgreementStatus(SltAgreementInfo apply);
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
SltInfoVo sltInfoVo = new SltInfoVo();
|
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||||
//租赁费用列表
|
//租赁费用列表
|
||||||
List<SltAgreementInfo> leaseListOne = getLeaseListOne(list);
|
List<SltAgreementInfo> leaseListOne = getLeaseListOne(list);
|
||||||
|
//预报废费用列表
|
||||||
List<SltAgreementInfo> leaseListThree = getLeaseListThree(list);
|
List<SltAgreementInfo> leaseListThree = getLeaseListThree(list);
|
||||||
//维修费用列表暂时不取
|
//维修费用列表暂时不取
|
||||||
//List<SltAgreementInfo> repairList = getRepairList(list);
|
//List<SltAgreementInfo> repairList = getRepairList(list);
|
||||||
|
|
@ -237,6 +237,35 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
// 实际结算金额
|
// 实际结算金额
|
||||||
bean.setRealCosts(realCosts);
|
bean.setRealCosts(realCosts);
|
||||||
}
|
}
|
||||||
|
Map<String, SltAgreementInfo> mergedMap = new HashMap<>();
|
||||||
|
for (SltAgreementInfo info : leaseList) {
|
||||||
|
String key = info.getTypeId();
|
||||||
|
if (info.getStartTime() != null && info.getEndTime() != null) {
|
||||||
|
key += "_" + info.getStartTime() + "_" + info.getEndTime();
|
||||||
|
}
|
||||||
|
if (mergedMap.containsKey(key)) {
|
||||||
|
SltAgreementInfo mergedInfo = mergedMap.get(key);
|
||||||
|
// 数量相加
|
||||||
|
mergedInfo.setNum(mergedInfo.getNum() + info.getNum());
|
||||||
|
// 实际结算金额相加
|
||||||
|
mergedInfo.setRealCosts(mergedInfo.getRealCosts().add(info.getRealCosts()));
|
||||||
|
// 应结算金额相加
|
||||||
|
mergedInfo.setCosts(mergedInfo.getCosts().add(info.getCosts()));
|
||||||
|
// 合并remark、ckRemark、outRemark
|
||||||
|
if (info.getRemark() != null && !info.getRemark().isEmpty()) {
|
||||||
|
mergedInfo.setRemark(mergedInfo.getRemark() + "、" + info.getRemark());
|
||||||
|
}
|
||||||
|
if (info.getCkRemark() != null && !info.getCkRemark().isEmpty()) {
|
||||||
|
mergedInfo.setCkRemark(mergedInfo.getCkRemark() + "、" + info.getCkRemark());
|
||||||
|
}
|
||||||
|
if (info.getOutRemark() != null && !info.getOutRemark().isEmpty()) {
|
||||||
|
mergedInfo.setOutRemark(mergedInfo.getOutRemark() + "、" + info.getOutRemark());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mergedMap.put(key, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leaseList = new ArrayList<>(mergedMap.values());
|
||||||
return leaseList;
|
return leaseList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -452,11 +481,24 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
public int updateTrimDay(List<SltAgreementInfo> sltAgreementInfo) {
|
public int updateTrimDay(List<SltAgreementInfo> sltAgreementInfo) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (SltAgreementInfo agreementInfo : sltAgreementInfo) {
|
for (SltAgreementInfo agreementInfo : sltAgreementInfo) {
|
||||||
|
List<SltAgreementInfo> list = sltAgreementInfoMapper.getCtList(agreementInfo);
|
||||||
|
if (list!= null && list.size() > 0) {
|
||||||
|
for (SltAgreementInfo bean : list) {
|
||||||
|
bean.setTrimDay(agreementInfo.getTrimDay());
|
||||||
|
bean.setEndTime(agreementInfo.getEndTime());
|
||||||
|
i = sltAgreementInfoMapper.updateTrimDay(bean);
|
||||||
|
if (i == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
i = sltAgreementInfoMapper.updateTrimDay(agreementInfo);
|
i = sltAgreementInfoMapper.updateTrimDay(agreementInfo);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -630,6 +672,38 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
||||||
// 实际结算金额
|
// 实际结算金额
|
||||||
bean.setRealCosts(realCosts);
|
bean.setRealCosts(realCosts);
|
||||||
}
|
}
|
||||||
|
// // 如果isSlt不为0,则进行合并
|
||||||
|
// if (list.get(0).getIsSlt() != null && list.get(0).getIsSlt() != 0) {
|
||||||
|
Map<String, SltAgreementInfo> mergedMap = new HashMap<>();
|
||||||
|
for (SltAgreementInfo info : leaseList) {
|
||||||
|
String key = info.getTypeId();
|
||||||
|
if (info.getStartTime() != null && info.getEndTime() != null) {
|
||||||
|
key += "_" + info.getStartTime() + "_" + info.getEndTime();
|
||||||
|
}
|
||||||
|
if (mergedMap.containsKey(key)) {
|
||||||
|
SltAgreementInfo mergedInfo = mergedMap.get(key);
|
||||||
|
// 数量相加
|
||||||
|
mergedInfo.setNum(mergedInfo.getNum() + info.getNum());
|
||||||
|
// 实际结算金额相加
|
||||||
|
mergedInfo.setRealCosts(mergedInfo.getRealCosts().add(info.getRealCosts()));
|
||||||
|
// 应结算金额相加
|
||||||
|
mergedInfo.setCosts(mergedInfo.getCosts().add(info.getCosts()));
|
||||||
|
// 合并remark、ckRemark、outRemark
|
||||||
|
if (info.getRemark() != null && !info.getRemark().isEmpty()) {
|
||||||
|
mergedInfo.setRemark(mergedInfo.getRemark() + "、" + info.getRemark());
|
||||||
|
}
|
||||||
|
if (info.getCkRemark() != null && !info.getCkRemark().isEmpty()) {
|
||||||
|
mergedInfo.setCkRemark(mergedInfo.getCkRemark() + "、" + info.getCkRemark());
|
||||||
|
}
|
||||||
|
if (info.getOutRemark() != null && !info.getOutRemark().isEmpty()) {
|
||||||
|
mergedInfo.setOutRemark(mergedInfo.getOutRemark() + "、" + info.getOutRemark());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mergedMap.put(key, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leaseList = new ArrayList<>(mergedMap.values());
|
||||||
|
// }
|
||||||
return leaseList;
|
return leaseList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,9 @@
|
||||||
mt2.type_name typeName,
|
mt2.type_name typeName,
|
||||||
lod.out_num,
|
lod.out_num,
|
||||||
lod.remark,
|
lod.remark,
|
||||||
mm.ma_code maCode
|
mm.ma_code maCode,
|
||||||
|
lod.parent_id as taskId,
|
||||||
|
lod.type_id as typeId
|
||||||
FROM
|
FROM
|
||||||
lease_out_details lod
|
lease_out_details lod
|
||||||
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
LEFT JOIN lease_apply_info lai ON lai.id = lod.parent_id
|
||||||
|
|
@ -110,6 +112,36 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getCtList" resultType="com.bonus.sgzb.material.domain.MaWholeVo">
|
||||||
|
select
|
||||||
|
lad.id as id,
|
||||||
|
mt.parent_id AS parentId,
|
||||||
|
mt.type_id as deviceTypeId,
|
||||||
|
mt2.type_name AS typeName,
|
||||||
|
mt.type_name AS deviceType,
|
||||||
|
lad.sets_num as setsNum,
|
||||||
|
CASE mt.manage_type
|
||||||
|
WHEN 0 THEN
|
||||||
|
IFNULL(subquery0.num, 0)
|
||||||
|
ELSE
|
||||||
|
IFNULL(mt.num, 0)
|
||||||
|
END as num,
|
||||||
|
case when lad.update_num IS NOT NULL then lad.update_num else lad.pre_num * lad.sets_num end as applyNum,
|
||||||
|
mt.is_storage AS isStorage
|
||||||
|
from lease_apply_details lad
|
||||||
|
left join ma_type mt on lad.type_id = mt.type_id
|
||||||
|
left join ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
left join (SELECT mt.type_id,
|
||||||
|
count(mm.ma_id) num
|
||||||
|
FROM ma_machine mm
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
WHERE mm.ma_code is not null and mm.ma_status in (15)
|
||||||
|
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
|
||||||
|
where
|
||||||
|
lad.parennt_id = #{taskId}
|
||||||
|
and lad.ct_parent_id = #{typeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
delete from lease_apply_details
|
delete from lease_apply_details
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
|
|
||||||
|
|
@ -1341,4 +1341,19 @@
|
||||||
<select id="getLeaseInfoId" resultType="java.lang.String">
|
<select id="getLeaseInfoId" resultType="java.lang.String">
|
||||||
select id from lease_apply_info where task_id = #{taskId}
|
select id from lease_apply_info where task_id = #{taskId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getCtBean" resultType="com.bonus.sgzb.app.domain.LeaseApplyDetails">
|
||||||
|
|
||||||
|
select
|
||||||
|
mt.type_id as typeId,
|
||||||
|
mt.type_name as typeModelName,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.unit_name as unitName,
|
||||||
|
mt.manage_type as manageType
|
||||||
|
from ma_type mt
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where
|
||||||
|
mt.type_id = #{typeId} and
|
||||||
|
mt.del_flag = 0 and mt1.del_flag = 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
ELSE
|
ELSE
|
||||||
IFNULL(mt.num, 0)
|
IFNULL(mt.num, 0)
|
||||||
END as num,
|
END as num,
|
||||||
case when lad.update_num IS NOT NULL then lad.update_num else lad.pre_num * lad.sets_num end as applyNum,
|
case when lad.update_num IS NOT NULL then lad.update_num else lad.pre_num end as applyNum,
|
||||||
mt.is_storage AS isStorage
|
mt.is_storage AS isStorage
|
||||||
from lease_apply_details lad
|
from lease_apply_details lad
|
||||||
left join ma_type mt on lad.type_id = mt.type_id
|
left join ma_type mt on lad.type_id = mt.type_id
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<select id="getCtList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||||
|
select sai.id,
|
||||||
|
sai.agreement_id as agreementId,
|
||||||
|
sai.company_id as companyId,
|
||||||
|
sai.type_id as typeId,
|
||||||
|
sai.num as num,
|
||||||
|
lai.remark,
|
||||||
|
sai.is_slt as isSlt,
|
||||||
|
sai.ck_remark as ckRemark,
|
||||||
|
sai.trim_day as trimDay,
|
||||||
|
DATE(sai.start_time) as startTime,
|
||||||
|
DATE(sai.end_time) as endTime
|
||||||
|
from slt_agreement_info sai
|
||||||
|
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||||
|
where sai.agreement_id = #{agreementId}
|
||||||
|
and sai.type_id = #{typeId}
|
||||||
|
and DATE(sai.start_time) = #{startTime}
|
||||||
|
and DATE(sai.end_time) = #{endTimeTemp}
|
||||||
|
and sai.lease_type = 0
|
||||||
|
and lai.cost_bearing_party = #{costBearingParty,jdbcType=VARCHAR}
|
||||||
|
order by sai.id
|
||||||
|
</select>
|
||||||
<update id="updateInfoOneStatus">
|
<update id="updateInfoOneStatus">
|
||||||
UPDATE slt_agreement_info sai
|
UPDATE slt_agreement_info sai
|
||||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||||
|
|
@ -357,6 +379,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sai.trim_day as trimDay,
|
sai.trim_day as trimDay,
|
||||||
DATE(sai.start_time) as startTime,
|
DATE(sai.start_time) as startTime,
|
||||||
DATE(sai.end_time) as endTime,
|
DATE(sai.end_time) as endTime,
|
||||||
|
DATE(sai.end_time) as endTimeTemp,
|
||||||
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
|
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
|
||||||
from slt_agreement_info sai
|
from slt_agreement_info sai
|
||||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||||
|
|
@ -367,6 +390,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join ma_type mt on sai.type_id = mt.type_id
|
left join ma_type mt on sai.type_id = mt.type_id
|
||||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
where sai.agreement_id = #{agreementId} and sai.lease_type = 0 and lai.cost_bearing_party = '01'
|
where sai.agreement_id = #{agreementId} and sai.lease_type = 0 and lai.cost_bearing_party = '01'
|
||||||
|
|
||||||
|
<!-- <if test="isSlt != null and isSlt != 0">-->
|
||||||
|
<!-- group by sai.type_id,startTime,endTime-->
|
||||||
|
<!-- </if>-->
|
||||||
</select>
|
</select>
|
||||||
<select id="getLeaseListThree" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
<select id="getLeaseListThree" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||||
select sai.id,
|
select sai.id,
|
||||||
|
|
@ -388,6 +415,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sai.ck_remark as ckRemark,
|
sai.ck_remark as ckRemark,
|
||||||
DATE(sai.start_time) as startTime,
|
DATE(sai.start_time) as startTime,
|
||||||
DATE(sai.end_time) as endTime,
|
DATE(sai.end_time) as endTime,
|
||||||
|
DATE(sai.end_time) as endTimeTemp,
|
||||||
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
|
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
|
||||||
from slt_agreement_info sai
|
from slt_agreement_info sai
|
||||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||||
|
|
@ -398,6 +426,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join ma_type mt on sai.type_id = mt.type_id
|
left join ma_type mt on sai.type_id = mt.type_id
|
||||||
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
where sai.agreement_id = #{agreementId} and sai.lease_type = 0 and lai.cost_bearing_party = '03'
|
where sai.agreement_id = #{agreementId} and sai.lease_type = 0 and lai.cost_bearing_party = '03'
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getLeaseListOneMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
<select id="getLeaseListOneMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue