Merge branch 'dev-cq' of http://192.168.0.56:3000/bonus/devicesmgt into dev-cq
This commit is contained in:
commit
484714a665
|
|
@ -1,8 +1,10 @@
|
|||
package com.bonus.sgzb.base.api.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
|
|
@ -14,6 +16,10 @@ public class SltAgreementInfo {
|
|||
*
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String ids;
|
||||
/**
|
||||
*协议id
|
||||
*/
|
||||
|
|
@ -41,14 +47,17 @@ public class SltAgreementInfo {
|
|||
/**
|
||||
*领料数量
|
||||
*/
|
||||
@Excel(name = "数量")
|
||||
private String num;
|
||||
/**
|
||||
*领料时间
|
||||
*/
|
||||
@Excel(name = "开始日期")
|
||||
private String startTime;
|
||||
/**
|
||||
*退料时间
|
||||
*/
|
||||
@Excel(name = "结算日期")
|
||||
private String endTime;
|
||||
/**
|
||||
*0在用1退回
|
||||
|
|
@ -65,6 +74,7 @@ public class SltAgreementInfo {
|
|||
/**
|
||||
*租赁单价
|
||||
*/
|
||||
@Excel(name = "台班费单价(元/天)")
|
||||
private String leasePrice;
|
||||
/**
|
||||
*原值
|
||||
|
|
@ -77,34 +87,50 @@ public class SltAgreementInfo {
|
|||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@Excel(name = "领用单位")
|
||||
private String unitName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "工程名称")
|
||||
private String projectName;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "设备名称")
|
||||
private String typeName;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String modelName;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@Excel(name = "单位")
|
||||
private String nuitName;
|
||||
/**
|
||||
* 租赁天数
|
||||
*/
|
||||
@Excel(name = "结算天数")
|
||||
private String leaseDays;
|
||||
/**
|
||||
* 租赁费用
|
||||
*/
|
||||
@Excel(name = "结算金额")
|
||||
private String costs;
|
||||
/**
|
||||
* 配件总价
|
||||
*/
|
||||
private String partAllCosts;
|
||||
/**
|
||||
* 总价
|
||||
*/
|
||||
private String allCosts;
|
||||
/**
|
||||
* 真实租赁费用
|
||||
*/
|
||||
@Excel(name = "本月暂计金额")
|
||||
private String realCosts;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
|
|
@ -127,6 +153,7 @@ public class SltAgreementInfo {
|
|||
/**
|
||||
* 费用承担方
|
||||
*/
|
||||
@Excel(name = "费用承担方")
|
||||
private String costBearingParty;
|
||||
/**
|
||||
* 调整天数
|
||||
|
|
@ -140,5 +167,23 @@ public class SltAgreementInfo {
|
|||
* 是否结算(0 未结算 1已结算)
|
||||
*/
|
||||
private String isSlt;
|
||||
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String month;
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private String nextMonth;
|
||||
/**
|
||||
* 委外维修费用
|
||||
*/
|
||||
private String outSourceCosts;
|
||||
private String beginTime;
|
||||
private String offTime;
|
||||
private String partModelName;
|
||||
private String partName;
|
||||
private Integer codeNum;
|
||||
private List<SltAgreementInfo> node;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public class SltInfoVo {
|
|||
/**
|
||||
* 租赁费用列表(01、03)
|
||||
*/
|
||||
List<SltAgreementInfo> leaseList;
|
||||
List<SltAgreementInfo> leaseListOne;
|
||||
List<SltAgreementInfo> leaseListThree;
|
||||
/**
|
||||
|
|
@ -23,6 +24,10 @@ public class SltInfoVo {
|
|||
* 报废费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> scrapList;
|
||||
/**
|
||||
* 预报废费用列表
|
||||
*/
|
||||
List<SltAgreementInfo> preScrapList;
|
||||
/**
|
||||
* 丢失费用列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.material.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementApply;
|
||||
import com.bonus.sgzb.base.api.domain.SltAgreementDetails;
|
||||
|
|
@ -11,10 +12,7 @@ import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.sgzb.common.log.annotation.Log;
|
||||
import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||
import com.bonus.sgzb.material.domain.AgreementInfo;
|
||||
import com.bonus.sgzb.material.domain.LeaseInfo;
|
||||
import com.bonus.sgzb.material.domain.LoseInfo;
|
||||
import com.bonus.sgzb.material.domain.ScrapInfo;
|
||||
import com.bonus.sgzb.material.domain.*;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -47,7 +45,7 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 根据协议获取完工结算清单
|
||||
* 根据协议获取结算清单
|
||||
*/
|
||||
@ApiOperation(value = "根据协议获取结算清单")
|
||||
@PostMapping("/getSltInfo")
|
||||
|
|
@ -57,13 +55,41 @@ public class SltAgreementInfoController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 根据协议获取完工结算清单
|
||||
* 根据协议获取月结算清单
|
||||
*/
|
||||
@ApiOperation(value = "根据协议获取结算清单")
|
||||
@ApiOperation(value = "根据协议获取月结算清单")
|
||||
@PostMapping("/getSltInfoMonth")
|
||||
public AjaxResult getSltInfoMonth(@RequestBody List<AgreementInfo> list) {
|
||||
SltInfoVo bean = sltAgreementInfoService.getSltInfo(list);
|
||||
return AjaxResult.success(bean);
|
||||
return AjaxResult.success(sltAgreementInfoService.getSltInfoMonth(list));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "月结明细导出")
|
||||
@PostMapping("/exportSltInfoMonth")
|
||||
public void exportSltInfoMonth(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> sltInfoMonth = sltAgreementInfoService.getSltInfoMonth(list);
|
||||
for (AgreementInfo agreementInfo : list) {
|
||||
for (SltAgreementInfo sltAgreementInfo : sltInfoMonth) {
|
||||
String[] split = agreementInfo.getCodeNum().split(",");
|
||||
for (String s : split) {
|
||||
if (s.equals(sltAgreementInfo.getCodeNum().toString())) {
|
||||
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
|
||||
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
|
||||
util.exportExcel(response, node, "月结明细导出数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量月结明细导出")
|
||||
@PostMapping("/exportBatchSltInfoMonth")
|
||||
public void exportBatchSltInfoMonth(HttpServletResponse response, @RequestBody List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> sltInfoMonth = sltAgreementInfoService.getSltInfoMonth(list);
|
||||
for (SltAgreementInfo sltAgreementInfo : sltInfoMonth) {
|
||||
List<SltAgreementInfo> node = sltAgreementInfo.getNode();
|
||||
ExcelUtil<SltAgreementInfo> util = new ExcelUtil<SltAgreementInfo>(SltAgreementInfo.class);
|
||||
util.exportExcel(response, node, "月结明细导出数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,8 +148,8 @@ public class SltAgreementInfoController extends BaseController {
|
|||
@PostMapping("/exportRepair")
|
||||
public void exportRepair(HttpServletResponse response, List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> explist = sltAgreementInfoService.getRepairList(list);
|
||||
List<LeaseInfo> leaseInfoList = Convert.toList(LeaseInfo.class, explist);
|
||||
ExcelUtil<LeaseInfo> util = new ExcelUtil<LeaseInfo>(LeaseInfo.class);
|
||||
List<RepairInfo> leaseInfoList = Convert.toList(RepairInfo.class, explist);
|
||||
ExcelUtil<RepairInfo> util = new ExcelUtil<RepairInfo>(RepairInfo.class);
|
||||
util.exportExcel(response, leaseInfoList, "维修明细导出");
|
||||
}
|
||||
|
||||
|
|
@ -139,6 +165,18 @@ public class SltAgreementInfoController extends BaseController {
|
|||
util.exportExcel(response, leaseInfoList, "维修明细导出");
|
||||
}
|
||||
|
||||
/**
|
||||
* 预报废明细导出
|
||||
*/
|
||||
@Log(title = "预报废明细导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportPreScrap")
|
||||
public void exportPreScrap(HttpServletResponse response, List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> explist = sltAgreementInfoService.getPreScrapList(list);
|
||||
List<preScrapInfo> leaseInfoList = Convert.toList(preScrapInfo.class, explist);
|
||||
ExcelUtil<preScrapInfo> util = new ExcelUtil<preScrapInfo>(preScrapInfo.class);
|
||||
util.exportExcel(response, leaseInfoList, "维修明细导出");
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用结算提交
|
||||
*/
|
||||
|
|
@ -148,6 +186,24 @@ public class SltAgreementInfoController extends BaseController {
|
|||
return sltAgreementInfoService.submitFee(apply);
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用结算提交
|
||||
*/
|
||||
@ApiOperation(value = "委外费用修改")
|
||||
@PostMapping("/updateOutSourceCosts")
|
||||
public AjaxResult updateOutSourceCosts(@RequestBody List<SltAgreementInfo> apply) {
|
||||
if (CollUtil.isEmpty(apply)) {
|
||||
return AjaxResult.error("请选择设备维修单");
|
||||
}
|
||||
for (SltAgreementInfo sltAgreementInfo : apply) {
|
||||
int res = sltAgreementInfoService.updateOutSourceCosts(sltAgreementInfo);
|
||||
if (res == 0) {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 费用结算提交
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
@Data
|
||||
public class AgreementInfo extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String ids;
|
||||
/**
|
||||
* 协议ID
|
||||
*/
|
||||
|
|
@ -112,6 +112,12 @@ public class AgreementInfo extends BaseEntity {
|
|||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
@ApiModelProperty(value = "结算月份")
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
|
@ -130,8 +136,17 @@ public class AgreementInfo extends BaseEntity {
|
|||
private String cost;
|
||||
@ApiModelProperty(value = "结算状态")
|
||||
private String sltStatus;
|
||||
@ApiModelProperty(value = "费用承担方")
|
||||
private String costBearingParty;
|
||||
private String codeNum;
|
||||
/**
|
||||
* 是否结算
|
||||
*/
|
||||
private Integer isSlt;
|
||||
|
||||
/** 导出选中列表 */
|
||||
/**
|
||||
* 导出选中列表
|
||||
*/
|
||||
@ApiModelProperty(value = "导出选中列表")
|
||||
private List<Long> dataCondition;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,14 @@ public class LeaseInfo {
|
|||
*
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
private String partName;
|
||||
/**
|
||||
*配件型号
|
||||
*/
|
||||
private String partModelName;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,6 +46,16 @@ public class RepairInfo {
|
|||
*
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 配件名称
|
||||
*/
|
||||
@Excel(name = "配件名称")
|
||||
private String partName;
|
||||
/**
|
||||
*配件型号
|
||||
*/
|
||||
@Excel(name = "配件型号")
|
||||
private String partModelName;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
|
|
@ -78,7 +88,7 @@ public class RepairInfo {
|
|||
/**
|
||||
*领料数量
|
||||
*/
|
||||
@Excel(name = "维修数量")
|
||||
@Excel(name = "数量")
|
||||
private String num;
|
||||
/**
|
||||
*领料时间
|
||||
|
|
@ -93,14 +103,41 @@ public class RepairInfo {
|
|||
*/
|
||||
private String leaseDays;
|
||||
/**
|
||||
* 租赁费用
|
||||
* 实际结算天数
|
||||
*/
|
||||
@Excel(name = "维修费用")
|
||||
private String realDays;
|
||||
/**
|
||||
* 应结算金额
|
||||
*/
|
||||
@Excel(name = "配件单价")
|
||||
private String costs;
|
||||
/**
|
||||
* 实际结算金额
|
||||
*/
|
||||
@Excel(name = "实际结算金额(元)")
|
||||
private String realCosts;
|
||||
/**
|
||||
* 配件总价
|
||||
*/
|
||||
@Excel(name = "配件总价(元)")
|
||||
private String partAllCosts;
|
||||
/**
|
||||
* 费用总价
|
||||
*/
|
||||
@Excel(name = "费用总价")
|
||||
private String allCosts;
|
||||
/**
|
||||
* 委外维修费用
|
||||
*/
|
||||
@Excel(name = "委外维修费用")
|
||||
private String outSourceCosts;
|
||||
/**
|
||||
* 实际结算金额
|
||||
*/
|
||||
private String trimDay;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
*/
|
||||
@Excel(name = "是否收费")
|
||||
private String partType;
|
||||
/**
|
||||
* 维修审核:0未审核,1已审核,2已驳回
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ public class ScrapInfo {
|
|||
*机具id
|
||||
*/
|
||||
private String maId;
|
||||
/**
|
||||
*设备编码
|
||||
*/
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
/**
|
||||
*0在用1退回
|
||||
|
|
@ -41,6 +46,7 @@ public class ScrapInfo {
|
|||
/**
|
||||
*原值
|
||||
*/
|
||||
@Excel(name = "赔偿单价")
|
||||
private String buyPrice;
|
||||
/**
|
||||
*
|
||||
|
|
@ -95,7 +101,6 @@ public class ScrapInfo {
|
|||
/**
|
||||
* (0自然,1人为)
|
||||
*/
|
||||
@Excel(name = "报废原因")
|
||||
private String scrapType;
|
||||
/**
|
||||
* 租赁费用
|
||||
|
|
|
|||
|
|
@ -0,0 +1,122 @@
|
|||
package com.bonus.sgzb.material.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author c liu
|
||||
* @date 2024/2/21
|
||||
*/
|
||||
@Data
|
||||
public class preScrapInfo {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
*协议id
|
||||
*/
|
||||
private String agreementId;
|
||||
/**
|
||||
*机具规格id
|
||||
*/
|
||||
private String typeId;
|
||||
/**
|
||||
*机具id
|
||||
*/
|
||||
private String maId;
|
||||
/**
|
||||
*设备编码
|
||||
*/
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
/**
|
||||
*0在用1退回
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
*领料id
|
||||
*/
|
||||
private String leaseId;
|
||||
/**
|
||||
*退料id
|
||||
*/
|
||||
private String backId;
|
||||
/**
|
||||
*原值
|
||||
*/
|
||||
private String buyPrice;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String companyId;
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
private String projectName;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "设备名称")
|
||||
private String typeName;
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@Excel(name = "规格型号")
|
||||
private String modelName;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@Excel(name = "计量单位")
|
||||
private String nuitName;
|
||||
/**
|
||||
*租赁单价
|
||||
*/
|
||||
private String leasePrice;
|
||||
/**
|
||||
*领料数量
|
||||
*/
|
||||
@Excel(name = "报废数量")
|
||||
private String num;
|
||||
/**
|
||||
*领料时间
|
||||
*/
|
||||
private String startTime;
|
||||
/**
|
||||
*退料时间
|
||||
*/
|
||||
private String endTime;
|
||||
/**
|
||||
* 租赁天数
|
||||
*/
|
||||
private String leaseDays;
|
||||
/**
|
||||
* (0自然,1人为)
|
||||
*/
|
||||
private String scrapType;
|
||||
/**
|
||||
* 租赁费用
|
||||
*/
|
||||
private String costs;
|
||||
/**
|
||||
* 类型(0不收费,1收费)
|
||||
*/
|
||||
private String partType;
|
||||
/**
|
||||
* 维修审核:0未审核,1已审核,2已驳回
|
||||
*/
|
||||
private String repairStatus;
|
||||
|
||||
/**
|
||||
* 费用类型:1租赁2丢失3维修4报废
|
||||
*/
|
||||
private String sltType;
|
||||
private String applyId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -56,4 +56,18 @@ public interface SltAgreementInfoMapper {
|
|||
int updateTrimDay(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
int updateInfoOneStatus(SltAgreementInfo apply);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListOneMonth(@Param("bean") AgreementInfo bean, @Param("ids") List<String> idList);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListThreeMonth(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListMonth(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getLeaseListMonthNotNull(AgreementInfo bean);
|
||||
|
||||
List<SltAgreementInfo> getPreScrapDetailsList(@Param("taskList") List<TmTask> taskList);
|
||||
|
||||
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
||||
|
||||
int updateBmAgreementInfo(@Param("agreementId") String agreementId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public interface SltAgreementInfoService {
|
|||
List<SltAgreementInfo> getRepairList(List<AgreementInfo> list);
|
||||
|
||||
List<SltAgreementInfo> getScrapList(List<AgreementInfo> list);
|
||||
List<SltAgreementInfo> getPreScrapList(List<AgreementInfo> list);
|
||||
|
||||
int updateTrimDay(List<SltAgreementInfo> sltAgreementInfo);
|
||||
|
||||
List<SltAgreementInfo> getSltInfoMonth(List<AgreementInfo> list);
|
||||
|
||||
int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -492,7 +492,8 @@ public class ScrapApplyDetailsServiceImpl implements IScrapApplyDetailsService {
|
|||
if (notScrapList.size() == scrapApplyDetailsList.size()) {
|
||||
task.setTaskStatus(59);
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
status = "2";
|
||||
List<ScrapApplyDetails> backList = new ArrayList<>();
|
||||
List<ScrapApplyDetails> repairList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.bonus.sgzb.material.domain.TmTask;
|
|||
import com.bonus.sgzb.material.mapper.SltAgreementInfoMapper;
|
||||
import com.bonus.sgzb.material.service.SltAgreementInfoService;
|
||||
import com.bonus.sgzb.material.vo.GlobalContants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
|
@ -50,18 +51,50 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
//报废费用列表
|
||||
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
//预报废费用列表
|
||||
List<SltAgreementInfo> preScrapList = getPreScrapList(list);
|
||||
//丢失费用列表
|
||||
List<SltAgreementInfo> loseList = getLoseList(list);
|
||||
sltInfoVo.setLeaseListOne(leaseListOne);
|
||||
sltInfoVo.setLeaseListThree(leaseListThree);
|
||||
sltInfoVo.setRepairList(repairList);
|
||||
sltInfoVo.setScrapList(scrapList);
|
||||
sltInfoVo.setPreScrapList(preScrapList);
|
||||
sltInfoVo.setLoseList(loseList);
|
||||
List<SltAgreementRelation> relations = getRelations(leaseListOne, leaseListThree, repairList, scrapList, loseList, list);
|
||||
sltInfoVo.setRelations(relations);
|
||||
return sltInfoVo;
|
||||
}
|
||||
|
||||
public List<SltAgreementInfo> getPreScrapList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> scrapList = new ArrayList<>();
|
||||
String taskType = "57";
|
||||
for (AgreementInfo bean : list) {
|
||||
List<TmTask> taskList = sltAgreementInfoMapper.getTaskList(bean, taskType);
|
||||
if (taskList != null && taskList.size() > 0) {
|
||||
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getPreScrapDetailsList(taskList);
|
||||
scrapList.addAll(scrapDetailsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (scrapList != null && scrapList.size() > 0) {
|
||||
for (SltAgreementInfo bean : scrapList) {
|
||||
if (bean.getBuyPrice() == null) {
|
||||
bean.setBuyPrice("0");
|
||||
}
|
||||
if (bean.getNum() == null) {
|
||||
bean.setNum("0");
|
||||
}
|
||||
BigDecimal buyPrice = new BigDecimal(bean.getBuyPrice());
|
||||
BigDecimal num = new BigDecimal(bean.getNum());
|
||||
BigDecimal costs = buyPrice.multiply(num);
|
||||
bean.setCosts(String.valueOf(costs));
|
||||
}
|
||||
}
|
||||
|
||||
return scrapList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SltInfoVo getSltExamInfo(SltAgreementApply apply) {
|
||||
SltInfoVo sltInfoVo = new SltInfoVo();
|
||||
|
|
@ -219,8 +252,8 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
}
|
||||
for (SltAgreementInfo repair : repairList) {
|
||||
if (repair.getAgreementId().equals(info.getAgreementId().toString())) {
|
||||
BigDecimal cost = new BigDecimal(repair.getCosts());
|
||||
repairCost = repairCost.add(cost);
|
||||
BigDecimal allCost = new BigDecimal(repair.getAllCosts());
|
||||
repairCost = repairCost.add(allCost);
|
||||
}
|
||||
}
|
||||
for (SltAgreementInfo scrap : scrapList) {
|
||||
|
|
@ -267,80 +300,13 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
@Override
|
||||
@Transactional
|
||||
public AjaxResult submitFee(SltAgreementApply apply) {
|
||||
List<SltAgreementRelation> relations = apply.getRelations();
|
||||
List<AgreementInfo> list = new ArrayList<>();
|
||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
||||
String code = sltCodeRule("JS");
|
||||
apply.setCreator(String.valueOf(userid));
|
||||
apply.setCode(code);
|
||||
apply.setCompanyId(relations.get(0).getCompanyId());
|
||||
int i = sltAgreementInfoMapper.insApply(apply);
|
||||
sltAgreementInfoMapper.updateInfoStatus(apply.getAgreementId());
|
||||
int i = sltAgreementInfoMapper.updateBmAgreementInfo(apply.getAgreementId());
|
||||
if (i > 0) {
|
||||
for (SltAgreementRelation relation : relations) {
|
||||
AgreementInfo info = new AgreementInfo();
|
||||
info.setAgreementId(Long.valueOf(relation.getAgreementId()));
|
||||
list.add(info);
|
||||
relation.setApplyId(String.valueOf(apply.getId()));
|
||||
sltAgreementInfoMapper.updateInfoStatus(relation.getAgreementId());
|
||||
int j = sltAgreementInfoMapper.insRelation(relation);
|
||||
if (j < 0) {
|
||||
throw new ServiceException("新增协议结算记录失败");
|
||||
//throw new ServiceException(ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR_MSG,ExceptionDict.NEW_AGREEMENT_SETTLEMENT_ERROR);
|
||||
}
|
||||
}
|
||||
List<SltAgreementInfo> leaseListOne = getLeaseListOne(list);
|
||||
List<SltAgreementInfo> leaseListThree = getLeaseListThree(list);
|
||||
List<SltAgreementInfo> repairList = getRepairList(list);
|
||||
List<SltAgreementInfo> scrapList = getScrapList(list);
|
||||
List<SltAgreementInfo> loseList = getLoseList(list);
|
||||
for (SltAgreementInfo info : leaseListOne) {
|
||||
info.setSltType("1");
|
||||
//info.setSltType(CostTypeEnum.LEASE_COST.getCode());
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType("1");
|
||||
//info.setPartType(PartTypeEnum.CHARGE.getCode());
|
||||
sltAgreementInfoMapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : leaseListThree) {
|
||||
info.setSltType("1");
|
||||
//info.setSltType(CostTypeEnum.LEASE_COST.getCode());
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType("1");
|
||||
//info.setPartType(PartTypeEnum.CHARGE.getCode());
|
||||
sltAgreementInfoMapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : repairList) {
|
||||
info.setSltType("3");
|
||||
//info.setSltType(CostTypeEnum.MAINTENANCE_COST.getCode());
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
//对是否收费进行转换
|
||||
//info.setPartType(PartTypeEnum.getCodeByInfo(info.getPartType()));
|
||||
info.setPartType(info.getPartType().equals("不收费") ? "0" : "1");
|
||||
sltAgreementInfoMapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : scrapList) {
|
||||
info.setSltType("4");
|
||||
//info.setSltType(CostTypeEnum.SCRAP_COST.getCode());
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
//info.setPartType(info.getScrapType());
|
||||
//info.setPartType(ScrapTypeEnum.getCodeByInfo(info.getScrapType()));
|
||||
info.setPartType(info.getScrapType().equals("自然") ? "0" : "1");
|
||||
sltAgreementInfoMapper.insDetails(info);
|
||||
}
|
||||
for (SltAgreementInfo info : loseList) {
|
||||
info.setSltType("2");
|
||||
//info.setSltType(CostTypeEnum.LOSE_COST.getCode());
|
||||
info.setApplyId(String.valueOf(apply.getId()));
|
||||
info.setPartType("1");
|
||||
//info.setPartType(PartTypeEnum.CHARGE.getCode());
|
||||
sltAgreementInfoMapper.insDetails(info);
|
||||
}
|
||||
|
||||
return AjaxResult.success("结算成功");
|
||||
} else {
|
||||
throw new ServiceException("新增结算单号失败");
|
||||
//throw new ServiceException(ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR_MSG,ExceptionDict.NEW_SETTLEMENT_NUMBER_ERROR);
|
||||
return AjaxResult.error("结算失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -401,7 +367,6 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
|
||||
if (scrapList != null && scrapList.size() > 0) {
|
||||
for (SltAgreementInfo bean : scrapList) {
|
||||
|
||||
if (bean.getBuyPrice() == null) {
|
||||
bean.setBuyPrice("0");
|
||||
}
|
||||
|
|
@ -411,13 +376,6 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
BigDecimal buyPrice = new BigDecimal(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(String.valueOf(costs));
|
||||
}
|
||||
}
|
||||
|
|
@ -438,6 +396,96 @@ public class SltAgreementInfoServiceImpl implements SltAgreementInfoService {
|
|||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SltAgreementInfo> getSltInfoMonth(List<AgreementInfo> list) {
|
||||
//租赁费用列表
|
||||
List<SltAgreementInfo> leaseListMonth = getLeaseListMonth(list);
|
||||
return leaseListMonth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateOutSourceCosts(SltAgreementInfo sltAgreementInfo) {
|
||||
return sltAgreementInfoMapper.updateOutSourceCosts(sltAgreementInfo);
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getLeaseListMonth(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> leaseList = new ArrayList<>();
|
||||
int num = 0;
|
||||
for (AgreementInfo bean : list) {
|
||||
if (StringUtils.isNotBlank(bean.getStartTime()) && StringUtils.isNotBlank(bean.getEndTime())) {
|
||||
List<SltAgreementInfo> monthList = sltAgreementInfoMapper.getLeaseListMonthNotNull(bean);
|
||||
for (SltAgreementInfo sltAgreementInfo : monthList) {
|
||||
AgreementInfo agreementInfo = new AgreementInfo();
|
||||
agreementInfo.setAgreementId(bean.getAgreementId());
|
||||
agreementInfo.setCostBearingParty(sltAgreementInfo.getCostBearingParty());
|
||||
agreementInfo.setStartTime(sltAgreementInfo.getBeginTime());
|
||||
agreementInfo.setIds(sltAgreementInfo.getIds());
|
||||
sltAgreementInfo.setMonth(bean.getMonth());
|
||||
sltAgreementInfo.setCodeNum(num++);
|
||||
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
|
||||
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo);
|
||||
sltAgreementInfo.setNode(leaseListOneMonth);
|
||||
}
|
||||
leaseList.addAll(monthList);
|
||||
} else {
|
||||
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseListMonth(bean);
|
||||
for (SltAgreementInfo sltAgreementInfo : oneOfList) {
|
||||
AgreementInfo agreementInfo = new AgreementInfo();
|
||||
agreementInfo.setAgreementId(bean.getAgreementId());
|
||||
agreementInfo.setIds(sltAgreementInfo.getIds());
|
||||
agreementInfo.setCostBearingParty(sltAgreementInfo.getCostBearingParty());
|
||||
agreementInfo.setStartTime(sltAgreementInfo.getBeginTime());
|
||||
sltAgreementInfo.setCodeNum(num++);
|
||||
agreementInfo.setEndTime(sltAgreementInfo.getOffTime());
|
||||
List<SltAgreementInfo> leaseListOneMonth = getLeaseListOneMonth(agreementInfo, sltAgreementInfo);
|
||||
sltAgreementInfo.setNode(leaseListOneMonth);
|
||||
}
|
||||
leaseList.addAll(oneOfList);
|
||||
}
|
||||
}
|
||||
return leaseList;
|
||||
}
|
||||
|
||||
private List<SltAgreementInfo> getLeaseListOneMonth(AgreementInfo list, SltAgreementInfo sltAgreementInfo) {
|
||||
ArrayList<String> idList = new ArrayList<>();
|
||||
String[] ids = list.getIds().split(",");
|
||||
for (String id : ids) {
|
||||
idList.add(id);
|
||||
}
|
||||
List<SltAgreementInfo> leaseList = sltAgreementInfoMapper.getLeaseListOneMonth(list, idList);
|
||||
BigDecimal leaseCostOne = BigDecimal.ZERO;
|
||||
for (SltAgreementInfo bean : leaseList) {
|
||||
if (bean.getLeasePrice() == null) {
|
||||
bean.setLeasePrice("0");
|
||||
}
|
||||
if (bean.getNum() == null) {
|
||||
bean.setNum("0");
|
||||
}
|
||||
if (bean.getLeaseDays() == null) {
|
||||
bean.setLeaseDays("0");
|
||||
}
|
||||
if (bean.getTrimDay() == null) {
|
||||
bean.setTrimDay(0);
|
||||
}
|
||||
BigDecimal leasePrice = new BigDecimal(bean.getLeasePrice());
|
||||
BigDecimal num = new BigDecimal(bean.getNum());
|
||||
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
|
||||
// 实际结算天数(领料天数 + 调整天数(可以为负整数))
|
||||
BigDecimal realDays = leaseDays.add(new BigDecimal(bean.getTrimDay()));
|
||||
// 实际结算金额
|
||||
BigDecimal realCosts = leasePrice.multiply(num).multiply(realDays);
|
||||
// 应结算金额
|
||||
BigDecimal costs = leasePrice.multiply(num).multiply(leaseDays);
|
||||
bean.setCosts(String.valueOf(costs));
|
||||
bean.setRealDays(realDays);
|
||||
bean.setRealCosts(String.valueOf(realCosts));
|
||||
leaseCostOne = leaseCostOne.add(costs);
|
||||
bean.setMonth(sltAgreementInfo.getMonth());
|
||||
}
|
||||
sltAgreementInfo.setCosts(String.valueOf(leaseCostOne));
|
||||
return leaseList;
|
||||
}
|
||||
|
||||
public List<SltAgreementInfo> getRepairList(List<AgreementInfo> list) {
|
||||
List<SltAgreementInfo> repairList = new ArrayList<>();
|
||||
String taskType = "41";
|
||||
|
|
|
|||
|
|
@ -109,11 +109,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sai.lease_type = 0
|
||||
AND lai.cost_bearing_party = #{costBearingParty}
|
||||
</update>
|
||||
<update id="updateOutSourceCosts">
|
||||
update repair_cost set out_source_costs = #{outSourceCosts} where id = #{id}
|
||||
</update>
|
||||
<update id="updateBmAgreementInfo">
|
||||
update bm_agreement_info set is_slt = 1 where agreement_id = #{agreementId}
|
||||
</update>
|
||||
<select id="getSltAgreementInfo" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
|
||||
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
|
||||
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
|
||||
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,sar.cost as cost,
|
||||
case when sar.id is null then '1' when sar.status = '0' then '2' when sar.status = '1' then '3' end as sltStatus
|
||||
bai.is_slt as isSlt
|
||||
FROM bm_agreement_info bai
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
|
|
@ -125,17 +131,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="projectId != null and projectId != ''">
|
||||
and bp.lot_id = #{projectId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="sltStatus == '1'.toString()">
|
||||
and sar.id is null
|
||||
</when>
|
||||
<when test="sltStatus == '2'.toString()">
|
||||
and sar.status = '0'
|
||||
</when>
|
||||
<when test="sltStatus == '3'.toString()">
|
||||
and sar.status = '1'
|
||||
</when>
|
||||
</choose>
|
||||
<if test="isSlt != null">
|
||||
and bai.is_slt = #{isSlt}
|
||||
</if>
|
||||
ORDER BY bai.agreement_id desc
|
||||
</select>
|
||||
|
||||
|
|
@ -201,17 +199,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bui.unit_name as unitName,
|
||||
bp.lot_name as projectName,
|
||||
rc.type_id as typeId,
|
||||
rc.id,
|
||||
rc.ma_id as maId,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sum(rc.repair_num) as num,
|
||||
sum(rc.costs) as costs,
|
||||
rc.repair_num as num,
|
||||
rc.costs as costs,
|
||||
rc.out_source_costs as outSourceCosts,
|
||||
ROUND(rc.repair_num * rc.costs, 2) AS partAllCosts,
|
||||
ROUND(rc.repair_num * rc.costs + IFNULL(rc.out_source_costs ,0), 2) AS allCosts,
|
||||
mpt.pa_name partModelName,
|
||||
mpt2.pa_name partName,
|
||||
case rc.part_type when '0' then '不收费' when '1' then '收费' else '' end as partType,
|
||||
rc.status as repairStatus,
|
||||
rc.company_id as companyId
|
||||
from repair_cost rc
|
||||
left join tm_task_agreement tta on rc.task_id = tta.task_id
|
||||
LEFT JOIN repair_part_details rpd on rc.task_id = rpd.task_id and rc.type_id = rpd.type_id and (rc.ma_id = rpd.ma_id OR rpd.ma_id IS NULL)
|
||||
LEFT JOIN ma_part_type mpt on rpd.part_id = mpt.pa_id
|
||||
LEFT JOIN ma_part_type mpt2 on mpt.parent_id = mpt2.pa_id
|
||||
LEFT JOIN bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||
|
|
@ -224,7 +231,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{task.taskId}
|
||||
</foreach>
|
||||
</if>
|
||||
group by rc.type_id,rc.ma_id,rc.part_type,rc.status
|
||||
</select>
|
||||
<select id="getScrapDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select tta.agreement_id as agreementId,
|
||||
|
|
@ -236,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.type_name as modelName,
|
||||
mt.unit_name as nuitName,
|
||||
sum(sad.scrap_num) as num,
|
||||
mm.ma_code as maCode,
|
||||
mt.buy_price as buyPrice,
|
||||
case sad.scrap_type when '0' then '自然' when '1' then '人为' else '' end as scrapType,
|
||||
sad.company_id as companyId
|
||||
|
|
@ -246,7 +253,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN bm_unit_info 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
|
||||
left join ma_machine mm on mm.ma_id = sad.ma_id
|
||||
where sad.status = 1
|
||||
<if test="taskList != null and taskList.size() > 0">
|
||||
and sad.task_id in
|
||||
<foreach item="task" collection="taskList" open="(" separator="," close=")">
|
||||
|
|
@ -362,4 +370,207 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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'
|
||||
</select>
|
||||
<select id="getLeaseListOneMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
sai.id,
|
||||
sai.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bp.lot_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,
|
||||
sai.is_slt AS isSlt,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
sai.trim_day AS trimDay,
|
||||
DATE(#{bean.startTime}) AS startTime,
|
||||
DATE(#{bean.endTime}) AS endTime,
|
||||
DATEDIFF(#{bean.endTime}, #{bean.startTime}) + 1 AS leaseDays
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info 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 = #{bean.agreementId}
|
||||
AND sai.lease_type = 0
|
||||
AND lai.cost_bearing_party = #{bean.costBearingParty}
|
||||
AND sai.id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="getLeaseListThreeMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
sai.id,
|
||||
sai.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bp.lot_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,
|
||||
sai.is_slt AS isSlt,
|
||||
sai.trim_day AS trimDay,
|
||||
DATE(sai.start_time) AS startTime,
|
||||
DATE(COALESCE(sai.end_time, CURDATE())) AS endTime,
|
||||
DATEDIFF(COALESCE(sai.end_time, CURDATE()), sai.start_time) + 1 AS leaseDays
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info 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.lease_type = 0
|
||||
AND lai.cost_bearing_party = '03'
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND DATE(sai.start_time) BETWEEN #{startTime} AND #{endTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND (DATE(COALESCE(sai.end_time, CURDATE())) <= #{endTime})
|
||||
</if>
|
||||
</select>
|
||||
<select id="getLeaseListMonth" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
DATE_FORMAT( DATE_ADD( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m' ) month,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN DATE_FORMAT( DATE_SUB( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-21' ) >= DATE( sai.start_time ) THEN
|
||||
DATE_FORMAT( DATE_SUB( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-21' )
|
||||
WHEN DATE_FORMAT( DATE_SUB( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-21' ) < DATE( sai.start_time ) THEN
|
||||
DATE( sai.start_time )
|
||||
END
|
||||
) AS beginTime,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN DATE_FORMAT( DATE_ADD( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-20' ) >= DATE( COALESCE ( sai.end_time, CURDATE() ) ) THEN
|
||||
DATE( COALESCE ( sai.end_time, CURDATE()))
|
||||
WHEN DATE_FORMAT( DATE_ADD( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-20' ) < DATE( COALESCE ( sai.end_time, CURDATE() ) ) THEN
|
||||
DATE_FORMAT( DATE_ADD( sai.start_time, INTERVAL 1 MONTH ), '%Y-%m-20')
|
||||
END
|
||||
) AS offTime,
|
||||
GROUP_CONCAT(sai.id) AS ids,
|
||||
sai.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bp.lot_name AS projectName,
|
||||
DATE( sai.start_time ) AS startTime,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
DATE( COALESCE ( sai.end_time, CURDATE() ) ) AS endTime
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info 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.lease_type = 0
|
||||
AND lai.cost_bearing_party = #{costBearingParty}
|
||||
AND (-- 当前月21号到月末
|
||||
( DAYOFMONTH( sai.start_time ) >= 21 AND DAYOFMONTH( sai.start_time ) <= 31 )
|
||||
OR -- 次月1号到20号
|
||||
(
|
||||
DAYOFMONTH( sai.start_time ) >= 1
|
||||
AND DAYOFMONTH( sai.start_time ) <= 20
|
||||
AND MONTH ( sai.start_time ) + 1 = MONTH (
|
||||
COALESCE (
|
||||
sai.end_time,
|
||||
CURDATE())))
|
||||
)
|
||||
GROUP BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' ),
|
||||
lai.cost_bearing_party
|
||||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' )
|
||||
</select>
|
||||
<select id="getLeaseListMonthNotNull" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
SELECT
|
||||
( CASE WHEN #{startTime} >= DATE( sai.start_time ) THEN #{startTime} ELSE DATE( sai.start_time ) END ) AS beginTime,
|
||||
(
|
||||
CASE
|
||||
|
||||
WHEN #{endTime} >= DATE( COALESCE ( sai.end_time, CURDATE() ) ) THEN
|
||||
DATE(
|
||||
COALESCE (
|
||||
sai.end_time,
|
||||
CURDATE())) ELSE #{endTime}
|
||||
END
|
||||
) AS offTime,
|
||||
GROUP_CONCAT(sai.id) AS ids,
|
||||
sai.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bp.lot_name AS projectName,
|
||||
DATE( sai.start_time ) AS startTime,
|
||||
lai.cost_bearing_party AS costBearingParty,
|
||||
DATE( COALESCE ( sai.end_time, CURDATE() ) ) AS endTime
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info 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 = 49
|
||||
AND sai.lease_type = 0
|
||||
AND lai.cost_bearing_party = #{costBearingParty}
|
||||
AND sai.start_time <= #{endTime} AND sai.end_time >= #{startTime}
|
||||
AND sai.start_time <= #{endTime} AND sai.end_time >= #{startTime}
|
||||
GROUP BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' ),
|
||||
lai.cost_bearing_party
|
||||
ORDER BY
|
||||
DATE_FORMAT( DATE_ADD( DATE( sai.start_time ), INTERVAL 1 - DAYOFMONTH( sai.start_time ) DAY ), '%Y-%m' );
|
||||
</select>
|
||||
<select id="getPreScrapDetailsList" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
|
||||
select tta.agreement_id as agreementId,
|
||||
bui.unit_name as unitName,
|
||||
bp.lot_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,
|
||||
mm.ma_code as maCode,
|
||||
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_lot bp ON bp.lot_id = bai.project_id
|
||||
LEFT JOIN bm_unit_info 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
|
||||
left join ma_machine mm on mm.ma_id = sad.ma_id
|
||||
where sad.status in (0,2)
|
||||
<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>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue