发票 积分 支付逻辑修改
This commit is contained in:
parent
b408554bdb
commit
8bcf0b33bd
|
|
@ -1,15 +1,9 @@
|
|||
package com.ruoyi.database.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUserByPhone;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.database.domain.BaseInvoiceInfo;
|
||||
import com.ruoyi.database.domain.dto.BaseInvoiceInfoDto;
|
||||
import com.ruoyi.database.service.BaseInvoiceInfoService;
|
||||
|
|
@ -17,14 +11,13 @@ import com.ruoyi.framework.web.service.TokenService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 发票信息表(BaseInvoiceInfo)Controller
|
||||
|
|
@ -42,27 +35,45 @@ public class BaseInvoiceInfoController extends BaseController {
|
|||
private final TokenService tokenService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询当前已开发票信息")
|
||||
public TableDataInfo<BaseInvoiceInfo> list(BaseInvoiceInfo baseInvoiceInfo, HttpServletRequest request) {
|
||||
@ApiOperation("查询当前已开发票信息(详情)")
|
||||
public AjaxResult list(@RequestParam String inUnid, HttpServletRequest request) {
|
||||
LoginUserByPhone loginUserByPhone = tokenService.getLoginUserByPhone(request);
|
||||
QueryWrapper<BaseInvoiceInfo> queryWrapper = new QueryWrapper<>(baseInvoiceInfo);
|
||||
queryWrapper.eq("user_phone",loginUserByPhone.getPhone());
|
||||
PageUtils.startPage();
|
||||
List<BaseInvoiceInfo> list = baseInvoiceInfoService.list(queryWrapper);
|
||||
long size = baseInvoiceInfoService.count(queryWrapper);
|
||||
return getDataTableEnhance(list, size);
|
||||
BaseInvoiceInfo one = baseInvoiceInfoService.lambdaQuery()
|
||||
.eq(BaseInvoiceInfo::getInUnid, inUnid)
|
||||
.eq(BaseInvoiceInfo::getUserPhone,loginUserByPhone.getPhone())
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
if (one != null) {
|
||||
return AjaxResult.success(one);
|
||||
}else {
|
||||
return AjaxResult.error("未找到对应订单");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增发票开票任务")
|
||||
@Transactional
|
||||
public AjaxResult insert(@RequestBody BaseInvoiceInfoDto baseInvoiceInfo, HttpServletRequest request) {
|
||||
BaseInvoiceInfo invoiceInfo = new BaseInvoiceInfo();
|
||||
BeanUtils.copyProperties(baseInvoiceInfo,invoiceInfo);
|
||||
invoiceInfo.setInvoiceTypeCode(0);
|
||||
invoiceInfo.setPriceTaxMark(1);
|
||||
return toAjax(baseInvoiceInfoService.save(invoiceInfo));
|
||||
try {
|
||||
LoginUserByPhone loginUserByPhone = tokenService.getLoginUserByPhone(request);
|
||||
List<String> inUnid = baseInvoiceInfo.getInUnid();
|
||||
String uuid = UUID.randomUUID().toString();
|
||||
for (String s : inUnid) {
|
||||
BaseInvoiceInfo invoiceInfo = new BaseInvoiceInfo();
|
||||
BeanUtils.copyProperties(baseInvoiceInfo,invoiceInfo);
|
||||
invoiceInfo.setInUnid(s);
|
||||
invoiceInfo.setInvoiceTypeCode(0);
|
||||
invoiceInfo.setPriceTaxMark(1);
|
||||
invoiceInfo.setUserPhone(loginUserByPhone.getPhone());
|
||||
invoiceInfo.setPlId(uuid);
|
||||
baseInvoiceInfoService.save(invoiceInfo);
|
||||
}
|
||||
return AjaxResult.success("操作成功,等待开票");
|
||||
} catch (BeansException e) {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,10 @@ import com.ruoyi.common.enums.BusinessType;
|
|||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.database.domain.ParkingBillInfo;
|
||||
import com.ruoyi.database.domain.ParkingBillPaymentInfo;
|
||||
import com.ruoyi.database.domain.vo.ParkingBillInfoVO;
|
||||
import com.ruoyi.database.service.ParkingBillInfoService;
|
||||
import com.ruoyi.database.service.ParkingBillPaymentInfoService;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -23,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RequestMapping("/ParkingBillInfo")
|
||||
@Api(tags = "订单管理")
|
||||
|
|
@ -31,6 +34,7 @@ import java.util.List;
|
|||
public class ParkingBillInfoController extends BaseController {
|
||||
|
||||
private final ParkingBillInfoService parkingBillInfoService;
|
||||
private final ParkingBillPaymentInfoService parkingBillPaymentInfoService;
|
||||
private final TokenService tokenService;
|
||||
|
||||
@GetMapping
|
||||
|
|
@ -42,7 +46,7 @@ public class ParkingBillInfoController extends BaseController {
|
|||
phone = loginUserByPhone.getPhone();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
PageUtils.startPage();
|
||||
|
||||
QueryWrapper<ParkingBillInfo> queryWrapper = new QueryWrapper<>(parkingBillInfo);
|
||||
if (phone != null && !"".equals(phone)){
|
||||
queryWrapper.eq("phone",phone);
|
||||
|
|
@ -50,33 +54,45 @@ public class ParkingBillInfoController extends BaseController {
|
|||
Integer timeRange = parkingBillInfo.getTimeRange();
|
||||
if (timeRange != null){
|
||||
Date now = new Date();
|
||||
|
||||
QueryWrapper<ParkingBillPaymentInfo> infoQueryWrapper = new QueryWrapper<>();
|
||||
if (timeRange == 1) { // 当天
|
||||
// 获取当天开始和结束时间
|
||||
Date beginOfDay = DateUtil.beginOfDay(now);
|
||||
Date endOfDay = DateUtil.endOfDay(now);
|
||||
queryWrapper.between("create_time", beginOfDay, endOfDay);
|
||||
infoQueryWrapper.between("create_time", beginOfDay, endOfDay);
|
||||
|
||||
} else if (timeRange == 2) { // 一个月内
|
||||
Date oneMonthAgo = DateUtil.offsetMonth(now, -1);
|
||||
queryWrapper.ge("create_time", oneMonthAgo);
|
||||
infoQueryWrapper.ge("create_time", oneMonthAgo);
|
||||
|
||||
} else if (timeRange == 3) { // 三个月内
|
||||
Date threeMonthsAgo = DateUtil.offsetMonth(now, -3);
|
||||
queryWrapper.ge("create_time", threeMonthsAgo);
|
||||
infoQueryWrapper.ge("create_time", threeMonthsAgo);
|
||||
}
|
||||
List<ParkingBillPaymentInfo> list = parkingBillPaymentInfoService.list(infoQueryWrapper);
|
||||
if (list != null && !list.isEmpty()){
|
||||
List<String> collect = list.stream().map(ParkingBillPaymentInfo::getInUnid).collect(Collectors.toList());
|
||||
queryWrapper.eq("in_unid",collect);
|
||||
}
|
||||
}
|
||||
queryWrapper.eq("is_pay",1);
|
||||
PageUtils.startPage();
|
||||
List<ParkingBillInfo> list = parkingBillInfoService.list(queryWrapper);
|
||||
List<ParkingBillInfoVO> parkingBillInfoVOS = new ArrayList<>();
|
||||
list.forEach(b -> {
|
||||
ParkingBillInfoVO parkingBillInfoVO = new ParkingBillInfoVO();
|
||||
BeanUtils.copyProperties(b, parkingBillInfoVO);
|
||||
parkingBillInfoVO.setTotalCostYuan(b.getTotalCostYuan().toString() + "元");
|
||||
parkingBillInfoVO.setTotalCost(b.getTotalCostYuan());
|
||||
parkingBillInfoVO.setPayMoneyYuan(b.getPayMoneyYuan().toString() + "元");
|
||||
parkingBillInfoVO.setPayMoney(b.getPayMoneyYuan());
|
||||
parkingBillInfoVO.setDeductMoneyYuan(b.getDeductMoneyYuan().toString() + "元");
|
||||
parkingBillInfoVO.setDeductMoney(b.getDeductMoneyYuan());
|
||||
ParkingBillPaymentInfo one = parkingBillPaymentInfoService.lambdaQuery()
|
||||
.eq(ParkingBillPaymentInfo::getInUnid, b.getInUnid())
|
||||
.eq(ParkingBillPaymentInfo::getPayStatus, 1)
|
||||
.last("LIMIT 1")
|
||||
.one();
|
||||
parkingBillInfoVO.setTotalCostYuan(one.getTotalCostYuan().toString() + "元");
|
||||
parkingBillInfoVO.setTotalCost(one.getTotalCostYuan());
|
||||
parkingBillInfoVO.setPayMoneyYuan(one.getPayMoneyYuan().toString() + "元");
|
||||
parkingBillInfoVO.setPayMoney(one.getPayMoneyYuan());
|
||||
parkingBillInfoVO.setDeductMoneyYuan(one.getDeductMoneyYuan().toString() + "元");
|
||||
parkingBillInfoVO.setDeductMoney(one.getDeductMoneyYuan());
|
||||
parkingBillInfoVO.setParkPeriodTime(minutesToDHMS(b.getParkPeriodTime()));
|
||||
parkingBillInfoVOS.add(parkingBillInfoVO);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,13 +51,17 @@ public class SmallProgramController extends BaseController {
|
|||
@Transactional
|
||||
public AjaxResult getOrder(String plateNo) {
|
||||
String trim = plateNo.trim();
|
||||
// ParkingBillInfo one = parkingBillInfoService.saveOrUpdateParkingBillInfo(trim);
|
||||
|
||||
ParkingBillInfo one = parkingBillInfoService.lambdaQuery()
|
||||
.eq(ParkingBillInfo::getPlateNo, plateNo)
|
||||
.eq(ParkingBillInfo::getIsPay,0)
|
||||
.orderByDesc(ParkingBillInfo::getCreateTime)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
|
||||
ParkingBillInfo parkingBillInfo = parkingBillInfoService.saveOrUpdateParkingBillInfo(trim);
|
||||
if (parkingBillInfo != null){
|
||||
one = parkingBillInfo;
|
||||
}
|
||||
if (one == null) {
|
||||
return AjaxResult.error("未查询到停车记录");
|
||||
} else {
|
||||
|
|
@ -294,6 +298,12 @@ public class SmallProgramController extends BaseController {
|
|||
parkingBillPaymentInfo.setPayStatus(0);
|
||||
parkingBillPaymentInfo.setOrderId(generate);
|
||||
parkingBillPaymentInfo.setInUnid(one.getInUnid());
|
||||
parkingBillPaymentInfo.setTotalCost(one.getTotalCost());
|
||||
parkingBillPaymentInfo.setTotalCostYuan(one.getTotalCostYuan());
|
||||
parkingBillPaymentInfo.setPayMoney(one.getPayMoney());
|
||||
parkingBillPaymentInfo.setPayMoneyYuan(one.getPayMoneyYuan());
|
||||
parkingBillPaymentInfo.setDeductMoney(one.getDeductMoney());
|
||||
parkingBillPaymentInfo.setDeductMoneyYuan(one.getDeductMoneyYuan());
|
||||
boolean b = parkingBillPaymentInfoService.saveOrUpdate(parkingBillPaymentInfo);
|
||||
if (b) {
|
||||
return AjaxResult.success(order);
|
||||
|
|
|
|||
|
|
@ -159,4 +159,8 @@ public class BaseInvoiceInfo extends BaseEntity {
|
|||
private String userPhone;
|
||||
|
||||
|
||||
@ApiModelProperty("批量id")
|
||||
private String plId;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,4 +186,10 @@ public class ParkingBillInfo {
|
|||
@TableField(exist = false)
|
||||
@ApiModelProperty("时间范围 1:当天, 2:一个月, 3;3个月")
|
||||
private Integer timeRange;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty("是否开票 0 未开票 1 已开票")
|
||||
@Excel(name = "是否开票")
|
||||
private Integer isInvoicing;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
|
@ -133,4 +134,51 @@ public class ParkingBillPaymentInfo {
|
|||
private String inUnid;
|
||||
|
||||
|
||||
/**
|
||||
* 总费用(分)
|
||||
*/
|
||||
@ApiModelProperty("总费用(分)")
|
||||
@Excel(name = "总费用(分)")
|
||||
private Integer totalCost;
|
||||
|
||||
|
||||
/**
|
||||
* 总费用(元)
|
||||
*/
|
||||
@ApiModelProperty("总费用(元)")
|
||||
@Excel(name = "总费用(元)")
|
||||
private BigDecimal totalCostYuan;
|
||||
|
||||
|
||||
/**
|
||||
* 抵扣金额(分)
|
||||
*/
|
||||
@ApiModelProperty("抵扣金额(分)")
|
||||
@Excel(name = "抵扣金额(分)")
|
||||
private Integer deductMoney;
|
||||
|
||||
/**
|
||||
* 抵扣金额(元)
|
||||
*/
|
||||
@ApiModelProperty("抵扣金额(元)")
|
||||
@Excel(name = "抵扣金额(元)")
|
||||
private BigDecimal deductMoneyYuan;
|
||||
|
||||
/**
|
||||
* 实付金额(分)
|
||||
*/
|
||||
@ApiModelProperty("实付金额(分)")
|
||||
@Excel(name = "实付金额(分)")
|
||||
private Integer payMoney;
|
||||
|
||||
|
||||
/**
|
||||
* 实付金额(元)
|
||||
*/
|
||||
@ApiModelProperty("实付金额(元)")
|
||||
@Excel(name = "实付金额(元)")
|
||||
private BigDecimal payMoneyYuan;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "BaseInvoiceInfoDto")
|
||||
public class BaseInvoiceInfoDto {
|
||||
|
|
@ -13,9 +15,9 @@ public class BaseInvoiceInfoDto {
|
|||
/**
|
||||
* 记录唯一标识
|
||||
*/
|
||||
@ApiModelProperty("记录唯一标识")
|
||||
@ApiModelProperty("记录唯一标识 数组")
|
||||
@Excel(name = "记录唯一标识")
|
||||
private String inUnid;
|
||||
private List<String> inUnid;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue