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