| @@ -1,7 +1,9 @@ | |||
| package com.simple.controller; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import org.apache.log4j.Logger; | |||
| @@ -34,41 +36,42 @@ public class WxDateAmountRecordController extends BaseController | |||
| private Logger logger = Logger.getLogger(WxDateAmountRecordController.class); | |||
| @ApiOperation("首页查询交易金额记录和核销记录接口") | |||
| @GetMapping("list") | |||
| public ResultData getRecord() { | |||
| Calendar c =Calendar.getInstance(); | |||
| int weekOfYear =c.get(Calendar.WEEK_OF_YEAR); | |||
| int day =c.get(Calendar.DAY_OF_WEEK); | |||
| WxDateAmountRecord temp = new WxDateAmountRecord(); | |||
| temp.setWeekOfYear(weekOfYear); | |||
| WxMerchantBUser u = getUser(); | |||
| temp.setTenantId(u.getTenantId()); | |||
| temp.setMerchantId(u.getMerchantId()); | |||
| AmountRecordVo vo = new AmountRecordVo(); | |||
| vo.setOrderAmountList(getAmountRecord(temp, day,0,vo)); | |||
| vo.setVerifyAmountList(getAmountRecord(temp,day, 1,vo)); | |||
| return new ResultData(Result.SUCCESS,"ok",vo); | |||
| @ApiOperation("首页查询交易金额记录接口") | |||
| @GetMapping("listOrder") | |||
| public ResultData listOrder() { | |||
| return list(0); | |||
| } | |||
| private List<WxDateAmountRecord> getAmountRecord( WxDateAmountRecord temp,int day ,int type,AmountRecordVo vo){ | |||
| temp.setType(type); | |||
| List<WxDateAmountRecord> list =new ArrayList<>(); | |||
| for(int i=1;i<=7;i++) {//周日是1 | |||
| temp.setDayOfWeek(i); | |||
| PageInfo<WxDateAmountRecord> page = wxDateAmountRecordService.listAsPage(temp, 1, 1); | |||
| if(page.getSize()>0) { | |||
| if(i==day ) { | |||
| if(type==0) { | |||
| vo.setOrderAmount(page.getList().get(0).getPayPrice()); | |||
| }else { | |||
| vo.setVerifyAmount(page.getList().get(0).getPayPrice()); | |||
| } | |||
| } | |||
| list.add(page.getList().get(0)); | |||
| } | |||
| } | |||
| return list; | |||
| } | |||
| @ApiOperation("首页查询交易金额记录接口") | |||
| @GetMapping("listVerified") | |||
| public ResultData listVerified() { | |||
| return list(1); | |||
| } | |||
| private ResultData list(int verified) { | |||
| List<AmountRecordVo> list =new ArrayList<>(); | |||
| WxDateAmountRecord temp = new WxDateAmountRecord(); | |||
| WxMerchantBUser u = getUser(); | |||
| temp.setTenantId(u.getTenantId()); | |||
| temp.setMerchantId(u.getMerchantId()); | |||
| temp.setType(verified); | |||
| SimpleDateFormat fmt = new SimpleDateFormat("MM/dd"); | |||
| PageInfo<WxDateAmountRecord> page = wxDateAmountRecordService.listAsPage(temp, 1, 7); | |||
| if(page.getSize()>0) { | |||
| for (WxDateAmountRecord wxDateAmountRecord:page.getList()) { | |||
| AmountRecordVo vo = new AmountRecordVo(); | |||
| vo.setAmount(wxDateAmountRecord.getPayPrice()); | |||
| vo.setAmountDetail(wxDateAmountRecord); | |||
| vo.setMouthAndDate(fmt.format(wxDateAmountRecord.getUpdateDate())); | |||
| list.add(vo); | |||
| } | |||
| } | |||
| return new ResultData(list); | |||
| } | |||
| } | |||
| @@ -27,17 +27,6 @@ public class WxCouponController extends BaseController { | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @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 WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| return new ResultData(wxCouponService.findListForCUser(wxCoupon, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/detail") | |||
| @ApiImplicitParam(name = "couponId", value = "id", dataType = "String", paramType = "query", required = true) | |||
| @@ -16,78 +16,48 @@ public class AmountRecordVo implements Serializable{ | |||
| * | |||
| */ | |||
| private static final long serialVersionUID = 4494858079134918638L; | |||
| //交易金额记录 | |||
| private List<WxDateAmountRecord> orderAmountList; | |||
| //核销金额记录 | |||
| private List<WxDateAmountRecord> verifyAmountList; | |||
| private WxDateAmountRecord amountDetail; | |||
| private Integer orderAmount; | |||
| private Integer amount; | |||
| private String orderAmountStr; | |||
| private Integer verifyAmount; | |||
| private String verifyAmountStr; | |||
| private String amountStr; | |||
| public String getOrderAmountStr() { | |||
| if(orderAmount!=null) { | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| orderAmountStr = df.format((float)orderAmount/100); | |||
| } | |||
| return orderAmountStr; | |||
| } | |||
| private String mouthAndDate; | |||
| public String getVerifyAmountStr() { | |||
| if(verifyAmount!=null) { | |||
| public String getAmountStr() { | |||
| if(amount!=null) { | |||
| DecimalFormat df=new DecimalFormat("0.00"); | |||
| verifyAmountStr = df.format((float)verifyAmount/100); | |||
| amountStr = df.format((float)amount/100); | |||
| } | |||
| return verifyAmountStr; | |||
| return amountStr; | |||
| } | |||
| public Integer getOrderAmount() { | |||
| return orderAmount; | |||
| public void setMouthAndDate(String mouthAndDate) { | |||
| this.mouthAndDate = mouthAndDate; | |||
| } | |||
| public void setOrderAmount(Integer orderAmount) { | |||
| this.orderAmount = orderAmount; | |||
| } | |||
| public String getMouthAndDate() {return mouthAndDate;} | |||
| public Integer getVerifyAmount() { | |||
| return verifyAmount; | |||
| public void setAmountStr(String amountStr) { | |||
| this.amountStr = amountStr; | |||
| } | |||
| public void setVerifyAmount(Integer verifyAmount) { | |||
| this.verifyAmount = verifyAmount; | |||
| } | |||
| public void setOrderAmountStr(String orderAmountStr) { | |||
| this.orderAmountStr = orderAmountStr; | |||
| public Integer getAmount() { | |||
| return amount; | |||
| } | |||
| public void setVerifyAmountStr(String verifyAmountStr) { | |||
| this.verifyAmountStr = verifyAmountStr; | |||
| } | |||
| public void setAmount(Integer amount) {this.amount = amount;} | |||
| public List<WxDateAmountRecord> getOrderAmountList() { | |||
| return orderAmountList; | |||
| public WxDateAmountRecord getAmountDetail() { | |||
| return amountDetail; | |||
| } | |||
| public void setOrderAmountList(List<WxDateAmountRecord> orderAmountList) { | |||
| this.orderAmountList = orderAmountList; | |||
| public void setAmountDetail(WxDateAmountRecord amountDetail) { | |||
| this.amountDetail = amountDetail; | |||
| } | |||
| public List<WxDateAmountRecord> getVerifyAmountList() { | |||
| return verifyAmountList; | |||
| } | |||
| public void setVerifyAmountList(List<WxDateAmountRecord> verifyAmountList) { | |||
| this.verifyAmountList = verifyAmountList; | |||
| } | |||
| } | |||
| @@ -15,8 +15,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<WxCoupon> findCanSendList(WxCoupon wxCoupon); | |||
| List<WxCouponCVo> findListForCUser(WxCoupon wxCoupon); | |||
| WxCouponCVo selectDetailForCUser(WxCoupon wxCoupon); | |||
| } | |||
| @@ -60,7 +60,6 @@ public interface WxCouponService { | |||
| */ | |||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCouponCVo> findListForCUser(WxCoupon record, Integer pageIndex, Integer pageSize); | |||
| WxCouponCVo selectDetailForCUser(WxCoupon record); | |||
| @@ -61,10 +61,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCanSendList(record)); | |||
| } | |||
| @Override | |||
| public PageInfo<WxCouponCVo> findListForCUser(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findListForCUser(record)); | |||
| } | |||
| @Override | |||
| public WxCouponCVo selectDetailForCUser(WxCoupon record) { | |||
| return wxCouponMapper.selectDetailForCUser(record); | |||
| @@ -476,8 +476,6 @@ | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="send_start_date" jdbcType="TIMESTAMP" property="sendStartDate" /> | |||
| <result column="send_end_date" jdbcType="TIMESTAMP" property="sendEndDate" /> | |||
| <result column="valid_type" jdbcType="INTEGER" property="validType" /> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||
| @@ -506,7 +504,7 @@ | |||
| </resultMap> | |||
| <sql id="allCUserColumns"> | |||
| c.id,c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.send_start_date,c.send_end_date,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||
| c.id,c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, | |||
| m.img_url,m.name,m.link_phone,m.status, | |||
| s.addr,s.shop_number,s.baidu_poi, | |||
| mb.building_name,mf.floor_name | |||
| @@ -517,24 +515,6 @@ | |||
| m.name | |||
| </sql> | |||
| <select id="findListForCUser" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||
| select <include refid="listCUserColumns" /> from wx_coupon c,wx_merchant m | |||
| where c.merchant_id = m.id | |||
| and c.status = '1' | |||
| and send_end_date >= NOW() | |||
| and send_start_date <= NOW() | |||
| <if test=" null != tenantId "> | |||
| and c.tenant_id = #{tenantId} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and c.business like concat('%', #{business},'%') | |||
| </if> | |||
| <if test=" null != type "> | |||
| and c.type = #{type} | |||
| </if> | |||
| </select> | |||
| <select id="selectDetailForCUser" parameterType="com.simple.domain.po.WxCoupon" resultMap="CUserResultMap"> | |||
| select <include refid="allCUserColumns" /> | |||