| @@ -1,9 +1,9 @@ | |||||
| package com.iformall.controller; | package com.iformall.controller; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||||
| import com.iformall.service.WxMerchantTradeDailyService; | import com.iformall.service.WxMerchantTradeDailyService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -13,6 +13,10 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.Calendar; | |||||
| import java.util.Date; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxMerchantTradeDaily") | @RequestMapping("wxMerchantTradeDaily") | ||||
| public class WxMerchantTradeDailyController extends BaseController { | public class WxMerchantTradeDailyController extends BaseController { | ||||
| @@ -21,46 +25,29 @@ public class WxMerchantTradeDailyController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantTradeDailyService wxMerchantTradeDailyService; | private WxMerchantTradeDailyService wxMerchantTradeDailyService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiOperation("获得昨日解单列表") | |||||
| @GetMapping("/listYesterday") | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| public ResultData list(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||||
| if (null == wxMerchantTradeDaily) wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||||
| final PageInfo<WxMerchantTradeDaily> page = wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum, pageSize); | |||||
| public ResultData listYesterday(@ModelAttribute WxMerchantTradeDailyVo wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||||
| if (wxMerchantTradeDaily == null) wxMerchantTradeDaily = new WxMerchantTradeDailyVo(); | |||||
| wxMerchantTradeDaily.setTenantId(getTenantId()); | |||||
| Calendar cal = Calendar.getInstance(); | |||||
| cal.setTime(new Date()); | |||||
| cal.add(Calendar.DAY_OF_YEAR, -1); | |||||
| SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | |||||
| wxMerchantTradeDaily.setReportDate(fmt.format(cal.getTime())); | |||||
| final PageInfo<WxMerchantTradeDailyVo> page = wxMerchantTradeDailyService.listAsPageVo(wxMerchantTradeDaily, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||||
| //Assert.notNull(wxMerchantTradeDaily.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxMerchantTradeDailyService.saveOrUpdate(wxMerchantTradeDaily); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||||
| wxMerchantTradeDailyService.saveOrUpdate(wxMerchantTradeDaily); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| wxMerchantTradeDailyService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantTradeDailyService.getById(id)); | |||||
| @ApiOperation("获得近30日解单") | |||||
| @GetMapping("/detail") | |||||
| public ResultData detail(Long merchantId) { | |||||
| return wxMerchantTradeDailyService.getVolumeOfMonth(merchantId); | |||||
| } | } | ||||
| @@ -46,6 +46,9 @@ public class WxMerchantTradeDaily implements Serializable { | |||||
| /*商户id**/ | /*商户id**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId") | @io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId") | ||||
| private Long merchantId; | private Long merchantId; | ||||
| /*b用户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "b用户id", name = "bUserId") | |||||
| private Long bUserId; | |||||
| /*交易额**/ | /*交易额**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "交易额", name = "tradeAmt") | @io.swagger.annotations.ApiModelProperty(value = "交易额", name = "tradeAmt") | ||||
| private Integer tradeAmt; | private Integer tradeAmt; | ||||
| @@ -75,6 +78,14 @@ public class WxMerchantTradeDaily implements Serializable { | |||||
| merchantId = _merchantId; | merchantId = _merchantId; | ||||
| } | } | ||||
| public Long getbUserId() { | |||||
| return bUserId; | |||||
| } | |||||
| public void setbUserId(Long bUserId) { | |||||
| this.bUserId = bUserId; | |||||
| } | |||||
| public Integer getTradeAmt() { | public Integer getTradeAmt() { | ||||
| return tradeAmt; | return tradeAmt; | ||||
| } | } | ||||
| @@ -0,0 +1,219 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| public class WxMerchantTradeDailyVo implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<String> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<String> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<String> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /*租户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") | |||||
| private String tenantId; | |||||
| /*商户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId") | |||||
| private Long merchantId; | |||||
| /*b用户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "b用户id", name = "bUserId") | |||||
| private Long bUserId; | |||||
| /*交易额**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "交易额", name = "tradeAmt") | |||||
| private Integer tradeAmt; | |||||
| /*提交日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "解单提交日期", name = "createDate") | |||||
| private Date createDate; | |||||
| /*更新日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "解单更新日期", name = "updateDate") | |||||
| private Date updateDate; | |||||
| /*解单日期**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "解单日期", name = "reportDate") | |||||
| private String reportDate; | |||||
| /*商户名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="merchantName") | |||||
| private String merchantName; | |||||
| /*b端用户姓名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "b端用户姓名", name = "bUserName") | |||||
| private String bUserName; | |||||
| /*B端用户手机号**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "B端用户手机号", name = "bUserPhone") | |||||
| private String bUserPhone; | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public String getbUserName() { | |||||
| return bUserName; | |||||
| } | |||||
| public void setbUserName(String bUserName) { | |||||
| this.bUserName = bUserName; | |||||
| } | |||||
| public String getbUserPhone() { | |||||
| return bUserPhone; | |||||
| } | |||||
| public void setbUserPhone(String bUserPhone) { | |||||
| this.bUserPhone = bUserPhone; | |||||
| } | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Long getbUserId() { | |||||
| return bUserId; | |||||
| } | |||||
| public void setbUserId(Long bUserId) { | |||||
| this.bUserId = bUserId; | |||||
| } | |||||
| public Integer getTradeAmt() { | |||||
| return tradeAmt; | |||||
| } | |||||
| public void setTradeAmt(Integer _tradeAmt) { | |||||
| tradeAmt = _tradeAmt; | |||||
| } | |||||
| public Date getCreateDate() { | |||||
| return createDate; | |||||
| } | |||||
| public void setCreateDate(Date _createDate) { | |||||
| createDate = _createDate; | |||||
| } | |||||
| public Date getUpdateDate() { | |||||
| return updateDate; | |||||
| } | |||||
| public void setUpdateDate(Date _updateDate) { | |||||
| updateDate = _updateDate; | |||||
| } | |||||
| public String getReportDate() { | |||||
| return reportDate; | |||||
| } | |||||
| public void setReportDate(String _reportDate) { | |||||
| reportDate = _reportDate; | |||||
| } | |||||
| public static enum Field { | |||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | |||||
| TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"), | |||||
| MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"), | |||||
| TradeAmt_ASC("`trade_amt` ASC"), TradeAmt_DESC("`trade_amt` DESC"), | |||||
| CreateDate_ASC("`create_date` ASC"), CreateDate_DESC("`create_date` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxMerchantTradeDailyVo.Field... fields) { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new java.util.ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -3,14 +3,16 @@ package com.iformall.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||||
| public interface WxMerchantTradeDailyMapper extends CommonMapper<WxMerchantTradeDaily, String> { | public interface WxMerchantTradeDailyMapper extends CommonMapper<WxMerchantTradeDaily, String> { | ||||
| List<WxMerchantTradeDaily> findList(WxMerchantTradeDaily wxMerchantTradeDaily); | List<WxMerchantTradeDaily> findList(WxMerchantTradeDaily wxMerchantTradeDaily); | ||||
| List<WxMerchantTradeDaily> findListOfWeek(WxMerchantTradeDaily wxMerchantTradeDaily); | List<WxMerchantTradeDaily> findListOfWeek(WxMerchantTradeDaily wxMerchantTradeDaily); | ||||
| List<WxMerchantTradeDailyVo> findListVo(WxMerchantTradeDailyVo wxMerchantTradeDaily); | |||||
| List<WxMerchantTradeDailyVo> findListVoOfMonth(WxMerchantTradeDaily wxMerchantTradeDaily); | |||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||||
| public interface WxMerchantTradeDailyService { | public interface WxMerchantTradeDailyService { | ||||
| @@ -46,20 +47,36 @@ public interface WxMerchantTradeDailyService { | |||||
| * @param volume | * @param volume | ||||
| */ | */ | ||||
| public ResultData saveDailyTradingVolume(Long userId, Integer volume); | |||||
| ResultData saveDailyTradingVolume(Long userId, Integer volume); | |||||
| /** | /** | ||||
| * 获取当日解单数据 | * 获取当日解单数据 | ||||
| */ | */ | ||||
| public ResultData getVolume(Long userId); | |||||
| ResultData getVolume(Long userId); | |||||
| /** | /** | ||||
| * 获取近7日解单数据 | * 获取近7日解单数据 | ||||
| */ | */ | ||||
| public ResultData getVolumeOfWeek(Long userId); | |||||
| ResultData getVolumeOfWeek(Long userId); | |||||
| /** | |||||
| * 获取近30日解单数据 ADMIN 端 | |||||
| */ | |||||
| ResultData getVolumeOfMonth(Long merchantId); | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxMerchantTradeDailyVo> listAsPageVo(WxMerchantTradeDailyVo record, Integer pageIndex, Integer pageSize); | |||||
| } | } | ||||
| @@ -2,6 +2,8 @@ package com.iformall.service.impl; | |||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| @@ -10,6 +12,7 @@ import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxMerchantBUser; | import com.iformall.domain.po.WxMerchantBUser; | ||||
| import com.iformall.domain.po.WxMerchantTradeDaily; | import com.iformall.domain.po.WxMerchantTradeDaily; | ||||
| import com.iformall.domain.vo.WxMerchantTradeDailyVo; | |||||
| import com.iformall.mapper.WxMerchantTradeDailyMapper; | import com.iformall.mapper.WxMerchantTradeDailyMapper; | ||||
| import com.iformall.service.WxMerchantTradeDailyService; | import com.iformall.service.WxMerchantTradeDailyService; | ||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| @@ -18,6 +21,7 @@ import com.iformall.service.WxMerchantService; | |||||
| 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.boot.autoconfigure.security.SecurityProperties; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| @@ -104,6 +108,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| wxMerchantTradeDaily.setId(idWorker.nextId()); | wxMerchantTradeDaily.setId(idWorker.nextId()); | ||||
| wxMerchantTradeDaily.setTenantId(merchant.getTenantId()); | wxMerchantTradeDaily.setTenantId(merchant.getTenantId()); | ||||
| wxMerchantTradeDaily.setMerchantId(merchant.getId()); | wxMerchantTradeDaily.setMerchantId(merchant.getId()); | ||||
| wxMerchantTradeDaily.setbUserId(userId); | |||||
| wxMerchantTradeDaily.setTradeAmt(volume); | wxMerchantTradeDaily.setTradeAmt(volume); | ||||
| wxMerchantTradeDaily.setCreateDate(new Date()); | wxMerchantTradeDaily.setCreateDate(new Date()); | ||||
| wxMerchantTradeDaily.setUpdateDate(new Date()); | wxMerchantTradeDaily.setUpdateDate(new Date()); | ||||
| @@ -113,6 +118,46 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxMerchantTradeDailyVo> listAsPageVo(WxMerchantTradeDailyVo record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantTradeDailyMapper.findListVo(record)); | |||||
| } | |||||
| @Override | |||||
| public ResultData getVolumeOfMonth(Long merchantId) { | |||||
| WxMerchant merchant = wxMerchantService.getById(merchantId); | |||||
| if (merchant==null) | |||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||||
| wxMerchantTradeDaily.setMerchantId(merchantId); | |||||
| List<WxMerchantTradeDailyVo> recordList = wxMerchantTradeDailyMapper.findListVoOfMonth(wxMerchantTradeDaily); | |||||
| Map<String,WxMerchantTradeDailyVo> recordMap = recordList.stream().collect(Collectors.toMap(WxMerchantTradeDailyVo::getReportDate, r -> r)); | |||||
| List<WxMerchantTradeDailyVo> tradeList = new ArrayList<>(); | |||||
| Calendar cal = Calendar.getInstance(); | |||||
| SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); | |||||
| SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); | |||||
| cal.setTime(new Date()); | |||||
| for (int i = 0; i < 30; i++) { | |||||
| cal.add(Calendar.DAY_OF_YEAR, -1); | |||||
| WxMerchantTradeDailyVo trade = recordMap.get(fmt.format(cal.getTime())); | |||||
| if (trade != null){ | |||||
| trade.setReportDate(fmtv.format(cal.getTime())); | |||||
| tradeList.add(trade); | |||||
| }else { | |||||
| trade = new WxMerchantTradeDailyVo(); | |||||
| trade.setTradeAmt(0); | |||||
| trade.setReportDate(fmtv.format(cal.getTime())); | |||||
| tradeList.add(trade); | |||||
| } | |||||
| } | |||||
| return new ResultData(tradeList); | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData getVolume(Long userId) { | public ResultData getVolume(Long userId) { | ||||
| @@ -175,14 +220,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ | |||||
| SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd"); | ||||
| wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | wxMerchantTradeDaily.setReportDate(fmt.format(new Date())); | ||||
| List<WxMerchantTradeDaily> tradeList = wxMerchantTradeDailyMapper.findListOfWeek(wxMerchantTradeDaily); | |||||
| if (tradeList.size() > 0 ) { | |||||
| return new ResultData(tradeList); | |||||
| } | |||||
| return new ResultData(ErrorCode.DALIY_REPORT_VOLUME_WEEK_NULL); | |||||
| return new ResultData(wxMerchantTradeDailyMapper.findListOfWeek(wxMerchantTradeDaily)); | |||||
| } | } | ||||
| @@ -5,6 +5,7 @@ | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | ||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||||
| <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | ||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | ||||
| @@ -12,7 +13,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`merchant_id`,`trade_amt`,`create_date`,`update_date`,`report_date` | |||||
| `id`,`tenant_id`,`merchant_id`,`b_user_id`,`trade_amt`,`create_date`,`update_date`,`report_date` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -31,8 +32,13 @@ | |||||
| <if test=" null != merchantId "> | <if test=" null != merchantId "> | ||||
| and `merchant_id` = #{merchantId} | and `merchant_id` = #{merchantId} | ||||
| </if> | |||||
| </if> | |||||
| <if test=" null != bUserId "> | |||||
| and `b_user_id` = #{bUserId} | |||||
| </if> | |||||
| <if test=" null != tradeAmt "> | <if test=" null != tradeAmt "> | ||||
| and `trade_amt` = #{tradeAmt} | and `trade_amt` = #{tradeAmt} | ||||
| @@ -81,8 +87,70 @@ | |||||
| </if> | </if> | ||||
| order by create_date desc LIMIT 7 | order by create_date desc LIMIT 7 | ||||
| </select> | </select> | ||||
| <resultMap id="BaseResultMapVo" type="com.iformall.domain.vo.WxMerchantTradeDailyVo"> | |||||
| <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="b_user_id" jdbcType="BIGINT" property="bUserId" /> | |||||
| <result column="trade_amt" jdbcType="DECIMAL" property="tradeAmt" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="report_date" jdbcType="VARCHAR" property="reportDate" /> | |||||
| <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="b_user_name" jdbcType="VARCHAR" property="bUserName" /> | |||||
| <result column="b_user_phone" jdbcType="VARCHAR" property="bUserPhone"/> | |||||
| </resultMap> | |||||
| <sql id="allColumnsVo"> | |||||
| mtd.id as id, mtd.tenant_id as tenant_id, mtd.merchant_id as merchant_id, mtd.b_user_id as b_user_id,`trade_amt`,mtd.create_date as create_date,mtd.update_date as update_date,`report_date`, m.name as merchant_name, mbu.name as b_user_name, mbu.phone as b_user_phone | |||||
| </sql> | |||||
| <select id="findListVo" parameterType="com.iformall.domain.vo.WxMerchantTradeDailyVo" resultMap="BaseResultMapVo"> | |||||
| select <include refid="allColumnsVo" /> | |||||
| from wx_merchant_trade_daily mtd | |||||
| inner join wx_merchant m on mtd.merchant_id = m.id | |||||
| left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id | |||||
| where 1=1 | |||||
| <if test=" null != merchantName "> | |||||
| and m.name like concat('%', #{merchantName},'%') | |||||
| </if> | |||||
| <if test=" reportDate!=null"> | |||||
| and mtd.report_date = #{reportDate} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and mtd.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and mtd.merchant_id = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </select> | |||||
| <select id="findListVoOfMonth" parameterType="com.iformall.domain.po.WxMerchantTradeDaily" resultMap="BaseResultMapVo"> | |||||
| select <include refid="allColumnsVo" /> | |||||
| from wx_merchant_trade_daily mtd | |||||
| inner join wx_merchant m on mtd.merchant_id = m.id | |||||
| left join wx_merchant_b_user mbu on mtd.b_user_id = mbu.id | |||||
| where 1 = 1 | |||||
| <if test=" null != tenantId "> | |||||
| and mtd.tenant_id = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and mtd.merchant_id = #{merchantId} | |||||
| </if> | |||||
| order by mtd.create_date desc LIMIT 30 | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||