结算模块修改

This commit is contained in:
bonus 2025-11-15 15:47:05 +08:00
parent d8ee1d4c68
commit 992897b829
13 changed files with 1317 additions and 801 deletions

View File

@ -1,5 +1,8 @@
package com.bonus.material.push.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.bonus.common.biz.utils.HttpHelper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -177,6 +180,46 @@ public class PushProDataUseInfoController extends BaseController {
}
}
// 检验临期和检验超期数量
@GetMapping(value = "getHyCheckingTimeout")
public AjaxResult getHyCheckTimeout(ProIdsBean bean) {
try {
List<StaticsNumsBean> results = new ArrayList<>();
Map<String, String> map = new HashMap<String, String>();
map.put("keyWord", "");
String body = JSONObject.toJSONString(map);
String url = "http://10.138.55.101:21021/iws/hystw/getHyCheckingCounts";
//String url = "http://192.168.1.134:8036/micro-server/zzaqgjf/syncSafetyTool";
String data = HttpHelper.sendHttpPost(url, body);
JSONObject object = JSONObject.parseObject(data);
System.err.println(data);
String code = object.getString("code");
if ("200".equals(code)) {
String dataResultString = object.getString("data");
JSONArray dataArray = JSONArray.parseArray(dataResultString);
if (dataArray != null && !dataArray.isEmpty()) {
// 有数据
for (int i = 0; i < dataArray.size(); i++) {
JSONObject dataObject = dataArray.getJSONObject(i);
String counts = dataObject.getString("counts");
StaticsNumsBean rs = new StaticsNumsBean();
rs.setTimeoutNum(BigDecimal.valueOf(Integer.parseInt(counts)));
results.add(rs);
}
}
}
return AjaxResult.success(results);
} catch (Exception e) {
logger.error(e.toString(), e);
throw new ServiceException("数据查询异常,请联系运维人员查询日志处理");
}
}
// 临期超期设备详情
@GetMapping(value = "getApproachingDetails")
public TableDataInfo getApproachingDetails(ProIdsBean bean) {

View File

@ -195,6 +195,7 @@ public class SltAgreementInfoController extends BaseController {
vo.setReductionList(Collections.emptyList());
vo.setRelations(Collections.emptyList());
}
dataList.add(vo);
if (info.getAgreementId() != null) {
agreementId = info.getAgreementId();
@ -208,6 +209,8 @@ public class SltAgreementInfoController extends BaseController {
TmTask tmTask = taskMapper.selectTaskById(agreementId, list.get(0).getSettlementType());
if (tmTask != null) {
bean.setApplyTime(tmTask.getCreateTime());
bean.setSltSignUrl(tmTask.getSltSignUrl());
bean.setAuditorSignUrl(tmTask.getAuditorSignUrl());
}
return AjaxResult.success(bean);
@ -478,6 +481,7 @@ public class SltAgreementInfoController extends BaseController {
maps.put("endTime", bean.getEndTime()==null ? null:dateFormat.format(bean.getEndTime()));
maps.put("leaseDays", bean.getLeaseDays());
maps.put("costs", bean.getCosts().setScale(2, RoundingMode.HALF_UP));
maps.put("unitName", bean.getUnitName());
}else {
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
@ -488,7 +492,8 @@ public class SltAgreementInfoController extends BaseController {
maps.put("endTime", bean.getEndTime()==null ? null:dateFormat.format(bean.getEndTime()));
maps.put("leaseDays", bean.getLeaseDays());
maps.put("costs", bean.getCosts().setScale(2, RoundingMode.HALF_UP));
maps.put("t1", "");
maps.put("unitName", bean.getUnitName());
maps.put("t2", "");
}
} else if(type == 2) {
if(flag==0){
@ -498,6 +503,7 @@ public class SltAgreementInfoController extends BaseController {
maps.put("buyPrice", bean.getBuyPrice());
maps.put("num", bean.getNum());
maps.put("costs", bean.getCosts());
maps.put("unitName", bean.getUnitName());
}else{
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
@ -505,10 +511,11 @@ public class SltAgreementInfoController extends BaseController {
maps.put("buyPrice", bean.getBuyPrice());
maps.put("num", bean.getNum());
maps.put("costs", bean.getCosts());
maps.put("t1", "");
maps.put("unitName", bean.getUnitName());
maps.put("t2", "");
maps.put("t3", "");
maps.put("t4", "");
maps.put("t5", "");
}
} else if (type == 3) {
if (flag==0) {
@ -518,6 +525,7 @@ public class SltAgreementInfoController extends BaseController {
maps.put("num", bean.getNum());
maps.put("partType", bean.getPartType());
maps.put("costs", bean.getCosts());
maps.put("unitName", bean.getUnitName());
} else {
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
@ -525,10 +533,11 @@ public class SltAgreementInfoController extends BaseController {
maps.put("num", bean.getNum());
maps.put("partType", bean.getPartType());
maps.put("costs", bean.getCosts());
maps.put("t1", "");
maps.put("unitName", bean.getUnitName());
maps.put("t2", "");
maps.put("t3", "");
maps.put("t4", "");
maps.put("t5", "");
}
} else if (type == 4) {
if (flag == 0) {
@ -539,6 +548,7 @@ public class SltAgreementInfoController extends BaseController {
maps.put("num", bean.getNum());
maps.put("partType", bean.getPartType());
maps.put("costs", bean.getCosts());
maps.put("unitName", bean.getUnitName());
} else {
maps.put("typeName", bean.getTypeName());
maps.put("modelName", bean.getModelName());
@ -547,9 +557,10 @@ public class SltAgreementInfoController extends BaseController {
maps.put("num", bean.getNum());
maps.put("partType", bean.getPartType());
maps.put("costs", bean.getCosts());
maps.put("t1", "");
maps.put("unitName", bean.getUnitName());
maps.put("t2", "");
maps.put("t3", "");
maps.put("t4", "");
}
} else if (type == 5) {
maps.put("typeName", bean.getTypeName());
@ -562,6 +573,7 @@ public class SltAgreementInfoController extends BaseController {
maps.put("leaseDays", bean.getDays());
maps.put("remark", bean.getRemark());
maps.put("costs", bean.getLeaseMoney().setScale(2, RoundingMode.HALF_UP));
maps.put("t4", "");
}
return maps;
}
@ -583,6 +595,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("归还日期");
list.add("租赁天数");
list.add("租赁费用(元)");
list.add("备注");
}else {
list.add("设备名称");
list.add("规格型号");
@ -593,6 +606,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("归还日期");
list.add("租赁天数");
list.add("租赁费用(元)");
list.add("备注");
list.add(" ");
}
}else if(type==2){
@ -603,6 +617,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("扣款单价");
list.add("丢失数量");
list.add("丢失费用(元)");
list.add("备注");
}else{
list.add("设备名称");
list.add("规格型号");
@ -610,6 +625,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("扣款单价");
list.add("丢失数量");
list.add("丢失费用(元)");
list.add("备注");
list.add(" ");
list.add(" ");
list.add(" ");
@ -624,6 +640,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("维修数量");
list.add("是否收费");
list.add("维修费用(元)");
list.add("备注");
}else{
list.add("设备名称");
list.add("规格型号");
@ -631,9 +648,10 @@ public class SltAgreementInfoController extends BaseController {
list.add("维修数量");
list.add("是否收费");
list.add("维修费用(元)");
list.add("备注");
list.add("");
list.add("");
list.add("");
list.add(" ");
list.add(" ");
}
}else if(type==4){
@ -645,6 +663,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("报废数量");
list.add("是否收费");
list.add("报废费用(元)");
list.add("备注");
}else{
list.add("设备名称");
list.add("规格型号");
@ -653,6 +672,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("报废数量");
list.add("是否收费");
list.add("报废费用(元)");
list.add("备注");
list.add("");
list.add("");
list.add("");
@ -668,6 +688,7 @@ public class SltAgreementInfoController extends BaseController {
list.add("减免天数");
list.add("减免原因");
list.add("减免费用(元)");
list.add("备注");
}
return list;
}
@ -690,7 +711,14 @@ public class SltAgreementInfoController extends BaseController {
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
List<SltAgreementInfo> oneOfList = new ArrayList<>();
// 如果开启了查询已结算数据那么就从结算记录📝里面查询已结算的租赁费用明细
if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) {
oneOfList = sltAgreementInfoMapper.getLeaseSltDetails(info);
} else {
oneOfList = sltAgreementInfoMapper.getLeaseList(info);
}
leaseList.addAll(oneOfList);
}
String projectName = handleData(projectNames);
@ -743,7 +771,14 @@ public class SltAgreementInfoController extends BaseController {
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
List<SltAgreementInfo> oneOfList =new ArrayList<>();
if ( info.getEnableQuerySltData()) {
oneOfList = sltAgreementInfoMapper.getSltLoseList(info);
}else{
oneOfList = sltAgreementInfoMapper.getLoseList(info);
}
loseList.addAll(oneOfList);
}
String projectName = handleData(projectNames);
@ -792,7 +827,14 @@ public class SltAgreementInfoController extends BaseController {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList);
repairList.addAll(repairDetailsList);
}
@ -816,6 +858,23 @@ public class SltAgreementInfoController extends BaseController {
}
}
private List<TmTask> checkTeamAgreementInfo(SltAgreementInfo info) {
List<TmTask> teamTaskList = new ArrayList<>();
try{
SltAgreementInfo bean = sltAgreementInfoMapper.getAgreementInfo(info);
List<SltAgreementInfo> agreementInfoList = sltAgreementInfoMapper.selectAgreementInfoList(bean);
if (null != agreementInfoList && !agreementInfoList.isEmpty()) {
teamTaskList = taskMapper.getTaskIdListByAgreementList(agreementInfoList);
}
}catch (Exception e){
e.printStackTrace();
}
return teamTaskList;
}
/**
* 导出减免费用明细
*/
@ -883,7 +942,16 @@ public class SltAgreementInfoController extends BaseController {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList);
scrapList.addAll(scrapDetailsList);
}
@ -1015,7 +1083,16 @@ public class SltAgreementInfoController extends BaseController {
BigDecimal totalCostRepair = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> repairList = new ArrayList<>();
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList);
repairList.addAll(repairDetailsList);
}
@ -1031,7 +1108,15 @@ public class SltAgreementInfoController extends BaseController {
BigDecimal totalCostScrap = BigDecimal.valueOf(0.00);
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskListScrap = taskMapper.getTaskIdList(info);
List<TmTask> taskScrapList2 = new ArrayList<>();
taskScrapList2 = checkTeamAgreementInfo(info);
if (null != taskListScrap && !taskListScrap.isEmpty()) {
if (null != taskScrapList2 && !taskScrapList2.isEmpty()) {
taskListScrap.addAll(taskScrapList2);
}
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskListScrap);
scrapList.addAll(scrapDetailsList);
}
@ -1159,7 +1244,14 @@ public class SltAgreementInfoController extends BaseController {
for (SltAgreementInfo info : sltAgreementInfo) {
projectNames.add(info.getProjectName());
unitNames.add(info.getUnitName());
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLeaseList(info);
List<SltAgreementInfo> oneOfList = new ArrayList<>();
if (info != null && info.getEnableQuerySltData() != null && info.getEnableQuerySltData()) {
oneOfList = sltAgreementInfoMapper.getLeaseSltDetails(info);
} else {
oneOfList = sltAgreementInfoMapper.getLeaseList(info);
}
leaseList.addAll(oneOfList);
}
for (SltAgreementInfo bean : leaseList) {
@ -1188,7 +1280,14 @@ public class SltAgreementInfoController extends BaseController {
List<SltAgreementInfo> loseList = new ArrayList<>();
for (SltAgreementInfo info : sltAgreementInfo) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
List<SltAgreementInfo> oneOfList = new ArrayList<>();
if ( info.getEnableQuerySltData()) {
oneOfList = sltAgreementInfoMapper.getSltLoseList(info);
}else{
oneOfList = sltAgreementInfoMapper.getLoseList(info);
}
loseList.addAll(oneOfList);
}
@ -1217,7 +1316,15 @@ public class SltAgreementInfoController extends BaseController {
for (SltAgreementInfo info : sltAgreementInfo) {
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList);
repairList.addAll(repairDetailsList);
}
@ -1234,7 +1341,12 @@ public class SltAgreementInfoController extends BaseController {
List<SltAgreementInfo> scrapList = new ArrayList<>();
for (SltAgreementInfo info : sltAgreementInfo) {
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList);
scrapList.addAll(scrapDetailsList);
}
@ -1347,7 +1459,14 @@ public class SltAgreementInfoController extends BaseController {
BigDecimal totalCostRepair = BigDecimal.ZERO;
List<SltAgreementInfo> repairList = new ArrayList<>();
List<TmTask> taskListRepair = taskMapper.getTaskIdList(sltAgreementInfo);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(sltAgreementInfo);
if (null != taskListRepair && !taskListRepair.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskListRepair.addAll(taskList2);
}
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(sltAgreementInfo, taskListRepair);
repairList.addAll(repairDetailsList);
}
@ -1362,7 +1481,14 @@ public class SltAgreementInfoController extends BaseController {
BigDecimal totalCostScrap = BigDecimal.ZERO;
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskListScrap = taskMapper.getTaskIdList(sltAgreementInfo);
List<TmTask> taskListScrap2 = new ArrayList<>();
taskListScrap2 = checkTeamAgreementInfo(sltAgreementInfo);
if (null != taskListScrap && !taskListScrap.isEmpty()) {
if (null != taskListScrap2 && !taskListScrap2.isEmpty()) {
taskListScrap.addAll(taskListScrap2);
}
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(sltAgreementInfo, taskListScrap);
scrapList.addAll(scrapDetailsList);
}
@ -1449,6 +1575,8 @@ public class SltAgreementInfoController extends BaseController {
@GetMapping("/getSltList")
public TableDataInfo getSltList(SltAgreementInfo bean) {
startPage();
List<SltAgreementInfo> list = sltAgreementInfoService.getSltList(bean);
return getDataTable(list);
}
@ -1460,6 +1588,7 @@ public class SltAgreementInfoController extends BaseController {
@GetMapping("/getLostReportList")
public TableDataInfo getLostReportList(SltAgreementInfo bean) {
startPage();
List<SltAgreementInfo> list = sltAgreementInfoService.getLostReportList(bean);
return getDataTable(list);
}
@ -1577,7 +1706,7 @@ public class SltAgreementInfoController extends BaseController {
// --------- 定义返回集合 ------------------
List<SltInfoVo> dataList = new ArrayList<>(list.size());
// 清空缓存确保每次请求都使用最新的数据避免缓存污染
// 清空缓存确保每次定时任务都使用最新的数据避免缓存污染
sltAgreementInfoService.clearCache();
// 批量处理减少单个查询
@ -1675,10 +1804,8 @@ public class SltAgreementInfoController extends BaseController {
}
});
// 清空缓存防止内存泄漏
sltAgreementInfoService.clearCache();
ExcelUtil<SltInfoVo> util = new ExcelUtil<>(SltInfoVo.class);
util.exportExcel(response, dataList, "导出未结算报表列表");
}
@ -1984,7 +2111,12 @@ public class SltAgreementInfoController extends BaseController {
List<TmTask> taskRepairList = taskMapper.getTaskIdList(info);
List<TmTask> taskRepairList2 = new ArrayList<>();
taskRepairList2 = checkTeamAgreementInfo(info);
if (null != taskRepairList && !taskRepairList.isEmpty()) {
if (null != taskRepairList2 && !taskRepairList2.isEmpty()) {
taskRepairList.addAll(taskRepairList2);
}
repairList = sltAgreementInfoMapper.getRepairDetailsList(info, taskRepairList);
}
@ -2000,7 +2132,15 @@ public class SltAgreementInfoController extends BaseController {
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskScrapList = taskMapper.getTaskIdList(info);
List<TmTask> taskScrapList2 = new ArrayList<>();
taskScrapList2 = checkTeamAgreementInfo(info);
if (null != taskScrapList && !taskScrapList.isEmpty()) {
if (null != taskScrapList2 && !taskScrapList2.isEmpty()) {
taskScrapList.addAll(taskScrapList2);
}
scrapList = sltAgreementInfoMapper.getScrapDetailsList(info, taskScrapList);
}

View File

@ -270,5 +270,16 @@ public class SltAgreementInfo extends BaseEntity {
@ApiModelProperty("年月")
private String yearMonth;
/** 核算员签字 */
@ApiModelProperty(value = "核算员签字")
private String sltSignUrl;
/** 审核签字 */
@ApiModelProperty(value = "审核签字")
private String auditorSignUrl;
/** 审核签字 */
@ApiModelProperty(value = "签字类型")
private String signType;
}

View File

@ -113,7 +113,7 @@ public class SltAgreementInfoLose extends BaseEntity {
private BigDecimal leasePrice;
/** 原值 */
@Excel(name = "单价(元)",sort = 8)
@Excel(name = "单价(元)",sort = 8, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "原值")
private BigDecimal buyPrice;
@ -234,7 +234,7 @@ public class SltAgreementInfoLose extends BaseEntity {
private BigDecimal repairCost;
private BigDecimal scrapCost;
@Excel(name = "丢失费用(元)",sort = 9)
@Excel(name = "丢失费用(元)",sort = 9, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal loseCost;
private BigDecimal reductionCost;

View File

@ -150,7 +150,7 @@ public class SltAgreementInfoScrap extends BaseEntity {
* 租赁费用
*/
@ApiModelProperty(value = "租赁费用")
@Excel(name = "报废费用(元)",sort = 9)
@Excel(name = "报废费用(元)",sort = 9, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal costs;
/**
@ -185,6 +185,7 @@ public class SltAgreementInfoScrap extends BaseEntity {
/**
* 是否收费
*/
@Excel(name = "是否收费",sort = 10)
private String partType;
/**

View File

@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import java.math.BigDecimal;
import java.util.Date;
@ -58,35 +59,35 @@ public class SltInfoVo {
/**
* 租赁费用小计
*/
@Excel(name = "租赁费用",sort = 5)
@Excel(name = "租赁费用",sort = 5,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "租赁费用小计")
private BigDecimal leaseCost;
/**
* 维修费用小计
*/
@Excel(name = "维修费用",sort = 6)
@Excel(name = "维修费用",sort = 6,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "维修费用小计")
private BigDecimal repairCost;
/**
* 报废费用小计
*/
@Excel(name = "报废费用",sort = 8)
@Excel(name = "报废费用",sort = 8,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "报废费用小计")
private BigDecimal scrapCost;
/**
* 丢失费用小计
*/
@Excel(name = "丢失费用",sort = 7)
@Excel(name = "丢失费用",sort = 7,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "丢失费用小计")
private BigDecimal loseCost;
/**
* 减免费用小计
*/
@Excel(name = "减免费用",sort = 9)
@Excel(name = "减免费用",sort = 9,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
@ApiModelProperty(value = "减免费用小计")
private BigDecimal reductionCost;
@ -94,7 +95,7 @@ public class SltInfoVo {
* 合计
*/
@ApiModelProperty(value = "合计")
@Excel(name = "合计费用",sort = 10)
@Excel(name = "合计费用",sort = 10,align = HorizontalAlignment.RIGHT, cellType = Excel.ColumnType.NUMERIC)
private BigDecimal totalCostAll;
private String createBy;
@ -144,4 +145,20 @@ public class SltInfoVo {
private String yearMonth;
/** 核算员签字 */
@ApiModelProperty(value = "核算员签字")
private String sltSignUrl;
/** 审核签字 */
@ApiModelProperty(value = "审核签字")
private String auditorSignUrl;
/** 承租负责人签字 */
@ApiModelProperty(value = "承租负责人签字")
private String managerSignUrl;
/** 签字类型 */
@ApiModelProperty(value = "签字类型")
private long signType;
}

View File

@ -337,4 +337,10 @@ public interface SltAgreementInfoMapper {
List<SltAgreementInfo> getRepairCodeList(SltAgreementInfo bean);
SltAgreementInfo getUnitAndProjectByAgreementId(Long agreementId);
SltAgreementInfo getAgreementInfo(SltAgreementInfo info);
List<SltAgreementInfo> selectAgreementInfoList(SltAgreementInfo bean);
List<SltAgreementInfo> getSltLoseList(SltAgreementInfo info);
}

View File

@ -168,6 +168,8 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
@Override
public SltInfoVo getSltInfo(SltAgreementInfo info) {
SltInfoVo sltInfoVo = new SltInfoVo();
sltInfoVo.setUnitName(info.getUnitName());
sltInfoVo.setProjectName(info.getProjectName());
@ -202,6 +204,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
}
//丢失费用列表
List<SltAgreementInfo> loseList = getLoseList(info);
//费用减免列表
List<SltAgreementReduce> reductionList = getReductionList(info);
@ -443,10 +446,11 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
bean.setNum(BigDecimal.ZERO);
}
if (null == bean.getLeaseDays()) {
bean.setLeaseDay(0L);
bean.setLeaseDays("0");
}
BigDecimal leasePrice = bean.getLeasePrice();
BigDecimal num = bean.getNum();
log.info("协议:"+bean.getAgreementId());
BigDecimal leaseDays = new BigDecimal(bean.getLeaseDays());
if (leaseDays.compareTo(BigDecimal.ZERO) < 0) {
leaseDays = BigDecimal.ZERO;
@ -497,13 +501,41 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
public List<SltAgreementInfo> getRepairList(SltAgreementInfo info) {
List<SltAgreementInfo> repairList = new ArrayList<>();
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList);
repairList.addAll(repairDetailsList);
}else{
List<SltAgreementInfo> repairDetailsList = sltAgreementInfoMapper.getRepairDetailsList(info, taskList2);
repairList.addAll(repairDetailsList);
}
return repairList;
}
private List<TmTask> checkTeamAgreementInfo(SltAgreementInfo info) {
List<TmTask> teamTaskList = new ArrayList<>();
try{
SltAgreementInfo bean = sltAgreementInfoMapper.getAgreementInfo(info);
List<SltAgreementInfo> agreementInfoList = sltAgreementInfoMapper.selectAgreementInfoList(bean);
if(null != agreementInfoList && !agreementInfoList.isEmpty()){
teamTaskList = taskMapper.getTaskIdListByAgreementList(agreementInfoList);
}
}catch (Exception e){
e.printStackTrace();
}
return teamTaskList;
}
public List<SltAgreementInfo> getRepairListBatch(SltAgreementInfo info) {
return repairListCache.get()
.stream()
@ -514,9 +546,20 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
public List<SltAgreementInfo> getScrapList(SltAgreementInfo info) {
List<SltAgreementInfo> scrapList = new ArrayList<>();
List<TmTask> taskList = taskMapper.getTaskIdList(info);
List<TmTask> taskList2 = new ArrayList<>();
taskList2 = checkTeamAgreementInfo(info);
if (null != taskList && !taskList.isEmpty()) {
if (null != taskList2 && !taskList2.isEmpty()) {
taskList.addAll(taskList2);
}
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList);
scrapList.addAll(scrapDetailsList);
}else{
List<SltAgreementInfo> scrapDetailsList = sltAgreementInfoMapper.getScrapDetailsList(info, taskList2);
scrapList.addAll(scrapDetailsList);
}
return scrapList;
}
@ -532,7 +575,13 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
}
public List<SltAgreementInfo> getLoseList(SltAgreementInfo info) {
List<SltAgreementInfo> oneOfList = sltAgreementInfoMapper.getLoseList(info);
List<SltAgreementInfo> oneOfList = new ArrayList<>();
if ( info.getEnableQuerySltData()) {
oneOfList = sltAgreementInfoMapper.getSltLoseList(info);
}else{
oneOfList = sltAgreementInfoMapper.getLoseList(info);
}
List<SltAgreementInfo> loseList = new ArrayList<>(oneOfList);
for (SltAgreementInfo bean : loseList) {
@ -608,18 +657,26 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
leaseCost = leaseCost.add(cost);
}
}
if(repairList != null) {
for (SltAgreementInfo repair : repairList) {
if (repair.getAgreementId().equals(sltInfo.getAgreementId())) {
if(repair !=null){
BigDecimal cost = repair.getCosts();
repairCost = repairCost.add(cost);
}
}
}
if(scrapList != null) {
for (SltAgreementInfo scrap : scrapList) {
if (scrap.getAgreementId().equals(sltInfo.getAgreementId())) {
if(scrap !=null){
BigDecimal cost = scrap.getCosts();
scrapCost = scrapCost.add(cost);
}
}
}
for (SltAgreementInfo lose : loseList) {
if (lose.getAgreementId().equals(sltInfo.getAgreementId())) {
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
@ -824,10 +881,12 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
*/
@Override
public List<SltAgreementInfo> getSltList(SltAgreementInfo bean) {
Boolean enableQuerySltData = bean.getEnableQuerySltData();
List<SltAgreementInfo> list = sltAgreementInfoMapper.getSltList(bean);
if (CollectionUtils.isNotEmpty(list)) {
for (SltAgreementInfo row : list) {
SltInfoVo sltInfoVo;
row.setEnableQuerySltData(enableQuerySltData);
sltInfoVo = getSltInfo(row);
if (sltInfoVo != null) {
row.setCosts(sum(sltInfoVo.getLeaseCost(), sltInfoVo.getRepairCost(), sltInfoVo.getScrapCost(), sltInfoVo.getLoseCost()));
@ -918,6 +977,8 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
*/
@Override
public List<SltAgreementInfo> getLostReportList(SltAgreementInfo info) {
int loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission();
info.setSettlementType(loginUserSettlementTypePermission);
List<SltAgreementInfo> loseList = sltAgreementInfoMapper.getLostReportList(info);
loseList.removeIf(Objects::isNull);
@ -938,6 +999,9 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
*/
@Override
public List<SltAgreementInfoLose> getLostReportListExport(SltAgreementInfoLose info) {
int loginUserSettlementTypePermission = this.checkLoginUserHasSettlementPermission();
info.setSettlementType(loginUserSettlementTypePermission);
List<SltAgreementInfoLose> loseList = sltAgreementInfoMapper.getLostReportListExport(info);
loseList.removeIf(Objects::isNull);
@ -1071,11 +1135,11 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
.setAgreementId(sltAgreementApply.getAgreementId())
.setSettlementType(sltAgreementApplyFromDb.getSettlementType())
);
if (countThree == 0) {
/* if (countThree == 0) {
log.error("slt_agreement_info修改失败" + "协议ID" + sltAgreementApply.getAgreementId() + "" + "结算类型:" + sltAgreementApplyFromDb.getSettlementType());
throw new ServiceException("slt_agreement_info修改失败");
}
*/
// 修改未退还设备状态为丢失
int countFour = sltAgreementInfoMapper.updateMaStatusLoseByAgreementIdType(new SltAgreementInfo()
.setAgreementId(sltAgreementApply.getAgreementId())

View File

@ -51,6 +51,14 @@ public class TmTask extends BaseEntity {
@ApiModelProperty(value = "任务编号,如新购单号,领料单号,退料单号等")
private String code;
/** 核算员签字 */
@ApiModelProperty(value = "核算员签字")
private String sltSignUrl;
/** 审核签字 */
@ApiModelProperty(value = "审核签字")
private String auditorSignUrl;
/** 数据所属组织 */
@Excel(name = "数据所属组织")
@ApiModelProperty(value = "数据所属组织")

View File

@ -214,4 +214,5 @@ public interface TmTaskMapper {
*/
List<Long> selectRepairInfo(TmTask info);
List<TmTask> getTaskIdListByAgreementList(@Param("agreementInfoList") List<SltAgreementInfo> agreementInfoList);
}

View File

@ -22,6 +22,9 @@
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bui ON bui.unit_id = bai.unit_id
WHERE saa.status in ('1', '2', '3')
<if test="keyWord != null and keyWord != ''">
AND (
su.user_name LIKE concat('%', #{keyWord}, '%') or
@ -31,8 +34,8 @@
saa.remark LIKE concat('%', #{keyWord}, '%')
)
</if>
<if test="startTime != null and endTime != ''">
AND DATE_FORMAT( saa.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
<if test="startTime != null and endTime != null ">
AND saa.create_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="startDate != null and endDate != ''">
AND DATE_FORMAT( saa.create_time, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.settlement.mapper.SltAgreementInfoMapper">
<resultMap type="com.bonus.material.settlement.domain.SltAgreementInfo" id="SltAgreementInfoResult">
<result property="id" column="id" />
@ -318,7 +318,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(
select sai.id,
sai.agreement_id as agreementId,
bui.unit_name as unitName,
IFNULL(bui2.unit_name,bui.unit_name) AS unitName,
bp.pro_name as projectName,
sai.company_id as companyId,
sai.type_id as typeId,
@ -326,15 +326,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
sai.lease_price as leasePrice,
Ifnull(sai.lease_price,0) as leasePrice,
sai.num as num,
DATE(sai.start_time) as startTime,
IF(sai.end_time is null, if(sai.is_slt = 1, sai.slt_time, CURDATE()) ,sai.end_time) as endTime,
DATEDIFF(IF(sai.end_time is null, if(sai.is_slt = 1, sai.slt_time, CURDATE()) ,sai.end_time), sai.start_time) + 1 as leaseDays
IF(sai.end_time is null, CURDATE() ,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 lease_publish_details lpd on sai.lease_id = lpd.parent_id
LEFT JOIN bm_unit bui2 ON bui2.unit_id = lpd.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
@ -343,7 +346,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.jiju_type = #{settlementType}
</if>
) res
GROUP BY res.typeId,res.startTime,res.endTime
GROUP BY res.unitName,res.typeId,res.startTime,res.endTime
ORDER BY res.unitName
</select>
<select id="getRepairDetailsList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
@ -394,6 +398,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name as modelName,
mt.unit_name as mtUnitName,
rc.repair_num as num,
ROUND(if(rc.costs > 0, rc.costs/rc.repair_num,0 ) ,2) as buyPrice,
rc.costs as costs,
case rc.part_type when '0' then '不收费' when '1' then '收费' else '' end as partType,
case rc.repair_type when '1' then '内部维修' when '2' then '返厂维修' else '' end as repairType,
@ -439,7 +444,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(
select sai.id,
sai.agreement_id as agreementId,
bui.unit_name as unitName,
IFNULL(bui2.unit_name,bui.unit_name) AS unitName,
bp.pro_name as projectName,
sai.company_id as companyId,
sai.type_id as typeId,
@ -456,6 +461,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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 lease_publish_details lpd ON sai.lease_id = lpd.parent_id
LEFT JOIN bm_unit bui2 ON bui2.unit_id = lpd.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.status = 0 and sai.source = '1'
@ -463,7 +470,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and mt.jiju_type = #{settlementType}
</if>
) res
GROUP BY res.typeId
GROUP BY res.unitName,res.typeId
ORDER BY
res.unitName
</select>
<select id="getCost" resultType="java.lang.String">
@ -575,45 +584,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 循环插入lease -->
<insert id="insertSltAgreementDetailLease" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,start_time,end_time,price,money)
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,start_time,end_time,price,money,unit_name)
values
<foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},1,#{item.num},#{item.startTime},#{item.endTime},#{item.leasePrice},#{item.costs})
(#{id}, #{item.typeId}, #{item.maId},1,#{item.num},#{item.startTime},#{item.endTime},#{item.leasePrice},#{item.costs},#{item.unitName})
</foreach>
</insert>
<!-- 循环插入repair -->
<insert id="insertSltAgreementDetailRepair" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge)
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge,unit_name)
values
<foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},3,#{item.num},#{item.costs},
<choose>
<when test="item.partType == '收费'">1</when>
<otherwise>0</otherwise>
</choose>)
</choose>,#{item.unitName})
</foreach>
</insert>
<!-- 循环插入scrap -->
<insert id="insertSltAgreementDetailScrap" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge)
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,is_charge,unit_name)
values
<foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},4,#{item.num},#{item.costs},
<choose>
<when test="item.partType == '收费'">1</when>
<otherwise>0</otherwise>
</choose>)
</choose>,#{item.unitName})
</foreach>
</insert>
<!-- 循环插入lose -->
<insert id="insertSltAgreementDetailLose" parameterType="com.bonus.material.settlement.domain.SltAgreementInfo">
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money)
insert into slt_agreement_details (apply_id, type_id,ma_id,slt_type,num,money,unit_name)
values
<foreach collection="list" item="item" separator=",">
(#{id}, #{item.typeId}, #{item.maId},2,#{item.num},#{item.costs})
(#{id}, #{item.typeId}, #{item.maId},2,#{item.num},#{item.costs},#{item.unitName})
</foreach>
</insert>
@ -632,6 +641,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code = #{agreementCode}
</if>
<if test="projectId != null and projectId != ''">
and bp.pro_id = #{projectId}
</if>
@ -1074,6 +1087,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="info.settlementType != null and info.settlementType != 0">
and mt.jiju_type = #{info.settlementType}
</if>
<if test="info.endTime != null and info.startTime != null">
and tt.create_time between #{info.startTime} and #{info.endTime}
</if>
<if test="info.agreementIds != null and info.agreementIds.size > 0">
and tta.agreement_id in
<foreach item="aid" collection="info.agreementIds" open="(" separator="," close=")">
@ -1158,6 +1176,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="info.settlementType != null and info.settlementType != 0">
and mt.jiju_type = #{info.settlementType}
</if>
<if test="info.endTime != null and info.startTime != null">
and tt.create_time between #{info.startTime} and #{info.endTime}
</if>
<if test="info.agreementIds != null and info.agreementIds.size > 0">
and tta.agreement_id in
<foreach item="aid" collection="info.agreementIds" open="(" separator="," close=")">
@ -1200,6 +1223,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="info.settlementType != null and info.settlementType != 0">
and mt.jiju_type = #{info.settlementType}
</if>
<if test="info.endTime != null and info.startTime != null">
and tt.create_time between #{info.startTime} and #{info.endTime}
</if>
<if test="info.agreementIds != null and info.agreementIds.size > 0">
and tta.agreement_id in
<foreach item="aid" collection="info.agreementIds" open="(" separator="," close=")">
@ -1212,77 +1238,189 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getLostReportList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
select sai.id,
sai.agreement_id as agreementId,
<!-- select sai.id,-->
<!-- sai.agreement_id as agreementId,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- bui.unit_name as unitName,-->
<!-- bp.pro_name as projectName,-->
<!-- sai.type_id as typeId,-->
<!-- sai.ma_id as maId,-->
<!-- mt1.type_name as typeName,-->
<!-- mt.type_name as modelName,-->
<!-- mt.unit_name as mtUnitName,-->
<!-- ROUND(mt.buy_price, 2) as buyPrice,-->
<!-- sum(sai.num) as num,-->
<!-- ROUND(mt.buy_price * sum(sai.num), 2) as loseCost-->
<!-- 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.source = '1' and sai.status = 0-->
<!-- <if test="settlementType != null and settlementType != 0">-->
<!-- and mt.jiju_type = #{settlementType}-->
<!-- </if>-->
<!-- <if test="startTime != null and endTime != null">-->
<!-- and sai.start_time between #{startTime} and #{endTime}-->
<!-- </if>-->
<!-- <if test="agreementCode != null and agreementCode != ''">-->
<!-- and bai.agreement_code like concat('%',#{agreementCode},'%')-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY-->
<!-- sai.agreement_id,mt.type_id-->
SELECT
res.agreementId,
res.agreementCode,
res.unitName,
res.projectName,
res.typeId,
res.typeName,
res.modelName,
res.mtUnitName,
res.buyPrice,
res.num as num,
res.startTime,
res.endTime,
res.leaseDays,
res. loseCost
FROM (SELECT bai.agreement_id AS agreementId,
bai.agreement_code as agreementCode,
bui.unit_name as unitName,
ifnull(sad.unit_name ,bui.unit_name) as unitName,
bp.pro_name as projectName,
sai.type_id as typeId,
sai.ma_id as maId,
sad.type_id as typeId,
sad.ma_id as maId,
sad.money as loseCost,
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
ROUND(mt.buy_price, 2) as buyPrice,
sum(sai.num) as num,
ROUND(mt.buy_price * sum(sai.num), 2) as loseCost
from
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
ROUND( IF ( sad.money > 0, sad.money / sad.num, 0 ), 2 ) AS buyPrice,
sad.num as num,
DATE (sad.start_time) as startTime,
DATE(ifnull(saa.create_time, sad.end_time)) as endTime,
DATEDIFF(
IF(sad.end_time is null, saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays
FROM
bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa
ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id AND sad.slt_type = '2'
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 mt on sad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
<where>
sai.source = '1'
<if test="settlementType != null and settlementType != 0">
and mt.jiju_type = #{settlementType}
</if>
<if test="startTime != null and endTime != null">
and sai.create_time between #{startTime} and #{endTime}
and saa.create_time between #{startTime} and #{endTime}
</if>
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code like concat('%',#{agreementCode},'%')
</if>
</where>
GROUP BY
sai.agreement_id,mt.type_id
) res
</select>
<select id="getLostReportListExport" resultType="com.bonus.material.settlement.domain.vo.SltAgreementInfoLose">
select sai.id,
sai.agreement_id as agreementId,
<!-- select sai.id,-->
<!-- sai.agreement_id as agreementId,-->
<!-- bai.agreement_code as agreementCode,-->
<!-- bui.unit_name as unitName,-->
<!-- bp.pro_name as projectName,-->
<!-- sai.type_id as typeId,-->
<!-- sai.ma_id as maId,-->
<!-- mt1.type_name as typeName,-->
<!-- mt.type_name as modelName,-->
<!-- mt.unit_name as mtUnitName,-->
<!-- ROUND(mt.buy_price, 2) as buyPrice,-->
<!-- sum(sai.num) as num,-->
<!-- ROUND(mt.buy_price * sum(sai.num), 2) as loseCost-->
<!-- 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.source = '1'-->
<!-- <if test="settlementType != null and settlementType != 0">-->
<!-- and mt.jiju_type = #{settlementType}-->
<!-- </if>-->
<!-- <if test="startTime != null and endTime != null">-->
<!-- and sai.create_time between #{startTime} and #{endTime}-->
<!-- </if>-->
<!-- <if test="agreementCode != null and agreementCode != ''">-->
<!-- and bai.agreement_code like concat('%',#{agreementCode},'%')-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY-->
<!-- sai.agreement_id,mt.type_id-->
SELECT
res.agreementId,
res.agreementCode,
res.unitName,
res.projectName,
res.typeId,
res.typeName,
res.modelName,
res.mtUnitName,
res.buyPrice,
res.num as num,
res.startTime,
res.endTime,
res.leaseDays,
res. loseCost
FROM (SELECT bai.agreement_id AS agreementId,
bai.agreement_code as agreementCode,
bui.unit_name as unitName,
ifnull(sad.unit_name ,bui.unit_name) as unitName,
bp.pro_name as projectName,
sai.type_id as typeId,
sai.ma_id as maId,
sad.type_id as typeId,
sad.ma_id as maId,
sad.money as loseCost,
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
ROUND(mt.buy_price, 2) as buyPrice,
sum(sai.num) as num,
ROUND(mt.buy_price * sum(sai.num), 2) as loseCost
from
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai on sai.agreement_id = bai.agreement_id
ROUND( IF ( sad.money > 0, sad.money / sad.num, 0 ), 2 ) AS buyPrice,
sad.num as num,
DATE (sad.start_time) as startTime,
DATE(ifnull(saa.create_time, sad.end_time)) as endTime,
DATEDIFF(
IF(sad.end_time is null, saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays
FROM
bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa
ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id AND sad.slt_type = '2'
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 mt on sad.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
<where>
sai.source = '1'
<if test="settlementType != null and settlementType != 0">
and mt.jiju_type = #{settlementType}
</if>
<if test="startTime != null and endTime != null">
and sai.create_time between #{startTime} and #{endTime}
and saa.create_time between #{startTime} and #{endTime}
</if>
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code like concat('%',#{agreementCode},'%')
</if>
</where>
GROUP BY
sai.agreement_id,mt.type_id
) res
</select>
@ -1554,8 +1692,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sad.price as leasePrice,
sad.num as num,
DATE(sad.start_time) as startTime,
DATE(sad.end_time) as endTime,
DATEDIFF(IF(sad.end_time is null,CURDATE(),sad.end_time), sad.start_time) + 1 as leaseDays
DATE(ifnull(saa.create_time,sad.end_time)) as endTime,
DATEDIFF(IF(sad.end_time is null,saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays
FROM
bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
@ -1565,7 +1703,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
bai.agreement_id = #{agreementId}
bai.agreement_id = #{agreementId} AND saa.`status` IN(1,2)
</select>
<update id="updateSltInfoByAgreementIdType">
@ -1724,6 +1862,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY create_time DESC
</select>
<select id="getAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
bai.agreement_id AS agreementId,
bai.unit_id as unitId,
bai.project_id as projectId
FROM
bm_agreement_info bai
where
bai.agreement_id = #{agreementId}
</select>
<select id="selectAgreementInfoList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
bai.agreement_id AS agreementId,
bai.unit_id as unitId,
bai.project_id as projectId
FROM
bm_agreement_info bai
where
bai.project_id = #{projectId} and bai.project_unit_id = #{unitId}
</select>
<select id="getSltLoseList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
res.agreementId,
res.unitName,
res.projectName,
res.typeId,
res.typeName,
res.modelName,
res.mtUnitName,
res.buyPrice,
res.num as num,
res.startTime,
res.endTime,
res.leaseDays
FROM (SELECT bai.agreement_id AS agreementId,
ifnull(sad.unit_name ,bui.unit_name) as unitName,
bp.pro_name as projectName,
sad.type_id as typeId,
sad.ma_id as maId,
sad.money as costs,
mt1.type_name as typeName,
mt.type_name as modelName,
mt.unit_name as mtUnitName,
ROUND( IF ( sad.money > 0, sad.money / sad.num, 0 ), 2 ) AS buyPrice,
sad.num as num,
DATE (sad.start_time) as startTime,
DATE(ifnull(saa.create_time, sad.end_time)) as endTime,
DATEDIFF(
IF(sad.end_time is null, saa.create_time,sad.end_time), sad.start_time) + 1 as leaseDays
FROM
bm_agreement_info bai
LEFT JOIN slt_agreement_apply saa
ON bai.agreement_id = saa.agreement_id AND saa.settlement_type = #{settlementType}
LEFT JOIN slt_agreement_details sad ON saa.id = sad.apply_id AND sad.slt_type = '2'
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
bai.agreement_id = #{agreementId}
) res
</select>
<insert id="addSltHistoryReport">
insert into slt_history_report (agreement_id,agreement_code,unit_name,project_name,
settlement_type,lease_cost,repair_cost,lose_cost,scrap_cost,reduction_cost,`year_month`,create_time

View File

@ -176,17 +176,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTaskById" resultType="com.bonus.material.task.domain.TmTask">
SELECT
creator as createBy,
create_time as createTime
saa.creator as createBy,
saa.create_time as createTime,
sur.sign_url AS sltSignUrl,
sur2.sign_url AS auditorSignUrl
FROM
slt_agreement_apply
slt_agreement_apply saa
LEFT JOIN sys_user sur on saa.creator = sur.user_id
LEFT JOIN sys_user sur2 on saa.auditor = sur2.user_id
WHERE
1 =1
<if test="agreementId != null">
and agreement_id = #{agreementId}
and saa.agreement_id = #{agreementId}
</if>
<if test="settlementType != null and settlementType != 0">
and settlement_type = #{settlementType}
and saa.settlement_type = #{settlementType}
</if>
</select>
@ -355,4 +359,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="getTaskIdListByAgreementList" resultType="com.bonus.material.task.domain.TmTask">
select tta.task_id as taskId
from tm_task_agreement tta
where tta.agreement_id in
<foreach item="item" collection="agreementInfoList" open="(" separator="," close=")">
#{item.agreementId}
</foreach>
</select>
</mapper>