| @@ -1,11 +1,10 @@ | |||
| package com.iformall.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MailMsg; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mq.MqBaseProducer; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.annotations.Api; | |||
| @@ -16,11 +15,7 @@ import org.apache.commons.collections.map.HashedMap; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.mail.javamail.MimeMessageHelper; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.mail.internet.MimeMessage; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| @RestController | |||
| @@ -138,7 +133,19 @@ public class WxCouponController extends BaseController { | |||
| if(wxCoupon.getEnddate() == null){ | |||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||
| } | |||
| result.put("list",wxCouponService.findCountData(wxCoupon,pageNum,pageSize)); | |||
| PageInfo<WxCoupon> pageInfo = wxCouponService.findCountData(wxCoupon,pageNum,pageSize); | |||
| for (WxCoupon coupon:pageInfo.getList()) { | |||
| if(coupon.getSaleAmount() == null){ | |||
| coupon.setSaleAmount(0); | |||
| } | |||
| if(coupon.getSumPayment() == null){ | |||
| coupon.setSumPayment(0); | |||
| } | |||
| if(coupon.getSumSubsidy() == null){ | |||
| coupon.setSumSubsidy(0); | |||
| } | |||
| } | |||
| result.put("list",pageInfo); | |||
| return new ResultData(result); | |||
| } | |||
| @@ -159,7 +166,17 @@ public class WxCouponController extends BaseController { | |||
| if(wxCoupon.getEnddate() == null){ | |||
| wxCoupon.setEnddate(DateUtils.stringToDate(DateUtils.getSystemTime("yyyy-MM-dd") + " 23:59:59")); | |||
| } | |||
| return new ResultData(wxCouponService.findCouponData(wxCoupon,pageNum,pageSize)); | |||
| PageInfo<WxCoupon> pageInfo = wxCouponService.findCouponData(wxCoupon,pageNum,pageSize); | |||
| for (WxCoupon coupon:pageInfo.getList()) { | |||
| if(coupon.getSumSubsidy() == null){ | |||
| coupon.setSumSubsidy(0); | |||
| } | |||
| if(coupon.getSumSubsidy() == null){ | |||
| coupon.setSumSubsidy(0); | |||
| } | |||
| } | |||
| return new ResultData(pageInfo); | |||
| } | |||
| @ApiOperation("砍价营销列表接口") | |||
| @@ -53,8 +53,8 @@ public class WxDeviceController extends BaseController { | |||
| wxDevice.setStatus(EnumDeviceStatus.VALID.getCode()); | |||
| wxDevice.setOnlineStatus(EnumDeviceOnlineStatus.OFFLINE.getCode()); | |||
| wxDevice.setTenantId(getTenantId()); | |||
| wxDeviceService.saveOrUpdate(wxDevice); | |||
| return new ResultData(); | |||
| return wxDeviceService.saveOrUpdate(wxDevice); | |||
| } | |||
| @ApiOperation("更新设备") | |||
| @@ -65,8 +65,8 @@ public class WxDeviceController extends BaseController { | |||
| if (wxDevice.getId() == null) | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| wxDevice.setTenantId(getTenantId()); | |||
| wxDeviceService.saveOrUpdate(wxDevice); | |||
| return new ResultData(); | |||
| return wxDeviceService.saveOrUpdate(wxDevice); | |||
| } | |||
| @ApiOperation("设备详情") | |||
| @@ -90,8 +90,9 @@ public class WxDeviceController extends BaseController { | |||
| wxDevice.setId(id); | |||
| wxDevice.setTenantId(getTenantId()); | |||
| wxDevice.setStatus(EnumDeviceStatus.INVALID.getCode()); | |||
| wxDeviceService.saveOrUpdate(wxDevice); | |||
| return new ResultData(); | |||
| return wxDeviceService.saveOrUpdate(wxDevice); | |||
| } | |||
| } | |||
| @@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @@ -95,7 +96,12 @@ public class WxDeviceScreenAdController extends BaseController { | |||
| wxDevice.setLastHbTime(new Date()); | |||
| wxDevice.setVersion(paramMap.get("version")); | |||
| wxDeviceService.saveOrUpdate(wxDevice); | |||
| return new ResultData(wxDevice); | |||
| Map<String, String> result = new HashMap<>(); | |||
| result.put("config",wxDevice.getConfig()); | |||
| result.put("name", wxDevice.getName()); | |||
| result.put("location", wxDevice.getLocation()); | |||
| return new ResultData(result); | |||
| } | |||
| @ApiOperation("基础信息") | |||
| @@ -50,6 +50,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # ROCKETMQ | |||
| rocketmq: | |||
| nameServer: 127.0.0.1:9876 | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 127.0.0.1 | |||
| @@ -50,6 +50,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| aws: | |||
| clientRegion: cn-northwest-1 | |||
| bucketName: iformall-net | |||
| @@ -47,6 +47,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -47,6 +47,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 127.0.0.1 | |||
| @@ -49,6 +49,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| aws: | |||
| clientRegion: cn-northwest-1 | |||
| bucketName: iformall-net | |||
| @@ -47,6 +47,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -47,6 +47,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 127.0.0.1 | |||
| @@ -51,6 +51,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| rocketmq: | |||
| nameServer: 127.0.0.1:9876 | |||
| producer: | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 127.0.0.1 | |||
| @@ -112,7 +112,7 @@ public class BillNotificationSchedule { | |||
| WxMsgRecord wxMsgRecord = new WxMsgRecord(); | |||
| wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); | |||
| wxMsgRecord.setModelType(EnumMsgModel.BILL_OWE.getCode()); | |||
| wxMsgRecord.setModelType(EnumMsgModel.BILL_WAIT_PAY.getCode()); | |||
| wxMsgRecord.setReceiver(phone); | |||
| wxMsgRecord.setTenantId(tenantId); | |||
| Map<String,String> map = new HashedMap(); | |||
| @@ -51,6 +51,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| aws: | |||
| clientRegion: cn-northwest-1 | |||
| bucketName: iformall-net | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: localhost | |||
| @@ -48,6 +48,9 @@ spring: | |||
| auth: true | |||
| starttls: | |||
| enable: true | |||
| socketFactory: | |||
| port: 465 | |||
| class: javax.net.ssl.SSLSocketFactory | |||
| # RABBITMQ | |||
| rabbitmq: | |||
| host: 127.0.0.1 | |||
| @@ -166,7 +166,7 @@ public class WxCoupon implements Serializable { | |||
| @Transient | |||
| private String xtime; | |||
| @Transient | |||
| private Long xcount; | |||
| private String xcount; | |||
| /**售出卡数量**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售出卡数量",name="saleCount") | |||
| @Transient | |||
| @@ -212,8 +212,7 @@ public class WxCoupon implements Serializable { | |||
| //营销分析-----end----- | |||
| public Integer getSumSubsidy() { | |||
| public Integer getSumSubsidy() { | |||
| return sumSubsidy; | |||
| } | |||
| @@ -259,11 +258,11 @@ public class WxCoupon implements Serializable { | |||
| this.pressJoinCount = pressJoinCount; | |||
| } | |||
| public Long getXcount() { | |||
| public String getXcount() { | |||
| return xcount; | |||
| } | |||
| public void setXcount(Long xcount) { | |||
| public void setXcount(String xcount) { | |||
| this.xcount = xcount; | |||
| } | |||
| @@ -92,6 +92,10 @@ public class WxDevice implements Serializable { | |||
| @io.swagger.annotations.ApiModelProperty(value="最后一次在线时间",name="hbCmd") | |||
| private Integer hbCmd; | |||
| /**设备名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="设备配置",name="config") | |||
| private String config; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -195,6 +199,14 @@ public class WxDevice implements Serializable { | |||
| this.hbCmd = hbCmd; | |||
| } | |||
| public String getConfig() { | |||
| return config; | |||
| } | |||
| public void setConfig(String config) { | |||
| this.config = config; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxDevice; | |||
| import java.util.List; | |||
| @@ -34,7 +35,7 @@ public interface WxDeviceService { | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxDevice record); | |||
| ResultData saveOrUpdate(WxDevice record); | |||
| /** | |||
| @@ -1492,8 +1492,8 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| Map<String,Object> result = new HashedMap(); | |||
| List<WxCoupon> saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); | |||
| List<WxCoupon> paymentList = wxCouponService.findPaymentByDate(wxCoupon); | |||
| Map<String,Long> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| for (WxCoupon coupon:saleMoneyList){ | |||
| saleMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -1538,10 +1538,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| List<WxCoupon> priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon); | |||
| List<WxCoupon> priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon); | |||
| Map<String,Long> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> priceCouponPaymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> priceCouponPaymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| for (WxCoupon coupon:orderCountList){ | |||
| orderCountMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -1594,9 +1594,9 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| List<WxCoupon> pressSuccHistory = wxCouponService.pressSuccHistory(wxCoupon); | |||
| List<WxCoupon> pressPaymentHistory = wxCouponService.pressPaymentHistory(wxCoupon); | |||
| Map<String,Long> pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,Long> pressPaymentHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| Map<String,String> pressPaymentHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); | |||
| for (WxCoupon coupon:pressSendHistory){ | |||
| pressSendHistoryMap.put(coupon.getXtime(),coupon.getXcount()); | |||
| @@ -1640,14 +1640,14 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| if (StringUtils.isEmpty(paramsMap.get("enddate"))) { | |||
| params.put("enddate", endTime); | |||
| } else { | |||
| endTime = DateUtils.stringToDate(paramsMap.get("enddate") + " 23:59:59", "yyyy-MM-dd HH:mm:ss"); | |||
| params.put("enddate", paramsMap.get("enddate") + " 23:59:59"); | |||
| } | |||
| List<Map<String, Object>> successlist = wxOrderGroupMapper.queryOrderGroupSuccessCountAndTime(params); | |||
| List<Map<String, Object>> verifyList = wxOrderGroupMapper.queryOrderGroupVerifyCountAndTime(params); | |||
| Map<String, Long> successMap = getDateMap(startTime, endTime); | |||
| Map<String, Long> verifyMap = getDateMap(startTime, endTime); | |||
| Map<String, String> successMap = getDateMap(startTime, endTime); | |||
| Map<String, String> verifyMap = getDateMap(startTime, endTime); | |||
| long successCount = wxOrderGroupMapper.queryOrderGroupSuccessCount(params); | |||
| long groupCount = wxOrderGroupMapper.queryOrderGroupCount(params); | |||
| @@ -1658,16 +1658,16 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| transferRatio = new BigDecimal(transfer).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); | |||
| } | |||
| Map<String, Long> successListMap = successlist.parallelStream().collect(Collectors.toMap(x -> { | |||
| Map<String, String> successListMap = successlist.parallelStream().collect(Collectors.toMap(x -> { | |||
| return x.get("time").toString(); | |||
| }, x -> { | |||
| return (long) x.get("total"); | |||
| return x.get("total").toString(); | |||
| })); | |||
| Map<String, Long> verifyListMap = verifyList.parallelStream().collect(Collectors.toMap(x -> { | |||
| Map<String, String> verifyListMap = verifyList.parallelStream().collect(Collectors.toMap(x -> { | |||
| return x.get("time").toString(); | |||
| }, x -> { | |||
| return (long) x.get("total"); | |||
| return x.get("total").toString(); | |||
| })); | |||
| successMap.putAll(successListMap); | |||
| @@ -1768,10 +1768,10 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| return vo; | |||
| } | |||
| public static Map<String,Long> getDateMap(Date begin, Date end) { | |||
| public static Map<String,String> getDateMap(Date begin, Date end) { | |||
| SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); | |||
| Map<String,Long> map = new LinkedHashMap<>(); | |||
| map.put(format.format(begin), 0L); | |||
| Map<String,String> map = new LinkedHashMap<>(); | |||
| map.put(format.format(begin), "0"); | |||
| Calendar calBegin = Calendar.getInstance(); | |||
| calBegin.setTime(begin); | |||
| Calendar calEnd = Calendar.getInstance(); | |||
| @@ -1780,7 +1780,7 @@ public class WxChartServiceImpl implements WxChartDataService { | |||
| end = calEnd.getTime(); | |||
| while (calBegin.getTime().before(end)) { | |||
| calBegin.add(Calendar.DAY_OF_MONTH, 1); | |||
| map.put(format.format(calBegin.getTime()), 0L); | |||
| map.put(format.format(calBegin.getTime()), "0"); | |||
| } | |||
| return map; | |||
| } | |||
| @@ -1,11 +1,15 @@ | |||
| package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxDevice; | |||
| import com.iformall.enums.EnumDeviceStatus; | |||
| import com.iformall.enums.EnumDeviceType; | |||
| import com.iformall.mapper.WxDeviceMapper; | |||
| import com.iformall.service.WxDeviceService; | |||
| import org.slf4j.Logger; | |||
| @@ -24,6 +28,14 @@ public class WxDeviceServiceImpl implements WxDeviceService { | |||
| @Autowired | |||
| WxDeviceMapper wxDeviceMapper; | |||
| final String DEVICE_DEFAULT_CONFIG_SCREEN_AD = "{" + | |||
| "\"heartbeatInterval\":300000," + //5MIN | |||
| "\"dataRefreshInterval\":3600000," + //1HOUR | |||
| "\"pageChangeInterval\":10000," + //10SEC | |||
| "\"animationTheme\":0" + | |||
| "}"; | |||
| @Override | |||
| public PageInfo<WxDevice> listAsPage(WxDevice record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxDeviceMapper.findList(record)); | |||
| @@ -34,20 +46,60 @@ public class WxDeviceServiceImpl implements WxDeviceService { | |||
| return wxDeviceMapper.selectByPrimaryKey(id); | |||
| } | |||
| private String getDefaultConfig(int type) { | |||
| if (type == EnumDeviceType.SCREEN.getCode()) { | |||
| return DEVICE_DEFAULT_CONFIG_SCREEN_AD; | |||
| } | |||
| return null; | |||
| } | |||
| private boolean checkConfig(int type, String config) { | |||
| JSONObject jConfig; | |||
| try { | |||
| jConfig = JSONObject.parseObject(config); | |||
| } catch (Exception e) { | |||
| return false; | |||
| } | |||
| if (type == EnumDeviceType.SCREEN.getCode()) { | |||
| Integer heartBeatIntervel = jConfig.getInteger("heartbeatInterval"); | |||
| Integer dataRefreshIntervel = jConfig.getInteger("dataRefreshInterval"); | |||
| Integer pageChangeInterval = jConfig.getInteger("pageChangeInterval"); | |||
| Integer animationTheme = jConfig.getInteger("animationTheme"); | |||
| if (heartBeatIntervel == null || | |||
| dataRefreshIntervel == null || | |||
| pageChangeInterval == null || | |||
| animationTheme == null) { | |||
| return false; | |||
| } | |||
| } | |||
| return true; | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxDevice record) { | |||
| public ResultData saveOrUpdate(WxDevice record) { | |||
| if (record.getId() == null) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| record.setId(idWorker.nextId()); | |||
| record.setCreateDate(new Date()); | |||
| record.setUpdateDate(new Date()); | |||
| record.setConfig(getDefaultConfig(record.getType())); | |||
| wxDeviceMapper.insertSelective(record); | |||
| } else { | |||
| record.setUpdateDate(new Date()); | |||
| if (record.getConfig() != null && record.getType() != null){ | |||
| if (!checkConfig(record.getType(),record.getConfig())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||
| } | |||
| } | |||
| wxDeviceMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxDeviceMapper.deleteByPrimaryKey(id); | |||
| @@ -226,15 +226,19 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||
| List<WxCUser> userList = new ArrayList<>(); | |||
| for (WxOrder order : orderList) { | |||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(order.getCUserId()); | |||
| userList.add(user); | |||
| if (user != null) { | |||
| userList.add(user); | |||
| } | |||
| } | |||
| if (!userList.isEmpty()) { | |||
| userList = userList.parallelStream().map(u -> { | |||
| WxCUser temp = new WxCUser(); | |||
| temp.setId(u.getId()); | |||
| temp.setNickName(u.getNickName()); | |||
| temp.setAvatarUrl(u.getAvatarUrl()); | |||
| return temp; | |||
| }).collect(Collectors.toList()); | |||
| } | |||
| userList = userList.parallelStream().map(u -> { | |||
| WxCUser temp = new WxCUser(); | |||
| temp.setId(u.getId()); | |||
| temp.setNickName(u.getNickName()); | |||
| temp.setAvatarUrl(u.getAvatarUrl()); | |||
| return temp; | |||
| }).collect(Collectors.toList()); | |||
| couponOrderGroup.put("userList", userList); | |||
| } | |||
| return new ResultData(couponOrderGroup); | |||
| @@ -12,6 +12,8 @@ import com.iformall.domain.po.WxCampaign; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxScreenAd; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.enums.EnumCouponChannelType; | |||
| import com.iformall.enums.EnumCouponType; | |||
| import com.iformall.enums.EnumScreenAdType; | |||
| import com.iformall.mapper.WxCampaignMapper; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| @@ -143,6 +145,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| try { | |||
| record.setQrcode(getQrcode(record.getTargetId(), | |||
| record.getType().intValue(), | |||
| record.getSubType().intValue(), | |||
| wxAppinfoService.getCAppInfo(record.getTenantId()))); | |||
| }catch (Exception e) { | |||
| logger.error("QRCODE set Error:"+e.getMessage()); | |||
| @@ -157,8 +160,9 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| private static String QRCODE_JUMP_CMD_HOME = "JH"; | |||
| private static String QRCODE_JUMP_CMD_COUPON = "JC"; | |||
| private static String QRCODE_JUMP_CMD_GROUP = "JG"; | |||
| private static String QRCODE_JUMP_CMD_CAMPGIN = "JB"; | |||
| private byte[] getQrcode(Long id, int type, WxAppinfo appInfo) throws Exception { | |||
| private byte[] getQrcode(Long id, int type, int subType, WxAppinfo appInfo) throws Exception { | |||
| if(appInfo == null) { | |||
| logger.error("QRCODE get error: appinfo is null"); | |||
| return null; | |||
| @@ -166,8 +170,13 @@ public class WxScreenAdServiceImpl implements WxScreenAdService { | |||
| WxMaService wxMaService = MaUtil.getWeappService(appInfo); | |||
| String scene = ""; | |||
| if (EnumScreenAdType.COUPON.getCode().equals(type)) | |||
| scene = QRCODE_JUMP_CMD_COUPON+":"+id.toString(); | |||
| if (EnumScreenAdType.COUPON.getCode().equals(type)) { | |||
| if (EnumCouponChannelType.COUPON_CHANNEL_ID_ORDER_GROUP.getCode().equals(subType)) { | |||
| scene = QRCODE_JUMP_CMD_GROUP + ":" + id.toString(); | |||
| } else { | |||
| scene = QRCODE_JUMP_CMD_COUPON + ":" + id.toString(); | |||
| } | |||
| } | |||
| else if (EnumScreenAdType.CAMPAIGN.getCode().equals(type)) | |||
| scene = QRCODE_JUMP_CMD_CAMPGIN+":"+id.toString(); | |||
| else | |||
| @@ -39,8 +39,8 @@ | |||
| <if test=" null != type "> | |||
| and cc.`type` = #{type} | |||
| </if> | |||
| <if test=" null != title "> | |||
| <if test=" null != title and ''!= title"> | |||
| and cc.`title` like concat('%', #{title},'%') | |||
| </if> | |||
| @@ -44,6 +44,7 @@ | |||
| <result column="sum_subsidy" property="sumSubsidy"/> | |||
| <result column="payment_rate" property="paymentRate"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| @@ -680,7 +681,7 @@ | |||
| </update> | |||
| <select id="findSaleMoneyByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(ci.sale_amount) xcount from wx_card_info ci | |||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| where c.type = 100 | |||
| and ci.create_date between #{startdate} and #{enddate} | |||
| @@ -688,11 +689,11 @@ | |||
| </select> | |||
| <select id="findPaymentByDate" parameterType="com.iformall.domain.po.WxCoupon" resultType="com.iformall.domain.po.WxCoupon"> | |||
| select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(wcs.payment) xcount from wx_card_info ci | |||
| select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_card_spend wcs on wcs.card_id = ci.id | |||
| where c.type = 100 | |||
| and ci.create_date between #{startdate} and #{enddate} | |||
| and wcs.create_date between #{startdate} and #{enddate} | |||
| group by xtime | |||
| </select> | |||
| @@ -713,7 +714,7 @@ | |||
| </select> | |||
| <select id="findSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(sc.subsidy) from wx_card_info ci | |||
| select sum(round(sc.subsidy/100,2)) from wx_card_info ci | |||
| left join wx_coupon c on c.id = ci.coupon_id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id | |||
| where c.type = 100 and c.create_date between #{startdate} and #{enddate} | |||
| @@ -730,17 +731,18 @@ | |||
| left join wx_card_transfer_info wcs on wcs.coupon_order_id = ci.id | |||
| where wc.id = c.id) as transfer_count, | |||
| (select sum(ci.sale_amount) from wx_card_info ci | |||
| (select sum(round(ci.sale_amount/100,2)) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| where wc.id = c.id) as sale_amount, | |||
| (select sum(wcs.payment) from wx_card_info ci | |||
| (select sum(round(wcs.real_payment/100,2)) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| left join wx_card_spend wcs on wcs.card_id = ci.id | |||
| where wc.id = c.id) as sum_payment, | |||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||
| left join wx_coupon_order wco on wc.id = wco.coupon_id | |||
| (select sum(round(sc.subsidy/100,2)) from wx_card_info ci | |||
| left join wx_coupon wc on wc.id = ci.coupon_id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = ci.id | |||
| where wc.id = c.id) as sum_subsidy | |||
| from wx_coupon c where c.type = 100 | |||
| @@ -753,11 +755,13 @@ | |||
| <select id="findCouponData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||
| select c.*, | |||
| (select count(wco.id) from wx_coupon_order wco where wco.coupon_id = c.id) as sale_count, | |||
| (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as payment_count, | |||
| (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 1 and wc.id = c.id) as sum_payment, | |||
| (select count(wco.id) from wx_coupon wc,wx_coupon_order wco where wco.coupon_id = wc.id and wco.coupon_order_status = 3 and wc.id = c.id) as backpay_count, | |||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||
| left join wx_coupon_order wco on wc.id = wco.coupon_id | |||
| (select sum(round(sc.subsidy/100,2)) from wx_coupon wc | |||
| left join wx_coupon_order wo on wo.coupon_id = wc.id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id | |||
| where wc.id = c.id) as sum_subsidy | |||
| from wx_coupon c where c.type not in(8,9,100) | |||
| <if test=" 1 == type "> | |||
| and c.sale_price > 0 | |||
| @@ -777,9 +781,11 @@ | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| where wop.first = 1 and wc.id = c.id) as press_count, | |||
| (select count(wo.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| where wo.order_status = 7 and wc.id = c.id) as press_succ_count, | |||
| (select count(wop.id) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| @@ -795,11 +801,7 @@ | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| left join wx_order_press wop on wop.order_id = wo.id | |||
| where wop.first = 1 and wc.id = c.id) | |||
| *100,2) as payment_rate, | |||
| (select sum(wc.subsidy_num) from wx_coupon wc | |||
| left join wx_order wo on wo.product_id = wc.id | |||
| where wo.order_status = 7 and wc.id = c.id) as sum_subsidy | |||
| *100,2) as payment_rate | |||
| from wx_coupon c where c.type = 8 | |||
| <if test="id != null"> | |||
| @@ -859,22 +861,23 @@ | |||
| </select> | |||
| <select id="findSumPriceSaleMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||
| select sum(round(c.sale_price/100,2)) from wx_coupon c,wx_coupon_order wco | |||
| where wco.coupon_id = c.id and wco.coupon_price > 0 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| <select id="findSumPricePayMent" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(wco.coupon_price) from wx_coupon c,wx_coupon_order wco | |||
| select sum(round(c.sale_price/100,2)) from wx_coupon c,wx_coupon_order wco | |||
| where wco.coupon_id = c.id and wco.coupon_price > 0 and wco.coupon_order_status = 1 | |||
| and wco.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| <select id="findSumSubsidyMoney" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long"> | |||
| select sum(sc.subsidy) from wx_coupon c | |||
| select sum(round(sc.subsidy/100,2)) from wx_coupon c | |||
| left join wx_coupon_order wo on wo.coupon_id = c.id | |||
| left join wx_merchant_subsidy sc on sc.coupon_order_id = wo.id | |||
| where c.type not in(8,9,100) and c.create_date between #{startdate} and #{enddate} | |||
| where c.type not in(8,9,100) and wo.coupon_order_status = 1 | |||
| and c.create_date between #{startdate} and #{enddate} | |||
| </select> | |||
| @@ -16,10 +16,11 @@ | |||
| <result column="first_hb_time" jdbcType="TIMESTAMP" property="firstHbTime"/> | |||
| <result column="last_hb_time" jdbcType="TIMESTAMP" property="lastHbTime"/> | |||
| <result column="hb_cmd" jdbcType="INTEGER" property="hbCmd"/> | |||
| <result column="config" jdbcType="VARCHAR" property="config"/> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`, `tenant_id`, `device_id`, `type`, `status`, `location`, `name`, `version`, `create_date`, `update_date`, `online_status`, `first_hb_time`, `last_hb_time`, `hb_cmd` | |||
| `id`, `tenant_id`, `device_id`, `type`, `status`, `location`, `name`, `version`, `create_date`, `update_date`, `online_status`, `first_hb_time`, `last_hb_time`, `hb_cmd`, `config` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -82,6 +83,10 @@ | |||
| and `hb_cmd` = #{hbCmd} | |||
| </if> | |||
| <if test=" null != config "> | |||
| and `config` = #{config} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| @@ -700,7 +700,7 @@ | |||
| </select> | |||
| <update id="updateStatusByOrderGroupId" parameterType="com.iformall.domain.po.WxOrder"> | |||
| update wx_order set order_status=#{orderStatus} where tenant_id=#{tenantId} and order_group_id=#{orderGroupId} | |||
| update wx_order set order_status=#{orderStatus} where tenant_id=#{tenantId} and order_group_id=#{orderGroupId} and order_status=10 | |||
| </update> | |||
| </mapper> | |||