投资支付

This commit is contained in:
pengjie 2023-07-10 15:20:27 +08:00
parent 5e09c64e23
commit fd64d7998d
10 changed files with 119 additions and 71 deletions

View File

@ -48,7 +48,7 @@ public class GovInvestmentPaymentItemController {
@ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST") @ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"), @ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "investmentPaymentId", value = "投资支付ID", paramType = "body", required = true, dataType = "String"), // @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付ID", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")

View File

@ -49,7 +49,7 @@ public class InvestmentPaymentItemController {
@ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST") @ApiOperation(value = " 分页列表查询投资支付子项信息", notes = "分页列表查询投资支付子项信息", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"), @ApiImplicitParam(name = "reportContent", value = "汇报内容", paramType = "body", dataType = "String"),
@ApiImplicitParam(name = "investmentPaymentId", value = "投资支付记录ID", paramType = "body", required = true, dataType = "String"), // @ApiImplicitParam(name = "investmentPaymentId", value = "投资支付记录ID", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "investmentApplyId", value = "投资支付申报ID", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"), @ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer") @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")

View File

@ -131,4 +131,8 @@ public class InspectRecord implements Serializable {
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "工程名称") @ApiModelProperty(value = "工程名称")
private String engineeringName; private String engineeringName;
@TableField(exist = false)
@ApiModelProperty(value = "逾期天数")
private Long slippage;
} }

View File

@ -122,7 +122,7 @@ public class ProjectSubItem implements Serializable {
*/ */
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "逾期天数") @ApiModelProperty(value = "逾期天数")
private Integer slippage; private Long slippage;
/** /**
* 附件地址 * 附件地址
*/ */

View File

@ -1,23 +1,29 @@
package com.zhgd.xmgl.modules.safety.service.impl; package com.zhgd.xmgl.modules.safety.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.handler.exception.CustomException; import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
import com.zhgd.xmgl.modules.basicdata.entity.EngineeringMain;
import com.zhgd.xmgl.modules.basicdata.entity.Project;
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringMainService;
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService;
import com.zhgd.xmgl.modules.basicdata.service.IProjectService;
import com.zhgd.xmgl.modules.safety.dto.InspectRecordDto; import com.zhgd.xmgl.modules.safety.dto.InspectRecordDto;
import com.zhgd.xmgl.modules.safety.dto.InspectRecordStatDto; import com.zhgd.xmgl.modules.safety.dto.InspectRecordStatDto;
import com.zhgd.xmgl.modules.basicdata.entity.*;
import com.zhgd.xmgl.modules.safety.mapper.InspectRecordMapper;
import com.zhgd.xmgl.modules.basicdata.service.*;
import com.zhgd.xmgl.modules.safety.vo.InspectRecordVo;
import com.zhgd.xmgl.modules.safety.entity.InspectQuestion; import com.zhgd.xmgl.modules.safety.entity.InspectQuestion;
import com.zhgd.xmgl.modules.safety.entity.InspectQuestionExamine; import com.zhgd.xmgl.modules.safety.entity.InspectQuestionExamine;
import com.zhgd.xmgl.modules.safety.entity.InspectRecord; import com.zhgd.xmgl.modules.safety.entity.InspectRecord;
import com.zhgd.xmgl.modules.safety.mapper.InspectRecordMapper;
import com.zhgd.xmgl.modules.safety.service.IInspectQuestionExamineService; import com.zhgd.xmgl.modules.safety.service.IInspectQuestionExamineService;
import com.zhgd.xmgl.modules.safety.service.IInspectQuestionService; import com.zhgd.xmgl.modules.safety.service.IInspectQuestionService;
import com.zhgd.xmgl.modules.safety.service.IInspectRecordService; import com.zhgd.xmgl.modules.safety.service.IInspectRecordService;
import com.zhgd.xmgl.modules.safety.vo.InspectRecordVo;
import com.zhgd.xmgl.security.SecurityUser; import com.zhgd.xmgl.security.SecurityUser;
import com.zhgd.xmgl.security.SecurityUtil; import com.zhgd.xmgl.security.SecurityUtil;
import com.zhgd.xmgl.util.ParamEnum; import com.zhgd.xmgl.util.ParamEnum;
@ -89,7 +95,14 @@ public class InspectRecordServiceImpl extends ServiceImpl<InspectRecordMapper, I
if (SecurityUtil.getUser().getAccountType() > 2) { if (SecurityUtil.getUser().getAccountType() > 2) {
wrapper.gt("i.state", 1); wrapper.gt("i.state", 1);
} }
return baseMapper.pageList(page, wrapper); Page<InspectRecordDto> inspectRecordDtoPage = baseMapper.pageList(page, wrapper);
inspectRecordDtoPage.getRecords().forEach(i -> {
if (i.getState() != 4 && i.getState() != 1) {
long betweenDay = DateUtil.between(i.getDeadline(), new Date(), DateUnit.DAY, false);
i.setSlippage(betweenDay <= 0 ? null : betweenDay);
}
});
return inspectRecordDtoPage;
} }
@Override @Override

View File

@ -8,22 +8,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.PageUtil; import com.zhgd.jeecg.common.util.PageUtil;
import com.zhgd.xmgl.handler.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.entity.Engineering; import com.zhgd.xmgl.modules.basicdata.entity.Engineering;
import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService; import com.zhgd.xmgl.modules.basicdata.service.IEngineeringService;
import com.zhgd.xmgl.modules.safety.entity.InvestmentApply;
import com.zhgd.xmgl.modules.safety.entity.InvestmentPaymentItem; import com.zhgd.xmgl.modules.safety.entity.InvestmentPaymentItem;
import com.zhgd.xmgl.modules.safety.mapper.InvestmentPaymentItemMapper; import com.zhgd.xmgl.modules.safety.mapper.InvestmentPaymentItemMapper;
import com.zhgd.xmgl.modules.safety.service.IInvestmentApplyService;
import com.zhgd.xmgl.modules.safety.service.IInvestmentPaymentItemService; import com.zhgd.xmgl.modules.safety.service.IInvestmentPaymentItemService;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @Description: 投资支付子项 * @Description: 投资支付子项
@ -37,23 +31,11 @@ public class InvestmentPaymentItemServiceImpl extends ServiceImpl<InvestmentPaym
@Autowired @Autowired
private IEngineeringService engineeringService; private IEngineeringService engineeringService;
@Autowired
private IInvestmentApplyService investmentApplyService;
@Override @Override
public IPage<InvestmentPaymentItem> pageList(Map<String, Object> map) { public IPage<InvestmentPaymentItem> pageList(Map<String, Object> map) {
QueryWrapper<InvestmentPaymentItem> queryWrapper = QueryGenerator.initPageQueryWrapper(InvestmentPaymentItem.class, map); QueryWrapper<InvestmentPaymentItem> queryWrapper = QueryGenerator.initPageQueryWrapper(InvestmentPaymentItem.class, map);
if (StringUtils.isBlank(MapUtils.getString(map, "investmentApplyId"))) { if (StringUtils.isBlank(MapUtils.getString(map, "investmentApplyId"))) {
String investmentPaymentId = MapUtils.getString(map, "investmentPaymentId"); return new Page<>();
if(StringUtils.isBlank(investmentPaymentId)) {
throw new CustomException("缺少参数");
}
List<InvestmentApply> investmentApplyList = investmentApplyService.list(Wrappers.<InvestmentApply>lambdaQuery().eq(InvestmentApply::getInvestmentPaymentId, investmentPaymentId));
List<Long> applyIds = Arrays.asList(0L);
if (investmentApplyList.size() > 0) {
applyIds = investmentApplyList.stream().map(i -> i.getId()).collect(Collectors.toList());
}
queryWrapper.lambda().in(InvestmentPaymentItem::getInvestmentApplyId, applyIds);
} }
Page<InvestmentPaymentItem> page = PageUtil.getPage(map); Page<InvestmentPaymentItem> page = PageUtil.getPage(map);
return baseMapper.selectPage(page, queryWrapper); return baseMapper.selectPage(page, queryWrapper);

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.modules.safety.service.impl; package com.zhgd.xmgl.modules.safety.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -154,22 +155,22 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
if (ids.size() > 0) { if (ids.size() > 0) {
List<ProjectSubItem> children = baseMapper.selectList(Wrappers.<ProjectSubItem>lambdaQuery().in(ProjectSubItem::getParentId, ids)); List<ProjectSubItem> children = baseMapper.selectList(Wrappers.<ProjectSubItem>lambdaQuery().in(ProjectSubItem::getParentId, ids));
for (ProjectSubItem child : children) { for (ProjectSubItem child : children) {
int compare = 0; if (child.getState() != 3) {
if (child.getRealEndTime() != null) { if (child.getRealEndTime() != null) {
compare = DateUtil.compare(child.getRealEndTime(), child.getPlanEndTime()); child.setSlippage(DateUtil.compare(child.getRealEndTime(), child.getPlanEndTime()) <= 0 ? null : DateUtil.between(child.getRealEndTime(), child.getPlanEndTime(), DateUnit.DAY));
} else { } else {
compare = DateUtil.compare(new Date(), child.getPlanEndTime()); child.setSlippage(DateUtil.compare(new Date(), child.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), child.getPlanEndTime(), DateUnit.DAY));
}
} }
child.setSlippage(compare < 0 ? 0 : compare);
} }
for (ProjectSubItemDto subItem : records) { for (ProjectSubItemDto subItem : records) {
int compare = 0; if (subItem.getState() != 3) {
if (subItem.getRealEndTime() != null) { if (subItem.getRealEndTime() != null) {
compare = DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()); subItem.setSlippage(DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(subItem.getRealEndTime(), subItem.getPlanEndTime(), DateUnit.DAY));
} else { } else {
compare = DateUtil.compare(new Date(), subItem.getPlanEndTime()); subItem.setSlippage(DateUtil.compare(new Date(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), subItem.getPlanEndTime(), DateUnit.DAY));
}
} }
subItem.setSlippage(compare < 0 ? 0 : compare);
subItem.setChildren(children.stream().filter(c -> c.getParentId().equals(subItem.getId())).collect(Collectors.toList())); subItem.setChildren(children.stream().filter(c -> c.getParentId().equals(subItem.getId())).collect(Collectors.toList()));
} }
} }
@ -177,13 +178,13 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
private void build1(List<ProjectSubItem> records) { private void build1(List<ProjectSubItem> records) {
for (ProjectSubItem subItem : records) { for (ProjectSubItem subItem : records) {
int compare = 0; if (subItem.getState() != 3) {
if (subItem.getRealEndTime() != null) { if (subItem.getRealEndTime() != null) {
compare = DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()); subItem.setSlippage(DateUtil.compare(subItem.getRealEndTime(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(subItem.getRealEndTime(), subItem.getPlanEndTime(), DateUnit.DAY));
} else { } else {
compare = DateUtil.compare(new Date(), subItem.getPlanEndTime()); subItem.setSlippage(DateUtil.compare(new Date(), subItem.getPlanEndTime()) <= 0 ? null : DateUtil.between(new Date(), subItem.getPlanEndTime(), DateUnit.DAY));
}
} }
subItem.setSlippage(compare < 0 ? 0 : compare);
} }
} }
@ -277,15 +278,16 @@ public class ProjectSubItemServiceImpl extends ServiceImpl<ProjectSubItemMapper,
projectSubItem.setRealEndTime(actualFinishDate); projectSubItem.setRealEndTime(actualFinishDate);
// projectSubItem.setRemark(task.getNotes()); // projectSubItem.setRemark(task.getNotes());
// 设置当前状态 // 设置当前状态
if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) { if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) {
projectSubItem.setCompleteRatio(new BigDecimal(0));
projectSubItem.setState(1);
} else if (task.getPercentageComplete().intValue() == 100 || (actualFinishDate != null && actualFinishDate.getTime() <= System.currentTimeMillis())) {
projectSubItem.setCompleteRatio(new BigDecimal(100));
projectSubItem.setState(3); projectSubItem.setState(3);
} else if (DateUtil.between(projectSubItem.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0){
projectSubItem.setState(4);
} else if (task.getPercentageComplete().intValue() == 0 || actualStartDate == null || actualStartDate.getTime() > System.currentTimeMillis()) {
projectSubItem.setState(1);
} else { } else {
projectSubItem.setState(2); projectSubItem.setState(2);
} }
projectSubItem.setCompleteRatio(new BigDecimal(task.getPercentageComplete().intValue()));
// 负责人名称 // 负责人名称
String dutyUserName = task.getText(1); String dutyUserName = task.getText(1);
projectSubItem.setCommander(dutyUserName); projectSubItem.setCommander(dutyUserName);

View File

@ -0,0 +1,44 @@
package com.zhgd.xmgl.task;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.zhgd.xmgl.modules.safety.entity.ProjectSubItem;
import com.zhgd.xmgl.modules.safety.service.IProjectSubItemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @description: 视频监控定时任务
**/
@Slf4j
@Component
public class SlippageTask {
@Autowired
private IProjectSubItemService projectSubItemService;
/**
* 每天凌晨计算项目进度是否逾期
*/
@Scheduled(cron = "0 0 2 * * ?")
private void projectSubItem() {
List<ProjectSubItem> change = new ArrayList<>();
List<ProjectSubItem> list = projectSubItemService.list();
list.stream().forEach(l -> {
if (l.getState() != 3 && DateUtil.between(l.getPlanEndTime(), new Date(), DateUnit.DAY, false) > 0) {
l.setState(4);
change.add(l);
}
});
if (change.size() > 0) {
projectSubItemService.updateBatchById(change);
}
log.info("=========定时修改项目进度状态任务执行成功========");
}
}

View File

@ -5,7 +5,7 @@
"groupId" : "1f3d3e5b9fe340bab84de67b0de08f44", "groupId" : "1f3d3e5b9fe340bab84de67b0de08f44",
"name" : "投资管理", "name" : "投资管理",
"createTime" : null, "createTime" : null,
"updateTime" : 1688866586913, "updateTime" : 1688970096225,
"lock" : null, "lock" : null,
"createBy" : "admin", "createBy" : "admin",
"updateBy" : "admin", "updateBy" : "admin",
@ -35,17 +35,18 @@ BigDecimal realPayAmountByYear = db.selectValue("SELECT IFNULL(SUM(pay_amount),
BigDecimal applyAmountTotal = db.selectValue("SELECT IFNULL(SUM(apply_payment), 0) FROM investment_payment_stat WHERE #project") BigDecimal applyAmountTotal = db.selectValue("SELECT IFNULL(SUM(apply_payment), 0) FROM investment_payment_stat WHERE #project")
BigDecimal paymentTotal = db.selectValue("SELECT IFNULL(SUM(payment), 0) FROM investment_payment_stat WHERE #project") BigDecimal paymentTotal = db.selectValue("SELECT IFNULL(SUM(payment), 0) FROM investment_payment_stat WHERE #project")
result.put("paymentByMonth", paymentByMonth) BigDecimal big = new BigDecimal(10000);
result.put("applyAmountByMonth", applyAmountByMonth) result.put("paymentByMonth", paymentByMonth.divide(big))
result.put("realPayAmountByMonth", realPayAmountByMonth) result.put("applyAmountByMonth", applyAmountByMonth.divide(big))
result.put("unPayAmountByMonth", applyAmountByMonth.subtract(realPayAmountByMonth)) result.put("realPayAmountByMonth", realPayAmountByMonth.divide(big))
result.put("unPayAmountByMonth", applyAmountByMonth.subtract(realPayAmountByMonth).divide(big))
result.put("totalAmount", totalAmount) result.put("totalAmount", totalAmount.divide(big))
result.put("payRatio", realPayAmountTotal == 0 ? 0 : realPayAmountTotal.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue()) result.put("payRatio", realPayAmountTotal == 0 ? 0 : realPayAmountTotal.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.put("paymentTotal", paymentTotal) result.put("paymentTotal", paymentTotal.divide(big))
result.put("applyAmountTotal", applyAmountTotal) result.put("applyAmountTotal", applyAmountTotal.divide(big))
result.put("settlementAmount", settlementAmount) result.put("settlementAmount", settlementAmount.divide(big))
result.put("settlementAmountByYear", settlementAmountByYear) result.put("settlementAmountByYear", settlementAmountByYear.divide(big))
result.put("realPayAmountTotal", realPayAmountTotal) result.put("realPayAmountTotal", realPayAmountTotal.divide(big))
result.put("realPayAmountByYear", realPayAmountByYear) result.put("realPayAmountByYear", realPayAmountByYear.divide(big))
return result return result

View File

@ -5,7 +5,7 @@
"groupId" : "de890cb5bb01484ab1feeedd1eb1c1dd", "groupId" : "de890cb5bb01484ab1feeedd1eb1c1dd",
"name" : "支付管理", "name" : "支付管理",
"createTime" : null, "createTime" : null,
"updateTime" : 1688900331033, "updateTime" : 1688970386266,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : "admin", "updateBy" : "admin",
@ -31,13 +31,15 @@ BigDecimal applyAmountByYear = db.selectValue("SELECT IFNULL(SUM(s.apply_payment
BigDecimal applyAmountByMonth = db.selectValue("SELECT IFNULL(SUM(s.apply_payment), 0) FROM investment_apply a INNER JOIN investment_payment_stat s ON a.id = s.investment_apply_id WHERE DATE_FORMAT(apply_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #projectalias ") BigDecimal applyAmountByMonth = db.selectValue("SELECT IFNULL(SUM(s.apply_payment), 0) FROM investment_apply a INNER JOIN investment_payment_stat s ON a.id = s.investment_apply_id WHERE DATE_FORMAT(apply_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #projectalias ")
Map payAmountByYear = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y') = DATE_FORMAT(now(), '%Y') AND #project") Map payAmountByYear = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y') = DATE_FORMAT(now(), '%Y') AND #project")
Map payAmountByMonth = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #project") Map payAmountByMonth = db.selectValue("SELECT IFNULL(SUM(pay_amount), 0) FROM investment_payment WHERE DATE_FORMAT(pay_time, '%Y-%m') = DATE_FORMAT(now(), '%Y-%m') AND #project")
result.put("payAmount", payAmount)
result.put("totalAmount", totalAmount.subtract(payAmount)) BigDecimal big = new BigDecimal(10000);
result.put("payAmount", payAmount.divide(big))
result.put("totalAmount", totalAmount.subtract(payAmount).divide(big))
result.put("payRatio", payAmount == 0 ? 0 : payAmount.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue()) result.put("payRatio", payAmount == 0 ? 0 : payAmount.divide(totalAmount, 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")).doubleValue())
result.put("applyAmountTotal", applyAmountTotal) result.put("applyAmountTotal", applyAmountTotal.divide(big))
result.put("applyAmountByYear", applyAmountByYear) result.put("applyAmountByYear", applyAmountByYear.divide(big))
result.put("applyAmountByMonth", applyAmountByMonth) result.put("applyAmountByMonth", applyAmountByMonth.divide(big))
result.put("payAmountTotal", payAmount) result.put("payAmountTotal", payAmount.divide(big))
result.put("payAmountByYear", payAmountByYear) result.put("payAmountByYear", payAmountByYear.divide(big))
result.put("payAmountByMonth", payAmountByMonth) result.put("payAmountByMonth", payAmountByMonth.divide(big))
return result return result