Commit b121d313 authored by hezhen's avatar hezhen

Merge branch 'master_tiande_company' into master-vehicle-price

parents 953d5a9c 481777d5
...@@ -61,6 +61,7 @@ public interface UserRestInterface { ...@@ -61,6 +61,7 @@ public interface UserRestInterface {
return; return;
} }
Integer dataAll=userDTO.getDataAll()== null ? 2 : userDTO.getDataAll(); Integer dataAll=userDTO.getDataAll()== null ? 2 : userDTO.getDataAll();
System.out.println("---dataAll==="+dataAll);
if (dataAll == 2){ if (dataAll == 2){
List<Integer> dataCompany2List = userDTO.dataCompany2List(); List<Integer> dataCompany2List = userDTO.dataCompany2List();
if (dataCompany2List != null && dataCompany2List.size() > 0){ if (dataCompany2List != null && dataCompany2List.size() > 0){
......
...@@ -192,6 +192,12 @@ public class UserBiz extends BaseBiz<UserMapper,User> { ...@@ -192,6 +192,12 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
Integer page=baseUserDTO.getPage()==null?1:baseUserDTO.getPage(); Integer page=baseUserDTO.getPage()==null?1:baseUserDTO.getPage();
Integer limit=baseUserDTO.getLimit()==null?10:baseUserDTO.getLimit(); Integer limit=baseUserDTO.getLimit()==null?10:baseUserDTO.getLimit();
PageDataVO<BaseUserVo> dataVO= PageDataVO.pageInfo(page, limit, ()->getList(baseUserDTO)); PageDataVO<BaseUserVo> dataVO= PageDataVO.pageInfo(page, limit, ()->getList(baseUserDTO));
List<BaseUserVo> list=dataVO.getData();
if (list != null && list.size() > 0){
for (BaseUserVo baseUserVo:list){
baseUserVo.setGroupList(groupBiz.getUserGroups(baseUserVo.getId()));
}
}
return ObjectRestResponse.succ(dataVO); return ObjectRestResponse.succ(dataVO);
} }
} }
package com.xxfc.platform.order.contant.enumerate;
import java.util.HashMap;
import java.util.Map;
public enum CompanyWalletSourceEnum {
CLOSED_VEHICLE(1, "收车服务费"),
DAMAGE_SAFE(2, "不计免赔费"),
RENT_VEHICLE(3, "车辆租赁费"),
ORDER_COMSSION(4, "订单抽成"),
PLATFORM_COMSSION(4, "平台抽成"),
LOSS_SPECIFIED(4, "定损费"),
BREAK_RULES_REGULATION(4, "违章费"),
;
/**
* 编码
*/
private Integer code;
/**
* 类型描述
*/
private String desc;
public static Map<Integer, CompanyWalletSourceEnum> codeAndDesc = new HashMap<Integer, CompanyWalletSourceEnum>();
//Maps.newHashMap();
static{
for(CompanyWalletSourceEnum enumE : CompanyWalletSourceEnum.values()){
codeAndDesc.put(enumE.getCode(), enumE);
}
}
CompanyWalletSourceEnum(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 CompanyWalletSourceEnum get(Integer code) {
for(CompanyWalletSourceEnum enumE : CompanyWalletSourceEnum.values()) {
if (enumE.getCode().equals(code)) {
return enumE;
}
}
return null;
}
}
\ No newline at end of file
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 门店钱包
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
@Data
@Table(name = "company_wallet")
public class CompanyWallet implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@Column(name = "id")
@ApiModelProperty(value = "id")
private Integer id;
/**
* 用户ID
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("门店ID")
private Integer companyId;
/**
* 余额(分)
*/
@Column(name = "balance")
@ApiModelProperty(value = "余额(元)")
private BigDecimal balance;
/**
* 支付密码
*/
@Column(name = "pay_password")
@ApiModelProperty(value = "支付密码")
private String payPassword;
/**
* 已提现金额
*/
@Column(name = "withdrawals")
@ApiModelProperty(value = "已提现金额")
private BigDecimal withdrawals;
/**
* 进账总额(分)
*/
@Column(name = "total_amount")
@ApiModelProperty(value = "进账总额(元)")
private BigDecimal totalAmount;
/**
* 今日收益
*/
@Column(name = "today_amount")
@ApiModelProperty(value = "今日收益")
private BigDecimal todayAmount;
/**
* 未入账金额
*/
@Column(name = "unbooked")
@ApiModelProperty(value = "未入账金额")
private BigDecimal unbooked;
/**
* 是否冻结:0-正常,1-冻结
*/
@Column(name = "is_frozen")
@ApiModelProperty(value = "是否冻结:0-正常,1-冻结")
private Integer isFrozen;
/**
* 最后进账时间
*/
@Column(name = "last_intime")
@ApiModelProperty(value = "最后进账时间")
private Long lastIntime;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
/**
* 版本
*/
@Column(name = "version")
@ApiModelProperty(value = "版本")
private Integer version;
}
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 门店钱包提现表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "company_wallet_cath")
public class CompanyWalletCath implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键ID")
private Long id;
/**
* 用户iD
*/
@Column(name = "company_id")
@ApiModelProperty(value = "门店ID")
private Integer companyId;
/**
* 提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)
*/
@Column(name = "cath_type")
@ApiModelProperty(value = "提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)")
private Integer cathType;
@Column(name = "account_number")
@ApiModelProperty(value = "用户账号")
private String accountNumber;
@Column(name = "cono")
@ApiModelProperty(value = "提现单号")
private String cono;
/**
* 提现金额
*/
@Column(name = "balance")
@ApiModelProperty(value = "当前钱包余额")
private BigDecimal balance;
/**
* 提现金额
*/
@Column(name = "amount")
@ApiModelProperty(value = "提现金额")
private BigDecimal amount;
/**
* 到账金额
*/
@Column(name = "real_amount")
@ApiModelProperty(value = "到账金额")
private BigDecimal realAmount;
/**
* 手续费
*/
@Column(name = "commission")
@ApiModelProperty(value = "手续费")
private BigDecimal commission;
/**
* 订单状态:0-未提现,待审核,1-已审核
*/
@Column(name = "stauts")
@ApiModelProperty(value = "订单状态:0-未提现,待审核,1-已审核")
private Integer stauts;
/**
* 失败原因
*/
@Column(name = "reason")
@ApiModelProperty(value = "失败原因")
private String reason;
/**
* 提现日期
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "提现日期", hidden = true)
private Long crtTime;
/**
* 审核日期
*/
@Column(name = "finish_time")
@ApiModelProperty(value = "审核日期")
private Long finishTime;
/**
* 操作者ID
*/
@Column(name = "upd_user")
@ApiModelProperty(value = "操作者ID")
private String updUser;
@Column(name = "order_no")
@ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等")
private String orderNo;
@Column(name = "account_name")
private String accountName;
@Column(name = "withdraw_way")
@ApiModelProperty(value = "提现方式 1:线下自动 2:线下手动 3:线上自动")
private Integer withdrawWay;
@Column(name = "real_reason")
private String realReason;
}
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 门店收支明细
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "company_wallet_detail")
public class CompanyWalletDetail implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键ID")
private Integer id;
@Column(name = "cono")
@ApiModelProperty(value = "订单号或提现号")
private Integer cono;
@Column(name = "source")
@ApiModelProperty(value = "收支类型:见枚举")
private Integer source;
@Column(name = "type")
@ApiModelProperty(value = "类型:1-收入;2-支出")
private Integer type;
@Column(name = "amount")
@ApiModelProperty(value = "收入/支出的金额(分)")
private BigDecimal amount;
@Column(name = "branch_id")
@ApiModelProperty(value = "企业id")
private Integer branchId;
@Column(name = "company_id")
@ApiModelProperty(value = "门店id")
private Integer companyId;
@Column(name = "s_amount")
@ApiModelProperty(value = "门店剩余金额")
private BigDecimal sAmount;
@Column(name = "crt_time")
@ApiModelProperty(value = "操作时间", hidden = true )
private Long crtTime;
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除:0-正常;1-删除")
private Integer isDel;
}
package com.xxfc.platform.order.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* 门店收支明细DTO
* @author libin
* @version 1.0
* @description
* @data 2019/12/25 14:53
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CompanyWalletDetailDTO{
@ApiModelProperty("订单号")
private String orderNo;
@ApiModelProperty("出发门店")
private Integer startCompanyId;
@ApiModelProperty("结束门店")
private Integer endCompanyId;
@ApiModelProperty("所属门店")
private Integer vehicleCompanyId;
@ApiModelProperty("平台门店")
private Integer platformCompanyId;
@ApiModelProperty("订单总额")
private BigDecimal orderAmount =BigDecimal.ZERO;
@ApiModelProperty("收车服务费")
private BigDecimal closedVehicleAmout =BigDecimal.ZERO;
@ApiModelProperty("不计免赔费")
private BigDecimal damageSafeAmount =BigDecimal.ZERO;
@ApiModelProperty("押金")
private BigDecimal deposit =BigDecimal.ZERO;
@ApiModelProperty("分销金额")
private BigDecimal comssion =BigDecimal.ZERO;
@ApiModelProperty("定损费")
private BigDecimal lossSpecifiedAmount =BigDecimal.ZERO;
@ApiModelProperty("违章费")
private BigDecimal breakRulesRegulation =BigDecimal.ZERO;
@ApiModelProperty("车辆收益比例")
private BigDecimal vehicleExtract = new BigDecimal(1);
@ApiModelProperty("订单抽成比例")
private BigDecimal orderExtract = new BigDecimal(1);
@ApiModelProperty("平台抽成比例")
private BigDecimal platformExtract = new BigDecimal(1);
@ApiModelProperty("车辆租赁费")
private BigDecimal rentVehicleAmount;
public BigDecimal getRentVehicleAmount(){
return (orderAmount.subtract(closedVehicleAmout).subtract(damageSafeAmount).subtract(deposit).subtract(comssion)).multiply(vehicleExtract).setScale(2, BigDecimal.ROUND_HALF_UP);
}
@ApiModelProperty("订单抽成")
private BigDecimal orderComssion;
public BigDecimal getOrderComssion(){
return (orderAmount.subtract(closedVehicleAmout).subtract(damageSafeAmount).subtract(deposit).subtract(comssion)).multiply(orderExtract).setScale(2, BigDecimal.ROUND_HALF_UP);
}
@ApiModelProperty("平台抽成")
private BigDecimal platformComssion;
public BigDecimal getPlatformComssion(){
return (orderAmount.subtract(closedVehicleAmout).subtract(damageSafeAmount).subtract(deposit).subtract(comssion)).multiply(platformExtract).setScale(2, BigDecimal.ROUND_HALF_UP);
}
@ApiModelProperty("出发门店金额")
private BigDecimal startCompanyAmount;
public BigDecimal getStartCompanyAmount(){
return getOrderAmount();
}
@ApiModelProperty("出发门店金额")
private BigDecimal endCompanyAmount;
public BigDecimal getEndCompanyAmount(){
return this.closedVehicleAmout;
}
@ApiModelProperty("所属门店金额")
private BigDecimal vehicleCompanyAmount;
public BigDecimal getVehicleCompanyAmount(){
return damageSafeAmount.add(getRentVehicleAmount()).add(lossSpecifiedAmount).add(breakRulesRegulation);
}
}
package com.xxfc.platform.order.biz;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import com.xxfc.platform.order.mapper.CompanyWalletDetailMapper;
import com.xxfc.platform.order.pojo.dto.CompanyWalletDetailDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, CompanyWalletDetail>{
@Autowired
BaseOrderBiz orderBiz;
public void addOrUpd(CompanyWalletDetailDTO walletDetailDTO){
String orderNo=walletDetailDTO.getOrderNo();
if (StringUtils.isBlank(orderNo)){
throw new BaseException("订单号不存在",ResultCode.FAILED_CODE);
}
log.info("---orderNo==="+orderNo);
BaseOrder baseOrder=new BaseOrder();
baseOrder.setNo(orderNo);
baseOrder=orderBiz.selectOne(baseOrder);
if (baseOrder == null || baseOrder.getStatus() >= OrderStatusEnum.ORDER_WAIT.getCode()){
throw new BaseException("订单不存在或状态不是已完成",ResultCode.FAILED_CODE);
}
walletDetailDTO.setOrderAmount(baseOrder.getRealAmount() );
}
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CompanyWalletCath;
import tk.mybatis.mapper.common.Mapper;
/**
* 钱包提现表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
public interface CompanyWalletCathMapper extends Mapper<CompanyWalletCath> {
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CompanyWalletDetail;
import tk.mybatis.mapper.common.Mapper;
/**
* 收入/支持明细表,每笔的进账,出账的详细记录
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
public interface CompanyWalletDetailMapper extends Mapper<CompanyWalletDetail> {
}
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.CompanyWallet;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
/**
* 我的钱包
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-11 14:14:54
*/
public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
void updMyWater(CompanyWallet companyWallet);
@Update("UPDATE `company_wallet` SET `is_frozen`=#{state} WHERE `id`=#{id}" )
void forbiddenWalletById(@Param("id") Integer id, @Param("state") Integer state);
}
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
LEFT JOIN branch_company c ON t.company_id=c.id LEFT JOIN branch_company c ON t.company_id=c.id
LEFT JOIN branch_company c1 ON t.start_company_id=c1.id LEFT JOIN branch_company c1 ON t.start_company_id=c1.id
LEFT JOIN company_info i ON t.corporation_id=i.id LEFT JOIN company_info i ON t.corporation_id=i.id
LEFT JOIN company_info ci ON t.start_corporation_id=i.id LEFT JOIN company_info ci ON t.start_corporation_id=ci.id
<if test="type==1"> <if test="type==1">
LEFT JOIN (select * from order_item where type = 104) i on b.id = i.order_id LEFT JOIN (select * from order_item where type = 104) i on b.id = i.order_id
</if> </if>
......
<?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.CompanyWalletMapper">
<update id="updMyWater" parameterType="com.xxfc.platform.order.entity.CompanyWallet">
update company_wallet
<set>
<if test=" companyId != null and companyId != '' ">
company_id=#{companyId},
</if>
<if test="balance!=null ">
balance=#{balance},
</if>
<if test="withdrawals!=null and withdrawals!='' ">
withdrawals=#{withdrawals},
</if>
<if test="totalAmount!=null and totalAmount!='' ">
total_amount=#{totalAmount},
</if>
<if test="todayAmount!=null and todayAmount!='' ">
today_amount=#{todayAmount},
</if>
<if test="unbooked!=null and unbooked!='' ">
unbooked=#{unbooked},
</if>
<if test="isFrozen!=null and isFrozen!='' ">
is_frozen=#{isFrozen},
</if>
<if test="lastIntime!=null and lastIntime!='' ">
last_intime=#{lastIntime},
</if>
<if test="crtTime!=null and crtTime!='' ">
crt_time=#{crtTime},
</if>
<if test="updTime!=null and updTime!='' ">
upd_time=#{updTime},
</if>
<if test="version!=null and version!='' ">
version=version+1,
</if>
</set>
<where>
id=#{id} and version=#{version}
</where>
</update>
</mapper>
\ No newline at end of file
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