Commit 711e0646 authored by hezhen's avatar hezhen

Merge branch 'master-vehicle-price' into dev-tiande

parents 8475c939 b4d39ecd
package com.xxfc.platform.order.contant.enumerate;
import java.util.HashMap;
import java.util.Map;
public enum CompanyWalletITypeEnum {
VEHICLE(1, "租车订单收入"),
VIOLATE(2, "违约金"),
REGULATION(3, "违章补偿"),
LOSS(4, "定损"),
PLATFORM(5, "平台抽成"),
CATH(6, "提现"),
TOUR(7, "旅游订单收入"),
;
/**
* 编码
*/
private Integer code;
/**
* 类型描述
*/
private String desc;
public static Map<Integer, CompanyWalletITypeEnum> codeAndDesc = new HashMap<Integer, CompanyWalletITypeEnum>();
//Maps.newHashMap();
static{
for(CompanyWalletITypeEnum enumE : CompanyWalletITypeEnum.values()){
codeAndDesc.put(enumE.getCode(), enumE);
}
}
CompanyWalletITypeEnum(Integer code, String desc){
this.code=code;
this.desc=desc;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static Boolean exists(Integer code){
return codeAndDesc.containsKey(code);
}
public static CompanyWalletITypeEnum get(Integer code) {
for(CompanyWalletITypeEnum enumE : CompanyWalletITypeEnum.values()) {
if (enumE.getCode().equals(code)) {
return enumE;
}
}
return null;
}
}
\ No newline at end of file
......@@ -8,9 +8,10 @@ public enum CompanyWalletSourceEnum {
DAMAGE_SAFE(2, "不计免赔费"),
RENT_VEHICLE(3, "车辆租赁费"),
ORDER_COMSSION(4, "订单抽成"),
PLATFORM_COMSSION(4, "平台抽成"),
LOSS_SPECIFIED(4, "定损费"),
BREAK_RULES_REGULATION(4, "违章费"),
PLATFORM_COMSSION(5, "平台抽成"),
LOSS_SPECIFIED(6, "定损费"),
BREAK_RULES_REGULATION(7, "违章费"),
VIOLATE_AMOUNT(8, "违约金"),
;
/**
* 编码
......
......@@ -342,4 +342,8 @@ public class BaseOrder implements Serializable {
*/
@Column(name = "invoice_id")
private Integer invoiceId;
@Column(name = "revenue_json")
private String revenueJson;
}
......@@ -37,7 +37,12 @@ public class CompanyWalletDetail implements Serializable {
@Column(name = "cono")
@ApiModelProperty(value = "订单号或提现号")
private Integer cono;
private String cono;
@Column(name = "itype")
@ApiModelProperty(value = "收支分类")
private Integer itype;
@Column(name = "source")
......@@ -60,7 +65,7 @@ public class CompanyWalletDetail implements Serializable {
@Column(name = "branch_id")
@ApiModelProperty(value = "企业id")
private Integer branchId;
private Long branchId;
......
......@@ -27,7 +27,6 @@ public class CompanyWalletDetailDTO{
private Integer startCompanyId;
@ApiModelProperty("结束门店")
private Integer endCompanyId;
......@@ -40,6 +39,10 @@ public class CompanyWalletDetailDTO{
private Integer platformCompanyId;
@ApiModelProperty("平台门店")
private Long platformBranchId;
@ApiModelProperty("订单总额")
private BigDecimal orderAmount =BigDecimal.ZERO;
......@@ -54,7 +57,7 @@ public class CompanyWalletDetailDTO{
@ApiModelProperty("押金")
private BigDecimal deposit =BigDecimal.ZERO;
//算出来
@ApiModelProperty("分销金额")
private BigDecimal comssion =BigDecimal.ZERO;
......@@ -67,6 +70,10 @@ public class CompanyWalletDetailDTO{
private BigDecimal breakRulesRegulation =BigDecimal.ZERO;
@ApiModelProperty("违约金")
private BigDecimal violateAmount =BigDecimal.ZERO;
@ApiModelProperty("车辆收益比例")
private BigDecimal vehicleExtract = new BigDecimal(1);
......@@ -79,7 +86,7 @@ public class CompanyWalletDetailDTO{
private BigDecimal platformExtract = new BigDecimal(1);
//算出来
@ApiModelProperty("车辆租赁费")
private BigDecimal rentVehicleAmount;
......
package com.xxfc.platform.order.pojo.dto;
import com.github.wxiaoqi.security.common.vo.DataInter;
import com.github.wxiaoqi.security.common.vo.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.List;
/**
* 门店收支明细DTO
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 14:53
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WalletDetailDTO extends PageParam implements DataInter {
@ApiModelProperty("门店")
private Integer companyId;
@ApiModelProperty("企业")
private Integer branchId;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
List<Integer> itypes;
List<Integer> dataCorporationIds;
List<Integer> dataCompanyIds;
}
package com.xxfc.platform.order.pojo.vo;
import com.xxfc.platform.order.contant.enumerate.CompanyWalletITypeEnum;
import com.xxfc.platform.order.contant.enumerate.CompanyWalletSourceEnum;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CompanyWalletDetailVo extends CompanyWalletDetail {
@ApiModelProperty("门店名称")
private String companyName;
@ApiModelProperty("企业名称")
private String branchName;
@ApiModelProperty("类型说明")
private String sourceName;
@ApiModelProperty("类型")
private String typeName;
public String getSourceName(){
return CompanyWalletITypeEnum.get(getItype()).getDesc();
}
public String getTypeName(){
return getType() == 1 ? "收入":"支出";
}
}
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.CompanyWalletMapper;
import com.xxfc.platform.order.pojo.dto.WalletDetailDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet>{
public void updCompanyWallet(CompanyWallet companyWallet){
mapper.updMyWater(companyWallet);
}
public CompanyWallet sumAmount(WalletDetailDTO walletDetailDTO){
return mapper.sumAmount(walletDetailDTO);
}
}
......@@ -2,8 +2,15 @@ package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import com.xxfc.platform.order.pojo.dto.WalletDetailDTO;
import com.xxfc.platform.order.pojo.vo.CompanyWalletDetailVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List;
/**
* 收入/支持明细表,每笔的进账,出账的详细记录
*
......@@ -14,4 +21,12 @@ import tk.mybatis.mapper.common.Mapper;
public interface CompanyWalletDetailMapper extends Mapper<CompanyWalletDetail> {
@Select("SELECT IFNULL(SUM(amount),0)+IFNULL((SELECT balance FROM company_wallet WHERE company_id = #{companyId}),0) FROM company_wallet_detail WHERE cono=#{no} and company_id = #{companyId}")
BigDecimal sumAmountByNo(@Param("no")String no,@Param("companyId")Integer companyId);
List<CompanyWalletDetailVo> selectList(WalletDetailDTO walletDetailDTO);
BigDecimal sumAmount(WalletDetailDTO walletDetailDTO);
}
......@@ -3,6 +3,7 @@ package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CompanyWallet;
import com.xxfc.platform.order.pojo.dto.WalletDetailDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
......@@ -21,4 +22,7 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
@Update("UPDATE `company_wallet` SET `is_frozen`=#{state} WHERE `id`=#{id}" )
void forbiddenWalletById(@Param("id") Integer id, @Param("state") Integer state);
CompanyWallet sumAmount(WalletDetailDTO walletDetailDTO);
}
package com.xxfc.platform.order.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.CompanyWalletDetailBiz;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("wallet/detail")
public class CompanyWalletDetailController extends BaseController<CompanyWalletDetailBiz, CompanyWalletDetail> {
@RequestMapping(value = "upd", method = RequestMethod.POST)
public ObjectRestResponse refundAmount(@RequestBody CompanyWalletDetail companyWalletDetail) {
baseBiz.addOrUpd(companyWalletDetail);
return ObjectRestResponse.succ();
}
}
\ No newline at end of file
......@@ -26,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import static com.github.wxiaoqi.security.common.vo.PageDataVO.pageInfo;
import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CNL;
import static com.xxfc.platform.order.entity.ShuntApply.STATUS_CRT;
@RestController
@RequestMapping("shuntApply")
......@@ -57,9 +59,32 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
shuntApply.setUserId(getCurrentUserIdInt());
shuntApply.setStatus(STATUS_CRT);
return add(shuntApply);
}
@RequestMapping(value = "/cancelApply", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "取消申请")
public ObjectRestResponse addApply(@RequestBody CnlApplyDTO dto) {
//查询列表数据
if (StrUtil.isBlank(getCurrentUserId())) {
throw new BaseException(ResultCode.AJAX_WECHAT_NOTEXIST_CODE);
}
ShuntApply shuntApply = baseBiz.selectById(dto.getApplyId());
if(null == shuntApply) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE);
}
baseBiz.updateSelectiveById(new ShuntApply(){{
setId(shuntApply.getId());
setStatus(STATUS_CNL);
}});
return ObjectRestResponse.succ();
}
@RequestMapping(value = "/pageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "申请列表")
......@@ -142,4 +167,9 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
public static class ApplyOrderDTO extends AddRentVehicleDTO {
Integer applyId;
}
@Data
public static class CnlApplyDTO {
Integer applyId;
}
}
\ No newline at end of file
package com.xxfc.platform.order.rest.background;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.CompanyWalletDetailBiz;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import com.xxfc.platform.order.pojo.dto.WalletDetailDTO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("admin/wallet")
public class AdminCompanyWalletDetailController extends BaseController<CompanyWalletDetailBiz, CompanyWalletDetail> implements UserRestInterface {
@Autowired
UserFeign userFeign;
@Override
public UserFeign getUserFeign() {
return userFeign;
}
@RequestMapping(value = "selectList", method = RequestMethod.GET)
@ApiModelProperty(value = "营收明细列表")
public ObjectRestResponse refundAmount(WalletDetailDTO walletDetailDTO) {
return ObjectRestResponse.succ(baseBiz.selectList(walletDetailDTO));
}
@RequestMapping(value = "sumAmount", method = RequestMethod.GET)
@ApiModelProperty(value = "营收统计")
public ObjectRestResponse sumAmount(WalletDetailDTO walletDetailDTO) {
return ObjectRestResponse.succ(baseBiz.getSumAmount(walletDetailDTO));
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderTemplate;
import com.xxfc.platform.order.pojo.OrderAccompanyDTO;
import com.xxfc.platform.order.pojo.dto.CompanyWalletDetailDTO;
import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.VehicleItemDTO;
import com.xxfc.platform.order.pojo.price.RentVehiclePriceVO;
......@@ -101,6 +102,15 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
public void initDetailSecond(RentVehicleBO bo) {
CompanyWalletDetailDTO companyWalletDetailDTO = new CompanyWalletDetailDTO();
//下单
companyWalletDetailDTO.setClosedVehicleAmout(BigDecimal.ZERO);//收车服务费
companyWalletDetailDTO.setPlatformCompanyId(0);//平台门店
companyWalletDetailDTO.setOrderExtract(BigDecimal.ZERO);//订单抽成比例
companyWalletDetailDTO.setPlatformExtract(BigDecimal.ZERO);//平台抽成比例
companyWalletDetailDTO.setVehicleExtract(BigDecimal.ZERO);//车辆收益比例
initDictionary();
VehicleModel vehicleModel = vehicleFeign.get(bo.getModelId()).getData();
bo.setVehicleModel(vehicleModel);
......
<?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.xxfc.platform.order.mapper.CompanyWalletDetailMapper">
<select id="selectList" resultType="com.xxfc.platform.order.pojo.vo.CompanyWalletDetailVo" parameterType="com.xxfc.platform.order.pojo.dto.WalletDetailDTO">
SELECT
d.cono,
d.itype,
d.type,
c.`name` as companyName,
ci.`name` as branchName,
SUM(d.amount) as amount,
MAX(s_amount)as sAmount
FROM company_wallet_detail d
LEFT JOIN branch_company c ON d.company_id=c.id
LEFT JOIN company_info ci ON d.branch_id=ci.id
<where>
d.itype != 5
<if test="companyId != null and companyId > 0">
and d.company_id=#{companyId}
</if>
<if test="branchId != null and branchId > 0">
and d.branch_id=#{branchId}
</if>
<if test="startTime != null and startTime > 0">
and d.crt_time > = {startTime}
</if>
<if test="endTime != null and endTime > 0">
and d.crt_time &lt;= {endTime}
</if>
<if test="dataCompanyIds != null and dataCompanyIds.size() > 0">
and d.company_id= in
<foreach collection="dataCompanyIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="dataCorporationIds != null and dataCorporationIds.size() > 0">
and d.branch_id in
<foreach collection="dataCorporationIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY d.cono,d.itype
order by d.id desc
</select>
<select id="sumAmount" resultType="BigDecimal" parameterType="com.xxfc.platform.order.pojo.dto.WalletDetailDTO">
SELECT IFNULL(SUM(amount),0) as amount FROM company_wallet_detail
<where>
itype in
<foreach collection="itypes" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="companyId != null and companyId > 0">
and company_id=#{companyId}
</if>
<if test="branchId != null and branchId > 0">
and branch_id=#{branchId}
</if>0
<if test="dataCompanyIds != null and dataCompanyIds.size() > 0">
and company_id in
<foreach collection="dataCompanyIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="dataCorporationIds != null and dataCorporationIds.size() > 0">
and branch_id in
<foreach collection="dataCorporationIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -45,4 +45,30 @@
</where>
</update>
<select id="sumAmount" resultType="com.xxfc.platform.order.entity.CompanyWallet" parameterType="com.xxfc.platform.order.pojo.dto.WalletDetailDTO">
SELECT IFNULL(SUM(w.balance),0) as balance,IFNULL(SUM(w.withdrawals),0) as withdrawals FROM company_wallet w
LEFT JOIN branch_company c ON w.company_id=c.id
<where>
<if test="companyId != null and companyId > 0">
and w.company_id=#{companyId}
</if>
<if test="branchId != null and branchId > 0">
and c.company_id=#{branchId}
</if>
<if test="dataCompanyIds != null and dataCompanyIds.size() > 0">
and w.company_id in
<foreach collection="dataCompanyIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="dataCorporationIds != null and dataCorporationIds.size() > 0">
and c.company_id in
<foreach collection="dataCorporationIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -52,9 +52,14 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(@RequestParam(value = "id") Integer id, @RequestParam(value = "score") Integer score);
//租车预约(无需审核)
@RequestMapping(value = "/vehicleInfo/rent/book/vehicle", method = RequestMethod.POST)
public ObjectRestResponse<VehicleBookRecord> rentApplyVehicle(@RequestBody RentVehicleBookDTO rentVehicleBookDTO);
//租车预约(需要审核)
@RequestMapping(value = "/vehicleInfo/apply/book/vehicle", method = RequestMethod.POST)
public ObjectRestResponse<VehicleBookRecord> applyBookVehicle(@RequestBody RentVehicleBookDTO rentVehicleBookDTO);
@RequestMapping(value = "/branchCompany/app/unauth/detail/{id}", method = RequestMethod.GET)
public ObjectRestResponse<CompanyDetail> getCompanyDetail(@PathVariable(value = "id") Integer id);
......
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