| @@ -0,0 +1,9 @@ | |||||
| #父级业态 | |||||
| insert into `wx_business` ( `id`, `title`, `type`, `create_date`, `update_date`) values ( '11', '数码家电', '1', now(), now()); | |||||
| #子级业态 | |||||
| insert into `wx_sub_business` ( `id`, `title`, `business_id`, `business_title`, `create_date`, `update_date`) values | |||||
| ( '59', '家用电器', '11', '数码家电', now(), now()), | |||||
| ( '60', '数码产品', '11', '数码家电', now(), now()), | |||||
| ( '61', '手机通信', '11', '数码家电', now(), now()), | |||||
| ( '62', '电脑办公', '11', '数码家电', now(), now()), | |||||
| ( '63', '影音娱乐', '11', '数码家电', now(), now()); | |||||
| @@ -95,4 +95,19 @@ public class WxCouponChannelController extends BaseController { | |||||
| }); | }); | ||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("change") | |||||
| public ResultData change(@ModelAttribute WxCouponChannel wxCouponChannel) { | |||||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | |||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| wxCouponChannel.setCouponStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.UpdateDate_DESC, BaseEntity.SortField.Id_DESC); | |||||
| WxCouponChannelVo vo = wxCouponChannelService.change(wxCouponChannel); | |||||
| return new ResultData(vo); | |||||
| } | |||||
| } | } | ||||
| @@ -1,6 +1,8 @@ | |||||
| package com.iformall.common; | package com.iformall.common; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import java.lang.management.ManagementFactory; | import java.lang.management.ManagementFactory; | ||||
| import java.net.UnknownHostException; | import java.net.UnknownHostException; | ||||
| @@ -16,6 +18,7 @@ import java.util.List; | |||||
| */ | */ | ||||
| public class IdWorker { | public class IdWorker { | ||||
| private final Logger logger = LoggerFactory.getLogger(IdWorker.class); | |||||
| // ==============================Fields=========================================== | // ==============================Fields=========================================== | ||||
| /** 开始时间截 (2015-01-01) */ | /** 开始时间截 (2015-01-01) */ | ||||
| private final long twepoch = 1489111610226L; | private final long twepoch = 1489111610226L; | ||||
| @@ -60,16 +63,19 @@ public class IdWorker { | |||||
| private long lastTimestamp = -1L; | private long lastTimestamp = -1L; | ||||
| ///////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////// | ||||
| private static class IdGenHolder { | |||||
| private static final IdWorker instance = new IdWorker(); | |||||
| } | |||||
| public static IdWorker get(){ | |||||
| return IdGenHolder.instance; | |||||
| private static IdWorker instance = null; | |||||
| public static IdWorker get() { | |||||
| if(instance == null) { | |||||
| synchronized (IdWorker.class){ | |||||
| if(instance==null){ | |||||
| instance = new IdWorker(); | |||||
| } | |||||
| } | |||||
| } | |||||
| return instance; | |||||
| } | } | ||||
| public IdWorker() { | |||||
| private IdWorker() { | |||||
| String ipAddr = ""; | String ipAddr = ""; | ||||
| try { | try { | ||||
| ipAddr = IPUtil.getLocalHostLANAddress().getHostAddress(); | ipAddr = IPUtil.getLocalHostLANAddress().getHostAddress(); | ||||
| @@ -3,7 +3,6 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| @@ -71,4 +70,6 @@ public interface WxCouponChannelService { | |||||
| void updateStatusByCouponId(Long couponId,String tenantId,int status); | void updateStatusByCouponId(Long couponId,String tenantId,int status); | ||||
| WxCouponChannelVo change(WxCouponChannel wxCouponChannel); | |||||
| } | } | ||||
| @@ -7,7 +7,6 @@ import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponChannelAddVo; | import com.iformall.domain.vo.WxCouponChannelAddVo; | ||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| @@ -17,7 +16,6 @@ import com.iformall.mapper.WxCouponChannelMapper; | |||||
| import com.iformall.mapper.WxCouponMerchantMapper; | import com.iformall.mapper.WxCouponMerchantMapper; | ||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.checkerframework.checker.units.qual.A; | |||||
| 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; | ||||
| @@ -138,6 +136,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponChannelMapper.updateStatusByCouponId(wxCouponChannel); | wxCouponChannelMapper.updateStatusByCouponId(wxCouponChannel); | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponChannelVo change(WxCouponChannel record) { | |||||
| return wxCouponChannelMapper.findVoList(record).parallelStream().findAny().orElseGet(null); | |||||
| } | |||||
| private boolean isCouponMerchantValid(Long couponId) { | private boolean isCouponMerchantValid(Long couponId) { | ||||
| Map paramMap = new HashMap<>(); | Map paramMap = new HashMap<>(); | ||||
| paramMap.put("productId",couponId); | paramMap.put("productId",couponId); | ||||
| @@ -4,6 +4,7 @@ import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.net.Inet4Address; | |||||
| import java.net.InetAddress; | import java.net.InetAddress; | ||||
| import java.net.NetworkInterface; | import java.net.NetworkInterface; | ||||
| import java.net.UnknownHostException; | import java.net.UnknownHostException; | ||||
| @@ -62,7 +63,7 @@ public class IPUtil { | |||||
| // 在所有的接口下再遍历IP | // 在所有的接口下再遍历IP | ||||
| for (Enumeration inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) { | for (Enumeration inetAddrs = iface.getInetAddresses(); inetAddrs.hasMoreElements();) { | ||||
| InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); | InetAddress inetAddr = (InetAddress) inetAddrs.nextElement(); | ||||
| if (!inetAddr.isLoopbackAddress()) {// 排除loopback类型地址 | |||||
| if (!inetAddr.isLoopbackAddress() && (inetAddr instanceof Inet4Address)) {// 排除loopback类型地址, ipv4 | |||||
| if (inetAddr.isSiteLocalAddress()) { | if (inetAddr.isSiteLocalAddress()) { | ||||
| // 如果是site-local地址,就是它了 | // 如果是site-local地址,就是它了 | ||||
| return inetAddr; | return inetAddr; | ||||