| @@ -71,15 +71,8 @@ public class HomeController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private MallUserActionService mallUserActionService; | private MallUserActionService mallUserActionService; | ||||
| @Autowired | |||||
| private WxBillAllService wxBillAllService; | |||||
| @GetMapping("/captcha.jpg") | @GetMapping("/captcha.jpg") | ||||
| public void captcha(HttpServletResponse response)throws ServletException, IOException { | public void captcha(HttpServletResponse response)throws ServletException, IOException { | ||||
| // //todo 测试 | |||||
| // wxBillAllService.getOweBillForEmail(); | |||||
| logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | logger.debug("[" + getIpAddr() + "] HomeController::captcha"); | ||||
| response.setHeader("Cache-Control", "no-store, no-cache"); | response.setHeader("Cache-Control", "no-store, no-cache"); | ||||
| response.setContentType("image/jpeg"); | response.setContentType("image/jpeg"); | ||||
| @@ -31,12 +31,14 @@ public class WxTopicController extends BaseController { | |||||
| String tenantId = getTenantId(); | String tenantId = getTenantId(); | ||||
| wxTopic.setTenantId(tenantId); | wxTopic.setTenantId(tenantId); | ||||
| PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); | PageInfo<WxTopic> page = wxTopicService.listAsPage(wxTopic, pageNum, pageSize); | ||||
| // Date now = new Date(); | |||||
| // page.getList().stream().forEach(cc->{ | |||||
| // if (cc.getEndTime()!=null && now.getTime() > cc.getEndTime().getTime()) { | |||||
| // cc.setStatus(EnumWxTopicStatus.INVAILD.getCode()); | |||||
| // } | |||||
| // }); | |||||
| //设置正在上架的专题 | |||||
| Date now = new Date(); | |||||
| page.getList().stream().forEach(cc->{ | |||||
| if (cc.getEndTime()!=null && cc.getBeginTime()!=null && now.getTime() >= cc.getBeginTime().getTime() && now.getTime() <= cc.getEndTime().getTime()) { | |||||
| cc.setIsOnline(1); | |||||
| } | |||||
| }); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -2,14 +2,12 @@ package com.iformall.controller; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxTopic; | import com.iformall.domain.po.WxTopic; | ||||
| import com.iformall.enums.EnumWxTopicStatus; | |||||
| import com.iformall.service.WxTopicService; | import com.iformall.service.WxTopicService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| 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.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/topic") | @RequestMapping("/api/topic") | ||||
| @@ -55,7 +55,7 @@ public class BillNotificationSchedule { | |||||
| sendWaitPayBill(); | sendWaitPayBill(); | ||||
| wxBillAllService.sendWaitPayBillEmail(); | wxBillAllService.sendWaitPayBillEmail(); | ||||
| sendOweBill(); | sendOweBill(); | ||||
| wxBillAllService.getOweBillForEmail(); | |||||
| wxBillAllService.sendOweBillForEmail(); | |||||
| logger.info("账单通知任务结束"); | logger.info("账单通知任务结束"); | ||||
| } | } | ||||
| @@ -1,118 +0,0 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| @Table(name = "wx_coupon_topic") | |||||
| public class WxCouponTopic implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||||
| private String tenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="专题ID",name="topicId") | |||||
| private Long topicId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="业务类型1通用卷2满减卷3代金卷4礼品卷5停车卷6砍价商品7拼团商品",name="busType") | |||||
| private String busType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="busId") | |||||
| private String busId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createtime") | |||||
| private Date createtime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updatetime") | |||||
| private Date updatetime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷名称",name="couponName") | |||||
| @Transient | |||||
| private String couponName; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷封面图片",name="couponPic") | |||||
| @Transient | |||||
| private String couponPic; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卷id",name="couponId") | |||||
| @Transient | |||||
| private String couponId; | |||||
| public Date getCreatetime() { | |||||
| return createtime; | |||||
| } | |||||
| public void setCreatetime(Date createtime) { | |||||
| this.createtime = createtime; | |||||
| } | |||||
| public Date getUpdatetime() { | |||||
| return updatetime; | |||||
| } | |||||
| public void setUpdatetime(Date updatetime) { | |||||
| this.updatetime = updatetime; | |||||
| } | |||||
| public String getCouponName() { | |||||
| return couponName; | |||||
| } | |||||
| public void setCouponName(String couponName) { | |||||
| this.couponName = couponName; | |||||
| } | |||||
| public String getCouponPic() { | |||||
| return couponPic; | |||||
| } | |||||
| public void setCouponPic(String couponPic) { | |||||
| this.couponPic = couponPic; | |||||
| } | |||||
| public String getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(String couponId) { | |||||
| this.couponId = couponId; | |||||
| } | |||||
| 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 getTopicId() { | |||||
| return topicId; | |||||
| } | |||||
| public void setTopicId(Long topicId) { | |||||
| this.topicId = topicId; | |||||
| } | |||||
| public String getBusType() { | |||||
| return busType; | |||||
| } | |||||
| public void setBusType(String busType) { | |||||
| this.busType = busType; | |||||
| } | |||||
| public String getBusId() { | |||||
| return busId; | |||||
| } | |||||
| public void setBusId(String busId) { | |||||
| this.busId = busId; | |||||
| } | |||||
| } | |||||
| @@ -64,6 +64,17 @@ public class WxTopic implements Serializable { | |||||
| //查询下架状态 | //查询下架状态 | ||||
| @Transient | @Transient | ||||
| private boolean queryDownLineStatus; | private boolean queryDownLineStatus; | ||||
| @io.swagger.annotations.ApiModelProperty(value="上架标志 1正在上架",name="isOnline") | |||||
| @Transient | |||||
| private Integer isOnline; | |||||
| public Integer getIsOnline() { | |||||
| return isOnline; | |||||
| } | |||||
| public void setIsOnline(Integer isOnline) { | |||||
| this.isOnline = isOnline; | |||||
| } | |||||
| public boolean isQueryDownLineStatus() { | public boolean isQueryDownLineStatus() { | ||||
| return queryDownLineStatus; | return queryDownLineStatus; | ||||
| @@ -11,7 +11,8 @@ public enum EnumCouponChannelType { | |||||
| COUPON_CHANNEL_ID_GAME(4, "游戏"), | COUPON_CHANNEL_ID_GAME(4, "游戏"), | ||||
| COUPON_CHANNEL_ID_CARD(5, "卡频道"), | COUPON_CHANNEL_ID_CARD(5, "卡频道"), | ||||
| COUPON_CHANNEL_ID_PRESS(6, "砍价频道"), | COUPON_CHANNEL_ID_PRESS(6, "砍价频道"), | ||||
| COUPON_CHANNEL_ID_ORDER_GROUP(7, "拼团频道") | |||||
| COUPON_CHANNEL_ID_ORDER_GROUP(7, "拼团频道"), | |||||
| COUPON_CHANNEL_ID_TOPIC(8, "专题") | |||||
| ; | ; | ||||
| public static EnumCouponChannelType getEnum(Integer code) { | public static EnumCouponChannelType getEnum(Integer code) { | ||||
| @@ -5,8 +5,9 @@ package com.iformall.enums; | |||||
| * 状态1生效2失效3作废 | * 状态1生效2失效3作废 | ||||
| */ | */ | ||||
| public enum EnumWxTopicStatus { | public enum EnumWxTopicStatus { | ||||
| VAILD(1, "有效"), | |||||
| INVAILD(2, "无效"), | |||||
| DEF(0, "保存"), | |||||
| VAILD(1, "上架"), | |||||
| INVAILD(2, "下架"), | |||||
| CANCLE(3, "作废") | CANCLE(3, "作废") | ||||
| ; | ; | ||||
| @@ -2,6 +2,7 @@ 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.WxTopic; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| @@ -28,5 +29,6 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| void offExpiriedCouponChannelByCouponStatus(); | void offExpiriedCouponChannelByCouponStatus(); | ||||
| void offExpiriedCouponChannel2ByEndTime(); | void offExpiriedCouponChannel2ByEndTime(); | ||||
| void delByTopic(WxTopic wxTopic); | |||||
| } | } | ||||
| @@ -68,4 +68,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findCouponByTopic(WxTopic wxTopic); | List<WxCoupon> findCouponByTopic(WxTopic wxTopic); | ||||
| } | } | ||||
| @@ -1,15 +0,0 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponTopic; | |||||
| import com.iformall.domain.po.WxTopic; | |||||
| import java.util.List; | |||||
| public interface WxCouponTopicMapper extends CommonMapper<WxCouponTopic, String> { | |||||
| void del(WxCouponTopic couponTopic); | |||||
| List<WxCoupon> findList(WxTopic wxTopic); | |||||
| } | |||||
| @@ -11,5 +11,5 @@ public interface WxTopicMapper extends CommonMapper<WxTopic, String> { | |||||
| WxTopic show(WxTopic record); | WxTopic show(WxTopic record); | ||||
| void updateStatus(); | |||||
| void updateStatus(WxTopic record); | |||||
| } | } | ||||
| @@ -34,5 +34,5 @@ public interface WxBillAllService { | |||||
| /** | /** | ||||
| * 发送欠缴通知邮件 | * 发送欠缴通知邮件 | ||||
| */ | */ | ||||
| void getOweBillForEmail(); | |||||
| void sendOweBillForEmail(); | |||||
| } | } | ||||
| @@ -640,12 +640,63 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void getOweBillForEmail() { | |||||
| wxBillAllMapper.getOweBillForEmail(); | |||||
| public void sendOweBillForEmail() { | |||||
| List<Map<String, Object>> oweBillForEmail = wxBillAllMapper.getOweBillForEmail(); | |||||
| if(CollectionUtils.isNotEmpty(oweBillForEmail)) { | |||||
| Map<Long, List<Map<String, Object>>> merchantMap = toMap(oweBillForEmail); | |||||
| for (Long merchantId : merchantMap.keySet()) { | |||||
| List<Map<String, Object>> mapList = merchantMap.get(merchantId); | |||||
| if(CollectionUtils.isNotEmpty(mapList)){ | |||||
| String email = (String)mapList.get(0).get("email"); | |||||
| if(StringUtils.isBlank(email)){ | |||||
| continue; | |||||
| } | |||||
| String tenantId = (String)mapList.get(0).get("tenantId"); | |||||
| String receiveDate = (String)mapList.get(0).get("receiveDate"); | |||||
| String manager = (String)mapList.get(0).get("manager"); | |||||
| String managerPhone = (String)mapList.get(0).get("managerPhone"); | |||||
| Integer expiredDay = (Integer)mapList.get(0).get("expiredDay"); | |||||
| String billListStr = ""; | |||||
| BigDecimal sumNeedPay = new BigDecimal(0); | |||||
| for (Map<String, Object> bill : mapList) { | |||||
| String billType = bill.get("billType").toString(); | |||||
| BigDecimal needPay = (BigDecimal) bill.get("owe"); | |||||
| BigDecimal price = needPay.divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN); | |||||
| sumNeedPay = sumNeedPay.add(price); | |||||
| billListStr += "<div style=\"margin: 0 5%;width:90%;box-sizing: content-box; border: 1px solid #DEDEDE;background: #FFFFFF;\">"; | |||||
| billListStr += "<div style=\"overflow: hidden;height: auto;width: 100%;font-size:14px;\">"; | |||||
| billListStr += "<div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">" + billType + "</div>"; | |||||
| billListStr += "<div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">" + price + "</div>"; | |||||
| billListStr += "<div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">" + receiveDate + "</div>"; | |||||
| billListStr += "<div style=\"width: 25%;float: left;height: 60px;line-height: 60px;text-align: center;font-family:MicrosoftYaHei;color:rgba(85,85,85,1);\">" + expiredDay + "</div>"; | |||||
| billListStr += "</div></div>"; | |||||
| } | |||||
| //发邮件 | |||||
| Map<String, String> map = new HashedMap(); | |||||
| map.put("price", sumNeedPay.toString()); | |||||
| map.put("date", receiveDate); | |||||
| map.put("billList", billListStr); | |||||
| map.put("linkName",manager==null?"":manager); | |||||
| map.put("linkPhone",managerPhone==null?"":managerPhone); | |||||
| MailMsg mailMsg = new MailMsg(); | |||||
| mailMsg.setSubject("欠缴账单通知"); | |||||
| mailMsg.setHtml(true); | |||||
| mailMsg.setMsgType(EnumMsgRecordType.EMAIL.getCode()); | |||||
| mailMsg.setModelId(EnumMailMsgModel.MAIL_BILL_OWE.getCode()); | |||||
| mailMsg.setTo(new String[]{email}); | |||||
| mailMsg.setTenantId(tenantId); | |||||
| mailMsg.setDynamicContentMap(map); | |||||
| mqBaseProducer.sendMessage(mailMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,20 +6,21 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.domain.po.WxCouponTopic; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.WxTopic; | import com.iformall.domain.po.WxTopic; | ||||
| import com.iformall.enums.EnumCouponChannelType; | |||||
| import com.iformall.enums.EnumWxTopicStatus; | import com.iformall.enums.EnumWxTopicStatus; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxCouponTopicMapper; | |||||
| import com.iformall.mapper.WxTopicMapper; | import com.iformall.mapper.WxTopicMapper; | ||||
| import com.iformall.service.WxTopicService; | import com.iformall.service.WxTopicService; | ||||
| import com.iformall.utils.DateUtils; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Arrays; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -32,30 +33,13 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| @Autowired | @Autowired | ||||
| private WxTopicMapper wxTopicMapper; | private WxTopicMapper wxTopicMapper; | ||||
| @Autowired | @Autowired | ||||
| private WxCouponTopicMapper wxCouponTopicMapper; | |||||
| @Autowired | |||||
| private WxCouponMapper wxCouponMapper; | private WxCouponMapper wxCouponMapper; | ||||
| // public void isQueryDownLineStatus(WxTopic record){ | |||||
| // record.setQueryDownLineStatus(false); | |||||
| // if(record.getStatus().equals(EnumWxTopicStatus.INVAILD.getCode())){ | |||||
| // record.setQueryDownLineStatus(true); | |||||
| // return; | |||||
| // } | |||||
| // if(StringUtils.isNotBlank(record.getStatusStr())){ | |||||
| // String[] array = record.getStatusStr().split(","); | |||||
| // for (String status:array) { | |||||
| // if(status.equals(EnumWxTopicStatus.INVAILD.getCode().toString())){ | |||||
| // record.setQueryDownLineStatus(true); | |||||
| // break; | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| @Autowired | |||||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxTopic> listAsPage(WxTopic record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxTopic> listAsPage(WxTopic record, Integer pageIndex, Integer pageSize) { | ||||
| wxTopicMapper.updateStatus(); | |||||
| wxTopicMapper.updateStatus(record); | |||||
| if(StringUtils.isNotBlank(record.getStatusStr())){ | if(StringUtils.isNotBlank(record.getStatusStr())){ | ||||
| String[] array = record.getStatusStr().split(","); | String[] array = record.getStatusStr().split(","); | ||||
| List<Integer> integerList = new ArrayList<>(); | List<Integer> integerList = new ArrayList<>(); | ||||
| @@ -71,7 +55,7 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| public WxTopic show(WxTopic record) { | public WxTopic show(WxTopic record) { | ||||
| WxTopic wxTopic = wxTopicMapper.show(record); | WxTopic wxTopic = wxTopicMapper.show(record); | ||||
| if(wxTopic != null) { | if(wxTopic != null) { | ||||
| wxTopic.setCouponList(wxCouponTopicMapper.findList(wxTopic)); | |||||
| wxTopic.setCouponList(wxCouponMapper.findCouponByTopic(record)); | |||||
| } | } | ||||
| return wxTopic; | return wxTopic; | ||||
| } | } | ||||
| @@ -88,22 +72,16 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"添加成功"); | return new ResultData(Result.SUCCESS,"添加成功"); | ||||
| } else { | } else { | ||||
| if(record.getStatus().equals(1)) { | |||||
| WxTopic queryTopic = new WxTopic(); | |||||
| queryTopic.setStatus(1); | |||||
| queryTopic.setTenantId(record.getTenantId()); | |||||
| if (wxTopicMapper.findList(queryTopic).size() > 0) { | |||||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION.getCode(), "已有正在投放的专题"); | |||||
| if(record.getStatus().equals(EnumWxTopicStatus.VAILD.getCode())) { | |||||
| WxTopic showTopic = wxTopicMapper.show(record); | |||||
| if (showTopic != null) { | |||||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION.getCode(), "["+showTopic.getName()+"]正在活动中,截止至"+ DateUtils.date2String(showTopic.getEndTime(),"yyyy-MM-dd")); | |||||
| } | } | ||||
| } | } | ||||
| record.setUpdatetime(new Date()); | record.setUpdatetime(new Date()); | ||||
| wxTopicMapper.updateByPrimaryKeySelective(record); | wxTopicMapper.updateByPrimaryKeySelective(record); | ||||
| if(StringUtils.isNotBlank(record.getCouponIds())) { | if(StringUtils.isNotBlank(record.getCouponIds())) { | ||||
| WxCouponTopic delCouponTopic = new WxCouponTopic(); | |||||
| delCouponTopic.setTopicId(record.getId()); | |||||
| wxCouponTopicMapper.del(delCouponTopic); | |||||
| wxCouponChannelMapper.delByTopic(record); | |||||
| addCouponTopic(record); | addCouponTopic(record); | ||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"更新成功"); | return new ResultData(Result.SUCCESS,"更新成功"); | ||||
| @@ -112,15 +90,20 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| public void addCouponTopic(WxTopic record){ | public void addCouponTopic(WxTopic record){ | ||||
| for (String couponId:JSONArray.parseArray(record.getCouponIds(), String.class)) { | for (String couponId:JSONArray.parseArray(record.getCouponIds(), String.class)) { | ||||
| String[] couponArray = couponId.split("-"); | |||||
| WxCouponTopic couponTopic = new WxCouponTopic(); | |||||
| couponTopic.setBusType(couponArray[0]); | |||||
| couponTopic.setBusId(couponArray[1]); | |||||
| couponTopic.setTenantId(record.getTenantId()); | |||||
| couponTopic.setTopicId(record.getId()); | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| couponTopic.setId(idWorker.nextId()); | |||||
| wxCouponTopicMapper.insertSelective(couponTopic); | |||||
| String[] couponArray = couponId.split("-"); | |||||
| //保存coupon_channel | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(Long.parseLong(couponArray[1])); | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setId(idWorker.nextId()); | |||||
| wxCouponChannel.setBeginTime(record.getBeginTime()); | |||||
| wxCouponChannel.setEndTime(record.getEndTime()); | |||||
| wxCouponChannel.setCouponId(Long.parseLong(couponArray[1])); | |||||
| wxCouponChannel.setSubTargetId(record.getId()); | |||||
| wxCouponChannel.setTenantId(record.getTenantId()); | |||||
| wxCouponChannel.setTitle(wxCoupon.getTitle()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_TOPIC.getCode()); | |||||
| wxCouponChannelMapper.insertSelective(wxCouponChannel); | |||||
| } | } | ||||
| } | } | ||||
| @@ -355,7 +355,7 @@ | |||||
| <select id="getWaitPayBillForEmail" resultType="hashmap"> | <select id="getWaitPayBillForEmail" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.receive_date receiveDate, | ||||
| bill.need_pay needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType,ws.manager,ws.manager_phone managerPhone from ( | |||||
| round(bill.need_pay/100,2) needPay,m.link_phone linkPhone,app.appname,m.email,bill.bill_type billType,ws.manager,ws.manager_phone managerPhone from ( | |||||
| select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | select bill.bill_type,bill.tenant_id,bill.merchant_id,bill.receive_date,ifnull(sum(need_pay),0) need_pay from ( | ||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| @@ -400,8 +400,9 @@ | |||||
| </select> | </select> | ||||
| <select id="getOweBillForEmail" resultType="hashmap"> | <select id="getOweBillForEmail" resultType="hashmap"> | ||||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.bill_type,bill.owe,m.link_phone linkPhone,m.email,app.appname from ( | |||||
| select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe from ( | |||||
| select bill.tenant_id tenantId,bill.merchant_id merchantId,bill.bill_type billType,round(bill.owe/100,2) owe,m.link_phone managerPhone,m.`link_person` manager,m.email,app.appname,bill.receive_date receiveDate,bill.expired_day expiredDay from ( | |||||
| select bill.tenant_id,bill.merchant_id,bill.bill_type,sum(owe) owe,bill.receive_date,bill.expired_day from ( | |||||
| select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | select id,merchant_id,shop_id,tenant_id,'租金' name,1 bill_type_value,'租金' | ||||
| bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | bill_type,need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' | ||||
| endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | endtime,rent_shop_type from wx_bill_rent where is_preview = 0 | ||||
| @@ -433,8 +434,9 @@ | |||||
| select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | select id,merchant_id,shop_id,tenant_id,name,8 bill_type_value,'其他押金' bill_type,0 as | ||||
| need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | need_pay,receive_pay,pay,owe,DATE_FORMAT(receive_date,'%Y-%m-%d') receive_date,pay_date,expired_day,status,'' starttime,'' endtime,rent_shop_type | ||||
| from wx_bill_other_deposit | from wx_bill_other_deposit | ||||
| ) bill | ) bill | ||||
| where DATEDIFF(bill.receive_date,now()) <0 and bill.status not in(3,5,6) | |||||
| where DATEDIFF(bill.receive_date,now())<0 and bill.status not in(3,5,6) | |||||
| group by bill.tenant_id,bill.merchant_id,bill.bill_type) bill | group by bill.tenant_id,bill.merchant_id,bill.bill_type) bill | ||||
| left join wx_merchant m on bill.merchant_id=m.id | left join wx_merchant m on bill.merchant_id=m.id | ||||
| left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | left join (select tenant_id,`name` appname from wx_appinfo app where type=1) app on bill.tenant_id=app.tenant_id | ||||
| @@ -245,4 +245,9 @@ | |||||
| where status = 0 and target_ad = 2 and end_time < now() | where status = 0 and target_ad = 2 and end_time < now() | ||||
| </update> | </update> | ||||
| <delete id="delByTopic" parameterType="com.iformall.domain.po.WxTopic"> | |||||
| delete from wx_coupon_channel where sub_target_id = #{id} | |||||
| </delete> | |||||
| </mapper> | </mapper> | ||||
| @@ -729,9 +729,9 @@ | |||||
| </select> | </select> | ||||
| <select id="findCouponByTopic" parameterType="com.iformall.domain.po.WxTopic" resultType="com.iformall.domain.po.WxCoupon"> | <select id="findCouponByTopic" parameterType="com.iformall.domain.po.WxTopic" resultType="com.iformall.domain.po.WxCoupon"> | ||||
| select wc.* from wx_coupon wc left join wx_coupon_topic wct on wct.`bus_id` = wc.id | |||||
| left join wx_topic wt on wct.`topic_id` = wt.id | |||||
| where wt.id = #{id} | |||||
| select wc.*,wc.title as couponName,wc.`cover_img` as couponPic,wc.id as couponId from wx_coupon_channel ct left join | |||||
| wx_coupon wc on wc.id = ct.coupon_id | |||||
| where ct.`sub_target_id` = #{id} | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -1,94 +0,0 @@ | |||||
| <?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.iformall.mapper.WxCouponTopicMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponTopic"> | |||||
| <id column="id" property="id" /> | |||||
| <result column="tenant_id" property="tenantId" /> | |||||
| <result column="name" property="name" /> | |||||
| <result column="title" property="title" /> | |||||
| <result column="content" property="content" /> | |||||
| <result column="cover" property="cover" /> | |||||
| <result column="advert" property="advert" /> | |||||
| <result column="begin_time" property="beginTime" /> | |||||
| <result column="end_time" property="endTime" /> | |||||
| <result column="status" property="status" /> | |||||
| <result column="createtime" property="createtime" /> | |||||
| <result column="updatetime" property="updatetime" /> | |||||
| <result column="couponName" property="couponName" /> | |||||
| <result column="couponPic" property="couponPic" /> | |||||
| <result column="couponId" property="couponId" /> | |||||
| </resultMap> | |||||
| <resultMap id="couponResultMap" type="com.iformall.domain.po.WxCoupon"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/> | |||||
| <result column="title" jdbcType="VARCHAR" property="title"/> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/> | |||||
| <result column="sale_price" jdbcType="INTEGER" property="salePrice"/> | |||||
| <result column="use_price" jdbcType="INTEGER" property="usePrice"/> | |||||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/> | |||||
| <result column="send_type" jdbcType="INTEGER" property="sendType"/> | |||||
| <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"/> | |||||
| <result column="valid_days" jdbcType="INTEGER" property="validDays"/> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit"/> | |||||
| <result column="remain_inventory" jdbcType="INTEGER" property="remainInventory"/> | |||||
| <result column="inventory" jdbcType="INTEGER" property="inventory"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="business" jdbcType="INTEGER" property="business"/> | |||||
| <result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/> | |||||
| <result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/> | |||||
| <result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/> | |||||
| <result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/> | |||||
| <result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/> | |||||
| <result column="auto_refund" jdbcType="INTEGER" property="autoRefund"/> | |||||
| </resultMap> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != name and '' != name "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != beginTime "> | |||||
| and `begin_time` >= #{beginTime} | |||||
| </if> | |||||
| <if test=" null != endTime "> | |||||
| and `end_time` <= #{endTime} | |||||
| </if> | |||||
| order by createtime desc | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="couponResultMap"> | |||||
| select wc.*,wc.title as couponName,wc.`cover_img` as couponPic,wc.id as couponId from wx_coupon_topic ct left join | |||||
| wx_coupon wc on wc.id = ct.bus_id | |||||
| where ct.`topic_id` = #{id} | |||||
| </select> | |||||
| <delete id="del" parameterType="com.iformall.domain.po.WxCouponTopic"> | |||||
| delete from wx_coupon_topic where topic_id = #{topicId} | |||||
| </delete> | |||||
| </mapper> | |||||
| @@ -47,7 +47,7 @@ | |||||
| #{statusItem} | #{statusItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | </if> | ||||
| order by createtime desc | |||||
| order by begin_time desc,status asc | |||||
| </sql> | </sql> | ||||
| <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | ||||
| @@ -58,11 +58,11 @@ | |||||
| <select id="show" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | <select id="show" parameterType="com.iformall.domain.po.WxTopic" resultMap="BaseResultMap"> | ||||
| select * from wx_topic t where t.status = 1 | select * from wx_topic t where t.status = 1 | ||||
| and now() >= t.begin_time and now() <= t.end_time | and now() >= t.begin_time and now() <= t.end_time | ||||
| order by t.createtime desc limit 1 | |||||
| order by t.begin_time desc limit 1 | |||||
| </select> | </select> | ||||
| <update id="updateStatus"> | |||||
| update wx_topic set status = 2 where now() >= end_time and status !=3 | |||||
| <update id="updateStatus" parameterType="com.iformall.domain.po.WxTopic"> | |||||
| update wx_topic set status = 2 where now() >= end_time and status not in (2,3) and tenant_id = #{tenantId} | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||