Commit 16e9d8cf authored by zhangzc's avatar zhangzc

添加司机账单

parent 5e2eca10
package com.esv.freight.app.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.feign.DriverBillInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/05/28 14:20
* @version:1.0
*/
@FeignClient(value = "freight-bill-service")
public interface DriverBillInterface {
/**
* 分页查询
* @param bodyJson
* @return
*/
@PostMapping(value = "bill/verify/paybill/list/app")
JSONObject listBillDriver(JSONObject bodyJson);
/**
* 账单详情
* @param bodyJson
* @return
*/
@PostMapping(value = "bill/verify/paybill/detail/app")
JSONObject billDriverDetail(JSONObject bodyJson);
/**
* 确认对账
* @param bodyJson
* @return
*/
@PostMapping(value = "bill/verify/paybill/confirmBill")
JSONObject confirmBill(JSONObject bodyJson);
/**
* 运单费用明细
* @param bodyJson
* @return
*/
@PostMapping(value = "bill/payData/detail")
JSONObject detail(JSONObject bodyJson);
}
package com.esv.freight.app.module.bill.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.util.FeignUtils;
import com.esv.freight.app.common.validator.groups.ValidatorDetail;
import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.feign.DriverBillInterface;
import com.esv.freight.app.feign.OwnerBillInterface;
import com.esv.freight.app.feign.PayInterface;
import com.esv.freight.app.module.bill.form.BillQueryForm;
import com.esv.freight.app.module.bill.form.OwnerPayForm;
import com.esv.freight.app.module.bill.pojo.DriverBillDetailPojo;
import com.esv.freight.app.module.bill.pojo.OwnerBillDetailPojo;
import com.esv.freight.app.module.bill.vo.BillDetailVO;
import com.esv.freight.app.module.bill.vo.BillListItemVO;
import com.esv.freight.app.module.bill.vo.BillListVO;
import com.esv.freight.app.module.bill.vo.PayVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* @description: 司机账单Controller
* @project: freight-app-service
* @name: com.esv.freight.app.module.bill.controller.DriverBillController
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/02 17:40
* @version:1.0
*/
@RestController
@RequestMapping("/driverBackend/bill")
@Slf4j
@Validated
public class DriverBillController {
private DriverBillInterface driverBillInterface;
@Autowired
public DriverBillController(DriverBillInterface driverBillInterface) {
this.driverBillInterface = driverBillInterface;
}
/**
* description 确认对账
* param complaintForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/06/03 13:30
**/
@PostMapping("/confirmBill")
public EResponse confirmBill(@RequestBody(required=false) @Validated(ValidatorDetail.class) BillQueryForm billQueryForm) {
// 调用确认账单接口
JSONObject reqJson = new JSONObject();
reqJson.put("id", billQueryForm.getId());
log.info(reqJson.toJSONString());
JSONObject result = driverBillInterface.confirmBill(reqJson);
log.info(result.toJSONString());
if(!FeignUtils.isFeignSuccess(result)) {
return FeignUtils.getFeignEResponse(result);
}
return EResponse.ok();
}
/**
* description 获取对账详情
* param complaintForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/06/03 13:30
**/
@PostMapping("/detail")
public EResponse detail(@RequestBody(required=false) @Validated(ValidatorDetail.class) BillQueryForm billQueryForm) {
// 调用账单详情接口
JSONObject reqJson = new JSONObject();
reqJson.put("id", billQueryForm.getId());
log.info(reqJson.toJSONString());
JSONObject result = driverBillInterface.billDriverDetail(reqJson);
log.info(result.toJSONString());
if(!FeignUtils.isFeignSuccess(result)) {
return FeignUtils.getFeignEResponse(result);
}
BillDetailVO billDetailVO = new BillDetailVO();
DriverBillDetailPojo driverBillDetailPojo = JSONObject.toJavaObject(FeignUtils.getFeignDataJson(result), DriverBillDetailPojo.class);
BeanUtils.copyProperties(driverBillDetailPojo, billDetailVO);
billDetailVO.setBillNo(driverBillDetailPojo.getPayBillNo());
billDetailVO.setBillState(driverBillDetailPojo.getPayBillState());
billDetailVO.setTopUrgent(driverBillDetailPojo.getPayTime());
return EResponse.ok(billDetailVO);
}
/**
* description 获取对账列表
* param complaintForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/06/02 18:00
**/
@PostMapping("/list")
public EResponse list(@RequestBody(required=false) @Validated(ValidatorList.class) BillQueryForm billQueryForm) {
// 调用评价列表分页查询接口
JSONObject reqJson = new JSONObject();
reqJson.put("driverId", billQueryForm.getUserId());
reqJson.put("pageNum", billQueryForm.getPageNum());
reqJson.put("pageSize", billQueryForm.getPageSize());
log.info(reqJson.toJSONString());
JSONObject result = driverBillInterface.listBillDriver(reqJson);
log.info(result.toJSONString());
if(!FeignUtils.isFeignSuccess(result)) {
return FeignUtils.getFeignEResponse(result);
}
BillListVO pageResultVO = new BillListVO();
JSONObject data = result.getJSONObject("data");
pageResultVO.setPageSize(data.getLong("pageSize"));
pageResultVO.setPageNum(data.getLong("pageNum"));
pageResultVO.setTotal(data.getLong("total"));
pageResultVO.setRecordSize(data.getLong("recordSize"));
if(pageResultVO.getRecordSize() > 0) {
JSONArray items = data.getJSONArray("records");
List<BillListItemVO> records = new ArrayList<>();
for(int i=0; i<items.size(); ++i) {
BillListItemVO vo = new BillListItemVO();
JSONObject object = items.getJSONObject(i);
vo.setId(object.getLong("id"));
vo.setBillNo(object.getString("payBillNo"));
vo.setBillState(object.getInteger("payBillState"));
vo.setBillTimeBucketStart(object.getDate("billTimeBucketStart"));
vo.setBillTimeBucketEnd(object.getDate("billTimeBucketEnd"));
vo.setTotalMoney(object.getBigDecimal("totalMoney"));
records.add(vo);
}
pageResultVO.setRecord(records);
}
return EResponse.ok(pageResultVO);
}
}
package com.esv.freight.app.module.bill.pojo;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.bill.pojo.DriverBillDetailPojo
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/03 14:10
* @version:1.0
*/
@Data
public class DriverBillDetailPojo {
/**
* 主键
*/
@TableId
private Long id;
/**
* 对账单号,YFZD+”8位日期“+”6位序号“
*/
private String payBillNo;
/**
* 账单开始时间
*/
private Date billTimeBucketStart;
/**
* 账单结束时间
*/
private Date billTimeBucketEnd;
/**
* 结算对象 个人、某个承运商
*/
private Integer settlementClient;
/**
* 结算方式
*/
private Integer settleMode;
/**
* 所属承运商ID
*/
private Long carrierId;
/**
* 所属承运商名称
*/
private String carrierName;
/**
* 司机ID
*/
private Long driverId;
/**
* 司机名称
*/
private String driverName;
/**
* 运费
*/
private BigDecimal freightPrice = BigDecimal.ZERO;
/**
* 预付款
*/
private BigDecimal prepay = BigDecimal.ZERO;
/**
* 油卡费
*/
private BigDecimal gasoline = BigDecimal.ZERO;
/**
* 亏吨
*/
private BigDecimal less = BigDecimal.ZERO;
/**
* 涨吨
*/
private BigDecimal more = BigDecimal.ZERO;
/**
* 保险费
*/
private BigDecimal premium = BigDecimal.ZERO;
/**
* 信息费
*/
private BigDecimal info = BigDecimal.ZERO;
/**
* 内保费
*/
private BigDecimal inprotect = BigDecimal.ZERO;
/**
* 罚款
*/
private BigDecimal punish = BigDecimal.ZERO;
/**
* 欠款
*/
private BigDecimal debt = BigDecimal.ZERO;
/**
* 装卸费
*/
private BigDecimal handling = BigDecimal.ZERO;
/**
* 奖金
*/
private BigDecimal bonus = BigDecimal.ZERO;
/**
* 补贴费
*/
private BigDecimal subsidy = BigDecimal.ZERO;
/**
* 抹零
*/
private BigDecimal smallchange = BigDecimal.ZERO;
/**
* 个税
*/
private BigDecimal individual = BigDecimal.ZERO;
/**
* 总计应付(元)
*/
private BigDecimal totalMoney = BigDecimal.ZERO;
/**
* 账单状态:0-未对账;1-核实中;2-已对账;3-已支付;4-已开票;5-支付失败
*/
private Integer payBillState;
/**
* 异常状态
*/
private Integer errorState;
/**
* 支付时间
*/
private Date payTime;
/**
* 支付方式:1-线上支付;2-线下支付
*/
private Integer paymentModel;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createUser;
/**
* 货主id
*/
private Long goodsOwnerId;
/**
* 货主名称
*/
private String goodsOwnerName;
}
...@@ -96,6 +96,7 @@ public class BillDetailVO { ...@@ -96,6 +96,7 @@ public class BillDetailVO {
/** /**
* 应收对账状态:1-核实中;2-已对账;3-已开票;4-已回款 * 应收对账状态:1-核实中;2-已对账;3-已开票;4-已回款
* 应付账单状态:1-核实中;2-已对账;3-已支付;4-已开票;5-支付失败
*/ */
private Integer billState; private Integer billState;
......
...@@ -3,20 +3,24 @@ package com.esv.freight.app.module.waybill.controller; ...@@ -3,20 +3,24 @@ package com.esv.freight.app.module.waybill.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.response.EResponse; import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.common.util.FeignUtils;
import com.esv.freight.app.common.validator.groups.ValidatorDetail; import com.esv.freight.app.common.validator.groups.ValidatorDetail;
import com.esv.freight.app.common.validator.groups.ValidatorInsert; import com.esv.freight.app.common.validator.groups.ValidatorInsert;
import com.esv.freight.app.common.validator.groups.ValidatorList; import com.esv.freight.app.common.validator.groups.ValidatorList;
import com.esv.freight.app.feign.DriverBillInterface;
import com.esv.freight.app.feign.TmsOrderInterface; import com.esv.freight.app.feign.TmsOrderInterface;
import com.esv.freight.app.feign.TmsWaybillInterface; import com.esv.freight.app.feign.TmsWaybillInterface;
import com.esv.freight.app.module.account.service.AppLoginService; import com.esv.freight.app.module.account.service.AppLoginService;
import com.esv.freight.app.module.waybill.form.UploadEvidenceForm; import com.esv.freight.app.module.waybill.form.UploadEvidenceForm;
import com.esv.freight.app.module.waybill.form.WaybillMultiQueryForm; import com.esv.freight.app.module.waybill.form.WaybillMultiQueryForm;
import com.esv.freight.app.module.waybill.form.WaybillQueryForm; import com.esv.freight.app.module.waybill.form.WaybillQueryForm;
import com.esv.freight.app.module.waybill.pojo.PayDataListItemPojo;
import com.esv.freight.app.module.waybill.vo.WaybillDetailVO; import com.esv.freight.app.module.waybill.vo.WaybillDetailVO;
import com.esv.freight.app.module.waybill.vo.WaybillListItemVO; import com.esv.freight.app.module.waybill.vo.WaybillListItemVO;
import com.esv.freight.app.module.waybill.vo.WaybillListVO; import com.esv.freight.app.module.waybill.vo.WaybillListVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -43,10 +47,36 @@ import java.util.List; ...@@ -43,10 +47,36 @@ import java.util.List;
public class DriverWaybillController { public class DriverWaybillController {
private TmsWaybillInterface tmsWaybillInterface; private TmsWaybillInterface tmsWaybillInterface;
private DriverBillInterface driverBillInterface;
@Autowired @Autowired
public DriverWaybillController(TmsWaybillInterface tmsWaybillInterface) { public DriverWaybillController(TmsWaybillInterface tmsWaybillInterface, DriverBillInterface driverBillInterface) {
this.tmsWaybillInterface = tmsWaybillInterface; this.tmsWaybillInterface = tmsWaybillInterface;
this.driverBillInterface = driverBillInterface;
}
/**
* description 获取运单费用明细
* param waybillQueryForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/04/26 15:00
**/
@PostMapping("/costDetail")
public EResponse costDetail(@RequestBody(required=false) @Validated(ValidatorDetail.class) WaybillQueryForm waybillQueryForm) {
// 调用运单费用明细接口
JSONObject reqJson = new JSONObject();
reqJson.put("waybillId", waybillQueryForm.getWaybillId());
log.info(reqJson.toJSONString());
JSONObject result = driverBillInterface.detail(reqJson);
log.info(result.toJSONString());
if(!FeignUtils.isFeignSuccess(result)) {
return FeignUtils.getFeignEResponse(result);
}
PayDataListItemPojo payDataListItemPojo = JSONObject.toJavaObject(FeignUtils.getFeignDataJson(result), PayDataListItemPojo.class);
return EResponse.ok(payDataListItemPojo);
} }
/** /**
......
package com.esv.freight.app.module.waybill.pojo;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @description:
* @project: app-service
* @name: com.esv.freight.app.module.account.pojo.PayDataListItemPojo
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/08 13:54
* @version:1.0
*/
@Data
public class PayDataListItemPojo {
/**
* 主键
*/
private Long id;
/**
* 运单ID
*/
private String waybillId;
/**
* 运单号
*/
private String waybillNo;
/**
* 订单号
*/
private String orderNo;
/**
* 运单生成时间
*/
private Date waybillTime;
/**
* 账单ID
*/
private Long billId;
/**
* 账单号
*/
private String billNo;
/**
* 运单状态
*/
private Integer waybillState;
/**
* 应付对账状态:0-未对账;1-核实中;2-已对账;3-已支付;4-已开票;5-支付失败
*/
private Integer payVerifyStatus;
/**
* 车辆ID
*/
private Long vehicleId;
/**
* 车牌号
*/
private String vehicleLicenseNo;
/**
* 所属承运商ID
*/
private String carrierId;
/**
* 所属承运商名称
*/
private String carrierName;
/**
* 司机ID
*/
private Long driverId;
/**
* 司机名称
*/
private String driverName;
/**
* 结算对象 个人、某个承运商
*/
private Long settlementClient;
/**
* 货物名称编码
*/
private String goodsNameCode;
/**
* 货物名称
*/
private String goodsName;
/**
* 货物单位 1-吨;2-件;3-立方;4-平方
*/
private Integer goodsUnit;
/**
* 交货量
*/
private BigDecimal goodsDeliveryAmount;
/**
* 运费单价
*/
private BigDecimal unitPrice;
/**
* 运费
*/
private BigDecimal freightPrice;
/**
* 亏吨
*/
private BigDecimal less = BigDecimal.ZERO;
/**
* 涨吨
*/
private BigDecimal more = BigDecimal.ZERO;
/**
* 预付款
*/
private BigDecimal prepay = BigDecimal.ZERO;
/**
* 油卡费
*/
private BigDecimal gasoline = BigDecimal.ZERO;
/**
* 保险费
*/
private BigDecimal premium = BigDecimal.ZERO;
/**
* 信息费
*/
private BigDecimal info = BigDecimal.ZERO;
/**
* 内保费
*/
private BigDecimal inprotect = BigDecimal.ZERO;
/**
* 个税
*/
private BigDecimal individual = BigDecimal.ZERO;
/**
* 罚款
*/
private BigDecimal punish = BigDecimal.ZERO;
/**
* 欠款
*/
private BigDecimal debt = BigDecimal.ZERO;
/**
* 装卸费
*/
private BigDecimal handling = BigDecimal.ZERO;
/**
* 奖金
*/
private BigDecimal bonus = BigDecimal.ZERO;
/**
* 补贴费
*/
private BigDecimal subsidy = BigDecimal.ZERO;
/**
* 抹零
*/
private BigDecimal smallchange = BigDecimal.ZERO;
/**
* 总计费用(元)
*/
private BigDecimal totalMoney;
/**
* 创建时间
*/
private Date createTime;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment