合并工程结算
This commit is contained in:
parent
97823f80a8
commit
31b04c5e6a
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.bonus.common.log.enums.OperaType;
|
import com.bonus.common.log.enums.OperaType;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
|
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -49,6 +50,13 @@ public class SltAgreementInfoController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据协议获取结算清单")
|
||||||
|
@PostMapping("/getSltInfo")
|
||||||
|
public AjaxResult getSltInfo(@RequestBody List<SltAgreementInfo> list) {
|
||||||
|
SltInfoVo bean = sltAgreementInfoService.getSltInfo(list);
|
||||||
|
return AjaxResult.success(bean);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出结算信息列表
|
* 导出结算信息列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -108,5 +108,27 @@ public class SltAgreementInfo extends BaseEntity {
|
||||||
@ApiModelProperty(value = "调整天数")
|
@ApiModelProperty(value = "调整天数")
|
||||||
private Long trimDay;
|
private Long trimDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁天数
|
||||||
|
*/
|
||||||
|
@Excel(name = "租赁天数")
|
||||||
|
@ApiModelProperty(value = "租赁天数")
|
||||||
|
private Long leaseDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租赁费用
|
||||||
|
*/
|
||||||
|
@Excel(name = "租赁费用")
|
||||||
|
@ApiModelProperty(value = "租赁费用")
|
||||||
|
private BigDecimal costs;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
/**
|
||||||
|
* 工程名称
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,19 @@ public class SltAgreementRelation extends BaseEntity {
|
||||||
@ApiModelProperty(value = "协议id")
|
@ApiModelProperty(value = "协议id")
|
||||||
private String agreementId;
|
private String agreementId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String unitName;
|
||||||
|
/**
|
||||||
|
* 工程名称
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
|
/**
|
||||||
|
* 公司ID
|
||||||
|
*/
|
||||||
|
private Long companyId;
|
||||||
|
|
||||||
/** 增加费用 */
|
/** 增加费用 */
|
||||||
@Excel(name = "增加费用")
|
@Excel(name = "增加费用")
|
||||||
@ApiModelProperty(value = "增加费用")
|
@ApiModelProperty(value = "增加费用")
|
||||||
|
|
@ -43,6 +56,11 @@ public class SltAgreementRelation extends BaseEntity {
|
||||||
@ApiModelProperty(value = "减免费用")
|
@ApiModelProperty(value = "减免费用")
|
||||||
private BigDecimal subCost;
|
private BigDecimal subCost;
|
||||||
|
|
||||||
|
/** 租赁费用 */
|
||||||
|
@Excel(name = "租赁费用")
|
||||||
|
@ApiModelProperty(value = "租赁费用")
|
||||||
|
private BigDecimal leaseCost;
|
||||||
|
|
||||||
/** 费用承担方1费用 */
|
/** 费用承担方1费用 */
|
||||||
@Excel(name = "费用承担方1费用")
|
@Excel(name = "费用承担方1费用")
|
||||||
@ApiModelProperty(value = "费用承担方1费用")
|
@ApiModelProperty(value = "费用承担方1费用")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bonus.material.settlement.domain.vo;
|
||||||
|
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author c liu
|
||||||
|
* @date 2024/2/23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SltInfoVo {
|
||||||
|
/**
|
||||||
|
* 租赁费用列表
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> leaseList;
|
||||||
|
/**
|
||||||
|
* 维修费用列表
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> repairList;
|
||||||
|
/**
|
||||||
|
* 报废费用列表
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> scrapList;
|
||||||
|
/**
|
||||||
|
* 丢失费用列表
|
||||||
|
*/
|
||||||
|
List<SltAgreementInfo> loseList;
|
||||||
|
|
||||||
|
List<SltAgreementRelation> relations;
|
||||||
|
|
||||||
|
String cost;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.material.lease.domain.LeaseOutDetails;
|
import com.bonus.material.lease.domain.LeaseOutDetails;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -67,4 +68,12 @@ public interface SltAgreementInfoMapper {
|
||||||
int updSltInfo(SltAgreementInfo sltAgreementInfo);
|
int updSltInfo(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
|
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
|
||||||
|
|
||||||
|
List<SltAgreementInfo> getLeaseList(SltAgreementInfo bean);
|
||||||
|
|
||||||
|
List<SltAgreementInfo> getRepairDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||||
|
|
||||||
|
List<SltAgreementInfo> getScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||||
|
|
||||||
|
List<SltAgreementInfo> getLoseList(SltAgreementInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.settlement.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
|
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算信息Service接口
|
* 结算信息Service接口
|
||||||
|
|
@ -26,6 +27,8 @@ public interface ISltAgreementInfoService {
|
||||||
*/
|
*/
|
||||||
public List<SltAgreementInfo> selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo);
|
public List<SltAgreementInfo> selectSltAgreementInfoList(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
public SltInfoVo getSltInfo(List<SltAgreementInfo> list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增结算信息
|
* 新增结算信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,24 @@
|
||||||
package com.bonus.material.settlement.service.impl;
|
package com.bonus.material.settlement.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||||
import com.bonus.common.core.exception.ServiceException;
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementRelation;
|
||||||
|
import com.bonus.material.settlement.domain.vo.SltInfoVo;
|
||||||
|
import com.bonus.material.task.domain.TmTask;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
import com.bonus.material.settlement.service.ISltAgreementInfoService;
|
import com.bonus.material.settlement.service.ISltAgreementInfoService;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算信息Service业务层处理
|
* 结算信息Service业务层处理
|
||||||
*
|
*
|
||||||
|
|
@ -20,6 +30,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TmTaskMapper taskMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询结算信息
|
* 查询结算信息
|
||||||
*
|
*
|
||||||
|
|
@ -42,6 +55,26 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
return sltAgreementInfoMapper.selectSltAgreementInfoList(sltAgreementInfo);
|
return sltAgreementInfoMapper.selectSltAgreementInfoList(sltAgreementInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SltInfoVo getSltInfo(List<SltAgreementInfo> list) {
|
||||||
|
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||||
|
//租赁费用列表
|
||||||
|
List<SltAgreementInfo> leaseList = getLeaseList(list);
|
||||||
|
//维修费用列表
|
||||||
|
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||||
|
//报废费用列表
|
||||||
|
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||||
|
//丢失费用列表
|
||||||
|
List<SltAgreementInfo> loseList = getLoseList(list);
|
||||||
|
sltInfoVo.setLeaseList(leaseList);
|
||||||
|
sltInfoVo.setRepairList(repairList);
|
||||||
|
sltInfoVo.setScrapList(scrapList);
|
||||||
|
sltInfoVo.setLoseList(loseList);
|
||||||
|
List<SltAgreementRelation> relations = getRelations(leaseList, repairList, scrapList, loseList, list);
|
||||||
|
sltInfoVo.setRelations(relations);
|
||||||
|
return sltInfoVo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增结算信息
|
* 新增结算信息
|
||||||
*
|
*
|
||||||
|
|
@ -95,4 +128,160 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
|
||||||
public int deleteSltAgreementInfoById(Long id) {
|
public int deleteSltAgreementInfoById(Long id) {
|
||||||
return sltAgreementInfoMapper.deleteSltAgreementInfoById(id);
|
return sltAgreementInfoMapper.deleteSltAgreementInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SltAgreementInfo> getLeaseList(List<SltAgreementInfo> list) {
|
||||||
|
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||||
|
for (SltAgreementInfo bean : list) {
|
||||||
|
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(bean);
|
||||||
|
leaseList.addAll(oneOfList);
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo bean : leaseList) {
|
||||||
|
if (bean.getLeasePrice() == null) {
|
||||||
|
bean.setLeasePrice(BigDecimal.valueOf(0.00));
|
||||||
|
}
|
||||||
|
if (bean.getNum() == null) {
|
||||||
|
bean.setNum(0L);
|
||||||
|
}
|
||||||
|
if (bean.getLeaseDay() == null) {
|
||||||
|
bean.setLeaseDay(0L);
|
||||||
|
}
|
||||||
|
BigDecimal leasePrice = bean.getLeasePrice();
|
||||||
|
BigDecimal num = new BigDecimal(bean.getNum());
|
||||||
|
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDay());
|
||||||
|
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
|
return leaseList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SltAgreementInfo> getRepairList(List<SltAgreementInfo> list) {
|
||||||
|
List<SltAgreementInfo> repairList = new ArrayList<>();
|
||||||
|
Integer taskType = TmTaskTypeEnum.TM_TASK_REPAIR.getTaskTypeId();
|
||||||
|
//String taskType = TaskTypeEnum.MAINTENANCE_TASK.getCode();
|
||||||
|
for (SltAgreementInfo bean : list) {
|
||||||
|
List<TmTask> taskList = taskMapper.getTaskList(bean, taskType);
|
||||||
|
if (taskList != null && taskList.size() > 0) {
|
||||||
|
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(taskList);
|
||||||
|
repairList.addAll(repairDetailsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return repairList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SltAgreementInfo> getScrapList(List<SltAgreementInfo> list) {
|
||||||
|
List<SltAgreementInfo> scrapList = new ArrayList<>();
|
||||||
|
Integer taskType = TmTaskTypeEnum.TM_TASK_SCRAP.getTaskTypeId();
|
||||||
|
//String taskType = TaskTypeEnum.SCRAP_TASK.getCode();
|
||||||
|
for (SltAgreementInfo bean : list) {
|
||||||
|
List<TmTask> taskList = taskMapper.getTaskList(bean, taskType);
|
||||||
|
if (taskList != null && taskList.size() > 0) {
|
||||||
|
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(taskList);
|
||||||
|
scrapList.addAll(scrapDetailsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (scrapList != null && scrapList.size() > 0) {
|
||||||
|
for (SltAgreementInfo bean : scrapList) {
|
||||||
|
|
||||||
|
if (bean.getBuyPrice() == null) {
|
||||||
|
bean.setBuyPrice(BigDecimal.valueOf(0.00));
|
||||||
|
}
|
||||||
|
if (bean.getNum() == null) {
|
||||||
|
bean.setNum(0L);
|
||||||
|
}
|
||||||
|
BigDecimal buyPrice = bean.getBuyPrice();
|
||||||
|
BigDecimal num = new BigDecimal(bean.getNum());
|
||||||
|
BigDecimal costs = buyPrice.multiply(num);
|
||||||
|
//计算总金额
|
||||||
|
/*BigDecimal costs = BigDecimal.ZERO;
|
||||||
|
if (bean.getBuyPrice() != null && bean.getBuyPrice() != null){
|
||||||
|
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
|
||||||
|
BigDecimal num = new BigDecimal(bean.getNum());
|
||||||
|
costs = buyPrice.multiply(num);
|
||||||
|
}*/
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scrapList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SltAgreementInfo> getLoseList(List<SltAgreementInfo> list) {
|
||||||
|
List<SltAgreementInfo> loseList = new ArrayList<>();
|
||||||
|
for (SltAgreementInfo bean : list) {
|
||||||
|
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(bean);
|
||||||
|
loseList.addAll(oneOfList);
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo bean : loseList) {
|
||||||
|
if (bean.getBuyPrice() == null) {
|
||||||
|
bean.setBuyPrice(BigDecimal.valueOf(0.00));
|
||||||
|
}
|
||||||
|
if (bean.getNum() == null) {
|
||||||
|
bean.setNum(0L);
|
||||||
|
}
|
||||||
|
BigDecimal buyPrice = bean.getBuyPrice();
|
||||||
|
BigDecimal num = new BigDecimal(bean.getNum());
|
||||||
|
// 原价 x 数量
|
||||||
|
BigDecimal costs = buyPrice.multiply(num);
|
||||||
|
//计算租赁费用
|
||||||
|
/*BigDecimal costs = BigDecimal.ZERO;
|
||||||
|
if (bean.getBuyPrice() != null && bean.getNum() != null){
|
||||||
|
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
|
||||||
|
BigDecimal num = new BigDecimal(bean.getNum());
|
||||||
|
costs = buyPrice.multiply(num);
|
||||||
|
}*/
|
||||||
|
bean.setCosts(costs);
|
||||||
|
}
|
||||||
|
return loseList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<SltAgreementRelation> getRelations(List<SltAgreementInfo> leaseList, List<SltAgreementInfo> repairList,
|
||||||
|
List<SltAgreementInfo> scrapList, List<SltAgreementInfo> loseList,
|
||||||
|
List<SltAgreementInfo> list) {
|
||||||
|
List<SltAgreementRelation> relations = new ArrayList<>();
|
||||||
|
for (SltAgreementInfo info : list) {
|
||||||
|
SltAgreementRelation relation = new SltAgreementRelation();
|
||||||
|
BigDecimal loseCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal leaseCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal scrapCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal repairCost = BigDecimal.ZERO;
|
||||||
|
for (SltAgreementInfo lease : leaseList) {
|
||||||
|
if (lease.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
relation.setAgreementId(String.valueOf(lease.getAgreementId()));
|
||||||
|
relation.setProjectName(lease.getProjectName());
|
||||||
|
relation.setUnitName(lease.getUnitName());
|
||||||
|
relation.setCompanyId(lease.getCompanyId());
|
||||||
|
BigDecimal cost = lease.getCosts();
|
||||||
|
leaseCost = leaseCost.add(cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo repair : repairList) {
|
||||||
|
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
BigDecimal cost = repair.getCosts();
|
||||||
|
repairCost = repairCost.add(cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo scrap : scrapList) {
|
||||||
|
if (scrap.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
BigDecimal cost = scrap.getCosts();
|
||||||
|
scrapCost = scrapCost.add(cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SltAgreementInfo lose : loseList) {
|
||||||
|
if (lose.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||||
|
//TODO 上面已经set过值,这里为什么还要set值
|
||||||
|
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
|
||||||
|
relation.setProjectName(lose.getProjectName());
|
||||||
|
relation.setUnitName(lose.getUnitName());
|
||||||
|
relation.setCompanyId(lose.getCompanyId());
|
||||||
|
BigDecimal cost = lose.getCosts();
|
||||||
|
loseCost = loseCost.add(cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
relation.setLeaseCost(leaseCost);
|
||||||
|
relation.setRepairCost(repairCost);
|
||||||
|
relation.setScrapCost(scrapCost);
|
||||||
|
relation.setLoseCost(loseCost);
|
||||||
|
relations.add(relation);
|
||||||
|
}
|
||||||
|
return relations;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
package com.bonus.material.task.mapper;
|
package com.bonus.material.task.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import com.bonus.material.task.domain.TmTaskAgreement;
|
import com.bonus.material.task.domain.TmTaskAgreement;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务Mapper接口
|
* 任务Mapper接口
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.bonus.material.task.mapper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -86,4 +88,6 @@ public interface TmTaskMapper {
|
||||||
*/
|
*/
|
||||||
String selectTaskNumByMonths(Date nowDate, Integer taskType);
|
String selectTaskNumByMonths(Date nowDate, Integer taskType);
|
||||||
|
|
||||||
|
List<TmTask> getTaskList(@Param("bean") SltAgreementInfo bean, @Param("taskType")Integer taskType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,4 +176,114 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
||||||
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
|
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="getLeaseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
select sai.id,
|
||||||
|
sai.agreement_id as agreementId,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bp.pro_name as projectName,
|
||||||
|
sai.company_id as companyId,
|
||||||
|
sai.type_id as typeId,
|
||||||
|
sai.ma_id as maId,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt.unit_name as nuitName,
|
||||||
|
sai.lease_price as leasePrice,
|
||||||
|
sai.num as num,
|
||||||
|
DATE(sai.start_time) as startTime,
|
||||||
|
DATE(sai.end_time) as endTime,
|
||||||
|
DATEDIFF(IF(sai.end_time is null,CURDATE(),sai.end_time), sai.start_time) + 1 as leaseDays
|
||||||
|
from slt_agreement_info sai
|
||||||
|
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_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
|
||||||
|
where sai.agreement_id = #{agreementId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRepairDetailsList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
select tta.agreement_id as agreementId,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bp.pro_name as projectName,
|
||||||
|
rc.type_id as typeId,
|
||||||
|
rc.ma_id as maId,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt.unit_name as nuitName,
|
||||||
|
rc.repair_num as num,
|
||||||
|
rc.costs as costs,
|
||||||
|
case rc.repair_type when '1' then '内部维修' when '2' then '返厂维修' else '' end as partType,
|
||||||
|
rc.company_id as companyId
|
||||||
|
from repair_cost rc
|
||||||
|
LEFT JOIN tm_task_agreement tta on rc.task_id = tta.task_id
|
||||||
|
LEFT JOIN tm_task tt on rc.task_id = tt.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
left join ma_type mt on rc.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where rc.status in ('3')
|
||||||
|
<if test="taskList != null and taskList.size() > 0">
|
||||||
|
and rc.task_id in
|
||||||
|
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||||
|
#{task.taskId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getScrapDetailsList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
select tta.agreement_id as agreementId,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bp.pro_name as projectName,
|
||||||
|
sad.type_id as typeId,
|
||||||
|
sad.ma_id as maId,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt.unit_name as nuitName,
|
||||||
|
sum(sad.scrap_num) as num,
|
||||||
|
mt.buy_price as buyPrice,
|
||||||
|
case sad.scrap_type when '0' then '自然' when '1' then '人为' else '' end as scrapType,
|
||||||
|
sad.company_id as companyId
|
||||||
|
from scrap_apply_details sad
|
||||||
|
left join tm_task_agreement tta on sad.task_id = tta.task_id
|
||||||
|
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
|
||||||
|
left join ma_type mt on sad.type_id = mt.type_id
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id
|
||||||
|
where 1=1 and sad.status = '3'
|
||||||
|
<if test="taskList != null and taskList.size() > 0">
|
||||||
|
and sad.task_id in
|
||||||
|
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||||
|
#{task.taskId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by sad.type_id,sad.ma_id,sad.scrap_type
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getLoseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
select sai.id,
|
||||||
|
sai.agreement_id as agreementId,
|
||||||
|
bui.unit_name as unitName,
|
||||||
|
bp.pro_name as projectName,
|
||||||
|
sai.company_id as companyId,
|
||||||
|
sai.type_id as typeId,
|
||||||
|
sai.ma_id as maId,
|
||||||
|
mt1.type_name as typeName,
|
||||||
|
mt.type_name as modelName,
|
||||||
|
mt.unit_name as nuitName,
|
||||||
|
sai.buy_price as buyPrice,
|
||||||
|
sai.num as num,
|
||||||
|
sai.start_time as startTime,
|
||||||
|
sai.end_time as endTime,
|
||||||
|
DATEDIFF(sai.end_time, sai.start_time) + 1 as leaseDays
|
||||||
|
from slt_agreement_info sai
|
||||||
|
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
|
||||||
|
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
|
||||||
|
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_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
|
||||||
|
where sai.agreement_id = #{agreementId} and sai.end_time is null
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -130,4 +130,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ORDER BY create_time DESC LIMIT 1
|
ORDER BY create_time DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getTaskList" resultType="com.bonus.material.task.domain.TmTask">
|
||||||
|
select tt.task_id as taskId
|
||||||
|
from tm_task_agreement tta
|
||||||
|
left join tm_task tt on tta.task_id = tt.task_id
|
||||||
|
where tta.agreement_id = #{bean.agreementId} and tt.task_type = #{taskType}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue