From ad97ea252f7c829b81e0593b5e1bd52fedd9d395 Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Sun, 12 Aug 2018 15:46:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20B=E7=AB=AF=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E4=BA=A4=E6=98=93=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=92=8C=E6=A0=B8=E9=94=80=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxCUserBasicInfoController.java | 3 + .../WxDateAmountRecordController.java | 110 ++++++++++++++++++ .../simple/domain/po/WxCUserBasicInfo.java | 37 ++++-- .../simple/domain/po/WxDateAmountRecord.java | 10 ++ .../com/simple/domain/vo/AmountRecordVo.java | 41 +++++++ .../mapper/WxCUserBasicInfoMapper.xml | 14 ++- .../mapper/WxDateAmountRecordMapper.xml | 8 +- 7 files changed, 213 insertions(+), 10 deletions(-) create mode 100644 mallinkBApi/src/main/java/com/simple/controller/WxDateAmountRecordController.java create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/AmountRecordVo.java diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java index 46602754c..055a32c6b 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java @@ -37,6 +37,7 @@ public class WxCUserBasicInfoController extends BaseController @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) public ResultData list(@ModelAttribute WxCUserBasicInfo wxCUserBasicInfo,Integer pageNum, Integer pageSize) { if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfo(); + wxCUserBasicInfo.setTenantId(getTenantId()); final PageInfo page = wxCUserBasicInfoService.listAsPage(wxCUserBasicInfo, pageNum, pageSize); return new ResultData(page); } @@ -46,6 +47,7 @@ public class WxCUserBasicInfoController extends BaseController public ResultData add(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { //Assert.notNull(wxCUserBasicInfo.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + wxCUserBasicInfo.setTenantId(getTenantId()); wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); return new ResultData(); } @@ -53,6 +55,7 @@ public class WxCUserBasicInfoController extends BaseController @ApiOperation("根据id更新接口") @PostMapping("update") public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) { + wxCUserBasicInfo.setTenantId(getTenantId()); wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo); return new ResultData(); } diff --git a/mallinkBApi/src/main/java/com/simple/controller/WxDateAmountRecordController.java b/mallinkBApi/src/main/java/com/simple/controller/WxDateAmountRecordController.java new file mode 100644 index 000000000..888f92d26 --- /dev/null +++ b/mallinkBApi/src/main/java/com/simple/controller/WxDateAmountRecordController.java @@ -0,0 +1,110 @@ +package com.simple.controller; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.github.pagehelper.PageInfo; +import com.simple.common.Result; +import com.simple.common.ResultData; +import com.simple.domain.po.WxDateAmountRecord; +import com.simple.domain.vo.AmountRecordVo; +import com.simple.service.WxDateAmountRecordService; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; + +@RestController +@RequestMapping("wxDateAmountRecord") +@Api(description="首页查询交易金额记录和核销记录接口") +public class WxDateAmountRecordController extends BaseController +{ + @Autowired + private WxDateAmountRecordService wxDateAmountRecordService; + + private Logger logger = Logger.getLogger(WxDateAmountRecordController.class); + + + @ApiOperation("首页查询交易金额记录和核销记录接口") + @ApiImplicitParams({ + @ApiImplicitParam(name="tenantId",value="租户id",dataType="String", paramType = "query",required=true), + @ApiImplicitParam(name="merchantId",value="商户id",dataType="long", paramType = "query",required=true)}) + public ResultData getRecord(String tenantId,Long merchantId) { + Calendar c =Calendar.getInstance(); + int weekOfYear =c.get(Calendar.WEEK_OF_YEAR); + WxDateAmountRecord temp = new WxDateAmountRecord(); + temp.setDayOfWeek(weekOfYear); + temp.setTenantId(tenantId); + temp.setMerchantId(merchantId); + AmountRecordVo vo = new AmountRecordVo(); + vo.setOrderAmountList(getAmountRecord(temp, 0)); + vo.setVerifyAmountList(getAmountRecord(temp, 0)); + return new ResultData(Result.SUCCESS,"ok",vo); + } + + private List getAmountRecord( WxDateAmountRecord temp,int type){ + temp.setType(type); + List list =new ArrayList<>(); + for(int i=1;i<=7;i++) {//周日是1 + temp.setDayOfWeek(i); + PageInfo page = wxDateAmountRecordService.listAsPage(temp, 1, 1); + if(page.getSize()>0) { + list.add(page.getList().get(0)); + } + } + return list; + } + + +// @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 WxDateAmountRecord wxDateAmountRecord,Integer pageNum, Integer pageSize) { +// if (null == wxDateAmountRecord) wxDateAmountRecord = new WxDateAmountRecord(); +// final PageInfo page = wxDateAmountRecordService.listAsPage(wxDateAmountRecord, pageNum, pageSize); +// return new ResultData(page); +// } + +// @ApiOperation("新增接口") +// @PostMapping("add") +// public ResultData add(@RequestBody WxDateAmountRecord wxDateAmountRecord) { +// //Assert.notNull(wxDateAmountRecord.getName(), "角色名不能为空"); +// //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); +// wxDateAmountRecordService.saveOrUpdate(wxDateAmountRecord); +// return new ResultData(); +// } +// +// @ApiOperation("根据id更新接口") +// @PostMapping("update") +// public ResultData update(@RequestBody WxDateAmountRecord wxDateAmountRecord) { +// wxDateAmountRecordService.saveOrUpdate(wxDateAmountRecord); +// return new ResultData(); +// } +// +// @ApiOperation("根据id删除接口") +// @GetMapping("/del") +// @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) +// public ResultData delete(Long id) { +// wxDateAmountRecordService.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,"查询成功",wxDateAmountRecordService.getById(id)); +// } + + + +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index 95df69cda..1a41bb7d1 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -1,12 +1,12 @@ package com.simple.domain.po; -import javax.persistence.*; -import java.util.*; -import java.math.*; -import javax.persistence.Transient; +import java.io.Serializable; +import java.util.Date; import java.util.List; + import javax.persistence.Id; -import java.io.Serializable; +import javax.persistence.Table; +import javax.persistence.Transient; @Table(name = "wx_c_user_basic_info") public class WxCUserBasicInfo implements Serializable { @@ -16,7 +16,7 @@ public class WxCUserBasicInfo implements Serializable { protected Long id; @Transient - protected List ids; + protected List ids; @Transient protected String sortColumns; @@ -32,10 +32,11 @@ public class WxCUserBasicInfo implements Serializable { return sortColumns; } - public List getIds() { + public List getIds() { return ids; } - public void setIds(List ids) { + + public void setIds(List ids) { this.ids = ids; } @@ -74,6 +75,12 @@ public class WxCUserBasicInfo implements Serializable { /*更新时间**/ @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; + /*租户id**/ + @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") + private String tenantId; + /*商户id**/ + @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") + private Long merchantId; public String getPhone() { return phone; } @@ -140,6 +147,18 @@ public class WxCUserBasicInfo implements Serializable { public void setUpdateDate(Date _updateDate) { updateDate = _updateDate; } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + public Long getMerchantId() { + return merchantId; + } + public void setMerchantId(Long _merchantId) { + merchantId = _merchantId; + } @@ -157,6 +176,8 @@ public class WxCUserBasicInfo implements Serializable { ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") ; private String value; Field(String value){ diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxDateAmountRecord.java b/mallinkService/src/main/java/com/simple/domain/po/WxDateAmountRecord.java index cb07c5a81..eebfd302d 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxDateAmountRecord.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxDateAmountRecord.java @@ -69,6 +69,9 @@ public class WxDateAmountRecord implements Serializable { /*更新日期**/ @io.swagger.annotations.ApiModelProperty(value="更新日期",name="updateDate") private Date updateDate; + /*类型:0 交易记录 1.核销记录**/ + @io.swagger.annotations.ApiModelProperty(value="类型:0 交易记录 1.核销记录",name="type") + private Integer type; public Date getDate() { return date; } @@ -123,6 +126,12 @@ public class WxDateAmountRecord implements Serializable { public void setUpdateDate(Date _updateDate) { updateDate = _updateDate; } + public Integer getType() { + return type; + } + public void setType(Integer _type) { + type = _type; + } @@ -138,6 +147,7 @@ public class WxDateAmountRecord implements Serializable { ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") + ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") ; private String value; Field(String value){ diff --git a/mallinkService/src/main/java/com/simple/domain/vo/AmountRecordVo.java b/mallinkService/src/main/java/com/simple/domain/vo/AmountRecordVo.java new file mode 100644 index 000000000..cfca6e507 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/AmountRecordVo.java @@ -0,0 +1,41 @@ +package com.simple.domain.vo; + +import java.io.Serializable; +/** + * 交易记录核销记录Vo + * @author jinguo + * + */ +import java.util.List; + +import com.simple.domain.po.WxDateAmountRecord; +public class AmountRecordVo implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 4494858079134918638L; + + List orderAmountList; + + List verifyAmountList; + + public List getOrderAmountList() { + return orderAmountList; + } + + public void setOrderAmountList(List orderAmountList) { + this.orderAmountList = orderAmountList; + } + + public List getVerifyAmountList() { + return verifyAmountList; + } + + public void setVerifyAmountList(List verifyAmountList) { + this.verifyAmountList = verifyAmountList; + } + + + +} diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index f52d61459..41c7e25bd 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -14,10 +14,12 @@ + + - `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`c_user_id`,`create_date`,`update_date` + `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`c_user_id`,`create_date`,`update_date`,`tenant_id`,`merchant_id` @@ -81,6 +83,16 @@ and `update_date` = #{updateDate} + + + + and `tenant_id` like concat('%', #{tenantId},'%') + + + + + and `merchant_id` = #{merchantId} + and id in diff --git a/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml b/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml index 5904b0e76..201fceed4 100644 --- a/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxDateAmountRecordMapper.xml @@ -12,10 +12,11 @@ + - `id`,`date`,`day_of_week`,`week_of_year`,`pay_price`,`tenant_id`,`month`,`merchant_id`,`create_date`,`update_date` + `id`,`date`,`day_of_week`,`week_of_year`,`pay_price`,`tenant_id`,`month`,`merchant_id`,`create_date`,`update_date`,`type` @@ -69,6 +70,11 @@ and `update_date` = #{updateDate} + + + + and `type` = #{type} + and id in