收银台
This commit is contained in:
parent
9fb78cf532
commit
757d9c5adb
@ -35,6 +35,11 @@ public interface MerchantConfigService extends IService<MerchantConfig> {
|
||||
*/
|
||||
public MerchantConfig selectMerchById(int id);
|
||||
|
||||
/**
|
||||
* 将所有的使用1改为0
|
||||
*/
|
||||
public void updateMerchOrter();
|
||||
|
||||
/**
|
||||
* 修改商户使用状态
|
||||
* @param merchantConfig
|
||||
|
@ -13,9 +13,11 @@ import com.fuint.api.fuyou.util.Utils;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||
import com.fuint.business.order.entity.CashierOrder;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.entity.LJOrder;
|
||||
import com.fuint.business.order.entity.OilOrder;
|
||||
import com.fuint.business.order.service.CashierOrderService;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.service.LJOrderService;
|
||||
import com.fuint.business.order.service.OilOrderService;
|
||||
import io.swagger.models.auth.In;
|
||||
@ -83,14 +85,14 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<String, String> orderQueryRes = queryOrder(map1);
|
||||
if(!orderQueryRes.get("msg").equals("unpaid")){
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
try {
|
||||
Map<String, String> orderQueryRes = queryOrder(map1);
|
||||
if(!orderQueryRes.get("msg").equals("unpaid")){
|
||||
timer.cancel();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
//定时器 立即开始 0.5s一次
|
||||
}, 0, 500);
|
||||
@ -102,6 +104,8 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
|
||||
@Autowired
|
||||
private MerchantConfigService merchantConfigService;
|
||||
@Autowired
|
||||
private HangBillService hangBillService;
|
||||
|
||||
@Override
|
||||
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
|
||||
@ -140,6 +144,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
|
||||
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||
HangBill hangBill = hangBillService.selectHangBillByOrderNo(orderNo);
|
||||
Date date = new Date();
|
||||
if (reqMap.get("trans_stat").equals("SUCCESS")){
|
||||
if (!ObjectUtil.isEmpty(oilOrder)){
|
||||
@ -152,6 +157,10 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
if (!ObjectUtil.isEmpty(cashierOrder)){
|
||||
cashierOrder.setStatus("paid");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(hangBill)){
|
||||
hangBill.setPayStatus("paid");
|
||||
hangBillService.updateHangBills(hangBill,allAmount);
|
||||
}
|
||||
if (ArrayUtil.isEmpty(list)){
|
||||
for (OilOrder order : list) {
|
||||
order.setOrderStatus("paid");
|
||||
@ -185,6 +194,10 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
if (!ObjectUtil.isEmpty(cashierOrder)){
|
||||
cashierOrder.setStatus("payFail");
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(hangBill)){
|
||||
hangBill.setPayStatus("payFail");
|
||||
hangBillService.updateById(hangBill);
|
||||
}
|
||||
if (!ArrayUtil.isEmpty(list)){
|
||||
for (OilOrder order : list) {
|
||||
order.setOrderStatus("payFail");
|
||||
|
@ -48,6 +48,19 @@ public class MerchantConfigServiceImpl extends ServiceImpl<MerchantConfigMapper,
|
||||
return merchantConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMerchOrter() {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_use","1");
|
||||
List<MerchantConfig> list = baseMapper.selectList(queryWrapper);
|
||||
if (list.size()>0){
|
||||
for (MerchantConfig merchantConfig : list) {
|
||||
merchantConfig.setIsUse("0");
|
||||
this.updateMerch(merchantConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateMerch(MerchantConfig merchantConfig) {
|
||||
int row = baseMapper.updateById(merchantConfig);
|
||||
|
@ -50,6 +50,9 @@ public class OilConfigServiceImpl extends ServiceImpl<OilConfigMapper, OilConfig
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
// 将其他使用的账户关掉
|
||||
merchantConfigService.updateMerchOrter();
|
||||
// 改变目前使用账户
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMerchById(list.get(index).getMerchConfigId());
|
||||
merchantConfig.setIsUse("1");
|
||||
merchantConfig.setIsOpenRule("1");
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.fuint.business.order.controller;
|
||||
|
||||
import com.fuint.business.order.entity.CreditUnit;
|
||||
import com.fuint.business.order.service.CreditUnitService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/business/creditUnit")
|
||||
public class CreditUnitController extends BaseController {
|
||||
@Autowired
|
||||
private CreditUnitService creditUnitService;
|
||||
|
||||
/**
|
||||
* 查询所有挂账单位信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
private ResponseObject list(){
|
||||
return getSuccessResult(creditUnitService.selectCreditUnitList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加挂账单位信息
|
||||
* @param creditUnit
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
private ResponseObject add(@Validated @RequestBody CreditUnit creditUnit){
|
||||
return getSuccessResult(creditUnitService.insertCreditUnit(creditUnit));
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package com.fuint.business.order.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账记录信息 controller层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/hangBill")
|
||||
public class HangBillController extends BaseController {
|
||||
@Autowired
|
||||
private HangBillService hangBillService;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询收银员订单信息
|
||||
* @param hangBillVo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public ResponseObject list(HangBillVo hangBillVo,
|
||||
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
|
||||
Page page =new Page(pageNo,pageSize);
|
||||
IPage<HangBillVo> list = hangBillService.selectHangBillList(page,hangBillVo);
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有挂账信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/hangBills")
|
||||
public ResponseObject hangBills(){
|
||||
return getSuccessResult(hangBillService.selectHangBills());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询挂账信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public ResponseObject info(@PathVariable Integer id){
|
||||
HangBillVo hangBillVo = hangBillService.selectHangBillById(id);
|
||||
return getSuccessResult(hangBillVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加挂账记录信息
|
||||
* @param hangBill
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(@Validated @RequestBody HangBill hangBill){
|
||||
return getSuccessResult(hangBillService.insertHangBill(hangBill));
|
||||
}
|
||||
|
||||
/**
|
||||
* 归还挂账记录信息,并收款
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(@Validated @RequestBody Map<String,String> map){
|
||||
int row = hangBillService.updateHangBill(map);
|
||||
return getSuccessResult(row);
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.fuint.business.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuint.framework.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 挂账单位信息表(CreditUnit)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-11-14 10:45:00
|
||||
*/
|
||||
@Data
|
||||
@TableName("credit_unit")
|
||||
@ApiModel(value = "CreditUnit对象", description = "挂账单位信息表")
|
||||
public class CreditUnit extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ApiModelProperty("自增ID")
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 挂账人
|
||||
*/
|
||||
private String personCredit;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactMobile;
|
||||
/**
|
||||
* 挂账额度
|
||||
*/
|
||||
private Double creditLimit;
|
||||
/**
|
||||
* 单据备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 单位状态:启用禁用
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
@ -30,26 +30,22 @@ public class HangBill extends BaseEntity implements Serializable {
|
||||
* 店铺id
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 挂账单位id
|
||||
*/
|
||||
private Integer creditUnitId;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
private String unitName;
|
||||
/**
|
||||
* 挂账人
|
||||
*/
|
||||
private String personCredit;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactMobile;
|
||||
/**
|
||||
* 订单状态:0未归还,1已归还
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 支付状态:已支付,未支付,支付失败
|
||||
*/
|
||||
private String payStatus;
|
||||
/**
|
||||
* 归还状态:0挂账,1归还
|
||||
*/
|
||||
@ -57,7 +53,15 @@ public class HangBill extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 挂账金额
|
||||
*/
|
||||
private String amount;
|
||||
private Double amount;
|
||||
/**
|
||||
* 已还金额
|
||||
*/
|
||||
private Double repaidAmount;
|
||||
/**
|
||||
* 未还金额
|
||||
*/
|
||||
private Double outstandAmount;
|
||||
/**
|
||||
* 操作员工id
|
||||
*/
|
||||
@ -66,127 +70,6 @@ public class HangBill extends BaseEntity implements Serializable {
|
||||
* 单据备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public String getUnitName() {
|
||||
return unitName;
|
||||
}
|
||||
|
||||
public void setUnitName(String unitName) {
|
||||
this.unitName = unitName;
|
||||
}
|
||||
|
||||
public String getPersonCredit() {
|
||||
return personCredit;
|
||||
}
|
||||
|
||||
public void setPersonCredit(String personCredit) {
|
||||
this.personCredit = personCredit;
|
||||
}
|
||||
|
||||
public String getContactMobile() {
|
||||
return contactMobile;
|
||||
}
|
||||
|
||||
public void setContactMobile(String contactMobile) {
|
||||
this.contactMobile = contactMobile;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(String amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Integer getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(Integer staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.fuint.business.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.order.entity.CreditUnit;
|
||||
|
||||
/**
|
||||
* 挂账单位信息 mapper层
|
||||
*/
|
||||
public interface CreditUnitMapper extends BaseMapper<CreditUnit> {
|
||||
}
|
@ -1,10 +1,37 @@
|
||||
package com.fuint.business.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂账记录表 mapper层
|
||||
*/
|
||||
public interface HangBillMapper extends BaseMapper<HangBill> {
|
||||
/**
|
||||
* 根据条件分页查询油品订单信息
|
||||
* @param page
|
||||
* @param hangBill
|
||||
* @return
|
||||
*/
|
||||
public IPage<HangBillVo> selectHangBillList(Page page,@Param("hangBill") HangBillVo hangBill);
|
||||
|
||||
/**
|
||||
* 查询所有挂账信息
|
||||
* @param storeId
|
||||
* @return
|
||||
*/
|
||||
public List<HangBillVo> selectHangBills(@Param("storeId") int storeId);
|
||||
|
||||
/**
|
||||
* 根据id查询挂账信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public HangBillVo selectHangBillById(@Param("id") int id);
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.order.mapper.HangBillMapper">
|
||||
<sql id="selectHangBill">
|
||||
select hb.*,ms.real_name,ms.mobile,cu.unit_name,cu.person_credit,cu.contact_mobile
|
||||
from hang_bill hb
|
||||
inner join mt_staff ms on hb.staff_id = ms.id
|
||||
inner join credit_unit cu on hb.credit_unit_id = cu.id
|
||||
</sql>
|
||||
|
||||
<select id="selectHangBillList" resultType="com.fuint.business.order.vo.HangBillVo">
|
||||
<include refid="selectHangBill"></include>
|
||||
<where>
|
||||
hb.store_id = #{hangBill.storeId}
|
||||
<if test="hangBill.status != null and hangBill.status != ''">
|
||||
and hb.status = #{hangBill.status}
|
||||
</if>
|
||||
<if test="hangBill.returnType != null and hangBill.returnType != ''">
|
||||
and hb.return_type = #{hangBill.returnType}
|
||||
</if>
|
||||
<if test="hangBill.unitName != null and hangBill.unitName != ''">
|
||||
and cu.unit_name like concat('%', #{hangBill.unitName}, '%')
|
||||
</if>
|
||||
<if test="hangBill.personCredit != null and hangBill.personCredit != ''">
|
||||
and cu.person_credit like concat('%', #{hangBill.personCredit}, '%')
|
||||
</if>
|
||||
<if test="hangBill.contactMobile != null and hangBill.contactMobile != ''">
|
||||
and cu.contact_mobile like concat('%', #{hangBill.contactMobile}, '%')
|
||||
</if>
|
||||
<if test="hangBill.mobile != null and hangBill.mobile != ''">
|
||||
and ms.mobile like concat('%', #{hangBill.mobile}, '%')
|
||||
</if>
|
||||
<if test="hangBill.params.beginTime != null and hangBill.params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(hb.create_time,'%y%m%d') >= date_format(#{hangBill.params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="hangBill.params.endTime != null and hangBill.params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(hb.create_time,'%y%m%d') <= date_format(#{hangBill.params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectHangBillById" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">
|
||||
<include refid="selectHangBill"></include>
|
||||
<where>
|
||||
hb.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectHangBills" resultType="com.fuint.business.order.vo.HangBillVo" parameterType="int">
|
||||
<include refid="selectHangBill"></include>
|
||||
<where>
|
||||
hb.store_id = #{storeId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,24 @@
|
||||
package com.fuint.business.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.order.entity.CreditUnit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 挂账单位信息 业务层
|
||||
*/
|
||||
public interface CreditUnitService extends IService<CreditUnit> {
|
||||
/**
|
||||
* 查询所有挂账单位信息
|
||||
* @return
|
||||
*/
|
||||
public List<CreditUnit> selectCreditUnitList();
|
||||
|
||||
/**
|
||||
* 添加挂账单位信息
|
||||
* @param creditUnit
|
||||
* @return
|
||||
*/
|
||||
public int insertCreditUnit(CreditUnit creditUnit);
|
||||
}
|
@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 挂账记录信息 业务层
|
||||
@ -15,7 +19,27 @@ public interface HangBillService extends IService<HangBill> {
|
||||
* @param hangBill
|
||||
* @return
|
||||
*/
|
||||
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill);
|
||||
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill);
|
||||
|
||||
/**
|
||||
* 查询所有挂账记录信息
|
||||
* @return
|
||||
*/
|
||||
public List<HangBillVo> selectHangBills();
|
||||
|
||||
/**
|
||||
* 根据id查询挂账信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public HangBillVo selectHangBillById(int id);
|
||||
|
||||
/**
|
||||
* 根据订单号查询挂账信息
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
public HangBill selectHangBillByOrderNo(String orderNo);
|
||||
|
||||
/**
|
||||
* 添加挂账记录
|
||||
@ -23,4 +47,19 @@ public interface HangBillService extends IService<HangBill> {
|
||||
* @return
|
||||
*/
|
||||
public int insertHangBill(HangBill hangBill);
|
||||
|
||||
/**
|
||||
* 修改挂账记录 并收款
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public int updateHangBill(Map<String,String> map);
|
||||
|
||||
/**
|
||||
* 修改挂账信息
|
||||
* @param hangBill
|
||||
* @param repaidAmount
|
||||
* @return
|
||||
*/
|
||||
public int updateHangBills(HangBill hangBill,Double repaidAmount);
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.order.entity.CreditUnit;
|
||||
import com.fuint.business.order.mapper.CreditUnitMapper;
|
||||
import com.fuint.business.order.service.CreditUnitService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CreditUnitServiceImpl extends ServiceImpl<CreditUnitMapper, CreditUnit> implements CreditUnitService {
|
||||
@Override
|
||||
public List<CreditUnit> selectCreditUnitList() {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status","qy");
|
||||
List<CreditUnit> list = baseMapper.selectList(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCreditUnit(CreditUnit creditUnit) {
|
||||
int row = baseMapper.insert(creditUnit);
|
||||
return row;
|
||||
}
|
||||
}
|
@ -1,31 +1,165 @@
|
||||
package com.fuint.business.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||
import com.fuint.api.fuyou.service.FyPayService;
|
||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||
import com.fuint.api.fuyou.service.OilConfigService;
|
||||
import com.fuint.business.order.entity.HangBill;
|
||||
import com.fuint.business.order.mapper.HangBillMapper;
|
||||
import com.fuint.business.order.service.HangBillService;
|
||||
import com.fuint.business.order.vo.HangBillVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 挂账记录信息 业务层
|
||||
*/
|
||||
@Service
|
||||
public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> implements HangBillService {
|
||||
@Override
|
||||
public IPage<HangBill> selectHangBillList(Page page, HangBill hangBill) {
|
||||
public IPage<HangBillVo> selectHangBillList(Page page, HangBillVo hangBill) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
hangBill.setStoreId(storeId);
|
||||
return null;
|
||||
IPage<HangBillVo> hangBillVoIPage = baseMapper.selectHangBillList(page, hangBill);
|
||||
return hangBillVoIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HangBillVo> selectHangBills() {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
List<HangBillVo> hangBillVos = baseMapper.selectHangBills(storeId);
|
||||
return hangBillVos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HangBillVo selectHangBillById(int id) {
|
||||
HangBillVo hangBillVo = baseMapper.selectHangBillById(id);
|
||||
return hangBillVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HangBill selectHangBillByOrderNo(String orderNo) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("order_no",orderNo);
|
||||
HangBill hangBill = baseMapper.selectOne(queryWrapper);
|
||||
return hangBill;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertHangBill(HangBill hangBill) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
Integer storeId = nowAccountInfo.getStoreId();
|
||||
hangBill.setStoreId(storeId);
|
||||
// 根据日期生成订单号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||
String orderNo = timestamp+randomString;
|
||||
Integer staffId = nowAccountInfo.getStaffId();
|
||||
hangBill.setStaffId(staffId);
|
||||
hangBill.setOrderNo(orderNo);
|
||||
hangBill.setOutstandAmount(hangBill.getAmount());
|
||||
hangBill.setRepaidAmount(0.0);
|
||||
int row = baseMapper.insert(hangBill);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private FyPayService fyPayService;
|
||||
@Autowired
|
||||
private MerchantConfigService merchantConfigService;
|
||||
@Autowired
|
||||
private OilConfigService oilConfigService;
|
||||
|
||||
@Override
|
||||
public int updateHangBill(Map<String,String> map) {
|
||||
String payType = map.get("payType");
|
||||
if (!map.get("repaidAmount").equals("0") && !payType.equals("CASH")){
|
||||
Integer allAmount = (int) (Double.valueOf(map.get("repaidAmount"))*100);
|
||||
// 判断是否开启支付规则
|
||||
List<MerchantConfig> list = merchantConfigService.selectMeChByIsOpen();
|
||||
if (list.size()>0){
|
||||
oilConfigService.oilRule();
|
||||
}
|
||||
// 根据店铺id查询商户配置信息
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||
// 处理支付需要的数据
|
||||
Map<String,String> map1 = new HashMap<>();
|
||||
map1.put("authCode",map.get("authCode"));
|
||||
map1.put("allAmount",allAmount.toString());
|
||||
map1.put("orderNo",map.get("orderNo"));
|
||||
map1.put("payType",payType);
|
||||
map1.put("insCd",merchantConfig.getInsCd());
|
||||
map1.put("mchntCd",merchantConfig.getMchntCd());
|
||||
map1.put("goodsDes",merchantConfig.getMerchantName());
|
||||
map1.put("publicKey",merchantConfig.getPublicKey());
|
||||
map1.put("privateKey",merchantConfig.getPrivateKey());
|
||||
try {
|
||||
fyPayService.pay(map);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// 根据id查询挂账信息
|
||||
HangBill hangBill = baseMapper.selectById(Integer.parseInt(map.get("id")));
|
||||
if (payType.equals("CASH")){
|
||||
hangBill.setPayStatus("paid");
|
||||
}
|
||||
int row = 0;
|
||||
hangBill.setRemark(map.get("remark"));
|
||||
// 支付成功后修改挂账信息
|
||||
if (hangBill.getPayStatus().equals("paid")){
|
||||
Double repaidAmount1 = Double.valueOf(map.get("repaidAmount"));
|
||||
Double amount = hangBill.getAmount();
|
||||
Double repaidAmount = hangBill.getRepaidAmount();
|
||||
Double outstandAmount = hangBill.getOutstandAmount();
|
||||
Double repaidAmountAfter = repaidAmount+repaidAmount1;
|
||||
// 修改挂账信息
|
||||
hangBill.setRepaidAmount(repaidAmountAfter);
|
||||
hangBill.setOutstandAmount(amount-repaidAmountAfter);
|
||||
if (outstandAmount == repaidAmountAfter){
|
||||
hangBill.setStatus("1");
|
||||
hangBill.setReturnType("1");
|
||||
}else {
|
||||
hangBill.setStatus("2");
|
||||
}
|
||||
}
|
||||
row = baseMapper.updateById(hangBill);
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHangBills(HangBill hangBill, Double repaidAmount) {
|
||||
HangBill hangBill1 = this.updateStatus(hangBill, repaidAmount);
|
||||
int row = baseMapper.updateById(hangBill1);
|
||||
return row;
|
||||
}
|
||||
|
||||
private HangBill updateStatus(HangBill hangBill,Double repaidAmount1){
|
||||
Double amount = hangBill.getAmount();
|
||||
Double repaidAmount = hangBill.getRepaidAmount();
|
||||
Double outstandAmount = hangBill.getOutstandAmount();
|
||||
Double repaidAmountAfter = repaidAmount+repaidAmount1;
|
||||
// 修改挂账信息
|
||||
hangBill.setRepaidAmount(repaidAmountAfter);
|
||||
hangBill.setOutstandAmount(amount-repaidAmountAfter);
|
||||
if (outstandAmount == repaidAmountAfter){
|
||||
hangBill.setStatus("1");
|
||||
hangBill.setReturnType("1");
|
||||
}else {
|
||||
hangBill.setStatus("2");
|
||||
}
|
||||
return hangBill;
|
||||
}
|
||||
}
|
||||
|
@ -5,4 +5,14 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HangBillVo extends HangBill {
|
||||
// 操作人名称
|
||||
private String realName;
|
||||
// 操作人手机号
|
||||
private String mobile;
|
||||
// 单位名称
|
||||
private String unitName;
|
||||
// 挂账人
|
||||
private String personCredit;
|
||||
// 联系电话
|
||||
private String contactMobile;
|
||||
}
|
||||
|
19
fuintCashierWeb/src/api/cashier/creditunit.js
Normal file
19
fuintCashierWeb/src/api/cashier/creditunit.js
Normal file
@ -0,0 +1,19 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询挂账信息列表
|
||||
export function listCreditUnit(query) {
|
||||
return request({
|
||||
url: '/business/creditUnit/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增挂账记录
|
||||
export function addCreditUnit(data) {
|
||||
return request({
|
||||
url: '/business/creditUnit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
44
fuintCashierWeb/src/api/cashier/hangbill.js
Normal file
44
fuintCashierWeb/src/api/cashier/hangbill.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询挂账信息列表
|
||||
export function listHangBill(query) {
|
||||
return request({
|
||||
url: '/business/hangBill/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询挂账信息列表
|
||||
export function hangBillInfo(id) {
|
||||
return request({
|
||||
url: '/business/hangBill/'+id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 查询所有挂账信息列表
|
||||
export function hangBills() {
|
||||
return request({
|
||||
url: '/business/hangBill/hangBills',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 新增挂账记录
|
||||
export function addHangBill(data) {
|
||||
return request({
|
||||
url: '/business/hangBill',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改挂账记录及收款
|
||||
export function editHangBill(data) {
|
||||
return request({
|
||||
url: '/business/hangBill',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user