| @@ -0,0 +1,64 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderQueryVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||||
| import com.iformall.service.WxProfitSharingOrderService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| @RestController | |||||
| @RequestMapping("wxProfitSharingOrder") | |||||
| public class WxProfitSharingOrderController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxProfitSharingOrderService wxProfitSharingOrderService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxProfitSharingOrderQueryVo order, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::list"); | |||||
| if (null == order) { | |||||
| order = new WxProfitSharingOrderQueryVo(); | |||||
| } | |||||
| final PageInfo<WxProfitSharingOrderVo> page = wxProfitSharingOrderService.listAsPage(order, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("交易统计") | |||||
| @PostMapping("/queryOrderSummary") | |||||
| public ResultData queryOrderSummary() { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::queryOrderSummary"); | |||||
| Map<String, Object> data = wxProfitSharingOrderService.queryOrderSummary(getTenantId()); | |||||
| return new ResultData(data); | |||||
| } | |||||
| @ApiOperation("分账详情") | |||||
| @GetMapping("findOrderDetails") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findOrderDetails(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingOrderController::findOrderDetails"); | |||||
| return wxProfitSharingOrderService.findOrderDetails(id); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,130 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class WxProfitSharingOrderDetailsVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long Id; | |||||
| private String tenantId; | |||||
| private Integer payAmount; | |||||
| private Date createTime; | |||||
| private Integer sharingStatus; | |||||
| private String finishTime; | |||||
| private String failedReason; | |||||
| private String description; | |||||
| private Integer receiverType; | |||||
| private String receiverAccount; | |||||
| private String receiverComments; | |||||
| private Integer sharingType; | |||||
| private Integer status; | |||||
| public Long getId() { | |||||
| return Id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| Id = id; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Integer getPayAmount() { | |||||
| return payAmount; | |||||
| } | |||||
| public void setPayAmount(Integer payAmount) { | |||||
| this.payAmount = payAmount; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date createTime) { | |||||
| this.createTime = createTime; | |||||
| } | |||||
| public Integer getSharingStatus() { | |||||
| return sharingStatus; | |||||
| } | |||||
| public void setSharingStatus(Integer sharingStatus) { | |||||
| this.sharingStatus = sharingStatus; | |||||
| } | |||||
| public String getFinishTime() { | |||||
| return finishTime; | |||||
| } | |||||
| public void setFinishTime(String finishTime) { | |||||
| this.finishTime = finishTime; | |||||
| } | |||||
| public String getFailedReason() { | |||||
| return failedReason; | |||||
| } | |||||
| public void setFailedReason(String failedReason) { | |||||
| this.failedReason = failedReason; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String description) { | |||||
| this.description = description; | |||||
| } | |||||
| public Integer getReceiverType() { | |||||
| return receiverType; | |||||
| } | |||||
| public void setReceiverType(Integer receiverType) { | |||||
| this.receiverType = receiverType; | |||||
| } | |||||
| public String getReceiverAccount() { | |||||
| return receiverAccount; | |||||
| } | |||||
| public void setReceiverAccount(String receiverAccount) { | |||||
| this.receiverAccount = receiverAccount; | |||||
| } | |||||
| public String getReceiverComments() { | |||||
| return receiverComments; | |||||
| } | |||||
| public void setReceiverComments(String receiverComments) { | |||||
| this.receiverComments = receiverComments; | |||||
| } | |||||
| public Integer getSharingType() { | |||||
| return sharingType; | |||||
| } | |||||
| public void setSharingType(Integer sharingType) { | |||||
| this.sharingType = sharingType; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,65 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class WxProfitSharingOrderQueryVo implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="tenantId",name="tenantId") | |||||
| private String tenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名称",name="merchantName") | |||||
| private String merchantName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="id",name="id") | |||||
| private Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="开始时间",name="startdate") | |||||
| private Date startdate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="结束时间",name="enddate") | |||||
| private Date enddate; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public Date getStartdate() { | |||||
| return startdate; | |||||
| } | |||||
| public void setStartdate(Date startdate) { | |||||
| this.startdate = startdate; | |||||
| } | |||||
| public Date getEnddate() { | |||||
| return enddate; | |||||
| } | |||||
| public void setEnddate(Date enddate) { | |||||
| this.enddate = enddate; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,156 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * @author gongbiao | |||||
| */ | |||||
| public class WxProfitSharingOrderVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| private Long id; | |||||
| private String tenantId; | |||||
| private Long merchantId; | |||||
| private String merchantName; | |||||
| private Long orderId; | |||||
| private Integer payAmount; | |||||
| private Date payTimeEnd; | |||||
| private Date payTimeStart; | |||||
| private String transactionId; | |||||
| private String sharingOrderNo; | |||||
| private Integer type; | |||||
| private String receivers; | |||||
| private String errorMsg; | |||||
| private Integer sharingStatus; | |||||
| private Date updateTime; | |||||
| private Date createTime; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long merchantId) { | |||||
| this.merchantId = merchantId; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public Long getOrderId() { | |||||
| return orderId; | |||||
| } | |||||
| public void setOrderId(Long orderId) { | |||||
| this.orderId = orderId; | |||||
| } | |||||
| public Integer getPayAmount() { | |||||
| return payAmount; | |||||
| } | |||||
| public void setPayAmount(Integer payAmount) { | |||||
| this.payAmount = payAmount; | |||||
| } | |||||
| public Date getPayTimeEnd() { | |||||
| return payTimeEnd; | |||||
| } | |||||
| public void setPayTimeEnd(Date payTimeEnd) { | |||||
| this.payTimeEnd = payTimeEnd; | |||||
| } | |||||
| public Date getPayTimeStart() { | |||||
| return payTimeStart; | |||||
| } | |||||
| public void setPayTimeStart(Date payTimeStart) { | |||||
| this.payTimeStart = payTimeStart; | |||||
| } | |||||
| public String getTransactionId() { | |||||
| return transactionId; | |||||
| } | |||||
| public void setTransactionId(String transactionId) { | |||||
| this.transactionId = transactionId; | |||||
| } | |||||
| public String getSharingOrderNo() { | |||||
| return sharingOrderNo; | |||||
| } | |||||
| public void setSharingOrderNo(String sharingOrderNo) { | |||||
| this.sharingOrderNo = sharingOrderNo; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public String getReceivers() { | |||||
| return receivers; | |||||
| } | |||||
| public void setReceivers(String receivers) { | |||||
| this.receivers = receivers; | |||||
| } | |||||
| public String getErrorMsg() { | |||||
| return errorMsg; | |||||
| } | |||||
| public void setErrorMsg(String errorMsg) { | |||||
| this.errorMsg = errorMsg; | |||||
| } | |||||
| public Integer getSharingStatus() { | |||||
| return sharingStatus; | |||||
| } | |||||
| public void setSharingStatus(Integer sharingStatus) { | |||||
| this.sharingStatus = sharingStatus; | |||||
| } | |||||
| public Date getUpdateTime() { | |||||
| return updateTime; | |||||
| } | |||||
| public void setUpdateTime(Date updateTime) { | |||||
| this.updateTime = updateTime; | |||||
| } | |||||
| public Date getCreateTime() { | |||||
| return createTime; | |||||
| } | |||||
| public void setCreateTime(Date createTime) { | |||||
| this.createTime = createTime; | |||||
| } | |||||
| } | |||||
| @@ -1,16 +1,24 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import java.util.*; | |||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxProfitSharingOrder; | import com.iformall.domain.po.WxProfitSharingOrder; | ||||
| import com.iformall.domain.vo.WxProfitSharingOrderDetailsVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderQueryVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> { | public interface WxProfitSharingOrderMapper extends CommonMapper<WxProfitSharingOrder, Long> { | ||||
| List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | ||||
| List<WxProfitSharingOrderVo> findOrderList(WxProfitSharingOrderQueryVo order); | |||||
| Long queryOrderForSum(Map<String,Object> params); | |||||
| Long queryOrderForMerchantCount(Map<String,Object> params); | |||||
| List<WxProfitSharingOrderDetailsVo> findOrderDetails(Long id); | |||||
| } | } | ||||
| @@ -1,23 +1,36 @@ | |||||
| package com.iformall.service; | package com.iformall.service; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.WxProfitSharingOrder; | import com.iformall.domain.po.WxProfitSharingOrder; | ||||
| import com.iformall.domain.vo.WxProfitSharingOrderQueryVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||||
| import java.util.Map; | |||||
| public interface WxProfitSharingOrderService { | public interface WxProfitSharingOrderService { | ||||
| /** | /** | ||||
| * 创建分账订单 | * 创建分账订单 | ||||
| */ | */ | ||||
| public ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto); | |||||
| ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto); | |||||
| /** | /** | ||||
| * 查询分账订单 | * 查询分账订单 | ||||
| */ | */ | ||||
| public ResultData querySharingOrder(WxProfitSharingOrder sharingOrderDto); | |||||
| ResultData querySharingOrder(WxProfitSharingOrder sharingOrderDto); | |||||
| /** | /** | ||||
| * 结束分账订单 | * 结束分账订单 | ||||
| */ | */ | ||||
| public ResultData finishSharingOrder(WxSharingOrderDto sharingOrderDto); | |||||
| ResultData finishSharingOrder(WxSharingOrderDto sharingOrderDto); | |||||
| PageInfo<WxProfitSharingOrderVo> listAsPage(WxProfitSharingOrderQueryVo order, Integer pageNum, Integer pageSize); | |||||
| Map<String,Object> queryOrderSummary(String tenantId); | |||||
| ResultData findOrderDetails(Long id); | |||||
| } | } | ||||
| @@ -1,31 +1,38 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import java.util.*; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.WxSharingOrderDto; | import com.iformall.domain.dto.WxSharingOrderDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxProfitSharingOrderDetailsVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderQueryVo; | |||||
| import com.iformall.domain.vo.WxProfitSharingOrderVo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.pay.*; | import com.iformall.pay.*; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| import com.iformall.utils.BeanUtils; | import com.iformall.utils.BeanUtils; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import com.iformall.utils.Utility; | import com.iformall.utils.Utility; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | |||||
| import org.springframework.transaction.annotation.Isolation; | import org.springframework.transaction.annotation.Isolation; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.*; | |||||
| @Service | @Service | ||||
| public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderService { | public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderService { | ||||
| @@ -490,4 +497,116 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| wxProfitSharingOrderMapper.updateByPrimaryKey(record); | wxProfitSharingOrderMapper.updateByPrimaryKey(record); | ||||
| return new ResultData(returnMap); | return new ResultData(returnMap); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxProfitSharingOrderVo> listAsPage(WxProfitSharingOrderQueryVo order, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingOrderMapper.findOrderList(order)); | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> queryOrderSummary(String tenantId) { | |||||
| Map<String, Object> result = new HashMap<>(); | |||||
| queryMerchantCount(tenantId, result); | |||||
| queryOrderSummary(tenantId,result); | |||||
| return result; | |||||
| } | |||||
| @Override | |||||
| public ResultData findOrderDetails(Long id) { | |||||
| Map<String,Object> result=new HashMap<>(2); | |||||
| WxProfitSharingOrderQueryVo wxProfitSharingOrderQueryVo = new WxProfitSharingOrderQueryVo(); | |||||
| wxProfitSharingOrderQueryVo.setId(id); | |||||
| WxProfitSharingOrderVo wxProfitSharingOrderVo = wxProfitSharingOrderMapper.findOrderList(wxProfitSharingOrderQueryVo).get(0); | |||||
| List<WxProfitSharingOrderDetailsVo> orderDetails = wxProfitSharingOrderMapper.findOrderDetails(id); | |||||
| result.put("order",wxProfitSharingOrderVo); | |||||
| result.put("details",orderDetails); | |||||
| return new ResultData(result); | |||||
| } | |||||
| public void queryMerchantCount(String tenantId, Map<String, Object> result) { | |||||
| //全部商户个数 | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| Long allMerchantCount=wxProfitSharingOrderMapper.queryOrderForMerchantCount(params); | |||||
| result.put("allMerchantCount",allMerchantCount); | |||||
| //今日 | |||||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd"); | |||||
| params.put("startdate", systemTime + " 00:00:00"); | |||||
| params.put("enddate", systemTime + " 23:59:59"); | |||||
| Long todayMerchantCount=wxProfitSharingOrderMapper.queryOrderForMerchantCount(params); | |||||
| result.put("todayMerchantCount",todayMerchantCount); | |||||
| //昨日 | |||||
| String yesterday = DateUtils.getTimeBefore(1, new Date()); | |||||
| params.put("startdate", yesterday + " 00:00:00"); | |||||
| params.put("enddate", yesterday + " 23:59:59"); | |||||
| Long yesterdayMerchantCount=wxProfitSharingOrderMapper.queryOrderForMerchantCount(params); | |||||
| result.put("yesterdayMerchantCount",yesterdayMerchantCount); | |||||
| //上周 | |||||
| String lastweek = DateUtils.getTimeBefore(7, new Date()); | |||||
| params.put("startdate", lastweek + " 00:00:00"); | |||||
| params.put("enddate", lastweek + " 23:59:59"); | |||||
| Long lastweekMerchantCount=wxOrderMapper.queryOrderForMerchantCount(params); | |||||
| result.put("lastweekMerchantCount",lastweekMerchantCount); | |||||
| //商户数日环比 | |||||
| if (yesterdayMerchantCount > 0) { | |||||
| double hbd = (double) (todayMerchantCount - yesterdayMerchantCount) / yesterdayMerchantCount * 100; | |||||
| double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||||
| result.put("increasedPercentMerchant", hb+"%"); | |||||
| } else { | |||||
| result.put("increasedPercentMerchant", "--"); | |||||
| } | |||||
| //商户数周同比 | |||||
| if (lastweekMerchantCount > 0) { | |||||
| double hbd = (double) (todayMerchantCount - lastweekMerchantCount) / lastweekMerchantCount * 100; | |||||
| double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||||
| result.put("increasedPercentWeekMerchant", hb+"%"); | |||||
| } else { | |||||
| result.put("increasedPercentWeekMerchant", "--"); | |||||
| } | |||||
| } | |||||
| public void queryOrderSummary(String tenantId, Map<String, Object> result) { | |||||
| //全部商户个数 | |||||
| Map<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| Long allOrderSummary=wxProfitSharingOrderMapper.queryOrderForSum(params); | |||||
| result.put("allOrderSummary",allOrderSummary); | |||||
| //今日 | |||||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd"); | |||||
| params.put("startdate", systemTime + " 00:00:00"); | |||||
| params.put("enddate", systemTime + " 23:59:59"); | |||||
| Long todayOrderSummary=wxProfitSharingOrderMapper.queryOrderForSum(params); | |||||
| result.put("todayOrderSummary",todayOrderSummary); | |||||
| //昨日 | |||||
| String yesterday = DateUtils.getTimeBefore(1, new Date()); | |||||
| params.put("startdate", yesterday + " 00:00:00"); | |||||
| params.put("enddate", yesterday + " 23:59:59"); | |||||
| Long yesterdayOrderSummary=wxProfitSharingOrderMapper.queryOrderForSum(params); | |||||
| result.put("yesterdayOrderSummary",yesterdayOrderSummary); | |||||
| //上周 | |||||
| String lastweek = DateUtils.getTimeBefore(7, new Date()); | |||||
| params.put("startdate", lastweek + " 00:00:00"); | |||||
| params.put("enddate", lastweek + " 23:59:59"); | |||||
| Long lastweekOrderSummary=wxProfitSharingOrderMapper.queryOrderForSum(params); | |||||
| result.put("lastweekOrderSummary",lastweekOrderSummary); | |||||
| //商户数日环比 | |||||
| if (yesterdayOrderSummary > 0) { | |||||
| double hbd = (double) (todayOrderSummary - yesterdayOrderSummary) / yesterdayOrderSummary * 100; | |||||
| double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||||
| result.put("increasedPercentSummary", hb+"%"); | |||||
| } else { | |||||
| result.put("increasedPercentSummary", "--"); | |||||
| } | |||||
| //商户数周同比 | |||||
| if (lastweekOrderSummary > 0) { | |||||
| double hbd = (double) (todayOrderSummary - lastweekOrderSummary) / lastweekOrderSummary * 100; | |||||
| double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||||
| result.put("increasedPercentWeekSummary", hb+"%"); | |||||
| } else { | |||||
| result.put("increasedPercentWeekSummary", "--"); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -269,12 +269,14 @@ | |||||
| <result column="name" jdbcType="VARCHAR" property="bUserName" /> | <result column="name" jdbcType="VARCHAR" property="bUserName" /> | ||||
| <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | <result column="bphone" jdbcType="VARCHAR" property="bUserPhone" /> | ||||
| <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | <result column="phone" jdbcType="VARCHAR" property="cUserPhone" /> | ||||
| <result column="c_user_name" jdbcType="VARCHAR" property="cUserName" /> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allPayOrderColumns"> | <sql id="allPayOrderColumns"> | ||||
| o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`, | o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`, | ||||
| o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`, | ||||
| m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone | |||||
| m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone,cu.`name` c_user_name | |||||
| </sql> | </sql> | ||||
| <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | <select id="findListOfMicroPayOrderByDate" parameterType="map" resultMap="PayVoResultMap"> | ||||
| @@ -104,5 +104,98 @@ | |||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <resultMap id="orderMap" type="com.iformall.domain.vo.WxProfitSharingOrderVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | |||||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" /> | |||||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" /> | |||||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | |||||
| <result column="sharing_order_no" jdbcType="VARCHAR" property="sharingOrderNo" /> | |||||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||||
| <result column="receivers" jdbcType="VARCHAR" property="receivers" /> | |||||
| <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" /> | |||||
| <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||||
| </resultMap> | |||||
| <select id="findOrderList" parameterType="com.iformall.domain.vo.WxProfitSharingOrderQueryVo" resultMap="orderMap"> | |||||
| select pso.*,m.`name` merchant_name from wx_profit_sharing_order pso | |||||
| left join wx_merchant m on pso.merchant_id=m.id | |||||
| <where> | |||||
| <if test="tenantId!=null"> | |||||
| and pso.tenant_id =#{tenantId} | |||||
| </if> | |||||
| <if test="id!=null"> | |||||
| and pso.id =#{id} | |||||
| </if> | |||||
| <if test="merchantName!=null"> | |||||
| and m.`name` like concat('%',#{merchantName},'%') | |||||
| </if> | |||||
| <if test="startdate!=null and enddate!=null"> | |||||
| and pso.create_date between #{startdate} and #{enddate} | |||||
| </if> | |||||
| </where> | |||||
| order by pso.id desc | |||||
| </select> | |||||
| <select id="queryOrderForMerchantCount" resultType="Long" parameterType="hashmap"> | |||||
| select count(*) merchantCount from ( | |||||
| select distinct merchant_id from wx_profit_sharing_order | |||||
| <where> | |||||
| <if test="tenantId!=null"> | |||||
| and tenant_id =#{tenantId} | |||||
| </if> | |||||
| <if test="startdate!=null and enddate!=null"> | |||||
| and create_time between #{startdate} and #{enddate} | |||||
| </if> | |||||
| </where> | |||||
| ) o | |||||
| </select> | |||||
| <select id="queryOrderForSum" resultType="Long" parameterType="hashmap"> | |||||
| select ifnull(sum(pay_amount),0) payment from wx_profit_sharing_order | |||||
| <where> | |||||
| <if test="tenantId!=null"> | |||||
| and tenant_id =#{tenantId} | |||||
| </if> | |||||
| <if test="startdate!=null and enddate!=null"> | |||||
| and create_time between #{startdate} and #{enddate} | |||||
| </if> | |||||
| </where> | |||||
| </select> | |||||
| <resultMap id="orderDetailsMap" type="com.iformall.domain.vo.WxProfitSharingOrderDetailsVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||||
| <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" /> | |||||
| <result column="finish_time" jdbcType="VARCHAR" property="finishTime" /> | |||||
| <result column="failed_reason" jdbcType="VARCHAR" property="failedReason" /> | |||||
| <result column="description" jdbcType="VARCHAR" property="description" /> | |||||
| <result column="receiver_type" jdbcType="INTEGER" property="receiverType" /> | |||||
| <result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount" /> | |||||
| <result column="receiver_comments" jdbcType="VARCHAR" property="receiverComments" /> | |||||
| <result column="sharing_type" jdbcType="INTEGER" property="sharingType" /> | |||||
| <result column="status" jdbcType="VARCHAR" property="status" /> | |||||
| </resultMap> | |||||
| <select id="findOrderDetail" resultMap="orderDetailsMap"> | |||||
| select psr.id,psr.tenant_id,psr.pay_amount,psr.create_time,sharing_status,finish_time,failed_reason,description, | |||||
| psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status` | |||||
| from wx_profit_sharing_result psr left join wx_profit_sharing_receiver psre on psr.sharing_receiver_id=psre.id | |||||
| where psr.sharing_order_id=#{value} | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||