Commit c19673ee authored by hezhen's avatar hezhen

添加营收

parent fe16f683
...@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.admin.entity.CompanyWallet; ...@@ -5,6 +5,8 @@ import com.github.wxiaoqi.security.admin.entity.CompanyWallet;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@Data @Data
public class CompanyWalletVo extends CompanyWallet { public class CompanyWalletVo extends CompanyWallet {
...@@ -18,4 +20,16 @@ public class CompanyWalletVo extends CompanyWallet { ...@@ -18,4 +20,16 @@ public class CompanyWalletVo extends CompanyWallet {
@ApiModelProperty("企业名称") @ApiModelProperty("企业名称")
private Long branchId; private Long branchId;
@ApiModelProperty("今日营收")
private BigDecimal todayAmount;
@ApiModelProperty("未入账")
private BigDecimal notDoAmount;
} }
...@@ -59,6 +59,18 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet ...@@ -59,6 +59,18 @@ public class CompanyWalletBiz extends BaseBiz<CompanyWalletMapper, CompanyWallet
return PageDataVO.pageInfo(walletDTO.getPage(), walletDTO.getLimit(), () -> getList(walletDTO)); return PageDataVO.pageInfo(walletDTO.getPage(), walletDTO.getLimit(), () -> getList(walletDTO));
} }
public CompanyWalletVo info(CompanyWalletDTO walletDTO){
List<CompanyWalletVo> list = mapper.selectList(walletDTO);
if (list.size() > 0) {
CompanyWalletVo companyWalletVo = list.get(0);
companyWalletVo.setTodayAmount(mapper.todayAmount(companyWalletVo.getCompanyId()));
companyWalletVo.setNotDoAmount(mapper.notDoAmount(companyWalletVo.getCompanyId()));
return companyWalletVo;
}
return null;
}
......
...@@ -30,4 +30,5 @@ public interface CompanyWalletDetailMapper extends Mapper<CompanyWalletDetail> { ...@@ -30,4 +30,5 @@ public interface CompanyWalletDetailMapper extends Mapper<CompanyWalletDetail> {
BigDecimal sumAmount(WalletDetailDTO walletDetailDTO); BigDecimal sumAmount(WalletDetailDTO walletDetailDTO);
} }
...@@ -8,9 +8,11 @@ import com.github.wxiaoqi.security.admin.dto.WalletDetailDTO; ...@@ -8,9 +8,11 @@ import com.github.wxiaoqi.security.admin.dto.WalletDetailDTO;
import com.github.wxiaoqi.security.admin.entity.CompanyWallet; import com.github.wxiaoqi.security.admin.entity.CompanyWallet;
import com.github.wxiaoqi.security.admin.vo.CompanyWalletVo; import com.github.wxiaoqi.security.admin.vo.CompanyWalletVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -33,4 +35,12 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> { ...@@ -33,4 +35,12 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
List<CompanyWalletVo> selectList(CompanyWalletDTO walletDTO); List<CompanyWalletVo> selectList(CompanyWalletDTO walletDTO);
@Select("SELECT IFNULL(SUM(amount),0) FROM company_wallet_detail WHERE type=1 and company_id=#{companyId} and from_unixtime(crt_time/1000,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')")
BigDecimal todayAmount(@Param("companyId") Integer companyId);
@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)")
BigDecimal notDoAmount(@Param("companyId") Integer companyId);
} }
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletBiz;
import com.github.wxiaoqi.security.admin.dto.CompanyWalletDTO;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/companyWallet")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Api(tags = {"店铺钱包"})
public class AppCompanyWalletController extends BaseController<CompanyWalletBiz> {
@GetMapping("info")
@ApiModelProperty("店铺营收信息")
@IgnoreUserToken
public ObjectRestResponse info(CompanyWalletDTO companyWalletDTO) {
if (companyWalletDTO.getCompanyId() == null || companyWalletDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
companyWalletDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ(baseBiz.info(companyWalletDTO));
}
}
package com.github.wxiaoqi.security.admin.rest.admin;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletBiz;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletCathBiz;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletDetailBiz;
import com.github.wxiaoqi.security.admin.dto.*;
import com.github.wxiaoqi.security.admin.entity.CompanyWalletCath;
import com.github.wxiaoqi.security.admin.entity.CompanyWalletDetail;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface;
import com.github.wxiaoqi.security.admin.vo.CompanyWalletDetailVo;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
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("backstage/wallet")
public class AdminCompanyWalletDetailController extends BaseController<CompanyWalletDetailBiz, CompanyWalletDetail> implements UserRestInterface {
@Autowired
UserFeign userFeign;
@Override
public UserFeign getUserFeign() {
return userFeign;
}
@Autowired
CompanyWalletCathBiz walletCathBiz;
@Autowired
CompanyWalletBiz walletBiz;
@RequestMapping(value = "selectList", method = RequestMethod.GET)
@ApiModelProperty(value = "营收明细列表")
public ObjectRestResponse<PageDataVO<CompanyWalletDetailVo>> selectList(WalletDetailDTO walletDetailDTO) {
setPowerData(walletDetailDTO);
return ObjectRestResponse.succ(baseBiz.selectList(walletDetailDTO));
}
@RequestMapping(value = "sumAmount", method = RequestMethod.GET)
@ApiModelProperty(value = "营收统计")
public ObjectRestResponse sumAmount(WalletDetailDTO walletDetailDTO) {
setPowerData(walletDetailDTO);
return ObjectRestResponse.succ(baseBiz.getSumAmount(walletDetailDTO));
}
@RequestMapping(value = "cath/selectList", method = RequestMethod.GET)
@ApiModelProperty(value = "提现明细列表")
public ObjectRestResponse<PageDataVO<CompanyWalletDetailVo>> cathSelectList(WalletCathDTO walletCathDTO) {
setPowerData(walletCathDTO);
return ObjectRestResponse.succ(walletCathBiz.selectList(walletCathDTO));
}
@RequestMapping(value = "amount/selectList", method = RequestMethod.GET)
@ApiModelProperty(value = "钱包列表")
public ObjectRestResponse<PageDataVO<CompanyWalletDetailVo>> amountSelectList(CompanyWalletDTO walletDTO) {
setPowerData(walletDTO);
return ObjectRestResponse.succ(walletBiz.selectList(walletDTO));
}
@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 = "提现审核")
public ObjectRestResponse withDrawProcess(@RequestBody CompanyWalletCath companyWalletCath) {
walletCathBiz.withDrawProcess(companyWalletCath);
return ObjectRestResponse.succ();
}
}
\ 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