i皖送费用推送审核导出Api

This commit is contained in:
syruan 2025-02-06 11:16:04 +08:00
parent a5ebc4d727
commit 69b7ac41ed
6 changed files with 180 additions and 243 deletions

View File

@ -1,119 +0,0 @@
//package com.bonus.material.lease.controller;
//
//import java.util.List;
//import javax.servlet.http.HttpServletResponse;
//import com.bonus.common.log.enums.OperaType;
//import com.bonus.material.common.annotation.PreventRepeatSubmit;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.bonus.common.log.annotation.SysLog;
//import com.bonus.common.security.annotation.RequiresPermissions;
//import com.bonus.material.lease.domain.LeaseApplyDetails;
//import com.bonus.material.lease.service.ILeaseApplyDetailsService;
//import com.bonus.common.core.web.controller.BaseController;
//import com.bonus.common.core.web.domain.AjaxResult;
//import com.bonus.common.core.utils.poi.ExcelUtil;
//import com.bonus.common.core.web.page.TableDataInfo;
//
///**
// * 领料任务详细Controller
// *
// * @author xsheng
// * @date 2024-10-16
// */
//@Api(tags = "领料任务详细接口")
//@RestController
//@RequestMapping("/lease_apply_details")
//public class LeaseApplyDetailsController extends BaseController {
// @Autowired
// private ILeaseApplyDetailsService leaseApplyDetailsService;
//
// /**
// * 查询领料任务详细列表
// */
// @ApiOperation(value = "查询领料任务详细列表")
// @RequiresPermissions("lease:details:list")
// @GetMapping("/list")
// public TableDataInfo list(LeaseApplyDetails leaseApplyDetails) {
// startPage();
// List<LeaseApplyDetails> list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails);
// return getDataTable(list);
// }
//
// /**
// * 导出领料任务详细列表
// */
// @ApiOperation(value = "导出领料任务详细列表")
// @PreventRepeatSubmit
// @RequiresPermissions("lease:details:export")
// @SysLog(title = "领料任务详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务详细")
// @PostMapping("/export")
// public void export(HttpServletResponse response, LeaseApplyDetails leaseApplyDetails) {
// List<LeaseApplyDetails> list = leaseApplyDetailsService.selectLeaseApplyDetailsList(leaseApplyDetails);
// ExcelUtil<LeaseApplyDetails> util = new ExcelUtil<LeaseApplyDetails>(LeaseApplyDetails.class);
// util.exportExcel(response, list, "领料任务详细数据");
// }
//
// /**
// * 获取领料任务详细详细信息
// */
// @ApiOperation(value = "获取领料任务详细详细信息")
// @RequiresPermissions("lease:details:query")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") Long id) {
// return success(leaseApplyDetailsService.selectLeaseApplyDetailsById(id));
// }
//
// /**
// * 新增领料任务详细
// */
// @ApiOperation(value = "新增领料任务详细")
// @PreventRepeatSubmit
// @RequiresPermissions("lease:details:add")
// @SysLog(title = "领料任务详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料任务详细")
// @PostMapping
// public AjaxResult add(@RequestBody LeaseApplyDetails leaseApplyDetails) {
// try {
// return toAjax(leaseApplyDetailsService.insertLeaseApplyDetails(leaseApplyDetails));
// } catch (Exception e) {
// return error("系统错误, " + e.getMessage());
// }
// }
//
// /**
// * 修改领料任务详细
// */
// @ApiOperation(value = "修改领料任务详细")
// @PreventRepeatSubmit
// @RequiresPermissions("lease:details:edit")
// @SysLog(title = "领料任务详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料任务详细")
// @PutMapping
// public AjaxResult edit(@RequestBody LeaseApplyDetails leaseApplyDetails) {
// try {
// return toAjax(leaseApplyDetailsService.updateLeaseApplyDetails(leaseApplyDetails));
// } catch (Exception e) {
// return error("系统错误, " + e.getMessage());
// }
// }
//
// /**
// * 删除领料任务详细
// */
// @ApiOperation(value = "删除领料任务详细")
// @PreventRepeatSubmit
// @RequiresPermissions("lease:details:remove")
// @SysLog(title = "领料任务详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料任务详细")
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids) {
// return toAjax(leaseApplyDetailsService.deleteLeaseApplyDetailsByIds(ids));
// }
//}

View File

@ -1,113 +0,0 @@
//package com.bonus.material.lease.controller;
//
//import java.util.List;
//import javax.servlet.http.HttpServletResponse;
//import com.bonus.common.log.enums.OperaType;
//import com.bonus.material.common.annotation.PreventRepeatSubmit;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.bonus.common.log.annotation.SysLog;
//import com.bonus.common.biz.domain.lease.LeaseOutDetails;
//import com.bonus.material.lease.service.ILeaseOutDetailsService;
//import com.bonus.common.core.web.controller.BaseController;
//import com.bonus.common.core.web.domain.AjaxResult;
//import com.bonus.common.core.utils.poi.ExcelUtil;
//import com.bonus.common.core.web.page.TableDataInfo;
//
///**
// * 领料出库详细Controller
// *
// * @author xsheng
// * @date 2024-10-16
// */
//@Api(tags = "领料出库详细接口")
//@RestController
//@RequestMapping("/lease_out_details")
//public class LeaseOutDetailsController extends BaseController {
//
// @Autowired
// private ILeaseOutDetailsService leaseOutDetailsService;
//
// /**
// * 查询领料出库详细列表
// */
// @ApiOperation(value = "查询领料出库详细列表")
// @GetMapping("/list")
// public TableDataInfo list(LeaseOutDetails leaseOutDetails) {
// startPage();
// List<LeaseOutDetails> list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails);
// return getDataTable(list);
// }
//
// /**
// * 导出领料出库详细列表
// */
// @ApiOperation(value = "导出领料出库详细列表")
// @PreventRepeatSubmit
// @SysLog(title = "领料出库详细", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料出库详细")
// @PostMapping("/export")
// public void export(HttpServletResponse response, LeaseOutDetails leaseOutDetails) {
// List<LeaseOutDetails> list = leaseOutDetailsService.selectLeaseOutDetailsList(leaseOutDetails);
// ExcelUtil<LeaseOutDetails> util = new ExcelUtil<>(LeaseOutDetails.class);
// util.exportExcel(response, list, "领料出库详细数据");
// }
//
// /**
// * 获取领料出库详细详细信息
// */
// @ApiOperation(value = "获取领料出库详细详细信息")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") Long id) {
// return success(leaseOutDetailsService.selectLeaseOutDetailsById(id));
// }
//
// /**
// * 新增领料出库详细
// */
// @ApiOperation(value = "新增领料出库详细")
// @PreventRepeatSubmit
// @SysLog(title = "领料出库详细", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增领料出库详细")
// @PostMapping
// public AjaxResult add(@RequestBody List<LeaseOutDetails> leaseOutDetailsList) {
// try {
// return leaseOutDetailsService.insertLeaseOutDetails(leaseOutDetailsList);
// } catch (Exception e) {
// return error("系统错误, " + e.getMessage());
// }
// }
//
// /**
// * 修改领料出库详细
// */
// @ApiOperation(value = "修改领料出库详细")
// @PreventRepeatSubmit
// @SysLog(title = "领料出库详细", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改领料出库详细")
// @PutMapping
// public AjaxResult edit(@RequestBody LeaseOutDetails leaseOutDetails) {
// try {
// return toAjax(leaseOutDetailsService.updateLeaseOutDetails(leaseOutDetails));
// } catch (Exception e) {
// return error("系统错误, " + e.getMessage());
// }
// }
//
// /**
// * 删除领料出库详细
// */
// @ApiOperation(value = "删除领料出库详细")
// @PreventRepeatSubmit
// @SysLog(title = "领料出库详细", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除领料出库详细")
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids) {
// return toAjax(leaseOutDetailsService.deleteLeaseOutDetailsByIds(ids));
// }
//}

View File

@ -1,12 +1,16 @@
package com.bonus.material.push.controller;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.material.push.domain.IwsCostPushBean;
import com.bonus.material.push.domain.vo.IwsCostPushExportVo;
import com.bonus.material.push.service.IwsCostPushService;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -14,9 +18,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author : 阮世耀
@ -69,6 +72,31 @@ public class IwsCostPushController extends BaseController {
return getDataTable(list);
}
/**
* 导出费用推送审核列表
*/
@PostMapping("/exportCostPushExamList")
@ApiOperation("导出费用推送审核列表--后端处理")
public void exportCostPushList(HttpServletResponse response, IwsCostPushBean obj) {
try {
List<IwsCostPushBean> list = iwsCostPushService.getCostPushCheckList(obj);
List<IwsCostPushExportVo> exportVoList = list.stream()
.map(bean -> {
IwsCostPushExportVo vo = new IwsCostPushExportVo();
BeanUtils.copyProperties(bean, vo);
vo.setMonth(Optional.ofNullable(obj).map(IwsCostPushBean::getMonth).orElse(""));
return vo;
})
.collect(Collectors.toList());
ExcelUtil<IwsCostPushExportVo> util = new ExcelUtil<>(IwsCostPushExportVo.class);
util.exportExcel(response, exportVoList, "协议推送匹配");
} catch (Exception e) {
System.err.println("导出异常 = " + e.getMessage());
throw new ServiceException("导出异常,请联系运维人员查询日志");
}
}
/**
* 根据协议ID及月份查询当月租赁费用明细
* @param obj 查询条件

View File

@ -74,13 +74,13 @@ public class IwsCostPushBean implements Serializable {
private BigDecimal leaseMoney;
private String lostMoney;
private BigDecimal lostMoney;
private String scrapMoney;
private BigDecimal scrapMoney;
private String repairMoney;
private BigDecimal repairMoney;
private String leasePrice;
private BigDecimal leasePrice;
private String time;

View File

@ -0,0 +1,142 @@
package com.bonus.material.push.domain.vo;
import com.bonus.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author : 阮世耀
* @version : 1.0
* @PackagePath: com.bonus.material.push.domain
* @CreateTime: 2025-02-06 10:01
* @Description: i皖送费用推送导出专用
* @since 2025-02-06
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class IwsCostPushExportVo implements Serializable {
private static final long serialVersionUID = -1473066593962126100L;
private String id;
// 协议号
@Excel(name = "协议号", sort = 1)
private String agreementCode;
// 协议id
private String agreementId;
private String projectId;
private String unitId;
@Excel(name = "工程名称", sort = 3)
private String projectName;
private String projectCode;
@Excel(name = "单位名称", sort = 2)
private String unitName;
// 物资类型
private String typeName;
// 规格型号
private String modelName;
// 物资类型id
private Integer typeId;
// 数量
private String num;
// 领用数量
private BigDecimal leaseNum;
// 领料日期
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime leaseDate;
// 领用天数
private Integer leaseDays;
// 退料日期
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime backDate;
@Excel(name = "租赁费用", sort = 5)
private BigDecimal leaseMoney;
@Excel(name = "退料费用", sort = 8)
private BigDecimal lostMoney;
@Excel(name = "报废费用", sort = 7)
private BigDecimal scrapMoney;
@Excel(name = "维修费用", sort = 6)
private BigDecimal repairMoney;
private BigDecimal leasePrice;
private String time;
// 月份
@NotBlank(message = "月份不能为空")
@Excel(name = "推送月份", sort = 4)
private String month;
private String type;
// 原值
private String buyPrice;
// 是否推送
@Excel(name = "是否推送", readConverterExp = "0=未推送,1=已推送")
private String isPush;
private String money;
private String year;
// 是否结算
@Excel(name = "是否结算", readConverterExp = "0=未结算,1=已结算", sort = 9)
private Byte isSettlement = 0;
// 结算时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime settlementTime;
// 是否匹配
private Byte isMatch = 0;
private String userName;
@ApiModelProperty(value = "审核状态")
@Excel(name = "是否审核", readConverterExp = "0=未审核,1=已审核", sort = 10)
private Byte checkStatus;
// 推送备注
private String pushRemark;
private String companyId;
// 开始时间
private String startTime;
// 结束时间
private String endTime;
// 是否删除 false未删除 true已删除
private boolean delFlag = false;
}

View File

@ -63,7 +63,6 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
*/
@Override
public AjaxResult computeTheMonthCost(IwsCostPushBean costDto) {
// 获取当月第一天的日期和最后一天日期
String firstDay = DateTimeHelper.getFirstDay();
String lastDay = DateTimeHelper.getLastDay();
@ -104,7 +103,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
return Collections.emptyList();
}
// 获取前端传入对应年月的第一天与最后一天的LocalDateTime对象
// 获取前端传入年月对应的第一天与最后一天 LocalDateTime对象
LocalDateTime queryStartTime = getFirstDayOfMonth(record.getMonth());
LocalDateTime queryEndTime = getLastDayOfMonthZ(record.getMonth());
@ -143,7 +142,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
leaseCostInfo.setLeaseDays(Math.toIntExact(calculateDaysInclusive(leaseCostInfo.getLeaseDate(), leaseCostInfo.getBackDate())));
// 计算费用
leaseCostInfo.setLeaseMoney(new BigDecimal(leaseCostInfo.getLeaseDays())
.multiply(new BigDecimal(leaseCostInfo.getLeasePrice()))
.multiply(leaseCostInfo.getLeasePrice())
.multiply(leaseCostInfo.getLeaseNum()).setScale(2, RoundingMode.HALF_UP)
);
@ -207,7 +206,7 @@ public class IwsCostPushServiceImpl implements IwsCostPushService {
* return true 需要推送, false 不需要推送
*/
private boolean checkPush(IwsCostPushBean o) {
return o.getUnitName().contains("大件") || o.getUnitName().contains("机械化") || StringUtils.isEmpty(o.getProjectId());
return !(o.getUnitName().contains("大件") || o.getUnitName().contains("机械化") || StringUtils.isEmpty(o.getProjectId()));
}
/**