diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java index b7d374d5b..a611515d9 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCouponController.java @@ -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 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 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("砍价营销列表接口") diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceController.java index bdd04a1ad..718d34061 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceController.java @@ -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); + } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceScreenAdController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceScreenAdController.java index afc554af7..9421bc17a 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceScreenAdController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxDeviceScreenAdController.java @@ -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 result = new HashMap<>(); + result.put("config",wxDevice.getConfig()); + result.put("name", wxDevice.getName()); + result.put("location", wxDevice.getLocation()); + return new ResultData(result); } @ApiOperation("基础信息") diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 67b288c92..3d09f0d74 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -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 diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index 77ede8192..028948c64 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -48,6 +48,9 @@ spring: auth: true starttls: enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost diff --git a/mallinkAdmin/src/main/resources/application-test.yml b/mallinkAdmin/src/main/resources/application-test.yml index ecb63ec51..827263411 100644 --- a/mallinkAdmin/src/main/resources/application-test.yml +++ b/mallinkAdmin/src/main/resources/application-test.yml @@ -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 diff --git a/mallinkBApi/src/main/resources/application-dev.yml b/mallinkBApi/src/main/resources/application-dev.yml index cde001b8b..d43000b27 100644 --- a/mallinkBApi/src/main/resources/application-dev.yml +++ b/mallinkBApi/src/main/resources/application-dev.yml @@ -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 diff --git a/mallinkBApi/src/main/resources/application-prod.yml b/mallinkBApi/src/main/resources/application-prod.yml index dab302677..69cbb6e34 100644 --- a/mallinkBApi/src/main/resources/application-prod.yml +++ b/mallinkBApi/src/main/resources/application-prod.yml @@ -47,6 +47,9 @@ spring: auth: true starttls: enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost diff --git a/mallinkBApi/src/main/resources/application-test.yml b/mallinkBApi/src/main/resources/application-test.yml index b35b0bfad..4141683a9 100644 --- a/mallinkBApi/src/main/resources/application-test.yml +++ b/mallinkBApi/src/main/resources/application-test.yml @@ -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 diff --git a/mallinkCApi/src/main/resources/application-dev.yml b/mallinkCApi/src/main/resources/application-dev.yml index d2dd7cfc0..a412f6cab 100644 --- a/mallinkCApi/src/main/resources/application-dev.yml +++ b/mallinkCApi/src/main/resources/application-dev.yml @@ -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 diff --git a/mallinkCApi/src/main/resources/application-prod.yml b/mallinkCApi/src/main/resources/application-prod.yml index 6305d420e..ccb70a731 100644 --- a/mallinkCApi/src/main/resources/application-prod.yml +++ b/mallinkCApi/src/main/resources/application-prod.yml @@ -47,6 +47,9 @@ spring: auth: true starttls: enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost diff --git a/mallinkCApi/src/main/resources/application-test.yml b/mallinkCApi/src/main/resources/application-test.yml index 84aaf924c..9a8511358 100644 --- a/mallinkCApi/src/main/resources/application-test.yml +++ b/mallinkCApi/src/main/resources/application-test.yml @@ -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 diff --git a/mallinkMQConsumer/src/main/resources/application-dev.yml b/mallinkMQConsumer/src/main/resources/application-dev.yml index edcc81afe..554af1227 100644 --- a/mallinkMQConsumer/src/main/resources/application-dev.yml +++ b/mallinkMQConsumer/src/main/resources/application-dev.yml @@ -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: diff --git a/mallinkMQConsumer/src/main/resources/application-prod.yml b/mallinkMQConsumer/src/main/resources/application-prod.yml index 3d9fee875..2f0b29d9b 100644 --- a/mallinkMQConsumer/src/main/resources/application-prod.yml +++ b/mallinkMQConsumer/src/main/resources/application-prod.yml @@ -48,6 +48,9 @@ spring: auth: true starttls: enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost diff --git a/mallinkMQConsumer/src/main/resources/application-test.yml b/mallinkMQConsumer/src/main/resources/application-test.yml index ca26cbaf6..f3c9256e4 100644 --- a/mallinkMQConsumer/src/main/resources/application-test.yml +++ b/mallinkMQConsumer/src/main/resources/application-test.yml @@ -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 diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java index c40acc1a1..77359957e 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/BillNotificationSchedule.java @@ -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 map = new HashedMap(); diff --git a/mallinkSchedule/src/main/resources/application-dev.yml b/mallinkSchedule/src/main/resources/application-dev.yml index 23a4f20b5..fd0290da1 100644 --- a/mallinkSchedule/src/main/resources/application-dev.yml +++ b/mallinkSchedule/src/main/resources/application-dev.yml @@ -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 diff --git a/mallinkSchedule/src/main/resources/application-prod.yml b/mallinkSchedule/src/main/resources/application-prod.yml index 71de10c00..65fa94c2b 100644 --- a/mallinkSchedule/src/main/resources/application-prod.yml +++ b/mallinkSchedule/src/main/resources/application-prod.yml @@ -48,6 +48,9 @@ spring: auth: true starttls: enable: true + socketFactory: + port: 465 + class: javax.net.ssl.SSLSocketFactory # RABBITMQ rabbitmq: host: localhost diff --git a/mallinkSchedule/src/main/resources/application-test.yml b/mallinkSchedule/src/main/resources/application-test.yml index 4f3a2535c..4965fb3df 100644 --- a/mallinkSchedule/src/main/resources/application-test.yml +++ b/mallinkSchedule/src/main/resources/application-test.yml @@ -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 diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 2ed6b9bf5..70e791443 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -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; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxDevice.java b/mallinkService/src/main/java/com/iformall/domain/po/WxDevice.java index b62f16b2a..4df4f4afc 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxDevice.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxDevice.java @@ -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") diff --git a/mallinkService/src/main/java/com/iformall/service/WxDeviceService.java b/mallinkService/src/main/java/com/iformall/service/WxDeviceService.java index 4b0dec811..b8a71c7b1 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxDeviceService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxDeviceService.java @@ -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); /** diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index f0dc4a23f..11f0a7101 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -1492,8 +1492,8 @@ public class WxChartServiceImpl implements WxChartDataService { Map result = new HashedMap(); List saleMoneyList = wxCouponService.findSaleMoneyByDate(wxCoupon); List paymentList = wxCouponService.findPaymentByDate(wxCoupon); - Map saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map payMentMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map saleMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map 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 priceCouponSaleCountList = wxCouponService.priceCouponSaleCount(wxCoupon); List priceCouponPaymentCountList = wxCouponService.priceCouponPaymentCount(wxCoupon); - Map orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map priceCouponPaymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map orderCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map paymentCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map priceCouponSaleCountMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map 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 pressSuccHistory = wxCouponService.pressSuccHistory(wxCoupon); List pressPaymentHistory = wxCouponService.pressPaymentHistory(wxCoupon); - Map pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); - Map pressPaymentHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map pressSendHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map pressSuccHistoryMap = getDateMap(wxCoupon.getStartdate(),wxCoupon.getEnddate()); + Map 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> successlist = wxOrderGroupMapper.queryOrderGroupSuccessCountAndTime(params); List> verifyList = wxOrderGroupMapper.queryOrderGroupVerifyCountAndTime(params); - Map successMap = getDateMap(startTime, endTime); - Map verifyMap = getDateMap(startTime, endTime); + Map successMap = getDateMap(startTime, endTime); + Map 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 successListMap = successlist.parallelStream().collect(Collectors.toMap(x -> { + Map successListMap = successlist.parallelStream().collect(Collectors.toMap(x -> { return x.get("time").toString(); }, x -> { - return (long) x.get("total"); + return x.get("total").toString(); })); - Map verifyListMap = verifyList.parallelStream().collect(Collectors.toMap(x -> { + Map 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 getDateMap(Date begin, Date end) { + public static Map getDateMap(Date begin, Date end) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - Map map = new LinkedHashMap<>(); - map.put(format.format(begin), 0L); + Map 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; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxDeviceServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxDeviceServiceImpl.java index 49a721965..901570ab9 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxDeviceServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxDeviceServiceImpl.java @@ -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 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); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java index c69a79acf..0ace5279c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxOrderGroupServiceImpl.java @@ -226,15 +226,19 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { List 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); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java index 97a156407..d6c61d953 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java @@ -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 diff --git a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml index ca576200d..763822fe3 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml @@ -39,8 +39,8 @@ and cc.`type` = #{type} - - + + and cc.`title` like concat('%', #{title},'%') diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 8c9ae624f..65d04c66b 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -44,6 +44,7 @@ + @@ -680,7 +681,7 @@ @@ -713,7 +714,7 @@ 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) 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 @@ -859,22 +861,23 @@ diff --git a/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml b/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml index 0050312eb..c33a30a69 100644 --- a/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxDeviceMapper.xml @@ -16,10 +16,11 @@ + - `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` @@ -82,6 +83,10 @@ and `hb_cmd` = #{hbCmd} + + and `config` = #{config} + + and id in diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 1f591b917..fc7b13b72 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -700,7 +700,7 @@ - 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