Commit a4919fdb authored by hezhen's avatar hezhen

Merge branch 'master-chw' into dev-chw

parents 1455e501 e13baa0a
......@@ -4,8 +4,10 @@ import java.util.HashMap;
import java.util.Map;
public enum CompanyWalletITypeEnum {
COMPANY(1, "商家"),
CATH(2, "提现"),
COMPANY(1, "订单收入"),
REGULATION(2, "违章收入"),
CATH(3, "订单提现"),
REGULATION_CATH(4, "违章提现"),
;
/**
* 编码
......
......@@ -25,5 +25,7 @@ public class BaseOrderAcceptDetailedDTO extends PageParam implements DataInter {
private Integer acceptId;
private Integer iType;
}
package com.github.wxiaoqi.security.admin.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/12 9:20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyAccountDTO {
@ApiModelProperty("店铺id")
private Integer companyId;
@ApiModelProperty(value = "银行账号")
private String bankAccount;
@ApiModelProperty(value = "开户名")
private String bankName;
@ApiModelProperty(value = "开户行")
private String bank;
}
package com.github.wxiaoqi.security.admin.dto;
import lombok.Data;
/**
* 店铺钱包设置密码
*/
@Data
public class CompanyWalletPwdDTO {
private Integer companyId;
private String phone;
private String mobilecod;
private String password;
private Integer type;
}
\ No newline at end of file
......@@ -25,8 +25,8 @@ public class WalletCathApplyDTO {
@ApiModelProperty("门店")
private List<JSONObject> companyIds;
@ApiModelProperty("营收Id")
private Integer revenueId;
@ApiModelProperty("提现金额")
......@@ -40,6 +40,9 @@ public class WalletCathApplyDTO {
@ApiModelProperty("账号名称")
private String accountName;
@ApiModelProperty("开户名")
private String bank;
......
......@@ -23,7 +23,8 @@ import java.util.List;
public class WalletCathDTO extends PageParam implements DataInter {
@ApiModelProperty("提现Id")
private Integer id;
@ApiModelProperty("门店")
private Integer companyId;
......
......@@ -32,6 +32,8 @@ public class WalletCathSumDto {
//钱包版本
private Integer version;
private Integer withdrawWay;
......
......@@ -3,9 +3,7 @@ package com.github.wxiaoqi.security.admin.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
......@@ -208,12 +206,4 @@ public class CompanyInfo {
@ApiModelProperty("公司地址-经度")
private BigDecimal longitude;
public String getHeadLogo(){
if (StringUtils.isBlank(headLogo)){
headLogo="https://chwplatform.upyuns.com/image/app/shop_logo_default.png";
}
return headLogo;
}
}
\ No newline at end of file
......@@ -42,6 +42,18 @@ public class CompanyWalletCath implements Serializable {
@ApiModelProperty(value = "门店ID")
private Integer companyId;
@Column(name = "wallet_detail_id")
@ApiModelProperty(value = "钱包明细id")
private Integer walletDetailId;
@Column(name = "revenue_id")
@ApiModelProperty(value = "营收id")
private Integer revenueId;
/**
* 提现类别,第三方提现类别(0-微信,1-支付宝,2-银行卡)
*/
......@@ -128,9 +140,15 @@ public class CompanyWalletCath implements Serializable {
private String updUser;
@Column(name = "order_no")
@ApiModelProperty(value = "第三方订单号:如微信,支付宝,银行卡等")
@ApiModelProperty(value = "订单号")
private String orderNo;
@Column(name = "cath_no")
@ApiModelProperty(value = "提现单号")
private String cathNo;
@Column(name = "account_name")
private String accountName;
......
......@@ -17,6 +17,14 @@ import java.math.BigDecimal;
@AllArgsConstructor
@NoArgsConstructor
public class ApplyCathVo {
@ApiModelProperty("营收Id")
private Integer revenueId;
/**
* 用户ID
*/
......@@ -47,7 +55,17 @@ public class ApplyCathVo {
@ApiModelProperty(value = "支付类型")
private Integer cathType;
@ApiModelProperty(value = "账号名称")
private String accountName;
@ApiModelProperty(value = "开户行")
private String bank;
@ApiModelProperty(value = "订单号")
private String orderNo;
}
......@@ -2,6 +2,8 @@ package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.constant.enumerate.CompanyWalletITypeEnum;
import com.github.wxiaoqi.security.admin.constant.enumerate.CompanyWalletSourceEnum;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.admin.dto.OrderWaterDTO;
import com.github.wxiaoqi.security.admin.entity.*;
......@@ -17,6 +19,7 @@ import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -82,6 +85,20 @@ public class BaseOrderRevenueBiz extends BaseBiz<BaseOrderRevenueMapper, BaseOrd
}
public Integer getType(String type){
Integer itype = CompanyWalletITypeEnum.CATH.getCode();
if (StringUtils.isNotBlank(type)) {
String[] values = type.split(",");
List<String> list = Arrays.asList(values);
if (list.contains(CompanyWalletSourceEnum.REGULATION.getCode()+"")) {
itype = CompanyWalletITypeEnum.REGULATION_CATH.getCode();
}
}
return itype;
}
}
......@@ -78,6 +78,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
companyInfo.setId(id);
updateSelectiveById(companyInfo);
}else {
setHeadLog(companyInfo);
insertSelective(companyInfo);
id=companyInfo.getId();
//初始化商家账号
......@@ -100,6 +101,19 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
return id;
}
public void setHeadLog(CompanyInfo companyInfo){
String headLog = companyInfo.getHeadLogo();
if (StringUtils.isBlank(headLog)){
Long id = companyInfo.getId() == null ? 0L : companyInfo.getId();
if ( id > 0){
CompanyInfo companyInfo1=selectById(id);
headLog=companyInfo1 == null ? null : companyInfo1.getHeadLogo();
}
headLog = StringUtils.isBlank(headLog) ? "https://chwplatform.upyuns.com/image/app/shop_logo_default.png" : headLog;
}
companyInfo.setHeadLogo(headLog);
}
//app上级用户为店铺推荐人
public void setInviterAccount(CompanyInfoApply companyInfoApply){
Integer inviterAccount = companyInfoApply.getInviterAccount() == null ? 0 : companyInfoApply.getInviterAccount();
......@@ -137,6 +151,7 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
if (id > 0L ){
updateSelectiveById(companyInfo);
}else {
setHeadLog(companyInfo);
insertSelective(companyInfo);
}
sendQueue(companyInfo);
......@@ -216,4 +231,8 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
groupBiz.modifyUserGroups(user.getId(),members);
}
public CompanyInfo getInfoByCompanyId(Integer companyId){
return mapper.getInfoByCompanyId(companyId);
}
}
package com.github.wxiaoqi.security.admin.biz;
import com.github.wxiaoqi.security.admin.dto.BaseOrderRevenueFindDTO;
import com.github.wxiaoqi.security.admin.dto.CompanyWalletDTO;
import com.github.wxiaoqi.security.admin.dto.WalletDetailDTO;
import com.github.wxiaoqi.security.admin.entity.CompanyWallet;
......@@ -11,6 +12,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
......@@ -23,6 +25,11 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet
@Autowired
BaseOrderRevenueBiz revenueBiz;
public void updCompanyWallet(CompanyWallet companyWallet){
mapper.updMyWater(companyWallet);
}
......@@ -65,7 +72,10 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet
CompanyWalletVo companyWalletVo = list.get(0);
companyWalletVo.setTodayAmount(mapper.todayAmount(companyWalletVo.getCompanyId()));
companyWalletVo.setNotDoAmount(mapper.notDoAmount(companyWalletVo.getCompanyId()));
companyWalletVo.setMonthAmount(mapper.monthAmount(companyWalletVo.getCompanyId(),walletDTO.getMonth()));
BaseOrderRevenueFindDTO baseOrderRevenueFindDTO = new BaseOrderRevenueFindDTO();
baseOrderRevenueFindDTO.setCompanyId(companyWalletVo.getCompanyId());
baseOrderRevenueFindDTO.setMonth(walletDTO.getMonth());
companyWalletVo.setMonthAmount(revenueBiz.sumAmount(baseOrderRevenueFindDTO));
return companyWalletVo;
}
......
......@@ -65,6 +65,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
.builder()
.orderNo(orderWaterDTO.getOrderNo())
.divisionTypes(divisionTypes)
.iType(CompanyWalletITypeEnum.COMPANY.getCode())
.build();
updByIdOrOrderNo(acceptDetailedDTO);
}
......@@ -77,6 +78,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
BaseOrderAcceptDetailedDTO acceptDetailedDTO = BaseOrderAcceptDetailedDTO
.builder()
.acceptId(acceptId)
.iType(CompanyWalletITypeEnum.REGULATION.getCode())
.build();
updByIdOrOrderNo(acceptDetailedDTO);
}
......@@ -112,7 +114,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
companyWalletDetail.setCompanyId(acceptDetailedVO.getMchId());
companyWalletDetail.setSAmount(companyAmount);
companyWalletDetail.setSource(source);
companyWalletDetail.setItype(CompanyWalletITypeEnum.COMPANY.getCode());
companyWalletDetail.setItype(acceptDetailedDTO.getIType());
insertSelective(companyWalletDetail);
walletDetails.add(companyWalletDetail);
}
......
......@@ -2,8 +2,14 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.entity.CompanyInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyInfoMapper extends Mapper<CompanyInfo>, SelectByIdListMapper<CompanyInfo,Long> {
@Select("SELECT * FROM company_info WHERE id in (SELECT company_id FROM branch_company WHERE id=#{companyId} )")
CompanyInfo getInfoByCompanyId(@Param("companyId")Integer companyId);
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.github.wxiaoqi.security.admin.mapper;
import com.github.wxiaoqi.security.admin.dto.WalletCathDTO;
import com.github.wxiaoqi.security.admin.dto.WalletCathSumDto;
import com.github.wxiaoqi.security.admin.entity.CompanyWalletCath;
import com.github.wxiaoqi.security.admin.vo.CompanyWalletCathVo;
import org.apache.ibatis.annotations.Param;
......@@ -27,4 +28,12 @@ public interface CompanyWalletCathMapper extends Mapper<CompanyWalletCath> {
@Select("SELECT IFNULL(SUM(amount),0) FROM company_wallet_cath WHERE company_id =#{companyId} AND stauts=0")
BigDecimal sunAmountByStatus(@Param("companyId") Integer companyId);
/**
* 计算提现的金额
* @param type 1-日;2-月
* @return
*/
WalletCathSumDto sumCathAmount(@Param("companyId") Integer companyId, @Param("type") int type);
}
......@@ -45,6 +45,6 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
BigDecimal monthAmount(@Param("companyId") Integer companyId,@Param("month") String month);
@Select("SELECT IFNULL(SUM(division_amount-fee),0) FROM base_order_accept_detailed WHERE `status`=0 and mch_id=#{companyId} and division_type in (3,5,6,7,8)")
@Select("SELECT IFNULL(SUM(amount),0) FROM base_order_revenue WHERE amount > 0 and is_del = 0 and company_id=#{companyId} and status = 0")
BigDecimal notDoAmount(@Param("companyId") Integer companyId);
}
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletCathBiz;
import com.github.wxiaoqi.security.admin.dto.CompanyAccountDTO;
import com.github.wxiaoqi.security.admin.dto.CompanyWalletPwdDTO;
import com.github.wxiaoqi.security.admin.vo.ApplyCathVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/companyWalletCath")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Api(tags = {"店铺提现"})
public class AppCompanyCathController extends BaseController<CompanyWalletCathBiz> {
@GetMapping("sendSMS")
@ApiOperation("发送验证码")
public ObjectRestResponse sendSMS() throws Exception{
baseBiz.sendSMS(getUserName());
return ObjectRestResponse.succ();
}
@GetMapping("checkCode")
@ApiOperation("检查验证码")
public ObjectRestResponse checkCode(
@RequestParam(value = "mobilecode", defaultValue = "") String mobilecod) throws Exception{
return baseBiz.checkCode(getUserName(), mobilecod);
}
@PostMapping("setPwd")
@ApiOperation("设置密码")
public ObjectRestResponse setPwd(@RequestBody CompanyWalletPwdDTO companyWalletPwdDTO) throws Exception{
if (companyWalletPwdDTO.getCompanyId() == null || companyWalletPwdDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyWalletPwdDTO.setCompanyId(companyIds.get(0));
}
}
if (StringUtils.isBlank(companyWalletPwdDTO.getPhone())){
companyWalletPwdDTO.setPhone(getUserName());
}
return baseBiz.setPwd(companyWalletPwdDTO);
}
@GetMapping("checkSetPwdOrAccount")
@ApiOperation("检查用户是否设置过(支付密码或银行卡)")
public ObjectRestResponse checkSetPwdOrAccount(@RequestParam(value = "companyId", defaultValue = "0") Integer companyId) {
if (companyId == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyId=companyIds.get(0);
}
}
return ObjectRestResponse.succ(baseBiz.checkSetPwdOrAccount(companyId));
}
@PostMapping("applyCath")
@ApiOperation("提现申请")
public ObjectRestResponse applyCath(@RequestBody ApplyCathVo applyCathVo) {
if (applyCathVo.getUserId() == null || applyCathVo.getUserId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
applyCathVo.setUserId(companyIds.get(0));
}
}
return baseBiz.applyCath(applyCathVo);
}
@PostMapping("updAccount")
@ApiOperation("设置银行卡")
public ObjectRestResponse updAccount(@RequestBody CompanyAccountDTO companyAccountDTO) {
if (companyAccountDTO.getCompanyId() == null || companyAccountDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyAccountDTO.setCompanyId(companyIds.get(0));
}
}
baseBiz.updAccount(companyAccountDTO);
return ObjectRestResponse.succ();
}
}
......@@ -73,20 +73,6 @@ public class AdminCompanyWalletDetailController extends BaseController<CompanyWa
}
@RequestMapping(value = "applyCath", method = RequestMethod.POST)
@ApiModelProperty(value = "提现申请")
public ObjectRestResponse applyCath(@RequestBody CompanyWalletCath walletCathDTO) {
walletCathBiz.applyCath(walletCathDTO);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "applyCathList", method = RequestMethod.POST)
@ApiModelProperty(value = "提现申请List")
public ObjectRestResponse applyCathList(@RequestBody WalletCathApplyDTO walletCathApplyDTO) {
walletCathBiz.applyCathList(walletCathApplyDTO);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "withDrawProcess", method = RequestMethod.POST)
@ApiModelProperty(value = "提现审核")
......@@ -96,4 +82,11 @@ public class AdminCompanyWalletDetailController extends BaseController<CompanyWa
}
@RequestMapping(value = "selectListByCath", method = RequestMethod.GET)
@ApiModelProperty(value = "提现记录")
public ObjectRestResponse<PageDataVO<CompanyWalletDetailVo>> selectListByCath(WalletCathDTO walletCathDTO) {
return ObjectRestResponse.succ(walletCathBiz.selectList(walletCathDTO));
}
}
\ No newline at end of file
......@@ -24,6 +24,9 @@
<when test="status == 1">
and `status` in (1,3)
</when>
<when test="status == 2">
and `status` in (2,4)
</when>
<otherwise>
and `status`=#{status}
</otherwise>
......
<?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.CompanyWalletCathMapper">
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.CompanyWalletCathMapper">
<select id="selectList" resultType="com.xxfc.platform.order.pojo.vo.CompanyWalletCathVo" parameterType="com.xxfc.platform.order.pojo.dto.WalletCathDTO">
<select id="selectList" resultType="com.github.wxiaoqi.security.admin.vo.CompanyWalletCathVo" parameterType="com.github.wxiaoqi.security.admin.dto.WalletCathDTO">
SELECT
wc.*,
c.`name` as companyName,
......@@ -20,6 +20,9 @@
<if test="branchId != null and branchId > 0">
and c.company_id=#{branchId}
</if>
<if test="id != null and id > 0">
and wc.id=#{id}
</if>
<if test="orderNo != null and orderNo != '' ">
and wc.order_no like concat('%',#{orderNo},'%')
</if>
......@@ -56,4 +59,22 @@
order by wc.crt_time desc
</select>
<select id="sumCathAmount" resultType="com.github.wxiaoqi.security.admin.dto.WalletCathSumDto">
select IFNULL(SUM(amount),0) as sumAmount,COUNT(*) as `number` from company_wallet_cath
<where>
company_id=#{companyId} and stauts in(0,1)
<choose>
<when test="type ==1 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</when>
<when test="type==2 ">
AND date_format(from_unixtime(crt_time/1000),'%Y-%m') = date_format(now(),'%Y-%m')
</when>
<otherwise>
</otherwise>
</choose>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -27,6 +27,8 @@ public interface ConfigFeign {
public static final int TYPE_BRANCH_COMPANY=111;
public static final int TYPE_COMPANY_CATH=89;
@RequestMapping(value = "/cofig/app/unauth/types",method = RequestMethod.GET)
ObjectRestResponse<List<Cofig>> getAllByType(@RequestParam("types") String types);
......
......@@ -30,6 +30,10 @@ public class WalletCathDTO extends PageParam implements DataInter {
private Integer companyId;
@ApiModelProperty("提现Id")
private Integer id;
@ApiModelProperty("企业")
private Integer branchId;
......
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