结算修改
This commit is contained in:
parent
48cf463236
commit
4ccd339437
|
|
@ -232,15 +232,6 @@
|
|||
form = layui.form,
|
||||
laydate = layui.laydate;
|
||||
|
||||
// 初始化日期选择器
|
||||
laydate.render({
|
||||
elem: '#startDate'
|
||||
});
|
||||
|
||||
laydate.render({
|
||||
elem: '#endDate'
|
||||
});
|
||||
|
||||
// 加载projectCost模块
|
||||
layui.use('projectCost', function(){
|
||||
var projectCost = layui.projectCost;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -47,7 +47,7 @@
|
|||
AND start_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND end_time <= #{endTime}
|
||||
AND end_time < DATE_ADD(#{endTime}, INTERVAL 1 DAY)
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.cost.beans;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -167,6 +168,10 @@ public class ProjectLeaseCostDetail {
|
|||
*/
|
||||
private Integer sequence;
|
||||
|
||||
private List<ProjectLeaseCostDetail> modifications;
|
||||
|
||||
private ProjectLeaseCostDetail modification;
|
||||
|
||||
/**
|
||||
* 查询关键字
|
||||
*/
|
||||
|
|
@ -443,5 +448,21 @@ public class ProjectLeaseCostDetail {
|
|||
public void setCalculationId(Integer calculationId) {
|
||||
this.calculationId = calculationId;
|
||||
}
|
||||
|
||||
public List<ProjectLeaseCostDetail> getModifications() {
|
||||
return modifications;
|
||||
}
|
||||
|
||||
public void setModifications(List<ProjectLeaseCostDetail> modifications) {
|
||||
this.modifications = modifications;
|
||||
}
|
||||
|
||||
public ProjectLeaseCostDetail getModification() {
|
||||
return modification;
|
||||
}
|
||||
|
||||
public void setModification(ProjectLeaseCostDetail modification) {
|
||||
this.modification = modification;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ public class ProjectCostController extends BaseController<T> {
|
|||
return ar;
|
||||
}
|
||||
|
||||
@RequestMapping("editSettlement")
|
||||
@RequestMapping("submitModifications")
|
||||
@ResponseBody
|
||||
public AjaxRes editSettlement(@RequestBody ProjectLeaseCostDetail o) {
|
||||
public AjaxRes submitModifications(@RequestBody ProjectLeaseCostDetail o) {
|
||||
AjaxRes ar = getAjaxRes();
|
||||
try {
|
||||
int res = projectCostService.editSettlement(o);
|
||||
|
|
|
|||
|
|
@ -55,20 +55,24 @@ public class NewSettlementService {
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int editSettlement(ProjectLeaseCostDetail o) {
|
||||
List<ProjectLeaseCostDetail> leaseDetails = o.getModifications();
|
||||
if (leaseDetails.size()>0){
|
||||
for (ProjectLeaseCostDetail leaseDetail : leaseDetails){
|
||||
//根据领料还是退料进行数据修改
|
||||
Byte operateType = o.getOperateType();
|
||||
Byte operateType = leaseDetail.getOperateType();
|
||||
if (Byte.valueOf("1").equals(operateType)) {
|
||||
int res = projectCostDao.editWfTaskRecord(o);
|
||||
int res = projectCostDao.editWfTaskRecord(leaseDetail);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("修改领料数据失败!");
|
||||
}
|
||||
|
||||
} else if (Byte.valueOf("2").equals(operateType)) {
|
||||
int res = projectCostDao.editWfInfoRecord(o);
|
||||
int res = projectCostDao.editWfInfoRecord(leaseDetail);
|
||||
if (res == 0) {
|
||||
throw new RuntimeException("修改退料数据失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//调用结算计算逻辑
|
||||
ProjectLeaseCostDetail bean = new ProjectLeaseCostDetail();
|
||||
bean.setProjectId(o.getProjectId());
|
||||
|
|
@ -133,6 +137,7 @@ public class NewSettlementService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +152,11 @@ public class NewSettlementService {
|
|||
// 获取退料明细
|
||||
List<ProjectLeaseCostDetail> returnDetails = queryProjectReturnDetails(o);
|
||||
|
||||
//计算逻辑
|
||||
return settlementLogic(o,leaseDetails,returnDetails);
|
||||
}
|
||||
|
||||
public Map<String, Object> settlementLogic(ProjectLeaseCostDetail o,List<ProjectLeaseCostDetail> leaseDetails,List<ProjectLeaseCostDetail> returnDetails){
|
||||
// 创建一个新的列表来存储合并后的结果
|
||||
List<ProjectLeaseCostDetail> mergedList = new ArrayList<>();
|
||||
if (leaseDetails != null) {
|
||||
|
|
@ -521,11 +531,8 @@ public class NewSettlementService {
|
|||
result.put("calculationResults", calculationResults); // 计算结果
|
||||
result.put("totalAmount", totalAmount); // 总金额
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 将local日期 转成当日日期
|
||||
* @param dateTime
|
||||
|
|
|
|||
Loading…
Reference in New Issue