Commit fceb5a46 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev-chw' into dev-chw

parents 6f4fb5f7 55b9efe4
......@@ -7,7 +7,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
......@@ -23,7 +26,7 @@ import java.util.List;
public class CompanyWalletDTO extends PageParam implements DataInter {
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
@ApiModelProperty("门店")
private Integer companyId;
......@@ -32,6 +35,9 @@ public class CompanyWalletDTO extends PageParam implements DataInter {
@ApiModelProperty("企业")
private Integer branchId;
@ApiModelProperty("月份")
private String month;
List<Integer> dataCorporationIds;
......@@ -41,6 +47,14 @@ public class CompanyWalletDTO extends PageParam implements DataInter {
Integer bizType;
public String getMonth(){
if (StringUtils.isBlank(month)){
month=dateFormat.format(new Date());
}
return month;
}
......
......@@ -40,6 +40,13 @@ public class WalletDetailDTO extends PageParam implements DataInter {
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("月份")
private String month;
@ApiModelProperty("0-未提现;1-已提现")
private Integer status;
List<Integer> itypes;
......
......@@ -2,6 +2,7 @@ package com.github.wxiaoqi.security.admin.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
......@@ -34,6 +35,11 @@ public class BranchCompany {
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@Column(name = "short_name")
@ApiModelProperty("简称")
private String shortName;
......@@ -195,4 +201,6 @@ public class BranchCompany {
//点赞数量
@Column(name = "give_num")
private Integer giveNum;
}
\ No newline at end of file
......@@ -3,12 +3,14 @@ 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;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Data
......@@ -27,6 +29,12 @@ public class CompanyInfo {
private String name;
@ApiModelProperty("门头照")
@Column(name = "head_logo")
private String headLogo;
@ApiModelProperty("公司类型:1-个体;2-企业")
private Integer type;
......@@ -190,4 +198,22 @@ public class CompanyInfo {
@Column(name = "is_del")
private Integer isDel;
@ApiModelProperty("公司地址-纬度")
private BigDecimal latitude;
/**
* 公司地址-经度
*/
@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
......@@ -34,6 +34,7 @@ public class CompanyInfoApply {
private String name;
@ApiModelProperty("公司类型:1-个体;2-企业")
private Integer type;
......
......@@ -82,6 +82,14 @@ public class CompanyWalletDetail implements Serializable {
@Column(name = "status")
@ApiModelProperty(value = "状态:0-未提现;1-已提现")
private Integer status;
@Column(name = "status_time")
@ApiModelProperty(value = "提现时间")
private Long statusTime;
@Column(name = "crt_time")
@ApiModelProperty(value = "操作时间", hidden = true )
......
......@@ -23,13 +23,20 @@ public class CompanyWalletDetailVo extends CompanyWalletDetail {
@ApiModelProperty("类型")
private String typeName;
@ApiModelProperty("显示时间")
private Long showTime;
public String getSourceName(){
if (getItype() == null)
return "";
return CompanyWalletITypeEnum.get(getItype()).getDesc();
}
public String getTypeName(){
if (getItype() == null)
return "";
return getType() == 1 ? "收入":"支出";
}
......
......@@ -25,6 +25,10 @@ public class CompanyWalletVo extends CompanyWallet {
private BigDecimal todayAmount;
@ApiModelProperty("月度营收")
private BigDecimal monthAmount;
@ApiModelProperty("未入账")
private BigDecimal notDoAmount;
......
......@@ -42,6 +42,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
if (branchCompany1 != null){
updateSelectiveById(branchCompany);
}else {
branchCompany.setCompanyPic(branchCompany.getHeadLogo());
branchCompany.setState(1);
insertSelective(branchCompany);
}
sendQueue(branchCompany);
......
......@@ -19,6 +19,7 @@ import com.xxfc.platform.universal.feign.MQSenderFeign;
import com.github.wxiaoqi.security.admin.dto.CompanyInfoFindDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
......@@ -57,6 +58,9 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
@Autowired
AppUserRelationBiz userRelationBiz;
@Autowired
CompanyWalletBiz companyWalletBiz;
public static final String CODE="SHOP-";
......@@ -81,10 +85,16 @@ public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
//初始化店铺
setInviterAccount(companyInfoApply);
BranchCompany branchCompany = getBranchCompanyInfo();
BeanUtils.copyProperties(companyInfo,branchCompany);
branchCompany.setCompanyId(id);
branchCompany.setInviterAccount(companyInfoApply.getInviterAccount());
branchCompany.setCode(CODE+ReferralCodeUtil.encode(companyInfoApply.getId().intValue()));
branchCompany.setLeader(companyInfoApply.getContact());
branchCompany.setLeaderContactInfo(companyInfoApply.getMobile());
branchCompanyBiz.addOrUpd(branchCompany);
CompanyWallet companyWallet = new CompanyWallet();
companyWallet.setCompanyId(branchCompany.getId());
companyWalletBiz.insertSelective(companyWallet);
}
sendQueue(companyInfo);
return id;
......
......@@ -65,6 +65,7 @@ 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()));
return companyWalletVo;
}
......
......@@ -122,6 +122,15 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
return mapper.selectList(walletDetailDTO);
}
public PageDataVO<CompanyWalletDetailVo> selectListByCompanyId(WalletDetailDTO walletDetailDTO) {
return PageDataVO.pageInfo(walletDetailDTO.getPage(), walletDetailDTO.getLimit(), () -> walletDetail(walletDetailDTO));
}
public List<CompanyWalletDetailVo> walletDetail(WalletDetailDTO walletDetailDTO){
return mapper.walletDetail(walletDetailDTO);
}
public JSONObject getSumAmount(WalletDetailDTO walletDetailDTO){
List<Integer> itypes=new ArrayList<>();
itypes.add(1);
......
......@@ -29,6 +29,8 @@ public interface CompanyWalletDetailMapper extends Mapper<CompanyWalletDetail> {
BigDecimal sumAmount(WalletDetailDTO walletDetailDTO);
List<CompanyWalletDetailVo> walletDetail(WalletDetailDTO walletDetailDTO);
}
......@@ -41,6 +41,10 @@ public interface CompanyWalletMapper extends Mapper<CompanyWallet> {
BigDecimal todayAmount(@Param("companyId") Integer companyId);
@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')=#{month}")
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)")
BigDecimal notDoAmount(@Param("companyId") Integer companyId);
}
......@@ -29,7 +29,6 @@ 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();
......
package com.github.wxiaoqi.security.admin.rest;
import com.github.wxiaoqi.security.admin.biz.CompanyWalletDetailBiz;
import com.github.wxiaoqi.security.admin.dto.WalletDetailDTO;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author Administrator
*/
@Slf4j
@RestController
@RequestMapping("app/companyWalletDetail")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Api(tags = {"店铺钱包明细"})
public class AppCompanyWalletDetailController extends BaseController<CompanyWalletDetailBiz> {
@GetMapping("selectList")
@ApiModelProperty("钱包明细")
public ObjectRestResponse info(WalletDetailDTO walletDetailDTO) {
if (walletDetailDTO.getCompanyId() == null || walletDetailDTO.getCompanyId() == 0){
List<Integer> companyIds = getBusinessUserCompanyIds();
if (companyIds != null && companyIds.size() > 0){
walletDetailDTO.setCompanyId(companyIds.get(0));
}
}
return ObjectRestResponse.succ(baseBiz.selectListByCompanyId(walletDetailDTO));
}
}
......@@ -24,10 +24,10 @@
<select id="search" parameterType="com.github.wxiaoqi.security.admin.dto.CompanySearchDTO" resultType="com.github.wxiaoqi.security.admin.vo.CompanySearchVO">
select c.*,i.name as companyName,l.name as levelName
<if test="lon != null and lat != null">
, ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0
, ROUND(( (2 * ASIN( SQRT( POW( SIN((c.latitude * PI() / 180.0
-${lat} * PI() / 180.0)/2), 2)
+COS( latitude * PI() / 180.0)*COS(${lat} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - ${lon} * PI() /
+COS( c.latitude * PI() / 180.0)*COS(${lat} * PI() / 180.0)
*POW(SIN((c.longitude * PI() / 180.0 - ${lon} * PI() /
180.0)/2),2))))*6378.137)*10000)/10000 as distance
</if>
from branch_company c
......
<?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">
<mapper namespace="com.github.wxiaoqi.security.admin.mapper.CompanyWalletDetailMapper">
<select id="selectList" resultType="com.xxfc.platform.order.pojo.vo.CompanyWalletDetailVo" parameterType="com.xxfc.platform.order.pojo.dto.WalletDetailDTO">
<select id="selectList" resultType="com.github.wxiaoqi.security.admin.vo.CompanyWalletDetailVo" parameterType="com.github.wxiaoqi.security.admin.dto.WalletDetailDTO">
SELECT
d.cono,
d.itype,
......@@ -46,7 +46,7 @@
order by d.id desc
</select>
<select id="sumAmount" resultType="BigDecimal" parameterType="com.xxfc.platform.order.pojo.dto.WalletDetailDTO">
<select id="sumAmount" resultType="BigDecimal" parameterType="com.github.wxiaoqi.security.admin.dto.WalletDetailDTO">
SELECT IFNULL(SUM(amount),0) as amount FROM company_wallet_detail
<where>
itype in
......@@ -74,7 +74,41 @@
</where>
</select>
<select id="walletDetail" resultType="com.github.wxiaoqi.security.admin.vo.CompanyWalletDetailVo" parameterType="com.github.wxiaoqi.security.admin.dto.WalletDetailDTO">
SELECT r.* FROM
(
SELECT
cono,
IFNULL(SUM(amount),0) as amount,
IF(FIND_IN_SET(GROUP_CONCAT(source),2)=1 ,2,1) as type,
`status`,
IF(status_time>0,status_time,crt_time) showTime
FROM company_wallet_detail
WHERE
company_id = #{companyId} and source in (1,2,3,5)
GROUP BY cono
UNION ALL
SELECT
cono,
IFNULL(SUM(amount),0) as totalAmount,
3 as type ,
`status`,
IF(status_time>0,status_time,crt_time) showTime
FROM company_wallet_detail
WHERE
company_id = #{companyId} and source in (4)
GROUP BY cono
) r
<where>
<if test="month != null and month != '' ">
and from_unixtime(r.showTime/1000,'%Y-%m')=#{month}
</if>
<if test="status != null and status == 0">
and r.status in (0,1)
</if>
</where>
order by r.showTime desc
</select>
</mapper>
\ No newline at end of file
......@@ -59,7 +59,7 @@ public class ActivityBiz extends BaseBiz<ActivityMapper, Activity> {
Map<Integer, AppUserVo> userMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(appUserVos)){
for (AppUserVo appUserVo:appUserVos){
userMap.put(appUserVo.getId(),appUserVo);
userMap.put(appUserVo.getUserid(),appUserVo);
}
}
for(ActivityVo activityVo : list){
......
package com.xxfc.platform.order.pojo.vo;
import com.github.wxiaoqi.security.admin.entity.CompanyWalletDetail;
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;
......@@ -25,6 +25,10 @@ public class CompanyWalletDetailVo extends CompanyWalletDetail {
private String typeName;
@ApiModelProperty("显示时间")
private Long showTime;
public String getSourceName(){
return CompanyWalletITypeEnum.get(getItype()).getDesc();
}
......
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