From 2eb9a0c0f502326b7ad0e64afb44b3ba51a9f186 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Mon, 27 Aug 2018 21:50:12 +0800 Subject: [PATCH 01/90] =?UTF-8?q?[=E5=88=B8=E8=AF=A6=E6=83=85][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]:=E8=AE=A2=E5=8D=95=E4=B8=8B=E5=8D=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCouponController.java | 20 ++++++++++++++++--- .../simple/controller/WxOrderController.java | 7 +++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponController.java index 082651d95..e5da28f68 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponController.java @@ -4,6 +4,7 @@ import com.simple.common.ErrorCode; import com.simple.domain.po.WxCouponChannel; import com.simple.domain.vo.WxCouponCVo; import io.swagger.annotations.Api; +import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; @@ -28,10 +29,23 @@ public class WxCouponController extends BaseController { @Autowired private WxCouponService wxCouponService; - @ApiOperation("根据id查询接口") + @ApiOperation("根据id(couponChannel)查询接口") @GetMapping("/detail") - public ResultData detail(@ModelAttribute WxCouponChannel wxCouponChannel) { - if(wxCouponChannel == null) wxCouponChannel = new WxCouponChannel(); + @ApiImplicitParams({ + @ApiImplicitParam(name = "id", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) + public ResultData detail(String id) { + if (StringUtils.isBlank(id)) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id为空"); + } + Long couponChannelId = 0L; + try { + couponChannelId = Long.valueOf(id); + } catch (NumberFormatException e) { + logger.error("id转换失败" + id); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "id转换失败" + id); + } + WxCouponChannel wxCouponChannel = new WxCouponChannel(); + wxCouponChannel.setId(couponChannelId); wxCouponChannel.setTenantId(getTenantId()); WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCouponChannel); if (wxCouponCVo == null) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java index 05ee45d5e..49d2e59a7 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java @@ -113,6 +113,13 @@ public class WxOrderController extends BaseController { } if (StringUtils.isBlank(couponIdStr)) { couponId = wxCouponChannel.getCouponId(); + } else { + try { + couponId = Long.valueOf(couponIdStr); + } catch (NumberFormatException e) { + logger.error("couponId convert error, " + couponIdStr + ", e:" + e.getMessage()); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); + } } WxCUser user = getUser(); From 447d9fab699332658138a41a25b790dc7e5f444c Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Mon, 27 Aug 2018 23:06:45 +0800 Subject: [PATCH 02/90] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=B4=9E=E5=AF=9F][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]=E4=BC=9A=E5=91=98=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WxCUserBasicInfoController.java | 81 +------ .../controller/WxUserStructureController.java | 197 ++++++++++++++++++ .../com/simple/domain/vo/UserStructureVo.java | 6 +- .../java/com/simple/mapper/WxCUserMapper.java | 2 +- .../com/simple/service/WxCUserService.java | 4 +- .../service/impl/WxCUserServiceImpl.java | 8 +- .../main/resources/mapper/WxCUserMapper.xml | 7 +- 7 files changed, 214 insertions(+), 91 deletions(-) create mode 100644 mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java index ba527055a..b281d108f 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java @@ -200,84 +200,5 @@ public class WxCUserBasicInfoController extends BaseController return new ResultData(Result.SUCCESS,"查询成功",page); } - @ApiOperation("查询会员性别结构") - @GetMapping("/findUserSexStructure") - public ResultData findUserSexStructure( - Date startTime,Date endTime - ) { - WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); - dto.setStartTime(startTime); - dto.setEndTime(endTime); - //保密 - dto.setSex(0); - long secrecy = getCount(dto); - dto.setSex(1); - long boy = getCount(dto); - dto.setSex(2); - long girl=getCount(dto); - Long all =secrecy+boy+girl; - List vos = new ArrayList<>(); - vos.add(getVo(boy, all, "男",1)); - vos.add(getVo(girl, all, "女",2)); - vos.add(getVo(secrecy, all, "保密",3)); - return new ResultData(vos); - } - - @ApiOperation("查询会员年龄结构") - @GetMapping("/findUserAgeStructure") - public ResultData findUserAgeStructure( Date startTime,Date endTime) { - WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); - dto.setStartTime(startTime); - dto.setEndTime(endTime); - long all =wxCUserBasicInfoService.findCountByAge(dto); - List vos = new ArrayList<>(); - Calendar c = Calendar.getInstance(); - for(EnumAgeInfo a:EnumAgeInfo.values()) { - c.clear(); - c.setTime(new Date()); - c.set(Calendar.HOUR_OF_DAY, 0); - c.set(Calendar.MINUTE,0); - c.set(Calendar.SECOND,0); - long count = getCountByAge(a, c,dto); - vos.add(getVo(count, all, a.getDesc(),a.getSortNum())); - } - return new ResultData(vos); - } - - - private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) { - c.add(Calendar.YEAR, -a.getEnd()); - Date startTime = c.getTime(); - c.clear(); - c.setTime(startTime); - c.add(Calendar.YEAR,a.getEnd()-a.getStart()); - Date endTime = c.getTime(); - dto.setBirthStartTime(startTime); - dto.setBirthEndTime(endTime); - return wxCUserBasicInfoService.findCountByAge(dto); - } - - - //通过性别获取数量 - private long getCount(WxCuerBasicInfoDto dto) { - //TODO 考虑性能问题,暂不处理少量重复问题,后续可考虑大数据处理 - return wxCUserBasicInfoService.findCountBySex(dto)+ - wxCUserService.findCountBySex(dto); - } - - private UserStructureVo getVo(long count,long all,String name,Integer num) { - UserStructureVo vo = new UserStructureVo(); - vo.setSortNum(num); - vo.setName(name); - vo.setCount(count+""); - NumberFormat nf = NumberFormat.getPercentInstance(); - nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 - if(all>0) { - vo.setPercentage(nf.format(new Long(count).doubleValue()/new Long(all).doubleValue())); - }else { - vo.setPercentage("0.00%"); - } - return vo; - } - + } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java new file mode 100644 index 000000000..80f591e7c --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java @@ -0,0 +1,197 @@ +package com.simple.controller; + +import java.text.NumberFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.simple.common.ResultData; +import com.simple.domain.dto.WxCuerBasicInfoDto; +import com.simple.domain.vo.UserStructureVo; +import com.simple.enums.EnumAgeInfo; +import com.simple.service.WxCUserBasicInfoService; +import com.simple.service.WxCUserService; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +@RestController +@Api(description="会员洞察") +@RequestMapping("userAnalysis") +public class WxUserStructureController { + + @Autowired + private WxCUserBasicInfoService wxCUserBasicInfoService; + + @Autowired + private WxCUserService wxCUserService; + + @ApiOperation("查询会员性别结构") + @GetMapping("/findUserSexStructure") + public ResultData findUserSexStructure( + Date startTime,Date endTime + ) { + WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); + dto.setStartTime(startTime); + if(endTime!=null) { + Calendar c = Calendar.getInstance(); + c.setTime(endTime); + c.add(Calendar.DAY_OF_YEAR, 1); + endTime =c.getTime(); + } + //保密 + dto.setSex(0); + long secrecy = getCount(dto); + dto.setSex(1); + long boy = getCount(dto); + dto.setSex(2); + long girl=getCount(dto); + Long all =secrecy+boy+girl; + List vos = new ArrayList<>(); + vos.add(getVo(boy, all, "男",1)); + vos.add(getVo(girl, all, "女",2)); + vos.add(getVo(secrecy, all, "保密",3)); + return new ResultData(vos); + } + + @ApiOperation("查询会员年龄结构") + @GetMapping("/findUserAgeStructure") + public ResultData findUserAgeStructure( Date startTime,Date endTime) { + WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); + dto.setStartTime(startTime); + if(endTime!=null) { + Calendar c = Calendar.getInstance(); + c.setTime(endTime); + c.add(Calendar.DAY_OF_YEAR, 1); + endTime =c.getTime(); + } + dto.setEndTime(endTime); + long all =wxCUserBasicInfoService.findCountByAge(dto); + List vos = new ArrayList<>(); + Calendar c = Calendar.getInstance(); + for(EnumAgeInfo a:EnumAgeInfo.values()) { + c.clear(); + c.setTime(new Date()); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE,0); + c.set(Calendar.SECOND,0); + long count = getCountByAge(a, c,dto); + vos.add(getVo(count, all, a.getDesc(),a.getSortNum())); + } + return new ResultData(vos); + } + + @ApiOperation("查询会员数量") + @GetMapping("/findUserDataCount") + public ResultData findUserCount(Date startTime,Date endTime) { + WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); + dto.setStartTime(startTime); + if(endTime!=null) { + Calendar c = Calendar.getInstance(); + c.setTime(endTime); + c.add(Calendar.DAY_OF_YEAR, 1); + endTime =c.getTime(); + } + long allCount = wxCUserService.findCount(dto);//总量 + + Calendar c = Calendar.getInstance(); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE,0); + c.set(Calendar.SECOND,0); + Date today = c.getTime(); + dto.setStartTime(today); + dto.setEndTime(null); + long todayCount= wxCUserService.findCount( dto);//今天新增 + List newCountVos = new ArrayList<>();//每日新增会员数 + int j=1; + for(int i=29;i>=0;i--) { + c.clear(); + c.setTime(today); + c.add(Calendar.DAY_OF_YEAR, -i); + dto.setStartTime(c.getTime()); + c.add(Calendar.DAY_OF_YEAR, 1); + dto.setEndTime(c.getTime()); + long count= wxCUserService.findCount(dto); + UserStructureVo vo = new UserStructureVo(); + vo.setSortNum(j); + j++; + vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); + vo.setCount(count); + newCountVos.add(vo); + } + List allCountVos = new ArrayList<>();//累计会员数 + c.clear(); + c.setTime(today); + c.add(Calendar.DAY_OF_YEAR, -30); + dto.setEndTime(c.getTime()); + dto.setStartTime(null); + long firstDay = wxCUserService.findCount(dto);//统计的第一天总数 + int i =0; + long sumCount=0; + for(UserStructureVo v:newCountVos) { + UserStructureVo vo = new UserStructureVo(); + sumCount+=v.getCount(); + vo.setCount(firstDay+sumCount); + vo.setName(v.getName()); + vo.setSortNum(i+1); + allCountVos.add(vo); + i++; + } + Map map = new HashMap<>(); + map.put("allCount", allCount);//累计会员总数 + map.put("todayCount", todayCount);//今日新增会员数 + map.put("allCountVos", allCountVos);//累计会员列表( 日期和数量list) + map.put("newCountVos", newCountVos);//新增会员列表(日期和数量list) + return new ResultData(map); + } + + + + private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) { + c.add(Calendar.YEAR, -a.getEnd()); + Date startTime = c.getTime(); + c.clear(); + c.setTime(startTime); + c.add(Calendar.YEAR,a.getEnd()-a.getStart()); + Date endTime = c.getTime(); + dto.setBirthStartTime(startTime); + dto.setBirthEndTime(endTime); + return wxCUserBasicInfoService.findCountByAge(dto); + } + + + + + //通过性别获取数量 + private long getCount(WxCuerBasicInfoDto dto) { + // wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic + //所有这里不需要再去查basic + return wxCUserService.findCount(dto); + } + + private UserStructureVo getVo(long count,long all,String name,Integer num) { + UserStructureVo vo = new UserStructureVo(); + vo.setSortNum(num); + vo.setName(name); + vo.setCount(count); + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 + if(all>0) { + vo.setPercentage(nf.format(new Long(count).doubleValue()/new Long(all).doubleValue())); + }else { + vo.setPercentage("0.00%"); + } + return vo; + } + + +} diff --git a/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java b/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java index 84db123d6..21a641ff0 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java @@ -15,7 +15,7 @@ public class UserStructureVo implements Serializable{ //名称 private String name; //数量 - private String count; + private long count; //百分比 private String percentage; //序号 @@ -32,10 +32,10 @@ public class UserStructureVo implements Serializable{ public void setName(String name) { this.name = name; } - public String getCount() { + public long getCount() { return count; } - public void setCount(String count) { + public void setCount(long count) { this.count = count; } public String getPercentage() { diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java index 222053d6e..bf502cd19 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java @@ -15,5 +15,5 @@ public interface WxCUserMapper extends CommonMapper { WxCUser findByToken(String token); - long findCountBySex(WxCuerBasicInfoDto dto); + long findCount(WxCuerBasicInfoDto dto); } diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserService.java b/mallinkService/src/main/java/com/simple/service/WxCUserService.java index 1dcb1e883..691cc301a 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCUserService.java @@ -55,9 +55,9 @@ public interface WxCUserService { void deleteById(Long id); /** - * 根据性别统计数量 + * 统计数量 * @param dto * @return */ - long findCountBySex(WxCuerBasicInfoDto dto); + long findCount(WxCuerBasicInfoDto dto); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java index e1dbc5676..b2a7c686e 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java @@ -63,10 +63,12 @@ public class WxCUserServiceImpl implements WxCUserService { } @Override - public long findCountBySex(WxCuerBasicInfoDto dto) { - - return wxCUserMapper.findCountBySex(dto); + public long findCount(WxCuerBasicInfoDto dto) { + return wxCUserMapper.findCount(dto); } + + + } diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index c247c6fe4..9b2aa3965 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -184,8 +184,11 @@ where `token` = #{token} - + select count(id) from wx_c_user where 1=1 + + and gender =#{sex} + and create_date >= #{startTime} From d46213a6da24e72cc8815faf872cdb93a0135c72 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Tue, 28 Aug 2018 00:04:58 +0800 Subject: [PATCH 03/90] =?UTF-8?q?[=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98?= =?UTF-8?q?=EF=BC=8C=E7=94=A8select=20count=EF=BC=88*=EF=BC=89=20=E4=BB=A3?= =?UTF-8?q?=E6=9B=BFselectCount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/mapper/WxCUserCarMapper.java | 1 + .../src/main/java/com/simple/mapper/WxCouponOrderMapper.java | 1 + .../src/main/java/com/simple/mapper/WxOrderMapper.java | 2 ++ .../java/com/simple/service/impl/WxCUserCarServiceImpl.java | 2 +- .../java/com/simple/service/impl/WxOrderServiceImpl.java | 4 ++-- .../src/main/resources/mapper/WxCUserCarMapper.xml | 5 +++++ .../src/main/resources/mapper/WxCouponOrderMapper.xml | 5 +++++ mallinkService/src/main/resources/mapper/WxOrderMapper.xml | 5 +++++ 8 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserCarMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserCarMapper.java index aa6a2780b..9d3265673 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserCarMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCUserCarMapper.java @@ -8,6 +8,7 @@ import com.simple.domain.po.WxCUserCar; public interface WxCUserCarMapper extends CommonMapper { List findList(WxCUserCar wxCUserCar); + Integer countList(WxCUserCar wxCUserCar); diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index b4cde9e0e..1a8c48d93 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -10,6 +10,7 @@ import com.simple.domain.po.WxCouponOrder; public interface WxCouponOrderMapper extends CommonMapper { List findList(WxCouponOrder wxCouponOrder); + Integer countList(WxCouponOrder wxCouponOrder); List findListOfUnverifiedByDate(Map dateMap); List findListOfVerifiedByDate(Map dateMap); diff --git a/mallinkService/src/main/java/com/simple/mapper/WxOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxOrderMapper.java index ad5230ed7..955b9303d 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxOrderMapper.java @@ -11,6 +11,8 @@ public interface WxOrderMapper extends CommonMapper { List findList(WxOrder wxOrder); + Integer countList(WxOrder wxOrder); + List findListOfUnpaidOrderByDate(Map dateMap); List findListOfCUser(WxOrder wxOrder); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java index b38485901..4173cc93a 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCUserCarServiceImpl.java @@ -29,7 +29,7 @@ public class WxCUserCarServiceImpl implements WxCUserCarService { @Override public Integer countUserCar(WxCUserCar record) { - return wxCUserCarMapper.selectCount(record); + return wxCUserCarMapper.countList(record); } @Override diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java index 0ec1a8ef5..39046266d 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java @@ -75,7 +75,7 @@ public class WxOrderServiceImpl implements WxOrderService { orderQ.setCUserId(user.getId()); orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); try { - countOrder = wxOrderMapper.selectCount(orderQ); + countOrder = wxOrderMapper.countList(orderQ); } catch (Exception e) { logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); throw new MallinkException(ErrorCode.ORDER_IS_FAIL); @@ -86,7 +86,7 @@ public class WxOrderServiceImpl implements WxOrderService { couponOrderQ.setCUserId(user.getId()); couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); try { - countCouponOrder = wxCouponOrderMapper.selectCount(couponOrderQ); + countCouponOrder = wxCouponOrderMapper.countList(couponOrderQ); } catch (Exception e) { logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); throw new MallinkException(ErrorCode.ORDER_IS_FAIL); diff --git a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml index 65e963ceb..44004949b 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserCarMapper.xml @@ -71,5 +71,10 @@ select from wx_c_user_car + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index e86ec8828..89aae7b91 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -90,6 +90,11 @@ + + diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 81877325f..4979e9db3 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -108,6 +108,11 @@ + + + + + + From 1096d065a48afe0e2722825639c8544eadb7164c Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Mon, 27 Aug 2018 23:06:45 +0800 Subject: [PATCH 05/90] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=B4=9E=E5=AF=9F][?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D]=E6=8B=93=E5=AE=A2=E5=88=86=E6=9E=90mapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkService/src/main/resources/mapper/WxCUserMapper.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index a4835ae35..92cd0f9e9 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -198,7 +198,11 @@ + - select from wx_coupon_order c,wx_coupon co,wx_merchant m left join wx_merchant_shop ms on ms.merchant_id = m.id diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 4979e9db3..9c69380ba 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -120,6 +120,8 @@ where order_status = '0' AND create_date > #{startDate,jdbcType=TIMESTAMP} + + AND create_date < #{endDate,jdbcType=TIMESTAMP} From 18a5841c23b5ecfa75c7c4304604743361e30f18 Mon Sep 17 00:00:00 2001 From: hupeng Date: Tue, 28 Aug 2018 14:49:59 +0800 Subject: [PATCH 18/90] =?UTF-8?q?[A=E7=AB=AF][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B8=E5=88=97=E8=A1=A8=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=98=BE=E7=A4=BA=E4=BD=9C=E5=BA=9F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCouponController.java | 9 +- .../com/simple/mapper/WxCouponMapper.java | 1 - .../com/simple/service/WxCouponService.java | 9 -- .../service/impl/WxCouponServiceImpl.java | 5 - .../main/resources/mapper/WxCouponMapper.xml | 142 ------------------ 5 files changed, 4 insertions(+), 162 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index 4e47f2e65..9e85e2383 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -57,11 +57,10 @@ public class WxCouponController extends BaseController if (null == wxCoupon) wxCoupon = new WxCoupon(); wxCoupon.setTenantId(getTenantId()); PageInfo page = null; - if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) { - page = wxCouponService.findEnableList(wxCoupon, pageNum, pageSize); - }else { - page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); - } + if (wxCoupon.getStatus() != null && wxCoupon.getStatus() == -1) + wxCoupon.setStatus(null); + page = wxCouponService.listAsPage(wxCoupon, pageNum, pageSize); + List wxCouponList = page.getList(); if(wxCouponList.isEmpty()){ diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponMapper.java index 3ef099724..d4b4b3a7c 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponMapper.java @@ -11,7 +11,6 @@ public interface WxCouponMapper extends CommonMapper { List findList(WxCoupon wxCoupon); - List findEnableList(WxCoupon wxCoupon); List findCanSendList(WxCoupon wxCoupon); diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponService.java b/mallinkService/src/main/java/com/simple/service/WxCouponService.java index 6dc34f35e..cdfc677c8 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponService.java @@ -19,15 +19,6 @@ public interface WxCouponService { */ PageInfo listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); - /** - * 根据实体查询分页列表 - * - * @param record - * @param pageIndex - * @param pageSize - * @return - */ - PageInfo findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); /** * 不分页 diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java index 4a66b6fdd..bdb0ea010 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponServiceImpl.java @@ -37,11 +37,6 @@ public class WxCouponServiceImpl implements WxCouponService { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); } - @Override - public PageInfo findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findEnableList(record)); - } - @Override public List findList(WxCoupon record) { return wxCouponMapper.findList(record); diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 27806625e..3a4043c37 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -171,144 +171,6 @@ order by ${sortColumns} - - where 1 = 1 - - - and `id` = #{id} - - - - - and `tenant_id` like concat('%', #{tenantId},'%') - - - - - and `merchant_id` = #{merchantId} - - - - - and `type` = #{type} - - - - - and `cover_img` like concat('%', #{coverImg},'%') - - - - - and `title` like concat('%', #{title},'%') - - - - - and `sub_title` like concat('%', #{subTitle},'%') - - - - - and `sale_price` = #{salePrice} - - - - - and `use_price` = #{usePrice} - - - - - and `use_limit_quantity` = #{useLimitQuantity} - - - - - and `target_ad` = #{targetAd} - - - - - and `send_type` = #{sendType} - - - - - - - and `valid_type` = #{validType} - - - - - and `valid_start_date` = #{validStartDate} - - - - - and `valid_end_date` = #{validEndDate} - - - - - and `valid_days` = #{validDays} - - - - - and `detail` like concat('%', #{detail},'%') - - - - - and `price` = #{price} - - - - - and `remain_inventory` = #{remainInventory} - - - - - and `inventory` = #{inventory} - - - - - and `remark` like concat('%', #{remark},'%') - - - - - and `status` =0 - - - - - and `create_date` = #{createDate} - - - - - and `update_date` = #{updateDate} - - - - - and `business` like concat('%', #{business},'%') - - - - and id in - - #{idItem} - - - order by ${sortColumns} - - where 1 = 1 @@ -451,10 +313,6 @@ - select from wx_coupon @@ -314,12 +179,6 @@ - - - @@ -398,6 +257,31 @@ and cc.target_ad = #{targetAd} - - + + + + + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, + m.img_url,m.name,m.link_phone,m.status, + s.addr,s.shop_number,s.baidu_poi, + mb.building_name,mf.floor_name + + + From a48a8661602f6ca2c98304d50756736af2df8fef Mon Sep 17 00:00:00 2001 From: hupeng Date: Tue, 28 Aug 2018 19:49:00 +0800 Subject: [PATCH 24/90] =?UTF-8?q?[B=E7=AB=AF][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=8A=E6=97=A5=E4=B8=8B=E5=8D=95=E6=80=BB?= =?UTF-8?q?=E9=A2=9D=E5=92=8C=E6=B5=81=E6=B0=B4=E6=BC=8F=E6=8E=89=E4=BB=8A?= =?UTF-8?q?=E6=97=A5=E6=A0=B8=E9=94=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/schedule/DaliyAmountSchedule.java | 2 +- .../java/com/simple/mapper/WxCouponOrderMapper.java | 4 ++-- .../service/impl/WxCouponOrderServiceImpl.java | 4 ++-- .../main/resources/mapper/WxCouponOrderMapper.xml | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java index e58ea293e..d3b6b641c 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java @@ -80,7 +80,7 @@ public class DaliyAmountSchedule { dateMap.put("endDate", new Date()); dateMap.put("merchantID",merchant.getId()); - List list = wxCouponOrderMapper.findListOfUnverifiedByDate(dateMap); + List list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); int total_price = 0; for(WxCouponOrder couponOrder : list) { diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index 94491d665..9ca433cad 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -12,10 +12,10 @@ public interface WxCouponOrderMapper extends CommonMapper { List findList(WxCouponOrder wxCouponOrder); Integer countList(WxCouponOrder wxCouponOrder); - List findListOfUnverifiedByDate(Map dateMap); + List findListOfOrderedByDate(Map dateMap); List findListOfVerifiedByDate(Map dateMap); - List findListOfUnverifiedByDateForBUser(Map dateMap); + List findListOfOrderedByDateForBUser(Map dateMap); List findListOfVerifiedByDateForBUser(Map dateMap); WxCouponOrderCVo selectDetailOfUser(Map paramMap); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java index 5b5a8a715..56032c63f 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java @@ -134,7 +134,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { if(isVerified) list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); else - list = wxCouponOrderMapper.findListOfUnverifiedByDate(dateMap); + list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); int total_price = 0; for (WxCouponOrder couponOrder : list) { @@ -146,7 +146,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { if (isVerified) resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap))); else - resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfUnverifiedByDateForBUser(dateMap))); + resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfOrderedByDateForBUser(dateMap))); } return new ResultData(resultMap); } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 1d396e8ee..128bebfc6 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -128,7 +128,7 @@ bu.name,cu.phone - + co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, c.type,c.title,c.sale_price,c.use_price,c.price, cu.phone @@ -138,8 +138,8 @@ co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price - + select from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu where o.id = co.order_id and o.merchant_id = #{merchantID} @@ -151,7 +151,7 @@ AND co.create_date < #{endDate,jdbcType=TIMESTAMP} - AND co.coupon_order_status = '0' + AND (co.coupon_order_status = '0' or co.coupon_order_status = '1') order by co.create_date desc @@ -243,7 +243,7 @@ - select from wx_coupon_order co,wx_order o where o.id = co.order_id @@ -254,7 +254,7 @@ AND co.create_date < #{endDate,jdbcType=TIMESTAMP} - AND co.coupon_order_status = '0' + AND (co.coupon_order_status = '0' or co.coupon_order_status = '1') From d5677136792f53dda8bc05fdcb90cff07d847372 Mon Sep 17 00:00:00 2001 From: hupeng Date: Tue, 28 Aug 2018 20:18:57 +0800 Subject: [PATCH 25/90] =?UTF-8?q?[C=E7=AB=AF][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E6=9B=B4=E6=94=B9c=E7=AB=AFcoupon=20list=E4=B8=BA=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=97=B6=E9=97=B4=E9=99=8D=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCouponChannelController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java index f1f017ea1..13cd9183c 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java @@ -38,7 +38,7 @@ public class WxCouponChannelController extends BaseController if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); wxCouponChannel.setTenantId(getTenantId()); wxCouponChannel.setStatus(0); - wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); + wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); final PageInfo page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); return new ResultData(page); } From edeba2743a4cf2183e44c400be5e2beb2305d058 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Tue, 28 Aug 2018 21:43:32 +0800 Subject: [PATCH 26/90] =?UTF-8?q?[=E6=95=B0=E6=8D=AE=E5=A1=94=E5=8F=B0][?= =?UTF-8?q?=E5=AE=A2=E6=B5=81=E6=95=B0=E6=8D=AE]:=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DataTowerController.java | 8 +++ .../com/simple/service/DataTowerService.java | 2 + .../service/impl/DataTowerServiceImpl.java | 66 ++++++++++++++++++- 3 files changed, 73 insertions(+), 3 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/DataTowerController.java b/mallinkAdmin/src/main/java/com/simple/controller/DataTowerController.java index 281a96560..3ed0a4e0e 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/DataTowerController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/DataTowerController.java @@ -43,6 +43,14 @@ public class DataTowerController extends BaseController { return new ResultData(data); } + @ApiOperation("查询客流") + @PostMapping("/queryCustomer") + public ResultData queryCustomer() { + + Map data=dataTowerService.queryCustomer(getTenantId()); + + return new ResultData(data); + } } diff --git a/mallinkService/src/main/java/com/simple/service/DataTowerService.java b/mallinkService/src/main/java/com/simple/service/DataTowerService.java index 0f2d231b5..949ce5788 100644 --- a/mallinkService/src/main/java/com/simple/service/DataTowerService.java +++ b/mallinkService/src/main/java/com/simple/service/DataTowerService.java @@ -9,4 +9,6 @@ public interface DataTowerService { Map queryCar(String tenantId); + Map queryCustomer(String tenantId); + } diff --git a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java index 55db6dd7a..148e142e6 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java @@ -1,6 +1,7 @@ package com.simple.service.impl; -import com.simple.common.ErrorCode; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.JsonObject; import com.simple.domain.po.WxMerchant; import com.simple.domain.po.WxMerchantTradeDaily; import com.simple.domain.po.WxShop; @@ -8,12 +9,14 @@ import com.simple.enums.EnumCarCmd; import com.simple.mapper.*; import com.simple.service.DataTowerService; import com.simple.utils.DateUtils; -import org.apache.commons.collections.map.TransformedMap; +import com.simple.utils.HashUtil; +import com.simple.utils.HttpUtil; import org.apache.log4j.Logger; -import org.apache.shiro.crypto.hash.Hash; +import org.apache.shiro.codec.Base64; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -223,6 +226,62 @@ public class DataTowerServiceImpl implements DataTowerService { return datamap; } + @Override + public Map queryCustomer(String tenantId) { + + String username="25016"; + String authVal=encrypt("b#/r{Rq0vxVw(aM46H&$uT>g2YeXQGkc"); + Map params=new HashMap<>(); + params.put("username",username); + params.put("authVal",authVal); + String token = HttpUtil.doPost("http://bi.wiwide.cn/fumao/login/auth", params); + + + Map datamap = new HashMap<>(); + datamap.put("token",JSONObject.parseObject(token).get("data")); + + return datamap; + } + + + public String encrypt(String key) + { + String data = new Date().getTime()/1000+30+""; + String md5 = HashUtil.md5(key); + int x = 0; + int len = data.length(); + int l = md5.length(); + char[] datachar =new char[len]; + for (int i = 0; i < len; i++) + { + if (x == l) + { + x = 0; + } + datachar[i]=md5.charAt(x); + x++; + } + + StringBuilder chars=new StringBuilder(); + for (int i = 0; i < len; i++) + { + int a = data.charAt(i); + int b = (datachar[i]%256); + char v = (char) (a+b); + chars.append(v); + } + + byte[] bytes=null; + try { + bytes = chars.toString().getBytes("ISO-8859-1"); + } catch (Exception e) { + e.printStackTrace(); + } + return Base64.encodeToString(bytes); + + } + + public TreeMap getTimeTreeMap(){ TreeMap timemap=new TreeMap(); timemap.put("06:00",0); @@ -248,4 +307,5 @@ public class DataTowerServiceImpl implements DataTowerService { + } From 326028d7ca3c02c07a90a5903d6e50dc8a300e08 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Tue, 28 Aug 2018 21:58:09 +0800 Subject: [PATCH 27/90] =?UTF-8?q?[=E8=BD=A6=E6=B5=81=E6=A8=A1=E6=9D=BF][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:=E5=A4=84=E7=90=86=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/controller/WxCarController.java | 4 ++++ mallinkService/src/main/java/com/simple/common/ErrorCode.java | 1 + 2 files changed, 5 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index dc320a020..8ed97d77c 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -142,6 +142,10 @@ public class WxCarController extends BaseController businessId = objParams.getString("businessId"); } String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, businessId); + if (ret == null) { + logger.error("quanTemplate failed, 优免券模板未发现"); + return new ResultData(ErrorCode.ETCP_CMD_FAIL.getCode(), "获取优免券模板异常"); + } JSONObject retObj = JSON.parseObject(ret); if (retObj.getIntValue("code") == 0) { return new ResultData(retObj.getJSONObject("data")); diff --git a/mallinkService/src/main/java/com/simple/common/ErrorCode.java b/mallinkService/src/main/java/com/simple/common/ErrorCode.java index 48c82883e..1b14096c5 100644 --- a/mallinkService/src/main/java/com/simple/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/simple/common/ErrorCode.java @@ -83,6 +83,7 @@ public enum ErrorCode{ ETCP_STOP_FEE_FAIL(2054, "ETCP停车费失败"), ETCP_QUAN_TEMP_FAIL(2055, "ETCP优免券模板失败"), ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"), + ETCP_CMD_FAIL(2057, "ETCP网络异常"), TJD_BIND_FAIL(2060,"TJD绑车牌失败"), TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"), From 2724598d85ab3acc02e57bcb9332ae448133d86a Mon Sep 17 00:00:00 2001 From: masterspirit Date: Wed, 29 Aug 2018 02:29:38 +0800 Subject: [PATCH 28/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8][=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarkingDataReportController.java | 29 +++++++ .../controller/WxCouponChannelController.java | 1 + .../domain/vo/MarkingCouponDataReportVo.java | 62 ++++++++++++++ .../simple/mapper/WxCouponOrderMapper.java | 13 +++ .../service/MarkingDataReportService.java | 10 +++ .../impl/MarkingDataReportServiceImpl.java | 83 +++++++++++++++++++ .../resources/mapper/WxCouponOrderMapper.xml | 19 +++++ 7 files changed, 217 insertions(+) create mode 100644 mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/MarkingCouponDataReportVo.java create mode 100644 mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java new file mode 100644 index 000000000..f803a5833 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java @@ -0,0 +1,29 @@ +package com.simple.controller; + +import com.simple.common.Result; +import com.simple.common.ResultData; +import com.simple.service.MarkingDataReportService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * Created by syf on 2018/8/29. + */ +@RestController +@RequestMapping("markingDataReport") +@Api(description="营销报表接口") +public class MarkingDataReportController extends BaseController { + + @Autowired + private MarkingDataReportService markingDataReportService; + @ApiOperation("根据id查询接口") + @GetMapping("/couponData") + public ResultData findCouponData() { + return new ResultData(markingDataReportService.getCouponDate(getTenantId())); + } +} diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java index 60ca33504..2baa6aafe 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponChannelController.java @@ -43,6 +43,7 @@ public class WxCouponChannelController extends BaseController wxCouponChannel.setStatus(null); } wxCouponChannel.setTenantId(getUser().getTenantId()); + wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); final PageInfo page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); return new ResultData(page); } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/MarkingCouponDataReportVo.java b/mallinkService/src/main/java/com/simple/domain/vo/MarkingCouponDataReportVo.java new file mode 100644 index 000000000..12c9d2f59 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/MarkingCouponDataReportVo.java @@ -0,0 +1,62 @@ +package com.simple.domain.vo; + +/** + * Created by syf on 2018/8/28. + */ +public class MarkingCouponDataReportVo { + + //券领取张数 couponCount + //券领取人数 couponUserCount + //券核销张数 verifyCount + //券核销人数 verifyUserCount + private String createTime; + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public int getCouponCount() { + return couponCount; + } + + public void setCouponCount(int couponCount) { + this.couponCount = couponCount; + } + + public int getCouponUserCount() { + return couponUserCount; + } + + public void setCouponUserCount(int couponUserCount) { + this.couponUserCount = couponUserCount; + } + + public int getVerifyCount() { + return verifyCount; + } + + public void setVerifyCount(int verifyCount) { + this.verifyCount = verifyCount; + } + + public int getVerifyUserCount() { + return verifyUserCount; + } + + public void setVerifyUserCount(int verifyUserCount) { + this.verifyUserCount = verifyUserCount; + } + + private int couponCount; + + private int couponUserCount; + + private int verifyCount; + + private int verifyUserCount; + +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index 9ca433cad..2754a3c94 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -2,6 +2,7 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.vo.MarkingCouponDataReportVo; import com.simple.domain.vo.WxCouponOrderBVo; import com.simple.domain.vo.WxCouponOrderCVo; import org.apache.ibatis.annotations.Param; @@ -22,4 +23,16 @@ public interface WxCouponOrderMapper extends CommonMapper { List findListOfCUser(WxCouponOrder wxCouponOrder); List findListOfAdmin(WxCouponOrder wxCouponOrder); + + List couponDataMap(HashMap params); + + + /** + * 查询商场领券数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + int findCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); } diff --git a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java new file mode 100644 index 000000000..2d8124f0d --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java @@ -0,0 +1,10 @@ +package com.simple.service; + +import java.util.Map; + +/** + * Created by syf on 2018/8/28. + */ +public interface MarkingDataReportService { + Map getCouponDate(String tenantId); +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java new file mode 100644 index 000000000..2e2320273 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -0,0 +1,83 @@ +package com.simple.service.impl; + +import com.simple.domain.vo.MarkingCouponDataReportVo; +import com.simple.mapper.WxCouponOrderMapper; +import com.simple.service.MarkingDataReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.NumberFormat; +import java.util.*; + +/** + * Created by syf on 2018/8/28. + */ +@Service +public class MarkingDataReportServiceImpl implements MarkingDataReportService { + + + @Autowired + private WxCouponOrderMapper wxCouponOrderMapper; + + //取本月第一天 + private Date getFirstDayOfMonth(){ + Calendar c = Calendar.getInstance(); + c.set(Calendar.DAY_OF_MONTH, 0);//设置为1号,当前日期既为本月第一天 + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.MILLISECOND, 0); + Date thisMonth = c.getTime(); + return thisMonth; + } + private Date addDay(int addDayAmount){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.DATE, addDayAmount); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.MILLISECOND, 0); + Date date = c.getTime(); + return date; + } + //取的当月券数据 + public Map getCouponDate(String tenantId){ + //今日领取券数 + //查询coupon order表 + int todayCouponCount = wxCouponOrderMapper.findCountByDateLimit(tenantId,addDay(0),addDay(1)); + int yesterdayCount = wxCouponOrderMapper.findCountByDateLimit(tenantId,addDay(-1),addDay(0)); + int lastWeekCount = wxCouponOrderMapper.findCountByDateLimit(tenantId,addDay(-7),addDay(-6)); + + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 + String couponUpDay =""; + if(yesterdayCount!=0) { + couponUpDay = nf.format((todayCouponCount - yesterdayCount) / (float) yesterdayCount); + }else{ + couponUpDay = nf.format(todayCouponCount); + } + String couponUpWeek =""; + if(lastWeekCount!=0) { + couponUpWeek = nf.format((todayCouponCount - lastWeekCount) / (float) lastWeekCount); + }else{ + couponUpWeek = nf.format(todayCouponCount); + } + + //couponData + HashMap params = new HashMap<>(); + params.put("tenantId",tenantId); + params.put("startTime",getFirstDayOfMonth()); + params.put("endTime",addDay(1)); + List couponDataMap=wxCouponOrderMapper.couponDataMap(params); + //查询券领取人数 + + HashMap returnMap = new HashMap<>(); + returnMap.put("couponUpDay",couponUpDay);//比昨日提升 + returnMap.put("couponUpWeek",couponUpWeek);//比上周提升 + returnMap.put("todayCouponCount",todayCouponCount);//今日领取数 + returnMap.put("couponDataMap",couponDataMap); + return returnMap; + } + + +} diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 128bebfc6..ec7afe1f2 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -371,7 +371,26 @@ + + + + From 02d233e0f27f2ce6f1dae6aaa7353717e2932aa6 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 05:04:26 +0800 Subject: [PATCH 29/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8=E4=BF=9D?= =?UTF-8?q?=E5=AD=98][=E6=96=B0=E5=A2=9E]:=E5=81=9C=E8=BD=A6=E5=88=B8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarController.java | 75 ++++++++++++++++++- .../controller/WxCouponCarController.java | 4 +- .../controller/WxCouponCarController.java | 4 +- .../com/simple/domain/po/WxCouponCar.java | 6 +- .../simple/service/WxCouponCarService.java | 11 ++- .../service/impl/WxCouponCarServiceImpl.java | 14 ++-- 6 files changed, 93 insertions(+), 21 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index 8ed97d77c..d0897e9cc 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -9,10 +9,7 @@ import com.simple.common.ResultData; import com.simple.domain.po.*; import com.simple.enums.EnumCarCmd; import com.simple.enums.EnumCarVendor; -import com.simple.service.WxCUserCarService; -import com.simple.service.WxCarCmdLogService; -import com.simple.service.WxMerchantService; -import com.simple.service.WxParkService; +import com.simple.service.*; import com.simple.utils.ETCPUtil; import com.simple.utils.TJDCarUtil; import io.swagger.annotations.ApiImplicitParam; @@ -50,6 +47,12 @@ public class WxCarController extends BaseController @Autowired WxCarCmdLogService wxCarCmdLogService; + @Autowired + WxCouponService wxCouponService; + + @Autowired + WxCouponCarService wxCouponCarService; + private WxPark getCurrentPark(MallUserInfo user) { WxPark parkQ = new WxPark(); parkQ.setTenantId(user.getTenantId()); @@ -171,4 +174,68 @@ public class WxCarController extends BaseController businessId = objParams1.getString("businessId"); return businessId; } + + @ApiOperation("新增接口") + @PostMapping("add") + @ApiImplicitParams({ + @ApiImplicitParam(name="coupon",value="coupon",dataType="WxCoupon", paramType = "body",required=true), + @ApiImplicitParam(name="vendorParams",value="vendor_params",dataType="String", paramType = "body",required=true)}) + public ResultData add(@RequestBody WxCoupon coupon, String vendorParams) { + /* + amount: 1000 + avaliavleNum: 1000 + businessId: "IgWGUtpAX68=" + businessName: "fmtest5678" + category: "1" + categoryValue: "2.00" + couponType: "0" + coverImg: "http://202.165.179.86:8081/images/5411b414-b90e-4f51-bdd4-834fca86a722.png" + effectiveEnd: "2018-11-30" + effectiveStart: "2018-08-26" + name: "优免2小时券" + priceStr: "2.00元" + type: "5" + validEndDate: "undefined 00:00:00" + validStartDate: "undefined 00:00:00" + */ + //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); + //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); + // Save to wx_counpon + if(StringUtils.isNotEmpty(coupon.getSalePriceStr())){ + coupon.setSalePrice((int)Double.parseDouble(coupon.getSalePriceStr())*100); + } + if(StringUtils.isNotEmpty(coupon.getUsePriceStr())){ + coupon.setUsePrice((int)Double.parseDouble(coupon.getUsePriceStr())*100); + } + if(StringUtils.isNotEmpty(coupon.getPriceStr())){ + coupon.setPrice((int)Double.parseDouble(coupon.getPriceStr())*100); + } + if(StringUtils.isNotBlank(coupon.getBusiness())) { + String[] arys = coupon.getBusiness().split(","); + coupon.setBusiness(JSON.toJSONString(arys)); + } + coupon.setTenantId(getUser().getTenantId()); + coupon.setChannels(""); + Long id = wxCouponService.saveOrUpdate(coupon); + + + // Save to wx_coupon_car + WxCouponCar couponCar = new WxCouponCar(); + couponCar.setId(id); + couponCar.setTenantId(coupon.getTenantId()); + couponCar.setMerchantId(coupon.getMerchantId()); + + MallUserInfo user = getUser(); + WxPark park = getCurrentPark(user); + couponCar.setParkId(park.getId()); + couponCar.setVendorType(park.getVendorType()); + couponCar.setVendorParams(vendorParams); + Date curDate = new Date(); + couponCar.setCreateDate(curDate); + couponCar.setUpdateDate(curDate); + wxCouponCarService.save(couponCar); + + + return new ResultData(id); + } } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java index 6da6ef31d..bd347e99e 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponCarController.java @@ -40,14 +40,14 @@ public class WxCouponCarController extends BaseController public ResultData add(@RequestBody WxCouponCar wxCouponCar) { //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); - wxCouponCarService.saveOrUpdate(wxCouponCar); + wxCouponCarService.save(wxCouponCar); return new ResultData(); } @ApiOperation("根据id更新接口") @PostMapping("update") public ResultData update(@RequestBody WxCouponCar wxCouponCar) { - wxCouponCarService.saveOrUpdate(wxCouponCar); + wxCouponCarService.update(wxCouponCar); return new ResultData(); } diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java index c0a37482a..eaa69c093 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java @@ -42,14 +42,14 @@ public class WxCouponCarController extends BaseController public ResultData add(@RequestBody WxCouponCar wxCouponCar) { //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); - wxCouponCarService.saveOrUpdate(wxCouponCar); + wxCouponCarService.save(wxCouponCar); return new ResultData(); } @ApiOperation("根据id更新接口") @PostMapping("update") public ResultData update(@RequestBody WxCouponCar wxCouponCar) { - wxCouponCarService.saveOrUpdate(wxCouponCar); + wxCouponCarService.update(wxCouponCar); return new ResultData(); } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java b/mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java index 691e410c7..a523d1de2 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCouponCar.java @@ -43,7 +43,7 @@ public class WxCouponCar implements Serializable { /*租户ID**/ @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") - private Long tenantId; + private String tenantId; /*停车场ID**/ @io.swagger.annotations.ApiModelProperty(value="停车场ID",name="parkId") private Long parkId; @@ -62,10 +62,10 @@ public class WxCouponCar implements Serializable { /*更新时间**/ @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") private Date updateDate; - public Long getTenantId() { + public String getTenantId() { return tenantId; } - public void setTenantId(Long _tenantId) { + public void setTenantId(String _tenantId) { tenantId = _tenantId; } public Long getParkId() { diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java index 6aca30ceb..eb1d4625b 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java @@ -24,12 +24,19 @@ public interface WxCouponCarService { */ WxCouponCar getById(Long id); - /** + /** * 保存或更新实体 * * @param record */ - void saveOrUpdate(WxCouponCar record); + void save(WxCouponCar record); + + /** + * 更新实体 + * + * @param record + */ + void update(WxCouponCar record); /** * 根据Id删除实体 diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java index 584a3fdd3..e2913ca1f 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java @@ -28,15 +28,13 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { } @Override - public void saveOrUpdate(WxCouponCar record) { - if (record.getId() == null) { - //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); - final IdWorker idWorker = IdWorker.get(); - record.setId(idWorker.nextId()); + public void save(WxCouponCar record) { wxCouponCarMapper.insertSelective(record); - } else { - wxCouponCarMapper.updateByPrimaryKeySelective(record); - } + } + + @Override + public void update(WxCouponCar record) { + wxCouponCarMapper.updateByPrimaryKey(record); } @Override From ba85e3322f24faeef3362172be57a62ee269dda1 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 05:17:03 +0800 Subject: [PATCH 30/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8=E4=BF=9D?= =?UTF-8?q?=E5=AD=98][=E6=96=B0=E5=A2=9E]:=E5=81=9C=E8=BD=A6=E5=88=B8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E,=E5=88=B8=E6=96=B0=E5=A2=9Eunit=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=97=B6=E9=97=B4=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponCarController.java | 49 +++++++++---------- .../java/com/simple/domain/po/WxCoupon.java | 9 ++++ .../main/resources/mapper/WxCouponMapper.xml | 17 +++++-- 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java index eaa69c093..092b6460e 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponCarController.java @@ -1,43 +1,39 @@ package com.simple.controller; -import io.swagger.annotations.Api; -import org.apache.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.Assert; -import org.springframework.web.bind.annotation.*; - import com.github.pagehelper.PageInfo; import com.simple.common.Result; import com.simple.common.ResultData; - import com.simple.domain.po.WxCouponCar; import com.simple.service.WxCouponCarService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("wxCouponCar") @Api(description = "停车发券相关接口") -public class WxCouponCarController extends BaseController -{ - @Autowired +public class WxCouponCarController extends BaseController { + @Autowired private WxCouponCarService wxCouponCarService; private Logger logger = Logger.getLogger(WxCouponCarController.class); - - @ApiOperation("分页列表接口") + + @ApiOperation("分页列表接口") @GetMapping("list") - @ApiImplicitParams({ - @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), - @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - public ResultData list(@ModelAttribute WxCouponCar wxCouponCar,Integer pageNum, Integer pageSize) { - if (null == wxCouponCar) wxCouponCar = new WxCouponCar(); + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + public ResultData list(@ModelAttribute WxCouponCar wxCouponCar, Integer pageNum, Integer pageSize) { + if (null == wxCouponCar) wxCouponCar = new WxCouponCar(); final PageInfo page = wxCouponCarService.listAsPage(wxCouponCar, pageNum, pageSize); return new ResultData(page); } - @ApiOperation("新增接口") + @ApiOperation("新增接口") @PostMapping("add") public ResultData add(@RequestBody WxCouponCar wxCouponCar) { //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); @@ -55,19 +51,18 @@ public class WxCouponCarController extends BaseController @ApiOperation("根据id删除接口") @GetMapping("/del") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData delete(Long id) { wxCouponCarService.deleteById(id); return new ResultData(Result.SUCCESS, "删除成功", null); } - - @ApiOperation("根据id查询接口") - @GetMapping("/findById") - @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) public ResultData findById(Long id) { - return new ResultData(Result.SUCCESS,"查询成功",wxCouponCarService.getById(id)); + return new ResultData(Result.SUCCESS, "查询成功", wxCouponCarService.getById(id)); } - - - + + } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java index b654829dc..74536b3e9 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCoupon.java @@ -105,6 +105,9 @@ public class WxCoupon implements Serializable { /*面额**/ @io.swagger.annotations.ApiModelProperty(value="面额",name="price") private Integer price; + /*单位**/ + @io.swagger.annotations.ApiModelProperty(value="单位(0:rmb分 1:小时)",name="unit") + private Integer unit; /*剩余库存**/ @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") private Integer remainInventory; @@ -228,6 +231,12 @@ public class WxCoupon implements Serializable { public void setPrice(Integer _price) { price = _price; } + public Integer getUnit() { + return unit; + } + public void setUnit(Integer _unit) { + unit = _unit; + } public Integer getRemainInventory() { return remainInventory; } diff --git a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml index 77fe94ae0..6586311f0 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponMapper.xml @@ -20,6 +20,7 @@ + @@ -30,7 +31,7 @@ - `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` + `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` @@ -126,8 +127,13 @@ and `price` = #{price} - - + + + + and `unit` = #{unit} + + + and `remain_inventory` = #{remainInventory} @@ -204,6 +210,7 @@ + @@ -226,7 +233,7 @@ - c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, mb.building_name,mf.floor_name, @@ -261,7 +268,7 @@ - c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, mb.building_name,mf.floor_name From 739be8182a2f50e0c4eafe0773723d6cbcee26ca Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 07:24:10 +0800 Subject: [PATCH 31/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8=E4=BF=9D?= =?UTF-8?q?=E5=AD=98][=E6=96=B0=E5=A2=9E]:=E5=81=9C=E8=BD=A6=E5=88=B8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarController.java | 49 ++- .../com/simple/domain/vo/WxCouponCarVo.java | 336 ++++++++++++++++++ 2 files changed, 370 insertions(+), 15 deletions(-) create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index d0897e9cc..2a3728a96 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -7,8 +7,10 @@ import com.simple.common.ErrorCode; import com.simple.common.Result; import com.simple.common.ResultData; import com.simple.domain.po.*; +import com.simple.domain.vo.WxCouponCarVo; import com.simple.enums.EnumCarCmd; import com.simple.enums.EnumCarVendor; +import com.simple.enums.EnumCouponStatus; import com.simple.service.*; import com.simple.utils.ETCPUtil; import com.simple.utils.TJDCarUtil; @@ -175,12 +177,9 @@ public class WxCarController extends BaseController return businessId; } - @ApiOperation("新增接口") + @ApiOperation("新增停车券接口") @PostMapping("add") - @ApiImplicitParams({ - @ApiImplicitParam(name="coupon",value="coupon",dataType="WxCoupon", paramType = "body",required=true), - @ApiImplicitParam(name="vendorParams",value="vendor_params",dataType="String", paramType = "body",required=true)}) - public ResultData add(@RequestBody WxCoupon coupon, String vendorParams) { + public ResultData add(@RequestBody WxCouponCarVo coupon) { /* amount: 1000 avaliavleNum: 1000 @@ -201,23 +200,44 @@ public class WxCarController extends BaseController //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); // Save to wx_counpon + Date curDate = new Date(); + WxCoupon wxCoupon = new WxCoupon(); + wxCoupon.setTenantId(getUser().getTenantId()); + wxCoupon.setMerchantId(coupon.getMerchantId()); if(StringUtils.isNotEmpty(coupon.getSalePriceStr())){ - coupon.setSalePrice((int)Double.parseDouble(coupon.getSalePriceStr())*100); + wxCoupon.setSalePrice((int)Double.parseDouble(coupon.getSalePriceStr())*100); } if(StringUtils.isNotEmpty(coupon.getUsePriceStr())){ - coupon.setUsePrice((int)Double.parseDouble(coupon.getUsePriceStr())*100); + wxCoupon.setUsePrice((int)Double.parseDouble(coupon.getUsePriceStr())*100); } if(StringUtils.isNotEmpty(coupon.getPriceStr())){ - coupon.setPrice((int)Double.parseDouble(coupon.getPriceStr())*100); + wxCoupon.setPrice((int)Double.parseDouble(coupon.getPriceStr())*100); } if(StringUtils.isNotBlank(coupon.getBusiness())) { String[] arys = coupon.getBusiness().split(","); - coupon.setBusiness(JSON.toJSONString(arys)); + wxCoupon.setBusiness(JSON.toJSONString(arys)); } - coupon.setTenantId(getUser().getTenantId()); - coupon.setChannels(""); - Long id = wxCouponService.saveOrUpdate(coupon); - + wxCoupon.setType(coupon.getType()); + wxCoupon.setCoverImg(coupon.getCoverImg()); + wxCoupon.setTitle(coupon.getTitle()); + wxCoupon.setSubTitle(coupon.getSubTitle()); + wxCoupon.setUseLimitQuantity(coupon.getUseLimitQuantity()); + wxCoupon.setTargetAd(coupon.getTargetAd()); + wxCoupon.setSendType(coupon.getSendType()); + wxCoupon.setValidType(coupon.getValidType()); + wxCoupon.setValidStartDate(coupon.getValidStartDate()); + wxCoupon.setValidEndDate(coupon.getValidEndDate()); + wxCoupon.setValidDays(coupon.getValidDays()); + wxCoupon.setDetail(coupon.getDetail()); + wxCoupon.setUnit(coupon.getUnit()); + wxCoupon.setRemainInventory(coupon.getRemainInventory()); + wxCoupon.setInventory(coupon.getInventory()); + wxCoupon.setRemark(coupon.getRemark()); + wxCoupon.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); + wxCoupon.setCreateDate(curDate); + wxCoupon.setUpdateDate(curDate); + wxCoupon.setChannels(""); + Long id = wxCouponService.saveOrUpdate(wxCoupon); // Save to wx_coupon_car WxCouponCar couponCar = new WxCouponCar(); @@ -229,8 +249,7 @@ public class WxCarController extends BaseController WxPark park = getCurrentPark(user); couponCar.setParkId(park.getId()); couponCar.setVendorType(park.getVendorType()); - couponCar.setVendorParams(vendorParams); - Date curDate = new Date(); + couponCar.setVendorParams(coupon.getVendorParams()); couponCar.setCreateDate(curDate); couponCar.setUpdateDate(curDate); wxCouponCarService.save(couponCar); diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java new file mode 100644 index 000000000..8dfda3307 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java @@ -0,0 +1,336 @@ +package com.simple.domain.vo; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.io.Serializable; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class WxCouponCarVo implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + @Transient + protected String channels; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + @Transient + private String salePriceStr; + + @Transient + private String usePriceStr; + + @Transient + private String priceStr; + + /*租户ID**/ + @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") + private String tenantId; + /*商户id**/ + @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") + private Long merchantId; + /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ + @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") + private Integer type; + /*封面图**/ + @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") + private String coverImg; + /*券名称**/ + @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") + private String title; + /*副标题**/ + @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") + private String subTitle; + /*售价(适用于类型2,3,4,5)**/ + @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") + private Integer salePrice; + /*使用条件金额(适用于类型1,2,3,4)**/ + @io.swagger.annotations.ApiModelProperty(value="使用条件金额(适用于类型1,2,3,4)",name="usePrice") + private Integer usePrice; + /*限领张数**/ + @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") + private Integer useLimitQuantity; + /*投放频道位置(1.banner图,2.限时抢购)**/ + @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.banner图,2.限时抢购)",name="targetAd") + private Integer targetAd; + /*1.主动领取2.定向投放**/ + @io.swagger.annotations.ApiModelProperty(value="1.主动领取2.定向投放",name="sendType") + private Integer sendType; + /*有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)**/ + @io.swagger.annotations.ApiModelProperty(value="有效时间类型1.时间范围(valid_start_date,valid_end_date). 2领取后几日有效(valid_days)",name="validType") + private Integer validType; + /*有效日期-开始**/ + @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") + private Date validStartDate; + /*有效日期-结束**/ + @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") + private Date validEndDate; + /*自领取之日几日有效,(停车券当天有效)**/ + @io.swagger.annotations.ApiModelProperty(value="自领取之日几日有效,(停车券当天有效)",name="validDays") + private Integer validDays; + /*须知**/ + @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") + private String detail; + /*面额**/ + @io.swagger.annotations.ApiModelProperty(value="面额",name="price") + private Integer price; + /*单位**/ + @io.swagger.annotations.ApiModelProperty(value="单位(0:rmb分 1:小时)",name="unit") + private Integer unit; + /*剩余库存**/ + @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") + private Integer remainInventory; + /*总库存**/ + @io.swagger.annotations.ApiModelProperty(value="总库存",name="inventory") + private Integer inventory; + /*购买须知**/ + @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") + private String remark; + /*状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)**/ + @io.swagger.annotations.ApiModelProperty(value="状态(-1:全部,0:草稿/待生效,1:已生效,2:已失效,3:已作废)",name="status") + private Integer status; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") + private Date createDate; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") + private Date updateDate; + /*业态**/ + @io.swagger.annotations.ApiModelProperty(value="业态",name="business") + private String business; + /*车场厂商相关信息**/ + @io.swagger.annotations.ApiModelProperty(value="车场厂商相关信息",name="vendorParams") + private String vendorParams; + public String getTenantId() { + return tenantId; + } + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + public Long getMerchantId() { + return merchantId; + } + public void setMerchantId(Long _merchantId) { + merchantId = _merchantId; + } + public Integer getType() { + return type; + } + public void setType(Integer _type) { + type = _type; + } + public String getCoverImg() { + return coverImg; + } + public void setCoverImg(String _coverImg) { + coverImg = _coverImg; + } + public String getTitle() { + return title; + } + public void setTitle(String _title) { + title = _title; + } + public String getSubTitle() { + return subTitle; + } + public void setSubTitle(String _subTitle) { + subTitle = _subTitle; + } + public Integer getSalePrice() { + return salePrice; + } + public void setSalePrice(Integer _salePrice) { + salePrice = _salePrice; + } + public Integer getUsePrice() { + return usePrice; + } + public void setUsePrice(Integer _usePrice) { + usePrice = _usePrice; + } + public Integer getUseLimitQuantity() { + return useLimitQuantity; + } + public void setUseLimitQuantity(Integer _useLimitQuantity) { + useLimitQuantity = _useLimitQuantity; + } + public Integer getTargetAd() { + return targetAd; + } + public void setTargetAd(Integer _targetAd) { + targetAd = _targetAd; + } + public Integer getSendType() { + return sendType; + } + public void setSendType(Integer _sendType) { + sendType = _sendType; + } + public Integer getValidType() { + return validType; + } + public void setValidType(Integer _validType) { + validType = _validType; + } + public Date getValidStartDate() { + return validStartDate; + } + public void setValidStartDate(Date _validStartDate) { + validStartDate = _validStartDate; + } + public Date getValidEndDate() { + return validEndDate; + } + public void setValidEndDate(Date _validEndDate) { + validEndDate = _validEndDate; + } + public Integer getValidDays() { + return validDays; + } + public void setValidDays(Integer _validDays) { + validDays = _validDays; + } + public String getDetail() { + return detail; + } + public void setDetail(String _detail) { + detail = _detail; + } + public Integer getPrice() { + return price; + } + public void setPrice(Integer _price) { + price = _price; + } + public Integer getUnit() { + return unit; + } + public void setUnit(Integer _unit) { + unit = _unit; + } + public Integer getRemainInventory() { + return remainInventory; + } + public void setRemainInventory(Integer _remainInventory) { + remainInventory = _remainInventory; + } + public Integer getInventory() { + return inventory; + } + public void setInventory(Integer _inventory) { + inventory = _inventory; + } + public String getRemark() { + return remark; + } + public void setRemark(String _remark) { + remark = _remark; + } + public Integer getStatus() { + return status; + } + public void setStatus(Integer _status) { + status = _status; + } + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date _createDate) { + createDate = _createDate; + } + public Date getUpdateDate() { + return updateDate; + } + public void setUpdateDate(Date _updateDate) { + updateDate = _updateDate; + } + public String getBusiness() { + return business; + } + public void setBusiness(String _business) { + business = _business; + } + + public String getVendorParams() { + return vendorParams; + } + + public void setVendorParams(String vendorParams) { + this.vendorParams = vendorParams; + } + + public String getSalePriceStr() { + if(salePrice!=null) { + DecimalFormat df=new DecimalFormat("0.00"); + salePriceStr = df.format((float)salePrice/100); + } + return salePriceStr; + } + + public void setSalePriceStr(String salePriceStr) { + this.salePriceStr = salePriceStr; + } + + public String getUsePriceStr() { + if(usePrice!=null) { + DecimalFormat df=new DecimalFormat("0.00"); + usePriceStr = df.format((float)usePrice/100); + } + return usePriceStr; + } + + public void setUsePriceStr(String usePriceStr) { + this.usePriceStr = usePriceStr; + } + + public String getPriceStr() { + if(price!=null) { + DecimalFormat df=new DecimalFormat("0.00"); + priceStr = df.format((float)price/100); + } + return priceStr; + } + + public void setPriceStr(String priceStr) { + this.priceStr = priceStr; + } + + public String getChannels() { + return channels; + } + + public void setChannels(String channels) { + this.channels = channels; + } +} From 06cceb46b3cec36f006cd1e776f9f48c03884ab6 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 11:07:27 +0800 Subject: [PATCH 32/90] =?UTF-8?q?[banner=E5=9B=BE=E6=94=AF=E4=BB=98][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:banner=E5=9B=BE=E5=88=B8=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxOrderController.java | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java index 3235b5246..ea3aa5857 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java @@ -92,28 +92,35 @@ public class WxOrderController extends BaseController { //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); String couponChannelIdStr = paramMap.get("couponChannelId"); String couponIdStr = paramMap.get("couponId"); + /* + // TODO 修改支持banner图,获取不到couponChannelId问题 if (StringUtils.isBlank(couponChannelIdStr)) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); } + */ Long couponChannelId = 0L, couponId = 0L; - try { - couponChannelId = Long.valueOf(couponChannelIdStr); - } catch (NumberFormatException e) { - logger.error("couponChannelId convert error, " + couponChannelIdStr + ", e:" + e.getMessage()); - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponChannelId: " + couponChannelIdStr + ", e:" + e.getMessage()); - } - WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId); - if (wxCouponChannel == null) { - logger.error("couponChannelId convert error, " + couponChannelIdStr); - return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "找不到发布的频道"); - } - if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { - logger.error("此券已下架:" + couponChannelIdStr); - return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), "此券已下架"); + + if (!StringUtils.isBlank(couponChannelIdStr)) { + try { + couponChannelId = Long.valueOf(couponChannelIdStr); + } catch (NumberFormatException e) { + logger.error("couponChannelId convert error, " + couponChannelIdStr + ", e:" + e.getMessage()); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponChannelId: " + couponChannelIdStr + ", e:" + e.getMessage()); + } + WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId); + if (wxCouponChannel == null) { + logger.error("couponChannelId convert error, " + couponChannelIdStr); + return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "找不到发布的频道"); + } + if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { + logger.error("此券已下架:" + couponChannelIdStr); + return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), "此券已下架"); + } + if (StringUtils.isBlank(couponIdStr)) { + couponId = wxCouponChannel.getCouponId(); + } } - if (StringUtils.isBlank(couponIdStr)) { - couponId = wxCouponChannel.getCouponId(); - } else { + if (couponId <= 0 && !StringUtils.isBlank(couponIdStr)) { try { couponId = Long.valueOf(couponIdStr); } catch (NumberFormatException e) { @@ -121,6 +128,12 @@ public class WxOrderController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "couponId: " + couponIdStr + ", e:" + e.getMessage()); } } + + if (couponId <= 0) { + logger.error("couponChannelId或者couponId不能为空"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId或者couponId不能为空"); + } + WxCUser user = getUser(); try { From 2ebc01fbc9dbe7720f5f96b8a88e7aec71c249be Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 11:16:39 +0800 Subject: [PATCH 33/90] =?UTF-8?q?[banner=E5=9B=BE=E6=94=AF=E4=BB=98][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:banner=E5=9B=BE=E5=88=B8=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/domain/vo/WxCouponCVo.java | 12 ++++++++++++ .../java/com/simple/domain/vo/WxCouponChannelVo.java | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCVo.java index 6a6f9abb2..9a3fee45a 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCVo.java @@ -122,6 +122,9 @@ public class WxCouponCVo implements Serializable { /*面额**/ @io.swagger.annotations.ApiModelProperty(value="面额",name="price") private Integer price; + /*单位**/ + @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") + private Integer unit; /*剩余库存**/ @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") private Integer remainInventory; @@ -310,6 +313,15 @@ public class WxCouponCVo implements Serializable { public void setPrice(Integer _price) { price = _price; } + + public Integer getUnit() { + return unit; + } + + public void setUnit(Integer unit) { + this.unit = unit; + } + public Integer getRemainInventory() { return remainInventory; } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java index f5ab53a7c..99fe69083 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java @@ -39,6 +39,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { /*面额**/ @io.swagger.annotations.ApiModelProperty(value="面额",name="price") private Integer price; + /*单位**/ + @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") + private Integer unit; /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") @@ -109,6 +112,14 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { return price; } + public Integer getUnit() { + return unit; + } + + public void setUnit(Integer unit) { + this.unit = unit; + } + public Integer getUseLimitQuantity() { return useLimitQuantity; } From 840447f80ecb50e15305967984058f740e835d81 Mon Sep 17 00:00:00 2001 From: hupeng Date: Wed, 29 Aug 2018 11:20:16 +0800 Subject: [PATCH 34/90] =?UTF-8?q?[=E7=B3=BB=E7=BB=9F][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E6=AF=8F=E5=A4=A9=E6=80=BB=E9=A2=9D=E7=BB=9F=E8=AE=A1=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=8B=E5=8A=A1=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/schedule/DaliyAmountSchedule.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java index d3b6b641c..4756c78a5 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/DaliyAmountSchedule.java @@ -12,6 +12,8 @@ import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -42,6 +44,7 @@ public class DaliyAmountSchedule { @Scheduled(cron = "0 0 23 * * ?") // 每天晚上11点盘点 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 + @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) public void daliyAmountSchedule() { From a874f9391ec30c8a0528a5985c00b15ac9f52afd Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 11:35:58 +0800 Subject: [PATCH 35/90] =?UTF-8?q?[banner=E5=9B=BE=E6=94=AF=E4=BB=98][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:banner=E5=9B=BE=E5=88=B8=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/controller/WxOrderController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java index ea3aa5857..7957e3152 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxOrderController.java @@ -88,6 +88,7 @@ public class WxOrderController extends BaseController { @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\"}") @PostMapping("save") public ResultData saveOrder(@RequestBody Map paramMap) { + logger.info("OrderSave: " + paramMap.toString()); //Assert.notNull(wxOrders.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); String couponChannelIdStr = paramMap.get("couponChannelId"); From 4f1f7aaa4b838b79a0ee24687f5320bc75005375 Mon Sep 17 00:00:00 2001 From: hupeng Date: Wed, 29 Aug 2018 13:33:33 +0800 Subject: [PATCH 36/90] =?UTF-8?q?[C=E7=AB=AF][=E6=96=B0=E5=A2=9E]:?= =?UTF-8?q?=E6=96=B0=E5=A2=9EC=E7=AB=AF=E7=9A=84=E5=95=86=E5=9C=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxMallController.java | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 mallinkCApi/src/main/java/com/simple/controller/WxMallController.java diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxMallController.java b/mallinkCApi/src/main/java/com/simple/controller/WxMallController.java new file mode 100644 index 000000000..9e2679de3 --- /dev/null +++ b/mallinkCApi/src/main/java/com/simple/controller/WxMallController.java @@ -0,0 +1,71 @@ +package com.simple.controller; + +import com.simple.annotation.AuthIgnore; +import com.simple.common.ErrorCode; +import com.simple.common.Result; +import com.simple.common.ResultData; +import com.simple.domain.po.WxAppinfo; +import com.simple.domain.po.WxMall; +import com.simple.service.WxAppinfoService; +import com.simple.service.WxMallService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/api/mall") +@Api(description="商场信息相关接口") +public class WxMallController extends BaseController { + private Logger logger = Logger.getLogger(WxMallController.class); + + @Autowired + private WxMallService wxMallService; + + @Autowired + private WxAppinfoService wxAppinfoService; + + + @AuthIgnore + @ApiOperation("根据appId获取") + @GetMapping("/getAppIcon") + @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) + public ResultData getAppIcon(String appId) { + WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + if (appInfo == null) { + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); + if (mall==null) { + return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); + } + Map resultMap = new HashMap(); + resultMap.put("mallImgUrl", mall.getImgUrl()); + resultMap.put("mallName", mall.getName()); + return new ResultData(Result.SUCCESS, "查询成功", resultMap); + } + + @ApiOperation("根据appId获取") + @GetMapping("/mallInfo") + @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true) + public ResultData getMallInfo(String appId) { + WxAppinfo appInfo = wxAppinfoService.getByAppId(appId); + if (appInfo == null) { + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); + } + WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); + if (mall==null) { + return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); + } + return new ResultData(Result.SUCCESS, "查询成功", mall); + } + + +} From a914fcacc77773e12d1e9221134779a6f419c5a4 Mon Sep 17 00:00:00 2001 From: hupeng Date: Wed, 29 Aug 2018 14:24:39 +0800 Subject: [PATCH 37/90] =?UTF-8?q?[C=E7=AB=AF][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=B8=AD=E5=A2=9E=E5=8A=A0=E5=B7=B2=E4=BB=98?= =?UTF-8?q?=E6=AC=BE=E8=AE=A2=E5=8D=95=E7=9A=84=E5=88=B8=E7=A0=81=E5=92=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/domain/vo/WxOrderCVo.java | 20 ++++++++++++++++++- .../main/resources/mapper/WxOrderMapper.xml | 9 +++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxOrderCVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxOrderCVo.java index 4c8d4a504..eab3cbddb 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxOrderCVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxOrderCVo.java @@ -85,6 +85,13 @@ public class WxOrderCVo extends WxCouponOrder{ private Date updateDate; + /*券ID-产品ID将来的产品都会放在coupon表里**/ + @io.swagger.annotations.ApiModelProperty(value="券包中券ID",name="couponOrderId") + private Long couponOrderId; + /*0: 未使用 1: 已核销 2:已过期 3:已退款**/ + @io.swagger.annotations.ApiModelProperty(value="0: 未使用 1: 已核销 2:已过期 3:已退款",name="couponOrderStatus") + private Integer couponOrderStatus; + /* 券类型信息 */ /*商户id**/ /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ @@ -179,7 +186,6 @@ public class WxOrderCVo extends WxCouponOrder{ public Long getCouponId() { return couponId; } - public void setCouponId(Long _couponId) { this.couponId = _couponId; } @@ -221,6 +227,18 @@ public class WxOrderCVo extends WxCouponOrder{ updateDate = _updateDate; } + public Long getCouponOrderId() { + return couponOrderId; + } + public void setCouponOrderId(Long _couponOrderId) { + this.couponOrderId = _couponOrderId; + } + public Integer getCouponOrderStatus() { + return couponOrderStatus; + } + public void setCouponOrderStatus(Integer _couponOrderStatus) { + couponOrderStatus = _couponOrderStatus; + } public Integer getType() { return type; diff --git a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml index 9c69380ba..50ac00a0f 100644 --- a/mallinkService/src/main/resources/mapper/WxOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxOrderMapper.xml @@ -138,7 +138,8 @@ co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, - mb.building_name,mf.floor_name + mb.building_name,mf.floor_name, + c.id as coupon_order_id,c.coupon_order_status @@ -167,6 +168,9 @@ + + + @@ -199,7 +203,8 @@ + select from wx_user_channel + + + + + + + + + From bd8f3c43e53ccca587a253815f83f2093fd936ae Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Wed, 29 Aug 2018 20:11:05 +0800 Subject: [PATCH 49/90] =?UTF-8?q?[=E6=8B=93=E5=AE=A2=E5=88=86=E6=9E=90][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]=E6=B8=A0=E9=81=93=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserStructureController.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java index 8dcbf13ca..98984d28d 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java @@ -18,10 +18,12 @@ import com.github.pagehelper.PageInfo; import com.simple.common.ResultData; import com.simple.domain.dto.WxCuerBasicInfoDto; import com.simple.domain.po.WxCUser; +import com.simple.domain.po.WxUserChannel; import com.simple.domain.vo.UserStructureVo; import com.simple.enums.EnumAgeInfo; import com.simple.service.WxCUserBasicInfoService; import com.simple.service.WxCUserService; +import com.simple.service.WxUserChannelService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -38,6 +40,8 @@ public class WxUserStructureController { @Autowired private WxCUserService wxCUserService; + @Autowired + private WxUserChannelService wxUserChannelService; @ApiOperation("查询会员性别结构") @GetMapping("/findUserSexStructure") @@ -163,10 +167,21 @@ public class WxUserStructureController { @ApiImplicitParams({ @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - private ResultData findUserByChannel(String channelName,Integer pageNum, Integer pageSize) { + public ResultData findUserByChannel(String channelName,Integer pageNum, Integer pageSize) { PageInfo list = wxCUserService.listByChannel(null, pageNum, pageSize); return new ResultData(list); } + + @ApiOperation("获取用户所有渠道") + @GetMapping("/findAllUserChannel") + public ResultData findAllUserChannel() { + List channels=wxUserChannelService.findDistinctChannel(); + List vos = new ArrayList<>(); + for(WxUserChannel w:channels) { + vos.add(w.getChannelName()); + } + return new ResultData(vos); + } private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) { From 4b4a53fc16f81a3c5824b0d54b5733e06ada5511 Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Wed, 29 Aug 2018 20:11:05 +0800 Subject: [PATCH 50/90] =?UTF-8?q?[=E6=8B=93=E5=AE=A2=E5=88=86=E6=9E=90][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]=E6=B8=A0=E9=81=93=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserStructureController.java | 30 +++++++++++++++++-- .../java/com/simple/domain/po/WxCUser.java | 14 +++++++++ .../impl/WxUserChannelServiceImpl.java | 5 +++- .../resources/mapper/WxUserChannelMapper.xml | 4 +-- 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java index 98984d28d..324a23592 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java @@ -9,6 +9,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -167,9 +168,32 @@ public class WxUserStructureController { @ApiImplicitParams({ @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) - public ResultData findUserByChannel(String channelName,Integer pageNum, Integer pageSize) { - PageInfo list = wxCUserService.listByChannel(null, pageNum, pageSize); - return new ResultData(list); + public ResultData findUserByChannel(String channelName,Integer pageNum, Integer pageSize) { + List sceneList =null; + if(StringUtils.isNotBlank(channelName)) { + WxUserChannel c= new WxUserChannel(); + c.setChannelName(channelName); + PageInfo page = wxUserChannelService.listAsPage(c, 1, 100); + if(page.getSize()>0) { + sceneList = new ArrayList<>(); + for(WxUserChannel wuc:page.getList()) { + sceneList.add(wuc.getSceneAddress()); + } + } + } + PageInfo page = wxCUserService.listByChannel(sceneList, pageNum, pageSize); + for(WxCUser u:page.getList()) { + WxUserChannel c= new WxUserChannel(); + c.setSceneAddress(u.getSceneAddress()); + PageInfo uc = wxUserChannelService.listAsPage(c, 1, 1); + if(uc.getSize()>0) { + u.setChannelName(uc.getList().get(0).getChannelName()); + }else { + u.setChannelName("其他来源"); + } + } + + return new ResultData(page); } @ApiOperation("获取用户所有渠道") diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java index aa53e96c7..cc72ec3e8 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java @@ -116,6 +116,20 @@ public class WxCUser implements Serializable { /*用户过期时间**/ @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") private Date expireTime; + + //渠道名称 + @Transient + private String channelName; + + + public String getChannelName() { + return channelName; + } + + public void setChannelName(String channelName) { + this.channelName = channelName; + } + public String getTenantId() { return tenantId; } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxUserChannelServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxUserChannelServiceImpl.java index 1332d026b..51fc512eb 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxUserChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxUserChannelServiceImpl.java @@ -46,8 +46,11 @@ public class WxUserChannelServiceImpl implements WxUserChannelService { @Override public List findDistinctChannel() { - + return wxUserChannelMapper.findDistinctChannel(); } + + + } diff --git a/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml index 39e968ba7..d86ae189e 100644 --- a/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml @@ -21,12 +21,12 @@ - and `channel_name` like concat('%', #{channelName},'%') + and `channel_name` = #{channelName} - and `scene_address` like concat('%', #{sceneAddress},'%') + and `scene_address` = #{sceneAddress} From 7933a3d6e88f3fc7d3ed7e1b2b6eb2bee7ea698e Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 22:19:35 +0800 Subject: [PATCH 51/90] =?UTF-8?q?[couponCar=E6=8E=A5=E5=8F=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0][=E6=96=B0=E5=A2=9E]:amtCount=E6=8E=A5=E5=8F=A3+?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=88=B8Detail=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarController.java | 40 +++++++++++++ .../com/simple/domain/vo/WxCouponCarVo.java | 11 ++++ .../com/simple/mapper/WxCouponCarMapper.java | 6 +- .../simple/service/WxCouponCarService.java | 20 +++++-- .../service/impl/WxCouponCarServiceImpl.java | 17 ++++-- .../resources/mapper/WxCouponCarMapper.xml | 58 ++++++++++++++++++- 6 files changed, 139 insertions(+), 13 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index 5889f7f3f..b52cd4146 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -17,8 +17,10 @@ import com.simple.utils.TJDCarUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; +import org.apache.poi.hmef.attribute.MAPIAttribute; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -258,4 +260,42 @@ public class WxCarController extends BaseController return new ResultData(id); } + + + @ApiOperation("优免券模板已分配总数") + @GetMapping("/templateAmtCount") + @ApiImplicitParams({ + @ApiImplicitParam(name="templateId",value="模板ID",dataType="Long", paramType = "query",required=true)}) + public ResultData getTemplateAmountSum(Long templateId) { + Map map = new HashMap(); + Integer amountCount = 0; + try { + amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId); + } catch (Exception e) { + logger.error(e.getMessage()); + } + map.put("amountCount", amountCount); + return new ResultData(map); + } + + @ApiOperation("停车券detail") + @GetMapping("/detail") + public ResultData getCouponCarDetail(@ModelAttribute WxCoupon coupon) { + MallUserInfo user = getUser(); + coupon.setTenantId(user.getTenantId()); + try { + WxCouponCarVo couponCarVo = wxCouponCarService.getByCoupon(coupon); + if (couponCarVo != null) { + return new ResultData(couponCarVo); + } else { + return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(), "券不存在"); + } + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(ErrorCode.DB_FAIL.getCode(), e.getMessage()); + } + + } + + } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java index 15058319a..78aaf0113 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java @@ -128,6 +128,9 @@ public class WxCouponCarVo implements Serializable { /*业态**/ @io.swagger.annotations.ApiModelProperty(value="业态",name="business") private String business; + /*车场厂商类型**/ + @io.swagger.annotations.ApiModelProperty(value="车场厂商类型1:ETCP,2:TJD",name="vendorType") + private String vendorType; /*车场厂商相关信息**/ @io.swagger.annotations.ApiModelProperty(value="车场厂商相关信息",name="vendorParams") private String vendorParams; @@ -282,6 +285,14 @@ public class WxCouponCarVo implements Serializable { business = _business; } + public String getVendorType() { + return vendorType; + } + + public void setVendorType(String vendorType) { + this.vendorType = vendorType; + } + public String getVendorParams() { return vendorParams; } diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java index 5421db797..6ff40a08b 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java @@ -2,6 +2,8 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.po.WxCoupon; +import com.simple.domain.vo.WxCouponCarVo; import org.apache.ibatis.annotations.Param; import com.simple.domain.po.WxCouponCar; @@ -10,8 +12,8 @@ public interface WxCouponCarMapper extends CommonMapper { List findList(WxCouponCar wxCouponCar); + Integer findTemplateAmtCount(Long templateId); - - + WxCouponCarVo selectCouponCarDetail(WxCoupon coupon); } diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java index eb1d4625b..d79bb9979 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java @@ -2,7 +2,9 @@ package com.simple.service; import java.util.*; import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponCar; +import com.simple.domain.vo.WxCouponCarVo; public interface WxCouponCarService { @@ -44,11 +46,21 @@ public interface WxCouponCarService { * @param id */ void deleteById(Long id); - - - - + /** + * 根据templateId获取分配总数 + * + * @param templateId + */ + Integer getAmtCountByTemplateId(Long templateId); + + /** + * 根据coupon获得实体 + * + * @param coupon + * @return + */ + WxCouponCarVo getByCoupon(WxCoupon coupon); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java index e2913ca1f..6764e3093 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java @@ -3,7 +3,9 @@ package com.simple.service.impl; import java.util.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponCar; +import com.simple.domain.vo.WxCouponCarVo; import com.simple.mapper.WxCouponCarMapper; import com.simple.service.WxCouponCarService; import org.springframework.beans.factory.annotation.Autowired; @@ -41,10 +43,17 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { public void deleteById(Long id) { wxCouponCarMapper.deleteByPrimaryKey(id); } - - - - + + + @Override + public Integer getAmtCountByTemplateId(Long templateId) { + return wxCouponCarMapper.findTemplateAmtCount(templateId); + } + + @Override + public WxCouponCarVo getByCoupon(WxCoupon coupon) { + return wxCouponCarMapper.selectCouponCarDetail(coupon); + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml index 593463c99..58c702a52 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml @@ -71,9 +71,61 @@ select from wx_coupon_car - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, + car.vendor_type, car.vendor_params + + From 6220843b3422cbdab1605c6ea1afbbc62aab29f9 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 22:43:11 +0800 Subject: [PATCH 52/90] =?UTF-8?q?[=E7=BC=96=E8=AF=91issuefix]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/WxUserChannelMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml b/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml index d86ae189e..90be01cee 100644 --- a/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxUserChannelMapper.xml @@ -51,7 +51,7 @@ - select distinct channel_name from wx_user_channel From 1e8740b33ea4b4c6c5db84309ce11db59744cec9 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Wed, 29 Aug 2018 22:55:48 +0800 Subject: [PATCH 53/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8][=E6=96=B0=E5=A2=9E]=20=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=8A=95=E6=94=BE=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarkingDataReportController.java | 9 ++- .../domain/vo/MarkingSceneDataReportVo.java | 62 ++++++++++++++++ .../mapper/WxCouponActionLogMapper.java | 12 ++++ .../service/MarkingDataReportService.java | 2 + .../impl/MarkingDataReportServiceImpl.java | 72 ++++++++++++++++++- .../mapper/WxCouponActionLogMapper.xml | 18 ++++- .../resources/mapper/WxCouponOrderMapper.xml | 9 --- 7 files changed, 171 insertions(+), 13 deletions(-) create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java index f803a5833..8caf77fdc 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java @@ -21,9 +21,16 @@ public class MarkingDataReportController extends BaseController { @Autowired private MarkingDataReportService markingDataReportService; - @ApiOperation("根据id查询接口") + @ApiOperation("查询券数据") @GetMapping("/couponData") public ResultData findCouponData() { return new ResultData(markingDataReportService.getCouponDate(getTenantId())); } + @ApiOperation("查询场景投放券数据") + @GetMapping("/sceneData") + public ResultData findSceneData() { + return new ResultData(markingDataReportService.getSceneData(getTenantId())); + } + + } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java b/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java new file mode 100644 index 000000000..d0ad3db8f --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java @@ -0,0 +1,62 @@ +package com.simple.domain.vo; + +/** + * Created by syf on 2018/8/29. + */ +public class MarkingSceneDataReportVo { + + private String xTime; + private int parkSendCount; + private int verifySendCount; + private int parkCount; + private int verifyCount; + private int tempCount; + + public int getTempCount() { + return tempCount; + } + + public void setTempCount(int tempCount) { + this.tempCount = tempCount; + } + + public String getxTime() { + return xTime; + } + + public void setxTime(String xTime) { + this.xTime = xTime; + } + + public int getParkSendCount() { + return parkSendCount; + } + + public void setParkSendCount(int parkSendCount) { + this.parkSendCount = parkSendCount; + } + + public int getVerifySendCount() { + return verifySendCount; + } + + public void setVerifySendCount(int verifySendCount) { + this.verifySendCount = verifySendCount; + } + + public int getParkCount() { + return parkCount; + } + + public void setParkCount(int parkCount) { + this.parkCount = parkCount; + } + + public int getVerifyCount() { + return verifyCount; + } + + public void setVerifyCount(int verifyCount) { + this.verifyCount = verifyCount; + } +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponActionLogMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponActionLogMapper.java index 053fa82d8..80d7d9714 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponActionLogMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponActionLogMapper.java @@ -2,12 +2,24 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.vo.MarkingSceneDataReportVo; import org.apache.ibatis.annotations.Param; import com.simple.domain.po.WxCouponActionLog; public interface WxCouponActionLogMapper extends CommonMapper { List findList(WxCouponActionLog wxCouponActionLog); + /** + * 查询场景投放发券数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + int findCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); + + List sceneDataMap(HashMap params); + List sceneDataMapJoinCouponOrder(HashMap params); diff --git a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java index 2d8124f0d..fad5463e2 100644 --- a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java +++ b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java @@ -7,4 +7,6 @@ import java.util.Map; */ public interface MarkingDataReportService { Map getCouponDate(String tenantId); + + Map getSceneData(String tenantId); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java index 2e2320273..607b07134 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -1,6 +1,8 @@ package com.simple.service.impl; import com.simple.domain.vo.MarkingCouponDataReportVo; +import com.simple.domain.vo.MarkingSceneDataReportVo; +import com.simple.mapper.WxCouponActionLogMapper; import com.simple.mapper.WxCouponOrderMapper; import com.simple.service.MarkingDataReportService; import org.springframework.beans.factory.annotation.Autowired; @@ -8,6 +10,7 @@ import org.springframework.stereotype.Service; import java.text.NumberFormat; import java.util.*; +import java.util.stream.Collectors; /** * Created by syf on 2018/8/28. @@ -18,6 +21,8 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { @Autowired private WxCouponOrderMapper wxCouponOrderMapper; + @Autowired + private WxCouponActionLogMapper wxCouponActionLogMapper; //取本月第一天 private Date getFirstDayOfMonth(){ @@ -41,6 +46,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { return date; } //取的当月券数据 + @Override public Map getCouponDate(String tenantId){ //今日领取券数 //查询coupon order表 @@ -68,16 +74,78 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { params.put("tenantId",tenantId); params.put("startTime",getFirstDayOfMonth()); params.put("endTime",addDay(1)); - List couponDataMap=wxCouponOrderMapper.couponDataMap(params); + List couponDatalist=wxCouponOrderMapper.couponDataMap(params); //查询券领取人数 HashMap returnMap = new HashMap<>(); returnMap.put("couponUpDay",couponUpDay);//比昨日提升 returnMap.put("couponUpWeek",couponUpWeek);//比上周提升 returnMap.put("todayCouponCount",todayCouponCount);//今日领取数 - returnMap.put("couponDataMap",couponDataMap); + returnMap.put("couponDataMap",couponDatalist); + return returnMap; + } + + + @Override + public Map getSceneData(String tenantId){ + //今日营销投放券数 + int todaySceneCount = wxCouponActionLogMapper.findCountByDateLimit(tenantId,addDay(0),addDay(1)); + int yesterdayCount = wxCouponActionLogMapper.findCountByDateLimit(tenantId,addDay(-1),addDay(0)); + int lastWeekCount = wxCouponActionLogMapper.findCountByDateLimit(tenantId,addDay(-7),addDay(-6)); + + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 + String sceneDownDay =""; + if(yesterdayCount!=0) { + sceneDownDay = nf.format((yesterdayCount-todaySceneCount) / (float) yesterdayCount); + }else{ + sceneDownDay = nf.format(0-todaySceneCount); + } + String sceneUpWeek =""; + if(lastWeekCount!=0) { + sceneUpWeek = nf.format((todaySceneCount - lastWeekCount) / (float) lastWeekCount); + }else{ + sceneUpWeek = nf.format(todaySceneCount); + } + + HashMap params = new HashMap<>(); + params.put("tenantId",tenantId); + params.put("startTime",getFirstDayOfMonth()); + params.put("endTime",addDay(1)); + //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 + List list = wxCouponActionLogMapper.sceneDataMap(params); + + //停车发券被核销数 + HashMap params1 = new HashMap<>(); + params1.put("tenantId",tenantId); + params1.put("startTime",getFirstDayOfMonth()); + params1.put("endTime",addDay(1)); + params1.put("channelType",3);//停车 + List list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); + Map parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p->p.getTempCount())); + //核销发券被核销数 + HashMap params2 = new HashMap<>(); + params2.put("tenantId",tenantId); + params2.put("startTime",getFirstDayOfMonth()); + params2.put("endTime",addDay(1)); + params2.put("channelType",4);//核销 + List list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); + Map verifyCountMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p->p.getTempCount())); + + for (MarkingSceneDataReportVo vo:list) { + vo.setParkCount(parkCountMap.get(vo.getxTime()) == null ? 0 : parkCountMap.get(vo.getxTime())); + vo.setVerifyCount(verifyCountMap.get(vo.getxTime()) == null ? 0 : verifyCountMap.get(vo.getxTime())); + } + + + HashMap returnMap = new HashMap<>(); + returnMap.put("sceneDownDay",sceneDownDay);//比昨日下降 + returnMap.put("sceneUpWeek",sceneUpWeek);//比上周提升 + returnMap.put("todaySceneCount",todaySceneCount);//今日领取数 + returnMap.put("sceneDataMap",list); return returnMap; } + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index 2ce37552e..4613245ec 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -71,7 +71,23 @@ select from wx_coupon_action_log - + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 4fde77b86..19f65a8cd 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -374,15 +374,6 @@ select COUNT(*) FROM wx_coupon_order where tenant_id = #{tenantId} and create_date >= #{startTime} and create_date <= #{endTime} - - + + update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number} + + + From 41c02d2d16003a918cb487d934c74b64d057551c Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Thu, 30 Aug 2018 00:37:33 +0800 Subject: [PATCH 57/90] =?UTF-8?q?[=E5=BE=AE=E4=BF=A1=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95][=E6=96=B0=E5=A2=9E]=E5=BE=AE=E4=BF=A1pv=20u?= =?UTF-8?q?v=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/config/RestTemplateConfig.java | 24 ++ .../controller/WxUserStructureController.java | 36 +++ .../com/simple/schedule/SchedulingConfig.java | 19 +- .../simple/schedule/WxAppVisitSchedule.java | 107 +++++++++ .../com/simple/domain/po/WxUserVisit.java | 212 ++++++++++++++++++ .../com/simple/mapper/WxUserVisitMapper.java | 17 ++ .../simple/service/WxUserVisitService.java | 48 ++++ .../service/impl/WxUserVisitServiceImpl.java | 54 +++++ .../resources/mapper/WxUserVisitMapper.xml | 104 +++++++++ 9 files changed, 613 insertions(+), 8 deletions(-) create mode 100644 mallinkAdmin/src/main/java/com/simple/config/RestTemplateConfig.java create mode 100644 mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java create mode 100644 mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java create mode 100644 mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java create mode 100644 mallinkService/src/main/java/com/simple/service/WxUserVisitService.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxUserVisitServiceImpl.java create mode 100644 mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml diff --git a/mallinkAdmin/src/main/java/com/simple/config/RestTemplateConfig.java b/mallinkAdmin/src/main/java/com/simple/config/RestTemplateConfig.java new file mode 100644 index 000000000..4fb4b4bda --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/config/RestTemplateConfig.java @@ -0,0 +1,24 @@ +package com.simple.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory) { + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory() { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(5000);//ms + factory.setConnectTimeout(10000);//ms + return factory; + } +} \ No newline at end of file diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java index 324a23592..b5cb6394c 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java @@ -11,10 +11,18 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; +import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.simple.common.ResultData; import com.simple.domain.dto.WxCuerBasicInfoDto; @@ -245,5 +253,33 @@ public class WxUserStructureController { return vo; } + public static String token="https://api.weixin.qq.com/cgi-bin/token?"+ + "grant_type=client_credential&appid=APPID&secret=APPSECRET"; + + private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; + + @Autowired + private RestTemplate r; + + @GetMapping("test") + public String visit() { + String url = token.replace("APPID", "wx8eb8275b78db4ede"). + replace("APPSECRET", "76c43df01296998d8ce12383f213ac10"); + Map map = r.getForObject(url,Map.class); + System.out.println(map.get("access_token")); + String reqUrl= visit+map.get("access_token"); +// Map map = r.getForObject(reqUrl,Map.class); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + map = new HashMap(); + map.put("begin_date", "20180828"); + map.put("end_date", "20180828"); + RestTemplate restTemplate = new RestTemplate(); + HttpEntity entity = new HttpEntity(map, headers); + // ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, Student.class, aa); + ResponseEntity responseEntity = restTemplate.postForEntity(reqUrl, entity, String.class); + return JSON.toJSONString(responseEntity); + } + } diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/SchedulingConfig.java b/mallinkAdmin/src/main/java/com/simple/schedule/SchedulingConfig.java index 1bbab78a5..f8c5d0fff 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/SchedulingConfig.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/SchedulingConfig.java @@ -2,17 +2,20 @@ package com.simple.schedule; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; @Configuration @EnableScheduling -public class SchedulingConfig { //implements SchedulingConfigurer { +public class SchedulingConfig implements SchedulingConfigurer { - // @Override - // public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { - // ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); - // scheduler.setPoolSize(10); - // scheduler.initialize(); - // taskRegistrar.setTaskScheduler(scheduler); - // } + @Override + public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { + ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); + scheduler.setPoolSize(10); + scheduler.initialize(); + taskRegistrar.setTaskScheduler(scheduler); + } } \ No newline at end of file diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java new file mode 100644 index 000000000..768a6397d --- /dev/null +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -0,0 +1,107 @@ +package com.simple.schedule; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.simple.domain.po.WxUserVisit; +import com.simple.service.WxUserVisitService; + +@Component +public class WxAppVisitSchedule { + + private Logger logger = Logger.getLogger(WxAppVisitSchedule.class); + + private static String token="https://api.weixin.qq.com/cgi-bin/token?"+ + "grant_type=client_credential&appid=APPID&secret=APPSECRET"; + + private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; + + @Autowired + private RestTemplate restTemplate; + + @Autowired + private WxUserVisitService wxUserVisitService; + + + //@Scheduled(cron = "0 */1 * * * *?") + @Scheduled(cron = "0 0 0 * * ? *") + public void start() { + try { + Calendar c =Calendar.getInstance(); + c.add(Calendar.DAY_OF_YEAR, -1); + Date time = c.getTime(); + String yesterday = new SimpleDateFormat("yyyyMMdd").format(time); + getData(yesterday); + }catch(Exception e) { + logger.error("获取微信访问数据失败",e); + } + } + + private void getData(String yesterday) throws Exception { + String accessToken = getAccessToken("wx8eb8275b78db4ede", "76c43df01296998d8ce12383f213ac10"); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + Map map = new HashMap(); + map.put("begin_date", yesterday); + map.put("end_date",yesterday); + RestTemplate restTemplate = new RestTemplate(); + HttpEntity> entity = new HttpEntity>(map, headers); + String reqUrl =visit+accessToken; + ResponseEntity responseEntity = restTemplate.postForEntity(reqUrl, entity, String.class); + logger.info("获取wx访问数据:"+JSON.toJSONString(responseEntity)); + if(responseEntity.hasBody()) { + String body = responseEntity.getBody(); + Map maps = (Map)JSON.parse(body); + JSONArray jSONArray = (JSONArray)maps.get("list"); + if(jSONArray.isEmpty()) { + return; + } + JSONObject jsonObject = jSONArray.getJSONObject(0); + Map itemMap = JSONObject.toJavaObject(jsonObject, Map.class); + //{"visit_uv":6,"stay_time_uv":1178.3333,"stay_time_session":115.9016,"ref_date":"20180828", + // "visit_depth":3.1311,"session_cnt":61,"visit_pv":645,"visit_uv_new":3} + logger.info(JSON.toJSONString(itemMap)); + WxUserVisit v = new WxUserVisit(); + v.setAppId("wx8eb8275b78db4ede"); + String time = itemMap.get("ref_date")+""; + Date date = new SimpleDateFormat("yyyyMMdd").parse(time); + v.setDayDate(date); + v.setRefDate(time); + v.setSessionCnt(Integer.valueOf(itemMap.get("session_cnt")+"")); + v.setVisitPv(Integer.valueOf(itemMap.get("visit_pv")+"")); + v.setVisitUv(Integer.valueOf(itemMap.get("visit_uv")+"")); + v.setVisitUvNew(Integer.valueOf(itemMap.get("visit_uv_new")+"")); + v.setStayTimeSession(itemMap.get("stay_time_session")+""); + v.setVisitDepth(itemMap.get("visit_depth")+""); + v.setStayTimeUv(itemMap.get("stay_time_uv")+""); + wxUserVisitService.saveOrUpdate(v); + } + + } + + private String getAccessToken(String appId,String appSecret) { +// return "13_rBo3ajS3jjd8OXZ2MLd4HfLrmt78gvaCeRtu-Xme0iC0fhs_lNS47aLPEwI8kfZQIMKnWYshY5wpaf2IoSI7tgVBm7WwVrm_Bg96J31VPKi8pEp8yB6JiTpDcWkpwv5GngiH2vDkwz7VHOsPLBYcAGAZPM"; + String url = token.replace("APPID", appId). + replace("APPSECRET", appSecret); + Map map = restTemplate.getForObject(url,Map.class); + logger.info("获取access_token返回:"+JSON.toJSONString(map)); + return (String)map.get("access_token"); + } + +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java b/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java new file mode 100644 index 000000000..c405528e4 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java @@ -0,0 +1,212 @@ +package com.simple.domain.po; + +import javax.persistence.*; +import java.util.*; +import java.math.*; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Id; +import java.io.Serializable; + +@Table(name = "wx_user_visit") +public class WxUserVisit implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + + /*日期字符串**/ + @io.swagger.annotations.ApiModelProperty(value="日期字符串",name="refDate") + private String refDate; + /*日期**/ + @io.swagger.annotations.ApiModelProperty(value="日期",name="dayDate") + private Date dayDate; + /*打开次数**/ + @io.swagger.annotations.ApiModelProperty(value="打开次数",name="sessionCnt") + private Integer sessionCnt; + /*访问次数**/ + @io.swagger.annotations.ApiModelProperty(value="访问次数",name="visitPv") + private Integer visitPv; + /*访问人数**/ + @io.swagger.annotations.ApiModelProperty(value="访问人数",name="visitUv") + private Integer visitUv; + /*新用户数**/ + @io.swagger.annotations.ApiModelProperty(value="新用户数",name="visitUvNew") + private Integer visitUvNew; + /*人均停留时长 (浮点型,单位:秒)**/ + @io.swagger.annotations.ApiModelProperty(value="人均停留时长 (浮点型,单位:秒)",name="stayTimeUv") + private String stayTimeUv; + /*次均停留时长 (浮点型,单位:秒)**/ + @io.swagger.annotations.ApiModelProperty(value="次均停留时长 (浮点型,单位:秒)",name="stayTimeSession") + private String stayTimeSession; + /*平均访问深度 (浮点型)**/ + @io.swagger.annotations.ApiModelProperty(value="平均访问深度 (浮点型)",name="visitDepth") + private String visitDepth; + /*appId**/ + @io.swagger.annotations.ApiModelProperty(value="appId",name="appId") + private String appId; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") + private Date createDate; + public String getRefDate() { + return refDate; + } + public void setRefDate(String _refDate) { + refDate = _refDate; + } + public Date getDayDate() { + return dayDate; + } + public void setDayDate(Date _dayDate) { + dayDate = _dayDate; + } + public Integer getSessionCnt() { + return sessionCnt; + } + public void setSessionCnt(Integer _sessionCnt) { + sessionCnt = _sessionCnt; + } + public Integer getVisitPv() { + return visitPv; + } + public void setVisitPv(Integer _visitPv) { + visitPv = _visitPv; + } + public Integer getVisitUv() { + return visitUv; + } + public void setVisitUv(Integer _visitUv) { + visitUv = _visitUv; + } + public Integer getVisitUvNew() { + return visitUvNew; + } + public void setVisitUvNew(Integer _visitUvNew) { + visitUvNew = _visitUvNew; + } + public String getStayTimeUv() { + return stayTimeUv; + } + public void setStayTimeUv(String _stayTimeUv) { + stayTimeUv = _stayTimeUv; + } + public String getStayTimeSession() { + return stayTimeSession; + } + public void setStayTimeSession(String _stayTimeSession) { + stayTimeSession = _stayTimeSession; + } + public String getVisitDepth() { + return visitDepth; + } + public void setVisitDepth(String _visitDepth) { + visitDepth = _visitDepth; + } + public String getAppId() { + return appId; + } + public void setAppId(String _appId) { + appId = _appId; + } + public Date getCreateDate() { + return createDate; + } + public void setCreateDate(Date _createDate) { + createDate = _createDate; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,RefDate_ASC("`refDate` ASC"),RefDate_DESC("`refDate` DESC") + ,DayDate_ASC("`dayDate` ASC"),DayDate_DESC("`dayDate` DESC") + ,SessionCnt_ASC("`sessionCnt` ASC"),SessionCnt_DESC("`sessionCnt` DESC") + ,VisitPv_ASC("`visitPv` ASC"),VisitPv_DESC("`visitPv` DESC") + ,VisitUv_ASC("`visitUv` ASC"),VisitUv_DESC("`visitUv` DESC") + ,VisitUvNew_ASC("`visitUvNew` ASC"),VisitUvNew_DESC("`visitUvNew` DESC") + ,StayTimeUv_ASC("`stayTimeUv` ASC"),StayTimeUv_DESC("`stayTimeUv` DESC") + ,StayTimeSession_ASC("`stayTimeSession` ASC"),StayTimeSession_DESC("`stayTimeSession` DESC") + ,VisitDepth_ASC("`visitDepth` ASC"),VisitDepth_DESC("`visitDepth` DESC") + ,AppId_ASC("`appId` ASC"),AppId_DESC("`appId` DESC") + ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") + ; + private String value; + Field(String value){ + this.value = value; + } + public String getValue() { + return value; + } + public void setCol(String value) { + this.value = value; + } + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(WxUserVisit.Field... fields) + { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + + } + + public void setSortColumns(String sortColumns) + { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + java.util.List fList = new java.util.ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java new file mode 100644 index 000000000..31d1418ff --- /dev/null +++ b/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java @@ -0,0 +1,17 @@ +package com.simple.mapper; + +import java.util.*; +import com.simple.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.simple.domain.po.WxUserVisit; + +public interface WxUserVisitMapper extends CommonMapper { + + List findList(WxUserVisit wxUserVisit); + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/WxUserVisitService.java b/mallinkService/src/main/java/com/simple/service/WxUserVisitService.java new file mode 100644 index 000000000..68c981d0c --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/WxUserVisitService.java @@ -0,0 +1,48 @@ +package com.simple.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxUserVisit; + +public interface WxUserVisitService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + PageInfo listAsPage(WxUserVisit record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxUserVisit getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxUserVisit record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxUserVisitServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxUserVisitServiceImpl.java new file mode 100644 index 000000000..b2ed28a41 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/WxUserVisitServiceImpl.java @@ -0,0 +1,54 @@ +package com.simple.service.impl; + +import java.util.*; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxUserVisit; +import com.simple.mapper.WxUserVisitMapper; +import com.simple.service.WxUserVisitService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.simple.common.IdWorker; + +@Service +public class WxUserVisitServiceImpl implements WxUserVisitService { + + @Autowired + WxUserVisitMapper wxUserVisitMapper; + + + @Override + public PageInfo listAsPage(WxUserVisit record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxUserVisitMapper.findList(record)); + } + + @Override + public WxUserVisit getById(Long id) { + return wxUserVisitMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxUserVisit record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + IdWorker idWorker = new IdWorker(0, 0); + record.setId(idWorker.nextId()); + wxUserVisitMapper.insertSelective(record); + } else { + wxUserVisitMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxUserVisitMapper.deleteByPrimaryKey(id); + } + + + + + + + + +} diff --git a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml new file mode 100644 index 000000000..c77ee5ee8 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + `id`,`ref_date`,`day_date`,`session_cnt`,`visit_pv`,`visit_uv`,`visit_uv_new`,`stay_time_uv`,`stay_time_session`,`visit_depth`,`app_id`,`create_date` + + + + where 1 = 1 + + + and `id` = #{id} + + + + + and `ref_date` like concat('%', #{refDate},'%') + + + + + and `day_date` = #{dayDate} + + + + + and `session_cnt` = #{sessionCnt} + + + + + and `visit_pv` = #{visitPv} + + + + + and `visit_uv` = #{visitUv} + + + + + and `visit_uv_new` = #{visitUvNew} + + + + + and `stay_time_uv` like concat('%', #{stayTimeUv},'%') + + + + + and `stay_time_session` like concat('%', #{stayTimeSession},'%') + + + + + and `visit_depth` like concat('%', #{visitDepth},'%') + + + + + and `app_id` like concat('%', #{appId},'%') + + + + + and `create_date` = #{createDate} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + From 073068f256d6ebdc140a815a5f89c47121e5fa8b Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Thu, 30 Aug 2018 00:37:33 +0800 Subject: [PATCH 58/90] =?UTF-8?q?[=E5=BE=AE=E4=BF=A1=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95][=E6=96=B0=E5=A2=9E]=E5=BE=AE=E4=BF=A1pv=20u?= =?UTF-8?q?v=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserStructureController.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java index b5cb6394c..b9a100c30 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java @@ -253,33 +253,5 @@ public class WxUserStructureController { return vo; } - public static String token="https://api.weixin.qq.com/cgi-bin/token?"+ - "grant_type=client_credential&appid=APPID&secret=APPSECRET"; - - private static String visit = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?access_token="; - - @Autowired - private RestTemplate r; - - @GetMapping("test") - public String visit() { - String url = token.replace("APPID", "wx8eb8275b78db4ede"). - replace("APPSECRET", "76c43df01296998d8ce12383f213ac10"); - Map map = r.getForObject(url,Map.class); - System.out.println(map.get("access_token")); - String reqUrl= visit+map.get("access_token"); -// Map map = r.getForObject(reqUrl,Map.class); - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - map = new HashMap(); - map.put("begin_date", "20180828"); - map.put("end_date", "20180828"); - RestTemplate restTemplate = new RestTemplate(); - HttpEntity entity = new HttpEntity(map, headers); - // ResponseEntity responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, Student.class, aa); - ResponseEntity responseEntity = restTemplate.postForEntity(reqUrl, entity, String.class); - return JSON.toJSONString(responseEntity); - } - } From 56312e102792b2893cf79f2bc078d25547679530 Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Thu, 30 Aug 2018 00:37:33 +0800 Subject: [PATCH 59/90] =?UTF-8?q?[=E5=BE=AE=E4=BF=A1=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95][=E4=BF=AE=E6=94=B9]=E5=BE=AE=E4=BF=A1pv=20u?= =?UTF-8?q?v=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/schedule/WxAppVisitSchedule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java index 768a6397d..014ab0faf 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -40,7 +40,7 @@ public class WxAppVisitSchedule { //@Scheduled(cron = "0 */1 * * * *?") - @Scheduled(cron = "0 0 0 * * ? *") + @Scheduled(cron = "0 0 0 * * ?") public void start() { try { Calendar c =Calendar.getInstance(); From b381381496732b1553148ceb888df95e8edaa701 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 30 Aug 2018 10:39:07 +0800 Subject: [PATCH 60/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8][=E6=96=B0?= =?UTF-8?q?=E5=A2=9E]=EF=BC=9A=E5=BA=93=E5=AD=98=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarController.java | 55 +++++++++++++------ .../com/simple/mapper/WxCouponCarMapper.java | 2 + .../simple/service/WxCouponCarService.java | 7 +++ .../service/impl/WxCouponCarServiceImpl.java | 5 ++ .../resources/mapper/WxCouponCarMapper.xml | 12 +++- 5 files changed, 63 insertions(+), 18 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index b52cd4146..1ebb48866 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -21,6 +21,7 @@ import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.apache.poi.hmef.attribute.MAPIAttribute; +import org.omg.PortableInterceptor.INACTIVE; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -183,28 +184,32 @@ public class WxCarController extends BaseController @PostMapping("add") public ResultData add(@RequestBody WxCouponCarVo coupon) { logger.info(coupon.toString()); - /* - amount: 1000 - avaliavleNum: 1000 - businessId: "IgWGUtpAX68=" - businessName: "fmtest5678" - category: "1" - categoryValue: "2.00" - couponType: "0" - coverImg: "http://202.165.179.86:8081/images/5411b414-b90e-4f51-bdd4-834fca86a722.png" - effectiveEnd: "2018-11-30" - effectiveStart: "2018-08-26" - name: "优免2小时券" - priceStr: "2.00元" - type: "5" - validEndDate: "undefined 00:00:00" - validStartDate: "undefined 00:00:00" - */ //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); // Save to wx_counpon Date curDate = new Date(); MallUserInfo user = getUser(); + // check 同一个模板的券分配额是否超了 + if (StringUtils.isBlank(coupon.getVendorParams())) { + logger.error("请填充停车厂商优免券参数"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "停车厂商参数为空"); + } + JSONObject vendorParamsObj = JSON.parseObject(coupon.getVendorParams()); + Long templateId = vendorParamsObj.getLong("id"); + Integer amount = vendorParamsObj.getInteger("amount"); + Integer avaliavleNum = vendorParamsObj.getInteger("avaliavleNum"); + Integer amtCount = wxCouponCarService.getAmtCountByTemplateId(templateId); + Integer availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); + if (amtCount >= amount) { + logger.error("已达到停车厂商优免券数量限制"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "已达到停车厂商优免券数量限制"); + } + if (availCount >= avaliavleNum) { + logger.error("已达到停车厂商优免券数量限制"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "已达到停车厂商优免券数量限制"); + } + // check End + WxCoupon wxCoupon = new WxCoupon(); wxCoupon.setTenantId(user.getTenantId()); @@ -278,6 +283,22 @@ public class WxCarController extends BaseController return new ResultData(map); } + @ApiOperation("优免券模板库存总数") + @GetMapping("/templateAvaiCount") + @ApiImplicitParams({ + @ApiImplicitParam(name="templateId",value="模板ID",dataType="Long", paramType = "query",required=true)}) + public ResultData getTemplateAvailSum(Long templateId) { + Map map = new HashMap(); + Integer availCount = 0; + try { + availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); + } catch (Exception e) { + logger.error(e.getMessage()); + } + map.put("availCount", availCount); + return new ResultData(map); + } + @ApiOperation("停车券detail") @GetMapping("/detail") public ResultData getCouponCarDetail(@ModelAttribute WxCoupon coupon) { diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java index 6ff40a08b..6abf581e8 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java @@ -14,6 +14,8 @@ public interface WxCouponCarMapper extends CommonMapper { Integer findTemplateAmtCount(Long templateId); + Integer findTemplateAvailCount(Long templateId); + WxCouponCarVo selectCouponCarDetail(WxCoupon coupon); } diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java index d79bb9979..03a0d64d9 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java @@ -54,6 +54,13 @@ public interface WxCouponCarService { */ Integer getAmtCountByTemplateId(Long templateId); + /** + * 根据templateId获取库存总数 + * + * @param templateId + */ + Integer getAvaibleCountByTemplateId(Long templateId); + /** * 根据coupon获得实体 * diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java index 6764e3093..fb9ee41ec 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java @@ -50,6 +50,11 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { return wxCouponCarMapper.findTemplateAmtCount(templateId); } + @Override + public Integer getAvaibleCountByTemplateId(Long templateId) { + return wxCouponCarMapper.findTemplateAvailCount(templateId); + } + @Override public WxCouponCarVo getByCoupon(WxCoupon coupon) { return wxCouponCarMapper.selectCouponCarDetail(coupon); diff --git a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml index 58c702a52..2dd872c47 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml @@ -75,7 +75,17 @@ + + From 0ff2e3dab3235eead195e0dbb6a7fd845c524d90 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 30 Aug 2018 11:32:34 +0800 Subject: [PATCH 61/90] =?UTF-8?q?[=E5=95=86=E5=9C=BA][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=88=E5=A4=96=E8=BF=AAkey,url=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/domain/po/WxMall.java | 23 +++++++++++++++++++ .../main/resources/mapper/WxMallMapper.xml | 6 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxMall.java b/mallinkService/src/main/java/com/simple/domain/po/WxMall.java index b46efc716..f0280b88a 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxMall.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxMall.java @@ -85,6 +85,13 @@ public class WxMall implements Serializable { @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl") private String imgUrl; + @io.swagger.annotations.ApiModelProperty(value="迈外迪key",name="wiwideKey") + private String wiwideKey; + + @io.swagger.annotations.ApiModelProperty(value="迈外迪url",name="wiwideUrl") + private String wiwideUrl; + + public String getTenantId() { return tenantId; } @@ -180,6 +187,22 @@ public class WxMall implements Serializable { this.imgUrl = _imgUrl; } + public String getWiwideKey() { + return wiwideKey; + } + + public void setWiwideKey(String wiwideKey) { + this.wiwideKey = wiwideKey; + } + + public String getWiwideUrl() { + return wiwideUrl; + } + + public void setWiwideUrl(String wiwideUrl) { + this.wiwideUrl = wiwideUrl; + } + public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") diff --git a/mallinkService/src/main/resources/mapper/WxMallMapper.xml b/mallinkService/src/main/resources/mapper/WxMallMapper.xml index 43a2928e6..251779e4e 100644 --- a/mallinkService/src/main/resources/mapper/WxMallMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMallMapper.xml @@ -18,11 +18,13 @@ - + + + - `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id`,`service_phone`,`img_url` + `id`,`tenant_id`,`name`,`group`,`country`,`province`,`city`,`addr`,`wiwide_id`,`total_area`,`operating_area`,`park_area`,`park_place_number`,`pay_id`,`service_phone`,`img_url`,`wiwide_key`,`wiwide_url` From 9e4c3fbbd65dc310490a0072922c98a30faa4097 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 30 Aug 2018 11:33:24 +0800 Subject: [PATCH 62/90] =?UTF-8?q?[=E6=95=B0=E6=8D=AE=E5=A1=94=E5=8F=B0][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:=E5=AE=A2=E6=B5=81=E9=9B=86=E6=88=90?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/service/impl/DataTowerServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java index 52fe78f7d..63b316e7f 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/DataTowerServiceImpl.java @@ -237,13 +237,13 @@ public class DataTowerServiceImpl implements DataTowerService { WxMall wxMall = new WxMall(); wxMall.setTenantId(tenantId); List list = wxMallMapper.findList(wxMall); - String username=list.get(0).getWiwideId(); - - String authVal=encrypt("b#/r{Rq0vxVw(aM46H&$uT>g2YeXQGkc"); + wxMall = list.get(0); + String username=wxMall.getWiwideId(); + String authVal=encrypt(wxMall.getWiwideKey()); Map params=new HashMap<>(); params.put("username",username); params.put("authVal",authVal); - String token = HttpUtil.doPost("http://bi.wiwide.cn/fumao/login/auth", params); + String token = HttpUtil.doPost(wxMall.getWiwideUrl(), params); Map datamap = new HashMap<>(); From e356531f8ffe74152693bde5c4434c64705b544c Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 30 Aug 2018 11:56:15 +0800 Subject: [PATCH 63/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8][=E6=96=B0?= =?UTF-8?q?=E5=A2=9E]=EF=BC=9A=E5=BA=93=E5=AD=98=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarCallBackController.java | 3 ++- .../java/com/simple/controller/WxCarController.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarCallBackController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarCallBackController.java index 4a6b4f4da..3307ae6d4 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarCallBackController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarCallBackController.java @@ -145,7 +145,8 @@ public class WxCarCallBackController extends BaseController return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); } - // TODO 发起 营销 -- 短信 + // TODO 如果此车关联了停车优免券,自动把优免券设为已使用 + return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index 1ebb48866..3ea2906cb 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -199,7 +199,13 @@ public class WxCarController extends BaseController Integer amount = vendorParamsObj.getInteger("amount"); Integer avaliavleNum = vendorParamsObj.getInteger("avaliavleNum"); Integer amtCount = wxCouponCarService.getAmtCountByTemplateId(templateId); + if (amtCount == null) { + amtCount = 0; + } Integer availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); + if (availCount == null) { + availCount = 0; + } if (amtCount >= amount) { logger.error("已达到停车厂商优免券数量限制"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "已达到停车厂商优免券数量限制"); @@ -276,6 +282,9 @@ public class WxCarController extends BaseController Integer amountCount = 0; try { amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId); + if (amountCount == null) { + amountCount = 0; + } } catch (Exception e) { logger.error(e.getMessage()); } @@ -292,6 +301,9 @@ public class WxCarController extends BaseController Integer availCount = 0; try { availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); + if (availCount == null) { + availCount = 0; + } } catch (Exception e) { logger.error(e.getMessage()); } From cc6c1a12c1e466f5d5c722e15bb7386776108fcf Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 30 Aug 2018 12:41:34 +0800 Subject: [PATCH 64/90] =?UTF-8?q?[A=E7=AB=AF][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E9=A6=96=E9=A1=B5banner=E5=9B=BE=E5=88=B8=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxCampaignServiceImpl.java | 47 ++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java index cebe23097..fdba3537e 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java @@ -60,6 +60,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { } else { wxCampaignMapper.updateByPrimaryKeySelective(record); } + record = wxCampaignMapper.selectByPrimaryKey(record); if (record.getStatus() == 0) addOrUpdateBatch(JSONArray.parseArray(record.getCouponIds(),String.class),record); else @@ -75,21 +76,36 @@ public class WxCampaignServiceImpl implements WxCampaignService { List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); if (wxCouponChannels.size() > 0) { for (WxCouponChannel ch : wxCouponChannels) { - ch.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); - wxCouponChannelMapper.updateByPrimaryKeySelective(ch); + ch.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); + wxCouponChannelMapper.updateByPrimaryKeySelective(ch); } } } public void addOrUpdateBatch(List ids, WxCampaign record) { + WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); + wxCouponChannelQuery.setTenantId(record.getTenantId()); + wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); + wxCouponChannelQuery.setSubTargetId(record.getId()); + List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); + for (String couponIdStr:ids) { Long couponId = Long.parseLong(couponIdStr); - saveOrUpdateCouponChannel(couponId,record); + saveOrUpdateCouponChannel(couponId, wxCouponChannels, record); + } + + if (wxCouponChannels.size() > 0) + { + for (int i = 0; i < wxCouponChannels.size(); i++) { + wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); + wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i)); + } + } } - public void saveOrUpdateCouponChannel(Long couponId, WxCampaign record){ + public void saveOrUpdateCouponChannel(Long couponId, List wxCouponChannels, WxCampaign record){ WxCoupon wxCoupon = wxCouponService.getById(couponId); if (wxCoupon == null) { @@ -98,26 +114,25 @@ public class WxCampaignServiceImpl implements WxCampaignService { if (wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) { throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); } - if (wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().after(new Date())) { + if (wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(new Date())) { throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); } - WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); - wxCouponChannelQuery.setTenantId(record.getTenantId()); - wxCouponChannelQuery.setCouponId(couponId); - wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); - wxCouponChannelQuery.setSubTargetId(record.getId()); - List wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); - if(wxCouponChannels.size()>0){ - if(wxCouponChannels.get(0).getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { - wxCouponChannels.get(0).setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); - wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(0)); + if(wxCouponChannels.size()>0) { + for (int i = 0; i < wxCouponChannels.size(); i++) { + + wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); + wxCouponChannels.get(i).setBeginTime(record.getValidStartDate()); + wxCouponChannels.get(i).setEndTime(record.getValidEndDate()); + wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i)); + wxCouponChannels.remove(i); } } else { WxCouponChannel wxCouponChannel = new WxCouponChannel(); - + wxCouponChannel.setBeginTime(record.getValidStartDate()); + wxCouponChannel.setEndTime(record.getValidEndDate()); wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setCouponId(couponId); wxCouponChannel.setMerchantId(wxCoupon.getMerchantId()); From 04dfa0c9a5c31be05e4010a67dcb4401bcb7c7cf Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 30 Aug 2018 12:44:35 +0800 Subject: [PATCH 65/90] =?UTF-8?q?[=E5=81=9C=E8=BD=A6=E5=88=B8][=E6=96=B0?= =?UTF-8?q?=E5=A2=9E]=EF=BC=9A=E5=BA=93=E5=AD=98=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCarController.java | 12 ------------ .../src/main/resources/mapper/WxCouponCarMapper.xml | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index 3ea2906cb..1ebb48866 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -199,13 +199,7 @@ public class WxCarController extends BaseController Integer amount = vendorParamsObj.getInteger("amount"); Integer avaliavleNum = vendorParamsObj.getInteger("avaliavleNum"); Integer amtCount = wxCouponCarService.getAmtCountByTemplateId(templateId); - if (amtCount == null) { - amtCount = 0; - } Integer availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); - if (availCount == null) { - availCount = 0; - } if (amtCount >= amount) { logger.error("已达到停车厂商优免券数量限制"); return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "已达到停车厂商优免券数量限制"); @@ -282,9 +276,6 @@ public class WxCarController extends BaseController Integer amountCount = 0; try { amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId); - if (amountCount == null) { - amountCount = 0; - } } catch (Exception e) { logger.error(e.getMessage()); } @@ -301,9 +292,6 @@ public class WxCarController extends BaseController Integer availCount = 0; try { availCount = wxCouponCarService.getAvaibleCountByTemplateId(templateId); - if (availCount == null) { - availCount = 0; - } } catch (Exception e) { logger.error(e.getMessage()); } diff --git a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml index 2dd872c47..f5e196b62 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml @@ -73,7 +73,7 @@ + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index 4613245ec..3d4f92708 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -87,10 +87,14 @@ AND wx_coupon_action_log.channel_type = #{channelType} group by xTime + - - - - - + diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 19f65a8cd..cf871e537 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -382,5 +382,15 @@ from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime + + + + From a575e45eac0c437e4d3cb44254d04593d3a19670 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 17:31:33 +0800 Subject: [PATCH 74/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=8A=A5=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/domain/{dto => vo}/TouchUsersReportVo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename mallinkService/src/main/java/com/simple/domain/{dto => vo}/TouchUsersReportVo.java (97%) diff --git a/mallinkService/src/main/java/com/simple/domain/dto/TouchUsersReportVo.java b/mallinkService/src/main/java/com/simple/domain/vo/TouchUsersReportVo.java similarity index 97% rename from mallinkService/src/main/java/com/simple/domain/dto/TouchUsersReportVo.java rename to mallinkService/src/main/java/com/simple/domain/vo/TouchUsersReportVo.java index 1d691a16d..bac601053 100644 --- a/mallinkService/src/main/java/com/simple/domain/dto/TouchUsersReportVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/TouchUsersReportVo.java @@ -1,4 +1,4 @@ -package com.simple.domain.dto; +package com.simple.domain.vo; /** * Created by syf on 2018/8/30. From 6728234307f68073fd22c6d7d7f6c7eb190dc64c Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 30 Aug 2018 17:58:42 +0800 Subject: [PATCH 75/90] =?UTF-8?q?[=E5=88=B8=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4][=E4=BF=AE=E6=94=B9]:=E5=88=B8=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8C=89=E7=85=A7=E5=A4=A9=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/enums/EnumCouponType.java | 40 +++++++++++++++++++ .../service/impl/WxOrderServiceImpl.java | 17 ++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 mallinkService/src/main/java/com/simple/enums/EnumCouponType.java diff --git a/mallinkService/src/main/java/com/simple/enums/EnumCouponType.java b/mallinkService/src/main/java/com/simple/enums/EnumCouponType.java new file mode 100644 index 000000000..9f76e0e56 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/enums/EnumCouponType.java @@ -0,0 +1,40 @@ +package com.simple.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumCouponType { + + // 1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券 + COUPON_MANJIAN(1, "满减券"), + COUPON_DAIJIN(2, "代金券"), + COUPON_TUANGOU(3, "团购券"), + COUPON_LIPIN(4, "礼品券"), + COUPON_TINGCHE(5, "停车券"), + ; + + public static EnumCouponType getEnum(Integer code) { + for (EnumCouponType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumCouponType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java index 4e70a709f..8df2b699f 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java @@ -20,6 +20,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -259,9 +260,19 @@ public class WxOrderServiceImpl implements WxOrderService { */ private void createCouponOrder(WxCUser user, WxOrder order, WxCoupon coupon) { Date curr = new Date(); - Date valid_date = (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode()) ? - coupon.getValidEndDate() : - new Date((curr.getTime() / 1000 + coupon.getValidDays() * 24 * 60 * 60) * 1000); + Date valid_date = null; + if (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode()) + valid_date = coupon.getValidEndDate(); + else { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(curr); + // 普通券精确到天 + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date zero = calendar.getTime(); + valid_date = new Date(zero.getTime() + (coupon.getValidDays()+1) * 24 * 60 * 60 * 1000); + } final IdWorker idWorker = IdWorker.get(); WxCouponOrder couponOrder = new WxCouponOrder(); From 3df4a5a9885aa2b760b9b7a2fb811c7a41e5f680 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Thu, 30 Aug 2018 18:24:36 +0800 Subject: [PATCH 76/90] =?UTF-8?q?[=E5=88=B8=E8=BF=87=E6=9C=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4][=E4=BF=AE=E6=94=B9]:=E5=88=B8=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8C=89=E7=85=A7=E5=A4=A9=E6=9D=A5,?= =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=88=B8=E6=8C=89=E6=9C=88=E6=9D=A5,?= =?UTF-8?q?=E9=99=90=E9=A2=86bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxOrderServiceImpl.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java index 8df2b699f..f5833eeb7 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java @@ -119,7 +119,7 @@ public class WxOrderServiceImpl implements WxOrderService { throw new MallinkException(ErrorCode.DB_FAIL); } - if (count > coupon.getUseLimitQuantity()) { + if (count >= coupon.getUseLimitQuantity()) { //解锁 redisLock.unlock(couponIdStr, timeStr); logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); @@ -266,12 +266,22 @@ public class WxOrderServiceImpl implements WxOrderService { else { Calendar calendar = Calendar.getInstance(); calendar.setTime(curr); - // 普通券精确到天 - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - Date zero = calendar.getTime(); - valid_date = new Date(zero.getTime() + (coupon.getValidDays()+1) * 24 * 60 * 60 * 1000); + if (coupon.getType() != EnumCouponType.COUPON_TINGCHE.getCode()) { + // 普通券精确到天 + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.add(Calendar.DAY_OF_MONTH, 1+coupon.getValidDays()); + valid_date = calendar.getTime(); + } else { + // 停车券过期日期到月 + calendar.set(Calendar.DAY_OF_MONTH, 0); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.add(Calendar.MONTH, 1); + valid_date = calendar.getTime(); + } } final IdWorker idWorker = IdWorker.get(); From b48fe6fb2651d36c7fd41b223b0196e1ffdf6554 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 18:54:55 +0800 Subject: [PATCH 77/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=8A=A5=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarkingDataReportController.java | 27 +++++++++-- .../com/simple/domain/po/WxUserVisit.java | 16 +++++-- .../simple/mapper/WxCouponOrderMapper.java | 5 +++ .../com/simple/mapper/WxUserVisitMapper.java | 3 ++ .../service/MarkingDataReportService.java | 5 +++ .../impl/MarkingDataReportServiceImpl.java | 45 +++++++++++++++++-- .../resources/mapper/WxCouponOrderMapper.xml | 8 ++++ .../resources/mapper/WxUserVisitMapper.xml | 14 +++++- 8 files changed, 110 insertions(+), 13 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java index d23d30ec6..e715b55a3 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java @@ -28,16 +28,35 @@ public class MarkingDataReportController extends BaseController { public ResultData findCouponData() { return new ResultData(markingDataReportService.getCouponDate(getTenantId())); } + + @ApiOperation("查询券数据列表") + @GetMapping("/couponDataList") + public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { + return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto)); + } + @ApiOperation("查询场景投放券数据") @GetMapping("/sceneData") public ResultData findSceneData() { return new ResultData(markingDataReportService.getSceneData(getTenantId())); } - @ApiOperation("查询券数据列表") - @GetMapping("/couponDataList") - public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { - return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto)); + @ApiOperation("查询场景营销数据列表") + @GetMapping("/sceneDataList") + public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { + return new ResultData(markingDataReportService.getSceneDataList(getTenantId(),markingCouponDataReportDto)); + } + + @ApiOperation("查询触达用户数数据") + @GetMapping("/touchUsersData") + public ResultData touchUsersData() { + return new ResultData(markingDataReportService.getTouchUsersReportData(getTenantId())); + } + + @ApiOperation("查询触达用户数数据列表") + @GetMapping("/touchUsersDataList") + public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { + return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(),markingCouponDataReportDto)); } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java b/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java index c405528e4..c347cfdf9 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxUserVisit.java @@ -39,9 +39,12 @@ public class WxUserVisit implements Serializable { public void setIds(List ids) { this.ids = ids; } - - - + + + /*租户ID**/ + @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") + private String tenantId; + /*日期字符串**/ @io.swagger.annotations.ApiModelProperty(value="日期字符串",name="refDate") private String refDate; @@ -141,6 +144,13 @@ public class WxUserVisit implements Serializable { public void setCreateDate(Date _createDate) { createDate = _createDate; } + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index d91cfb298..bb919f217 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -3,6 +3,7 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; import com.simple.domain.vo.MarkingCouponDataReportVo; +import com.simple.domain.vo.TouchUsersReportVo; import com.simple.domain.vo.WxCouponOrderBVo; import com.simple.domain.vo.WxCouponOrderCVo; import org.apache.ibatis.annotations.Param; @@ -24,10 +25,14 @@ public interface WxCouponOrderMapper extends CommonMapper { List findListOfCUser(WxCouponOrder wxCouponOrder); List findListOfAdmin(WxCouponOrder wxCouponOrder); + //营销报表 券数据图表 List couponDataMap(HashMap params); + //营销报表 券数据报表 List couponDataList(HashMap params); //返回日期格式yy-MM-dd + //营销报表 触达用户数 + List touchUsersReportList(HashMap params); //返回日期格式yy-MM-dd /** diff --git a/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java index 31d1418ff..d73973b81 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxUserVisitMapper.java @@ -2,12 +2,15 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.vo.TouchUsersReportVo; import org.apache.ibatis.annotations.Param; import com.simple.domain.po.WxUserVisit; public interface WxUserVisitMapper extends CommonMapper { List findList(WxUserVisit wxUserVisit); + + List touchUsersReportList(HashMap params); diff --git a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java index e36ed7d3c..d28778597 100644 --- a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java +++ b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java @@ -4,6 +4,7 @@ import com.simple.domain.dto.MarkingCouponDataReportDto; import com.simple.domain.vo.MarkingCouponDataReportVo; import com.simple.domain.vo.MarkingSceneDataReportVo; import com.simple.domain.vo.MarkingSceneDataVo; +import com.simple.domain.vo.TouchUsersReportVo; import java.util.List; import java.util.Map; @@ -19,4 +20,8 @@ public interface MarkingDataReportService { List getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); List getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); + + List getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); + + List getTouchUsersReportData(String tenantId); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java index d52719537..916cdff5b 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -1,12 +1,15 @@ package com.simple.service.impl; import com.simple.domain.dto.MarkingCouponDataReportDto; +import com.simple.domain.po.WxUserVisit; import com.simple.domain.vo.MarkingCouponDataReportVo; import com.simple.domain.vo.MarkingSceneDataReportVo; import com.simple.domain.vo.MarkingSceneDataVo; +import com.simple.domain.vo.TouchUsersReportVo; import com.simple.mapper.WxCarCmdLogMapper; import com.simple.mapper.WxCouponActionLogMapper; import com.simple.mapper.WxCouponOrderMapper; +import com.simple.mapper.WxUserVisitMapper; import com.simple.service.MarkingDataReportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -28,6 +31,8 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { private WxCouponActionLogMapper wxCouponActionLogMapper; @Autowired private WxCarCmdLogMapper wxCarCmdLogMapper; + @Autowired + private WxUserVisitMapper wxUserVisitMapper; //取本月第一天 private Date getFirstDayOfMonth() { @@ -197,7 +202,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 - List templist = wxCouponActionLogMapper.sceneDataMap(params); + List templist = wxCouponActionLogMapper.sceneDataList(params); List list = new ArrayList<>(); for (MarkingSceneDataReportVo temp: templist) { @@ -208,6 +213,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { }else{ vo.setSendCount(temp.getVerifySendCount()); } + list.add(vo); } @@ -255,16 +261,47 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { return list; } - public Map getTouchUsersReport(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto){ - + @Override + public List getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto){ //获取领取人数 //获取领取量 //获取核销人数 //核销量 + HashMap params = new HashMap<>(); + params.put("tenantId", tenantId); + params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); + params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); + List couponDatalist = wxCouponOrderMapper.touchUsersReportList(params); + + //查询UV PV + HashMap params1 = new HashMap<>(); + params1.put("tenantId", tenantId); + params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); + params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); + List wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1); + Map visitMap = wxUserVisitList.stream().collect(Collectors.toMap(TouchUsersReportVo::getxTime, p -> p)); + for (TouchUsersReportVo temp:couponDatalist) { + if(visitMap.get(temp.getxTime())!=null){ + temp.setUv(visitMap.get(temp.getxTime()).getUv()); + temp.setPv(visitMap.get(temp.getxTime()).getPv()); + } + } + return couponDatalist; + } + + @Override + public List getTouchUsersReportData(String tenantId){ + //查询UV PV + HashMap params = new HashMap<>(); + params.put("tenantId", tenantId); + params.put("startTime", getFirstDayOfMonth()); + params.put("endTime", addDay(1)); + List wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params); + return wxUserVisitList; - return null; } + //计算最大公约数 public int gcd(int x, int y){ // 这个是运用辗转相除法求 两个数的 最大公约数 看不懂可以百度 // 下 if(y == 0) diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index cf871e537..c18da2d3d 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -390,6 +390,14 @@ from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime + + diff --git a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml index c77ee5ee8..1e7ad8c7f 100644 --- a/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxUserVisitMapper.xml @@ -3,6 +3,7 @@ + @@ -17,7 +18,7 @@ - `id`,`ref_date`,`day_date`,`session_cnt`,`visit_pv`,`visit_uv`,`visit_uv_new`,`stay_time_uv`,`stay_time_session`,`visit_depth`,`app_id`,`create_date` + `id`,`tenant_id`,`ref_date`,`day_date`,`session_cnt`,`visit_pv`,`visit_uv`,`visit_uv_new`,`stay_time_uv`,`stay_time_session`,`visit_depth`,`app_id`,`create_date` @@ -26,7 +27,11 @@ and `id` = #{id} - + + + and `tenant_id` like concat('%', #{tenantId},'%') + + and `ref_date` like concat('%', #{refDate},'%') @@ -95,6 +100,11 @@ select from wx_user_visit + + From 929c5891e913ac23db0c0572d824edf545089acd Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 18:55:51 +0800 Subject: [PATCH 78/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=8A=A5=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/service/impl/MarkingDataReportServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java index 916cdff5b..da9de2320 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -69,7 +69,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); Date result = c.getTime(); - return date; + return result; } private Date convertDateAndAdd(Date date, int addDayAmount) { @@ -81,7 +81,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); Date result = c.getTime(); - return date; + return result; } //取的当月券数据 From 36b9c6d9b2e63bda934db2d649407eb634e45ab2 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 19:33:09 +0800 Subject: [PATCH 79/90] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=8A=A5=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E6=9F=A5=E8=AF=A2=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/mapper/WxCouponOrderMapper.java | 23 +++++++++++++++---- .../resources/mapper/WxCouponOrderMapper.xml | 11 +++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index bb919f217..1a3532e6e 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -2,10 +2,7 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; -import com.simple.domain.vo.MarkingCouponDataReportVo; -import com.simple.domain.vo.TouchUsersReportVo; -import com.simple.domain.vo.WxCouponOrderBVo; -import com.simple.domain.vo.WxCouponOrderCVo; +import com.simple.domain.vo.*; import org.apache.ibatis.annotations.Param; import com.simple.domain.po.WxCouponOrder; @@ -43,4 +40,22 @@ public interface WxCouponOrderMapper extends CommonMapper { * @return */ int findCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); + /** + * 日期分组 消费总数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + List queryPriceTotalGroup(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); + /** + * 查询时间段内消费总数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + int queryPriceTotal(@Param("tenantId")String tenantId, @Param("startTime") Date startTime, @Param("endTime")Date endTime); + + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index c18da2d3d..4ca6369a0 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -398,6 +398,17 @@ from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY xTime + + + + + From db22d11bf4614e0282d3afb35b2221eb42e48700 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 20:45:03 +0800 Subject: [PATCH 80/90] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=8A=A5=E8=A1=A8][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E6=9F=A5=E8=AF=A2=E6=B6=88=E8=B4=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/vo/CUserDateAmountVo.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mallinkService/src/main/java/com/simple/domain/vo/CUserDateAmountVo.java diff --git a/mallinkService/src/main/java/com/simple/domain/vo/CUserDateAmountVo.java b/mallinkService/src/main/java/com/simple/domain/vo/CUserDateAmountVo.java new file mode 100644 index 000000000..50a4a86ff --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/vo/CUserDateAmountVo.java @@ -0,0 +1,27 @@ +package com.simple.domain.vo; + + +/** + * Created by syf on 2018/8/30. + */ +public class CUserDateAmountVo { + + private String xTime; + private int price; + + public String getxTime() { + return xTime; + } + + public void setxTime(String xTime) { + this.xTime = xTime; + } + + public int getPrice() { + return price; + } + + public void setPrice(int price) { + this.price = price; + } +} From de6f8e01d379acbf87d58cc30a3178ea1160340a Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Thu, 30 Aug 2018 21:50:22 +0800 Subject: [PATCH 81/90] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=B8=A0=E9=81=93?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2][=E4=BF=AE=E6=94=B9]mapper=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkService/src/main/resources/mapper/WxCUserMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index ea57ed19b..30148783e 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -200,7 +200,7 @@ - - - - - From 29ea3bf8d96d75569b13ef6dba1ef4e7dddd05e3 Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 22:10:56 +0800 Subject: [PATCH 83/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=95=B0=E6=8D=AE][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/domain/vo/MarkingSceneDataReportVo.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java b/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java index 503c7e2f1..4d12d7adc 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/MarkingSceneDataReportVo.java @@ -13,6 +13,15 @@ public class MarkingSceneDataReportVo { private int tempCount; private Integer carCount; //车辆进场数 private String verifyPercent; + private int total; + + public int getTotal() { + return verifySendCount+parkSendCount; + } + + public void setTotal(int total) { + this.total = total; + } public int getTempCount() { return tempCount; From d20a30eaff101f4c28b9cf463b1c397e4433942a Mon Sep 17 00:00:00 2001 From: masterspirit Date: Thu, 30 Aug 2018 23:15:51 +0800 Subject: [PATCH 84/90] =?UTF-8?q?[=E8=90=A5=E9=94=80=E6=95=B0=E6=8D=AE][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=20=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarkingDataReportController.java | 12 +++++------ .../service/MarkingDataReportService.java | 7 ++++--- .../impl/MarkingDataReportServiceImpl.java | 17 ++++++++++------ .../mapper/WxCouponActionLogMapper.xml | 9 ++++++++- .../resources/mapper/WxCouponOrderMapper.xml | 20 +++++++++++++++++-- 5 files changed, 47 insertions(+), 18 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java index e715b55a3..a19a432cb 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MarkingDataReportController.java @@ -31,8 +31,8 @@ public class MarkingDataReportController extends BaseController { @ApiOperation("查询券数据列表") @GetMapping("/couponDataList") - public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { - return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto)); + public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { + return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); } @ApiOperation("查询场景投放券数据") @@ -43,8 +43,8 @@ public class MarkingDataReportController extends BaseController { @ApiOperation("查询场景营销数据列表") @GetMapping("/sceneDataList") - public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { - return new ResultData(markingDataReportService.getSceneDataList(getTenantId(),markingCouponDataReportDto)); + public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { + return new ResultData(markingDataReportService.getSceneDataList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); } @ApiOperation("查询触达用户数数据") @@ -55,8 +55,8 @@ public class MarkingDataReportController extends BaseController { @ApiOperation("查询触达用户数数据列表") @GetMapping("/touchUsersDataList") - public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto) { - return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(),markingCouponDataReportDto)); + public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { + return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); } diff --git a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java index d28778597..2c61449ea 100644 --- a/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java +++ b/mallinkService/src/main/java/com/simple/service/MarkingDataReportService.java @@ -1,5 +1,6 @@ package com.simple.service; +import com.github.pagehelper.PageInfo; import com.simple.domain.dto.MarkingCouponDataReportDto; import com.simple.domain.vo.MarkingCouponDataReportVo; import com.simple.domain.vo.MarkingSceneDataReportVo; @@ -17,11 +18,11 @@ public interface MarkingDataReportService { Map getSceneData(String tenantId); - List getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); + PageInfo getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); - List getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); + PageInfo getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); - List getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto); + PageInfo getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); List getTouchUsersReportData(String tenantId); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java index da9de2320..b9821ceab 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/MarkingDataReportServiceImpl.java @@ -1,5 +1,7 @@ package com.simple.service.impl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.simple.domain.dto.MarkingCouponDataReportDto; import com.simple.domain.po.WxUserVisit; import com.simple.domain.vo.MarkingCouponDataReportVo; @@ -186,22 +188,24 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { } @Override - public List getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto) { + public PageInfo getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { HashMap params = new HashMap<>(); params.put("tenantId", tenantId); params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); + PageHelper.startPage(pageIndex, pageSize); List couponDatalist = wxCouponOrderMapper.couponDataList(params); - return couponDatalist; + return new PageInfo<>(couponDatalist); } @Override - public List getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto) { + public PageInfo getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { HashMap params = new HashMap<>(); params.put("tenantId", tenantId); params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 + PageHelper.startPage(pageIndex, pageSize); List templist = wxCouponActionLogMapper.sceneDataList(params); List list = new ArrayList<>(); @@ -258,11 +262,11 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { vo.setVerifyPercent(vo.getVerifyCount() / gcd + "/" + vo.getSendCount() / gcd); } } - return list; + return new PageInfo<>(list); } @Override - public List getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto){ + public PageInfo getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { //获取领取人数 //获取领取量 //获取核销人数 @@ -271,6 +275,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { params.put("tenantId", tenantId); params.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); params.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); + PageHelper.startPage(pageIndex, pageSize); List couponDatalist = wxCouponOrderMapper.touchUsersReportList(params); //查询UV PV @@ -286,7 +291,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { temp.setPv(visitMap.get(temp.getxTime()).getPv()); } } - return couponDatalist; + return new PageInfo<>(couponDatalist); } @Override diff --git a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml index 3d4f92708..bb81f2d06 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponActionLogMapper.xml @@ -89,7 +89,14 @@ SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime ,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount - ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId} AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount + ,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId} + + AND c.update_date >= #{startTime} + + + and c.update_date <= #{endTime} + + ) as verifyCount ,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId} AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount - from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY xTime + from wx_coupon_order where tenant_id=#{tenantId} + + AND create_date >= #{startTime} + + + and create_date <= #{endTime} + + + + GROUP BY xTime