| @@ -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; | |||||
| } | |||||
| } | |||||
| @@ -43,6 +43,14 @@ public class DataTowerController extends BaseController { | |||||
| return new ResultData(data); | return new ResultData(data); | ||||
| } | } | ||||
| @ApiOperation("查询客流") | |||||
| @PostMapping("/queryCustomer") | |||||
| public ResultData queryCustomer() { | |||||
| Map<String,Object> data=dataTowerService.queryCustomer(getTenantId()); | |||||
| return new ResultData(data); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,64 @@ | |||||
| package com.simple.controller; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.dto.MarkingCouponDataReportDto; | |||||
| 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.ModelAttribute; | |||||
| 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("查询券数据") | |||||
| @GetMapping("/couponData") | |||||
| public ResultData findCouponData() { | |||||
| return new ResultData(markingDataReportService.getCouponDate(getTenantId())); | |||||
| } | |||||
| @ApiOperation("查询券数据列表") | |||||
| @GetMapping("/couponDataList") | |||||
| public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||||
| } | |||||
| @ApiOperation("查询场景投放券数据") | |||||
| @GetMapping("/sceneData") | |||||
| public ResultData findSceneData() { | |||||
| return new ResultData(markingDataReportService.getSceneData(getTenantId())); | |||||
| } | |||||
| @ApiOperation("查询场景营销数据列表") | |||||
| @GetMapping("/sceneDataList") | |||||
| public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(markingDataReportService.getSceneDataList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||||
| } | |||||
| @ApiOperation("查询触达用户数数据") | |||||
| @GetMapping("/touchUsersData") | |||||
| public ResultData touchUsersData() { | |||||
| return new ResultData(markingDataReportService.getTouchUsersReportData(getTenantId())); | |||||
| } | |||||
| @ApiOperation("查询触达用户数数据列表") | |||||
| @GetMapping("/touchUsersDataList") | |||||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||||
| return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||||
| } | |||||
| } | |||||
| @@ -1,6 +1,7 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import java.io.BufferedInputStream; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| @@ -50,7 +51,7 @@ public class UploadController { | |||||
| ) { | ) { | ||||
| ResultData data = new ResultData(); | ResultData data = new ResultData(); | ||||
| FileOutputStream fos=null; | FileOutputStream fos=null; | ||||
| FileInputStream fs=null; | |||||
| BufferedInputStream fs=null; | |||||
| try { | try { | ||||
| File targetFile = new File(filePath); | File targetFile = new File(filePath); | ||||
| if(!targetFile.exists()){ | if(!targetFile.exists()){ | ||||
| @@ -60,7 +61,7 @@ public class UploadController { | |||||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | ||||
| fileName=fileName+ multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | fileName=fileName+ multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | ||||
| fos = new FileOutputStream(new File(filePath+File.separator+fileName)); | fos = new FileOutputStream(new File(filePath+File.separator+fileName)); | ||||
| fs=(FileInputStream) multiReq.getInputStream(); | |||||
| fs=(BufferedInputStream) multiReq.getInputStream(); | |||||
| byte[] buffer=new byte[1024]; | byte[] buffer=new byte[1024]; | ||||
| int len=0; | int len=0; | ||||
| while((len=fs.read(buffer))!=-1){ | while((len=fs.read(buffer))!=-1){ | ||||
| @@ -75,6 +76,7 @@ public class UploadController { | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| e.printStackTrace(); | e.printStackTrace(); | ||||
| data.code=ResultData.ERROR; | data.code=ResultData.ERROR; | ||||
| data.message="上传失败"; | |||||
| }finally { | }finally { | ||||
| if(fos!=null) { | if(fos!=null) { | ||||
| try { | try { | ||||
| @@ -200,84 +200,5 @@ public class WxCUserBasicInfoController extends BaseController | |||||
| return new ResultData(Result.SUCCESS,"查询成功",page); | 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<UserStructureVo> 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<UserStructureVo> 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; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,209 @@ | |||||
| 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.BeanUtils; | |||||
| 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.TouchUsersReportVo; | |||||
| import com.simple.domain.vo.UserStructureVo; | |||||
| import com.simple.service.WxCUserService; | |||||
| import com.simple.service.WxUserVisitService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxCUserData") | |||||
| @Api(description="会员首页报表数据") | |||||
| public class WxCUserDataController extends BaseController{ | |||||
| @Autowired | |||||
| private WxCUserService wxCUserService; | |||||
| @Autowired | |||||
| private WxUserVisitService wxUserVisitService; | |||||
| @GetMapping("findUserCountData") | |||||
| @ApiOperation("查询用户数量接口") | |||||
| public ResultData findUserCountData() { | |||||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||||
| 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);//今天新增 | |||||
| // System.out.println(todayCount); | |||||
| long todayCount=0; | |||||
| long yesterdayCount =0; | |||||
| long dayOfWeekCount=0; | |||||
| List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数 | |||||
| int j=0; | |||||
| for(int i=7;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); | |||||
| if(i==1) { | |||||
| yesterdayCount= count; | |||||
| } | |||||
| if(i==0) { | |||||
| todayCount=count; | |||||
| } | |||||
| if(i==7) { | |||||
| dayOfWeekCount=count;//上周同比 | |||||
| }else { | |||||
| newCountVos.add(vo); | |||||
| } | |||||
| } | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||||
| nf.setMinimumFractionDigits(2); | |||||
| String dayPercentage =""; | |||||
| if(yesterdayCount>0) { | |||||
| Long count =todayCount-yesterdayCount; | |||||
| dayPercentage=nf.format(count.doubleValue()/new Double(yesterdayCount).doubleValue()); | |||||
| }else { | |||||
| dayPercentage= nf.format(new Double(todayCount).doubleValue()); | |||||
| } | |||||
| String weekPercentage =""; | |||||
| if(dayOfWeekCount>0) { | |||||
| Long count =todayCount-dayOfWeekCount; | |||||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||||
| }else { | |||||
| weekPercentage= nf.format(new Double(todayCount).doubleValue()); | |||||
| } | |||||
| Map<String,Object> map = new HashMap<>(); | |||||
| map.put("allCount", allCount); | |||||
| map.put("todayCount", todayCount); | |||||
| map.put("newCountVos", newCountVos); | |||||
| map.put("dayPercentage",dayPercentage);//日环比 | |||||
| map.put("weekPercentage",weekPercentage); //周同比 | |||||
| return new ResultData(map); | |||||
| } | |||||
| @GetMapping("findUserVisitData") | |||||
| public ResultData findUserVisitData() { | |||||
| HashMap<String, Object> params =new HashMap<>(); | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.add(Calendar.DAY_OF_YEAR, -1); | |||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE,0); | |||||
| c.set(Calendar.SECOND,0); | |||||
| Date endTime = c.getTime(); | |||||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||||
| Date startTime = c.getTime(); | |||||
| params.put("startTime", startTime); | |||||
| params.put("endTime", endTime); | |||||
| params.put("tenantId", getTenantId()); | |||||
| List<TouchUsersReportVo> list = wxUserVisitService.touchUsersReportList(params); | |||||
| Map<String,TouchUsersReportVo> dateMap = new HashMap<>(); | |||||
| for(TouchUsersReportVo vo :list) { | |||||
| dateMap.put(vo.getxTime(), vo); | |||||
| } | |||||
| List<UserStructureVo> weekVos = new ArrayList<>();//每周uv | |||||
| List<UserStructureVo> monthVos =new ArrayList<>();//每月uv | |||||
| int j=1; | |||||
| long yesterdayCount =0;//昨天活跃数 | |||||
| long beforeYesterdayCount=0;//前天活跃数 | |||||
| long thisMonthCount=0;//月总数 | |||||
| long dayOfWeekCount=0;//上周周x数 | |||||
| for(int i=6;i>=0;i--) { | |||||
| c.clear(); | |||||
| c.setTime(endTime); | |||||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||||
| UserStructureVo vo = new UserStructureVo(); | |||||
| vo.setName(dayStr); | |||||
| vo.setSortNum(j); | |||||
| j++; | |||||
| if(dateMap.get(dayStr)!=null) { | |||||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||||
| Long l = new Long((long) rv.getUv()); | |||||
| vo.setCount(l); | |||||
| }else { | |||||
| vo.setCount(0); | |||||
| } | |||||
| weekVos.add(vo); | |||||
| } | |||||
| j=1; | |||||
| for(int i=29;i>=0;i--) { | |||||
| c.clear(); | |||||
| c.setTime(endTime); | |||||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | |||||
| UserStructureVo vo = new UserStructureVo(); | |||||
| vo.setName(dayStr); | |||||
| vo.setSortNum(j); | |||||
| if(dateMap.get(dayStr)!=null) { | |||||
| TouchUsersReportVo rv = dateMap.get(dayStr); | |||||
| Long l = new Long((long) rv.getUv()); | |||||
| vo.setCount(l); | |||||
| }else { | |||||
| vo.setCount(0); | |||||
| } | |||||
| thisMonthCount+=vo.getCount(); | |||||
| if(i==0) { | |||||
| yesterdayCount =vo.getCount(); | |||||
| } | |||||
| if(i==1) { | |||||
| beforeYesterdayCount =vo.getCount(); | |||||
| } | |||||
| if(i==7) { | |||||
| dayOfWeekCount=vo.getCount(); | |||||
| } | |||||
| monthVos.add(vo); | |||||
| j++; | |||||
| } | |||||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||||
| nf.setMinimumFractionDigits(2); | |||||
| String dayPercentage =""; | |||||
| if(beforeYesterdayCount>0) { | |||||
| Long count =yesterdayCount-beforeYesterdayCount; | |||||
| dayPercentage=nf.format(count.doubleValue()/new Double(beforeYesterdayCount).doubleValue()); | |||||
| }else { | |||||
| dayPercentage= nf.format(new Double(yesterdayCount).doubleValue()); | |||||
| } | |||||
| String weekPercentage =""; | |||||
| if(dayOfWeekCount>0) { | |||||
| Long count =yesterdayCount-dayOfWeekCount; | |||||
| weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); | |||||
| }else { | |||||
| weekPercentage= nf.format(new Double(yesterdayCount).doubleValue()); | |||||
| } | |||||
| Map<String,Object> mapVo =new HashMap<>(); | |||||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | |||||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | |||||
| mapVo.put("weekVos", weekVos);//上周活跃数 | |||||
| mapVo.put("monthVos", monthVos);//上月活跃数 | |||||
| mapVo.put("dayPercentage",dayPercentage);//日环比 | |||||
| mapVo.put("weekPercentage",weekPercentage); //周同比 | |||||
| return new ResultData(mapVo); | |||||
| } | |||||
| } | |||||
| @@ -1,12 +1,18 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCampaign; | import com.simple.domain.po.WxCampaign; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponChannelVo; | |||||
| import com.simple.enums.EnumCouponChannelType; | |||||
| import com.simple.enums.EnumCouponStatus; | |||||
| import com.simple.service.WxCampaignService; | import com.simple.service.WxCampaignService; | ||||
| import com.simple.service.WxCouponChannelService; | |||||
| import com.simple.service.WxCouponService; | import com.simple.service.WxCouponService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -29,9 +35,13 @@ public class WxCampaignController extends BaseController | |||||
| { | { | ||||
| @Autowired | @Autowired | ||||
| private WxCampaignService wxCampaignService; | private WxCampaignService wxCampaignService; | ||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| private WxCouponChannelService wxCouponChannelService; | |||||
| private Logger logger = Logger.getLogger(WxCampaignController.class); | private Logger logger = Logger.getLogger(WxCampaignController.class); | ||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @@ -59,6 +69,8 @@ public class WxCampaignController extends BaseController | |||||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | ||||
| String[] arys = wxCampaign.getCouponIds().split(","); | String[] arys = wxCampaign.getCouponIds().split(","); | ||||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | wxCampaign.setCouponIds(JSON.toJSONString(arys)); | ||||
| }else { | |||||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | |||||
| } | } | ||||
| wxCampaign.setStatus(0); | wxCampaign.setStatus(0); | ||||
| wxCampaign.setTenantId(getTenantId()); | wxCampaign.setTenantId(getTenantId()); | ||||
| @@ -73,6 +85,8 @@ public class WxCampaignController extends BaseController | |||||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | ||||
| String[] arys = wxCampaign.getCouponIds().split(","); | String[] arys = wxCampaign.getCouponIds().split(","); | ||||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | wxCampaign.setCouponIds(JSON.toJSONString(arys)); | ||||
| }else { | |||||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | |||||
| } | } | ||||
| wxCampaignService.saveOrUpdate(wxCampaign); | wxCampaignService.saveOrUpdate(wxCampaign); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -92,18 +106,13 @@ public class WxCampaignController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | WxCampaign wxCampaign = wxCampaignService.getById(id); | ||||
| if (wxCampaign != null) { | if (wxCampaign != null) { | ||||
| List<Long> list = new ArrayList<>(); | |||||
| List<String> templist = JSON.parseArray(wxCampaign.getCouponIds(), String.class); | |||||
| for (String temp : templist | |||||
| ) { | |||||
| list.add(Long.parseLong(temp)); | |||||
| } | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setIds(list); | |||||
| wxCoupon.setStatus(0); | |||||
| List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | |||||
| wxCampaign.setCoupons(couponlist); | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| wxCouponChannel.setStatus(0); | |||||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||||
| wxCampaign.setCoupons(couponList); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||
| @@ -145,7 +145,8 @@ public class WxCarCallBackController extends BaseController | |||||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | ||||
| } | } | ||||
| // TODO 发起 营销 -- 短信 | |||||
| // TODO 如果此车关联了停车优免券,自动把优免券设为已使用 | |||||
| return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); | return new Result(EnumETCPCode.SUCCESS.getCode(), EnumETCPCode.SUCCESS.getMessage()); | ||||
| } | } | ||||
| @@ -6,20 +6,24 @@ import com.alibaba.fastjson.JSONObject; | |||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.dto.WxCounponDto; | |||||
| import com.simple.domain.dto.WxCouponCarDto; | |||||
| import com.simple.domain.po.*; | import com.simple.domain.po.*; | ||||
| import com.simple.domain.vo.WxCouponCarVo; | |||||
| import com.simple.enums.EnumCarCmd; | import com.simple.enums.EnumCarCmd; | ||||
| import com.simple.enums.EnumCarVendor; | 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.enums.EnumCouponStatus; | |||||
| import com.simple.service.*; | |||||
| import com.simple.utils.ETCPUtil; | import com.simple.utils.ETCPUtil; | ||||
| import com.simple.utils.TJDCarUtil; | import com.simple.utils.TJDCarUtil; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import io.swagger.models.auth.In; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.apache.log4j.Logger; | 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.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| @@ -50,6 +54,12 @@ public class WxCarController extends BaseController | |||||
| @Autowired | @Autowired | ||||
| WxCarCmdLogService wxCarCmdLogService; | WxCarCmdLogService wxCarCmdLogService; | ||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| WxCouponCarService wxCouponCarService; | |||||
| private WxPark getCurrentPark(MallUserInfo user) { | private WxPark getCurrentPark(MallUserInfo user) { | ||||
| WxPark parkQ = new WxPark(); | WxPark parkQ = new WxPark(); | ||||
| parkQ.setTenantId(user.getTenantId()); | parkQ.setTenantId(user.getTenantId()); | ||||
| @@ -142,6 +152,10 @@ public class WxCarController extends BaseController | |||||
| businessId = objParams.getString("businessId"); | businessId = objParams.getString("businessId"); | ||||
| } | } | ||||
| String ret = etcp.getBCouponList(url, merchantNo, merchantKey, version, parkId, 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); | JSONObject retObj = JSON.parseObject(ret); | ||||
| if (retObj.getIntValue("code") == 0) { | if (retObj.getIntValue("code") == 0) { | ||||
| return new ResultData(retObj.getJSONObject("data")); | return new ResultData(retObj.getJSONObject("data")); | ||||
| @@ -167,4 +181,154 @@ public class WxCarController extends BaseController | |||||
| businessId = objParams1.getString("businessId"); | businessId = objParams1.getString("businessId"); | ||||
| return businessId; | return businessId; | ||||
| } | } | ||||
| @ApiOperation("新增停车券接口") | |||||
| @PostMapping("save") | |||||
| public ResultData save(@RequestBody WxCouponCarVo coupon) { | |||||
| logger.info(coupon.toString()); | |||||
| //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()); | |||||
| wxCoupon.setMerchantId(coupon.getMerchantId()); | |||||
| if(StringUtils.isNotEmpty(coupon.getSalePriceStr())){ | |||||
| wxCoupon.setSalePrice((int)Double.parseDouble(coupon.getSalePriceStr())*100); | |||||
| } | |||||
| if(StringUtils.isNotEmpty(coupon.getUsePriceStr())){ | |||||
| wxCoupon.setUsePrice((int)Double.parseDouble(coupon.getUsePriceStr())*100); | |||||
| } | |||||
| if(StringUtils.isNotEmpty(coupon.getPriceStr())){ | |||||
| wxCoupon.setPrice((int)Double.parseDouble(coupon.getPriceStr())*100); | |||||
| } | |||||
| if(StringUtils.isNotBlank(coupon.getBusiness())) { | |||||
| String[] arys = coupon.getBusiness().split(","); | |||||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||||
| } | |||||
| 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(); | |||||
| couponCar.setId(id); | |||||
| couponCar.setTenantId(user.getTenantId()); | |||||
| couponCar.setMerchantId(coupon.getMerchantId()); | |||||
| WxPark park = getCurrentPark(user); | |||||
| couponCar.setParkId(park.getId()); | |||||
| couponCar.setVendorType(park.getVendorType()); | |||||
| couponCar.setVendorParams(coupon.getVendorParams()); | |||||
| couponCar.setCreateDate(curDate); | |||||
| couponCar.setUpdateDate(curDate); | |||||
| WxCouponCar newCouponCar = wxCouponCarService.getById(couponCar.getId()); | |||||
| if (newCouponCar == null) { | |||||
| wxCouponCarService.save(couponCar); | |||||
| } else { | |||||
| wxCouponCarService.update(couponCar); | |||||
| } | |||||
| 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("优免券模板库存总数") | |||||
| @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) { | |||||
| MallUserInfo user = getUser(); | |||||
| coupon.setTenantId(user.getTenantId()); | |||||
| try { | |||||
| WxCouponCarVo couponCarVo = wxCouponCarService.getByCoupon(coupon); | |||||
| if (couponCarVo != null) { | |||||
| WxCouponCarDto dto = new WxCouponCarDto(); | |||||
| org.springframework.beans.BeanUtils.copyProperties(couponCarVo, dto); | |||||
| WxMerchant merchant = wxMerchantService.getById(couponCarVo.getMerchantId()); | |||||
| dto.setWxMerchant(merchant); | |||||
| return new ResultData(dto); | |||||
| } else { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL.getCode(), e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -40,14 +40,14 @@ public class WxCouponCarController extends BaseController | |||||
| public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | ||||
| //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCouponCarService.saveOrUpdate(wxCouponCar); | |||||
| wxCouponCarService.save(wxCouponCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCouponCar wxCouponCar) { | public ResultData update(@RequestBody WxCouponCar wxCouponCar) { | ||||
| wxCouponCarService.saveOrUpdate(wxCouponCar); | |||||
| wxCouponCarService.update(wxCouponCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -1,7 +1,10 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.simple.domain.dto.WxCouponChannelDto; | import com.simple.domain.dto.WxCouponChannelDto; | ||||
| import com.simple.domain.po.MallUserInfo; | import com.simple.domain.po.MallUserInfo; | ||||
| import com.simple.domain.po.WxChannel; | |||||
| import com.simple.domain.vo.WxCouponChannelVo; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -17,6 +20,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| @@ -41,7 +46,8 @@ public class WxCouponChannelController extends BaseController | |||||
| wxCouponChannel.setStatus(null); | wxCouponChannel.setStatus(null); | ||||
| } | } | ||||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | wxCouponChannel.setTenantId(getUser().getTenantId()); | ||||
| final PageInfo<WxCouponChannel> page = wxCouponChannelService.listAsPage(wxCouponChannel, pageNum, pageSize); | |||||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); | |||||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -51,6 +57,23 @@ public class WxCouponChannelController extends BaseController | |||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | ||||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | wxCouponChannel.setTenantId(getUser().getTenantId()); | ||||
| if(wxCouponChannel.getCouponId()!=null&&wxCouponChannel.getStatus()!=null){ | |||||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | |||||
| if(orignal.getStatus()==1&&wxCouponChannel.getStatus()==0){ | |||||
| //查找是否该券 在该频道有其他上架 | |||||
| WxCouponChannel query = new WxCouponChannel(); | |||||
| query.setTenantId(orignal.getTenantId()); | |||||
| query.setCouponId(orignal.getCouponId()); | |||||
| query.setStatus(0);//已上架 | |||||
| query.setTargetAd(orignal.getTargetAd()); | |||||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query,1,1).getList(); | |||||
| if(list!=null&&list.size()>0){ | |||||
| //不能修改 | |||||
| return new ResultData(Result.ERROR,"不允许同一个券,多个投放"); | |||||
| } | |||||
| } | |||||
| } | |||||
| wxCouponChannelService.saveOrUpdate(wxCouponChannel); | wxCouponChannelService.saveOrUpdate(wxCouponChannel); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -76,10 +99,29 @@ public class WxCouponChannelController extends BaseController | |||||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | String[] ids = wxCouponChannelDto.getCouponIds().split(","); | ||||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | String[] channelId = wxCouponChannelDto.getChannelId().split(","); | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime()); | |||||
| return new ResultData(); | |||||
| return wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime()); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findChannelByCouponId") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData findChannelByCouponId(Long id) { | |||||
| List<Integer> channellist = new ArrayList<>(); | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | |||||
| wxCouponChannel.setStatus(0); | |||||
| wxCouponChannel.setCouponId(id); | |||||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel,1,5).getList(); | |||||
| if(list.isEmpty()){ | |||||
| return new ResultData(Result.SUCCESS,"查询成功", ""); | |||||
| } | |||||
| for (WxCouponChannel temp:list) { | |||||
| channellist.add(temp.getTargetAd()); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS,"查询成功", JSON.toJSONString(channellist)); | |||||
| } | } | ||||
| @@ -56,12 +56,12 @@ public class WxCouponController extends BaseController | |||||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC); | |||||
| PageInfo<WxCoupon> page = null; | PageInfo<WxCoupon> 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<WxCoupon> wxCouponList = page.getList(); | List<WxCoupon> wxCouponList = page.getList(); | ||||
| if(wxCouponList.isEmpty()){ | if(wxCouponList.isEmpty()){ | ||||
| @@ -170,10 +170,8 @@ public class WxCouponController extends BaseController | |||||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | if (null == wxCoupon) wxCoupon = new WxCoupon(); | ||||
| wxCoupon.setTenantId(getTenantId()); | wxCoupon.setTenantId(getTenantId()); | ||||
| wxCoupon.setStatus(0); | wxCoupon.setStatus(0); | ||||
| PageInfo<WxCoupon> page = null; | |||||
| page = wxCouponService.findCanSendList(wxCoupon, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | |||||
| } | } | ||||
| @@ -1,10 +1,7 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.vo.WxCouponOrderBVo; | |||||
| import com.simple.service.WxCouponOrderService; | import com.simple.service.WxCouponOrderService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -12,7 +9,13 @@ import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | |||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCouponOrder") | @RequestMapping("wxCouponOrder") | ||||
| @@ -32,8 +35,17 @@ public class WxCouponOrderController extends BaseController | |||||
| public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | ||||
| if (wxCouponOrder == null) wxCouponOrder= new WxCouponOrder(); | if (wxCouponOrder == null) wxCouponOrder= new WxCouponOrder(); | ||||
| wxCouponOrder.setTenantId(getTenantId()); | wxCouponOrder.setTenantId(getTenantId()); | ||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | |||||
| return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | ||||
| } | } | ||||
| @RequestMapping("/exportData") | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response){ | |||||
| wxCouponOrderService.exportData(request,response,getTenantId()); | |||||
| } | |||||
| } | } | ||||
| @@ -33,6 +33,8 @@ public class WxOrderController extends BaseController | |||||
| }) | }) | ||||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | ||||
| if (null == wxOrder) wxOrder = new WxOrder(); | if (null == wxOrder) wxOrder = new WxOrder(); | ||||
| wxOrder.setTenantId(getTenantId()); | |||||
| wxOrder.setSortColumns(WxOrder.Field.Id_DESC); | |||||
| final PageInfo<WxOrder> page = wxOrderService.listAsPage(wxOrder, pageNum, pageSize); | final PageInfo<WxOrder> page = wxOrderService.listAsPage(wxOrder, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @@ -10,12 +10,16 @@ import com.simple.service.WxRefundOrderService; | |||||
| import com.simple.utils.XmlUtil; | import com.simple.utils.XmlUtil; | ||||
| import org.apache.commons.io.IOUtils; | import org.apache.commons.io.IOUtils; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.jdom.JDOMException; | |||||
| import org.springframework.http.MediaType; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.io.ByteArrayOutputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| import java.nio.charset.Charset; | import java.nio.charset.Charset; | ||||
| import java.util.LinkedHashMap; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.SortedMap; | import java.util.SortedMap; | ||||
| import java.util.TreeMap; | import java.util.TreeMap; | ||||
| @@ -40,22 +44,36 @@ public class WxPayController extends BaseController { | |||||
| * @return 接收微信异步通知 | * @return 接收微信异步通知 | ||||
| * @throws Exception 可能产生的任何异常 | * @throws Exception 可能产生的任何异常 | ||||
| */ | */ | ||||
| @RequestMapping(value = "/pay") | |||||
| public String _payNotify(HttpServletRequest request) throws Exception { | |||||
| @RequestMapping(value = "/pay", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) | |||||
| @ResponseBody | |||||
| public String _payNotify(HttpServletRequest request) throws IOException, JDOMException { | |||||
| logger.info("微信支付回调"); | |||||
| InputStream inStream = request.getInputStream(); | |||||
| ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); | |||||
| byte[] buffer = new byte[1024]; | |||||
| int len = 0; | |||||
| while ((len = inStream.read(buffer)) != -1) { | |||||
| outSteam.write(buffer, 0, len); | |||||
| } | |||||
| String resultxml = new String(outSteam.toByteArray(), Charset.forName("UTF-8")); | |||||
| logger.info(resultxml); | |||||
| outSteam.close(); | |||||
| inStream.close(); | |||||
| Map<String, String> paramMap = null; | Map<String, String> paramMap = null; | ||||
| try { | try { | ||||
| String xml = IOUtils.toString(request.getInputStream(), Charset.forName("UTF-8")); | |||||
| paramMap = WxPayment.xmlToMap(xml); | |||||
| logger.info("payment wxpay, notify, param: " + paramMap.toString() ); | |||||
| paramMap = WxPayment.xmlToMap(resultxml); | |||||
| logger.info("微信支付回调, notify, param: " + paramMap.toString() ); | |||||
| String response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | String response = wxPayOrderService.notify(paramMap, EnumPayWay.PAY_WAY_WEAPP); | ||||
| logger.info("payment wxpay, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||||
| logger.info("微信支付回调, notify success, req : " + paramMap.toString() + ", resp: " + response.toString()); | |||||
| return response; | return response; | ||||
| } catch (BizMessageException e) { | } catch (BizMessageException e) { | ||||
| if (paramMap == null) { | if (paramMap == null) { | ||||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||||
| } else { | } else { | ||||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| } | } | ||||
| SortedMap resultMap = new TreeMap<>(); | SortedMap resultMap = new TreeMap<>(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| @@ -63,9 +81,9 @@ public class WxPayController extends BaseController { | |||||
| return XmlUtil.getRequestXml(resultMap); | return XmlUtil.getRequestXml(resultMap); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| if (paramMap == null) { | if (paramMap == null) { | ||||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||||
| } else { | } else { | ||||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| } | } | ||||
| SortedMap resultMap = new TreeMap<>(); | SortedMap resultMap = new TreeMap<>(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| @@ -73,9 +91,9 @@ public class WxPayController extends BaseController { | |||||
| return XmlUtil.getRequestXml(resultMap); | return XmlUtil.getRequestXml(resultMap); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| if (paramMap == null) { | if (paramMap == null) { | ||||
| logger.error("payment wxpay, order create error, e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, e: " + e.getMessage()); | |||||
| } else { | } else { | ||||
| logger.error("payment wxpay, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| logger.error("微信支付回调, order create error, req: " + paramMap.toString() + ", e: " + e.getMessage()); | |||||
| } | } | ||||
| SortedMap resultMap = new TreeMap(); | SortedMap resultMap = new TreeMap(); | ||||
| resultMap.put("return_code", "FAIL"); | resultMap.put("return_code", "FAIL"); | ||||
| @@ -0,0 +1,71 @@ | |||||
| package com.simple.controller; | |||||
| 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.WxUserChannel; | |||||
| import com.simple.service.WxUserChannelService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxUserChannel") | |||||
| public class WxUserChannelController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| private WxUserChannelService wxUserChannelService; | |||||
| private Logger logger = Logger.getLogger(WxUserChannelController.class); | |||||
| @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 WxUserChannel wxUserChannel,Integer pageNum, Integer pageSize) { | |||||
| if (null == wxUserChannel) wxUserChannel = new WxUserChannel(); | |||||
| final PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(wxUserChannel, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxUserChannel wxUserChannel) { | |||||
| //Assert.notNull(wxUserChannel.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxUserChannelService.saveOrUpdate(wxUserChannel); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxUserChannel wxUserChannel) { | |||||
| wxUserChannelService.saveOrUpdate(wxUserChannel); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||||
| public ResultData delete(Long id) { | |||||
| wxUserChannelService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @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,"查询成功",wxUserChannelService.getById(id)); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,260 @@ | |||||
| 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.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; | |||||
| 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; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @Api(description="会员洞察") | |||||
| @RequestMapping("userAnalysis") | |||||
| public class WxUserStructureController extends BaseController{ | |||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | |||||
| private WxCUserService wxCUserService; | |||||
| @Autowired | |||||
| private WxUserChannelService wxUserChannelService; | |||||
| @ApiOperation("查询会员性别结构") | |||||
| @GetMapping("/findUserSexStructure") | |||||
| public ResultData findUserSexStructure( | |||||
| Date startTime,Date endTime | |||||
| ) { | |||||
| WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto(); | |||||
| dto.setTenantId(getTenantId()); | |||||
| 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<UserStructureVo> 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.setTenantId(getTenantId()); | |||||
| 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<UserStructureVo> 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.setTenantId(getTenantId()); | |||||
| 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<UserStructureVo> 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<UserStructureVo> 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<String,Object> 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); | |||||
| } | |||||
| @ApiOperation("拓客分析") | |||||
| @GetMapping("/findUserByChannel") | |||||
| @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) { | |||||
| List<String> sceneList =null; | |||||
| if(StringUtils.isNotBlank(channelName)) { | |||||
| WxUserChannel c= new WxUserChannel(); | |||||
| c.setChannelName(channelName); | |||||
| PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 100); | |||||
| if(page.getSize()>0) { | |||||
| sceneList = new ArrayList<>(); | |||||
| for(WxUserChannel wuc:page.getList()) { | |||||
| sceneList.add(wuc.getSceneAddress()); | |||||
| } | |||||
| } | |||||
| } | |||||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(sceneList, pageNum, pageSize); | |||||
| for(WxCUser u:page.getList()) { | |||||
| WxUserChannel c= new WxUserChannel(); | |||||
| c.setSceneAddress(u.getSceneAddress()); | |||||
| PageInfo<WxUserChannel> 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("获取用户所有渠道") | |||||
| @GetMapping("/findAllUserChannel") | |||||
| public ResultData findAllUserChannel() { | |||||
| List<WxUserChannel> channels=wxUserChannelService.findDistinctChannel(); | |||||
| List<String> vos = new ArrayList<>(); | |||||
| for(WxUserChannel w:channels) { | |||||
| vos.add(w.getChannelName()); | |||||
| } | |||||
| 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) { | |||||
| // 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; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,55 @@ | |||||
| package com.simple.schedule; | |||||
| import com.simple.common.IdWorker; | |||||
| import com.simple.domain.po.WxCouponOrder; | |||||
| import com.simple.domain.po.WxDateAmountRecord; | |||||
| import com.simple.domain.po.WxMall; | |||||
| import com.simple.domain.po.WxMerchant; | |||||
| import com.simple.enums.EnumDateAmtType; | |||||
| import com.simple.mapper.*; | |||||
| import com.simple.service.WxDateAmountRecordService; | |||||
| 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; | |||||
| import java.util.*; | |||||
| @Component | |||||
| public class CouponExpiringSchedule { | |||||
| private final Logger logger = Logger.getLogger(CouponExpiringSchedule.class); | |||||
| @Autowired | |||||
| private WxMallMapper wxMallMapper; | |||||
| @Autowired | |||||
| private WxCouponChannelMapper wxCouponChannelMapper; | |||||
| @Autowired | |||||
| private WxCouponMapper wxCouponMapper; | |||||
| @Scheduled(cron = "0 30 0 * * ?") // 每天凌晨 | |||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| public void couponExpiringSchedule() { | |||||
| } | |||||
| @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨 | |||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | |||||
| public void couponChannelExpiringSchedule() { | |||||
| wxCouponChannelMapper.offExpiriedCouponChannelByEndTime(); | |||||
| wxCouponChannelMapper.offExpiriedCouponChannelByValidDate(); | |||||
| } | |||||
| } | |||||
| @@ -5,13 +5,15 @@ import com.simple.domain.po.WxCouponOrder; | |||||
| import com.simple.domain.po.WxDateAmountRecord; | import com.simple.domain.po.WxDateAmountRecord; | ||||
| import com.simple.domain.po.WxMall; | import com.simple.domain.po.WxMall; | ||||
| import com.simple.domain.po.WxMerchant; | import com.simple.domain.po.WxMerchant; | ||||
| import com.simple.enums.EnumDateAmtType; | |||||
| import com.simple.mapper.*; | import com.simple.mapper.*; | ||||
| import com.simple.service.WxDateAmountRecordService; | import com.simple.service.WxDateAmountRecordService; | ||||
| import com.simple.utils.*; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Scheduled; | import org.springframework.scheduling.annotation.Scheduled; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| @@ -42,6 +44,7 @@ public class DaliyAmountSchedule { | |||||
| @Scheduled(cron = "0 0 23 * * ?") // 每天晚上11点盘点 | @Scheduled(cron = "0 0 23 * * ?") // 每天晚上11点盘点 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| public void daliyAmountSchedule() { | public void daliyAmountSchedule() { | ||||
| @@ -80,7 +83,7 @@ public class DaliyAmountSchedule { | |||||
| dateMap.put("endDate", new Date()); | dateMap.put("endDate", new Date()); | ||||
| dateMap.put("merchantID",merchant.getId()); | dateMap.put("merchantID",merchant.getId()); | ||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfUnverifiedByDate(dateMap); | |||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | ||||
| int total_price = 0; | int total_price = 0; | ||||
| for(WxCouponOrder couponOrder : list) { | for(WxCouponOrder couponOrder : list) { | ||||
| @@ -108,7 +111,7 @@ public class DaliyAmountSchedule { | |||||
| dateAmountRecord.setPayPrice(total_price); | dateAmountRecord.setPayPrice(total_price); | ||||
| dateAmountRecord.setMerchantId(merchant.getId()); | dateAmountRecord.setMerchantId(merchant.getId()); | ||||
| dateAmountRecord.setTenantId(merchant.getTenantId()); | dateAmountRecord.setTenantId(merchant.getTenantId()); | ||||
| dateAmountRecord.setType(0); | |||||
| dateAmountRecord.setType(EnumDateAmtType.PAY_RECORD.getCode()); | |||||
| dateAmountRecord.setDate(now); | dateAmountRecord.setDate(now); | ||||
| dateAmountRecord.setDayOfWeek(cal.get(Calendar.DAY_OF_WEEK)); | dateAmountRecord.setDayOfWeek(cal.get(Calendar.DAY_OF_WEEK)); | ||||
| dateAmountRecord.setMonth(cal.get(Calendar.MONTH)); | dateAmountRecord.setMonth(cal.get(Calendar.MONTH)); | ||||
| @@ -129,7 +132,7 @@ public class DaliyAmountSchedule { | |||||
| dateAmountRecord.setId(IdWorker.get().nextId()); | dateAmountRecord.setId(IdWorker.get().nextId()); | ||||
| dateAmountRecord.setPayPrice(total_price); | dateAmountRecord.setPayPrice(total_price); | ||||
| dateAmountRecord.setType(1); | |||||
| dateAmountRecord.setType(EnumDateAmtType.VERIFY_RECORD.getCode()); | |||||
| wxDateAmountRecordService.saveDaliyAmount(dateAmountRecord); | wxDateAmountRecordService.saveDaliyAmount(dateAmountRecord); | ||||
| } | } | ||||
| @@ -48,7 +48,7 @@ public class MsgSendingSchedule { | |||||
| public void sendmsg(WxMsg wxMsg){ | public void sendmsg(WxMsg wxMsg){ | ||||
| //从短信配置中查询密钥 bid 等信息 | //从短信配置中查询密钥 bid 等信息 | ||||
| WxMsgConfig wxMsgConfig = new WxMsgConfig(); | WxMsgConfig wxMsgConfig = new WxMsgConfig(); | ||||
| wxMsgConfig.setTenantId("1"); | |||||
| wxMsgConfig.setTenantId(wxMsg.getTenantId()); | |||||
| List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); | ||||
| if (wxMsgConfigs.size() == 0) return; | if (wxMsgConfigs.size() == 0) return; | ||||
| wxMsgConfig = wxMsgConfigs.get(0); | wxMsgConfig = wxMsgConfigs.get(0); | ||||
| @@ -0,0 +1,21 @@ | |||||
| 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 { | |||||
| @Override | |||||
| public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { | |||||
| ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); | |||||
| scheduler.setPoolSize(10); | |||||
| scheduler.initialize(); | |||||
| taskRegistrar.setTaskScheduler(scheduler); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,108 @@ | |||||
| 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 4 * * ? ") | |||||
| 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<String, String> map = new HashMap<String, String>(); | |||||
| map.put("begin_date", yesterday); | |||||
| map.put("end_date",yesterday); | |||||
| RestTemplate restTemplate = new RestTemplate(); | |||||
| HttpEntity<Map<String,String>> entity = new HttpEntity<Map<String,String>>(map, headers); | |||||
| String reqUrl =visit+accessToken; | |||||
| ResponseEntity<String> responseEntity = restTemplate.postForEntity(reqUrl, entity, String.class); | |||||
| logger.info("获取wx访问数据:"+JSON.toJSONString(responseEntity)); | |||||
| if(responseEntity.hasBody()) { | |||||
| String body = responseEntity.getBody(); | |||||
| Map<String,Object> maps = (Map<String,Object>)JSON.parse(body); | |||||
| JSONArray jSONArray = (JSONArray)maps.get("list"); | |||||
| if(jSONArray==null || jSONArray.isEmpty()) { | |||||
| logger.info("获取失败"); | |||||
| return; | |||||
| } | |||||
| JSONObject jsonObject = jSONArray.getJSONObject(0); | |||||
| Map<String, Object> 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<String,Object> map = restTemplate.getForObject(url,Map.class); | |||||
| logger.info("获取access_token返回:"+JSON.toJSONString(map)); | |||||
| return (String)map.get("access_token"); | |||||
| } | |||||
| } | |||||
| @@ -39,4 +39,4 @@ mapper: | |||||
| - com.simple.common.CommonMapper | - com.simple.common.CommonMapper | ||||
| pay: | pay: | ||||
| real: false | |||||
| real: true | |||||
| @@ -39,4 +39,4 @@ mapper: | |||||
| - com.simple.common.CommonMapper | - com.simple.common.CommonMapper | ||||
| pay: | pay: | ||||
| real: false | |||||
| real: true | |||||
| @@ -6,7 +6,11 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCampaign; | import com.simple.domain.po.WxCampaign; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.domain.vo.WxCouponChannelVo; | |||||
| import com.simple.enums.EnumCouponChannelType; | |||||
| import com.simple.service.WxCampaignService; | import com.simple.service.WxCampaignService; | ||||
| import com.simple.service.WxCouponChannelService; | |||||
| import com.simple.service.WxCouponService; | import com.simple.service.WxCouponService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -31,6 +35,8 @@ public class WxCampaignController extends BaseController | |||||
| private WxCampaignService wxCampaignService; | private WxCampaignService wxCampaignService; | ||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| private WxCouponChannelService wxCouponChannelService; | |||||
| private Logger logger = Logger.getLogger(WxCampaignController.class); | private Logger logger = Logger.getLogger(WxCampaignController.class); | ||||
| @@ -54,18 +60,13 @@ public class WxCampaignController extends BaseController | |||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | WxCampaign wxCampaign = wxCampaignService.getById(id); | ||||
| if (wxCampaign != null) { | if (wxCampaign != null) { | ||||
| List<Long> list = new ArrayList<>(); | |||||
| List<String> templist = JSON.parseArray(wxCampaign.getCouponIds(), String.class); | |||||
| for (String temp : templist | |||||
| ) { | |||||
| list.add(Long.parseLong(temp)); | |||||
| } | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| wxCoupon.setIds(list); | |||||
| wxCoupon.setStatus(1); | |||||
| List<WxCoupon> couponlist = wxCouponService.findList(wxCoupon); | |||||
| wxCampaign.setCoupons(couponlist); | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||||
| wxCouponChannel.setStatus(0); | |||||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||||
| wxCampaign.setCoupons(couponList); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||
| @@ -1,73 +1,68 @@ | |||||
| package com.simple.controller; | 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.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | import com.simple.common.Result; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCouponCar; | import com.simple.domain.po.WxCouponCar; | ||||
| import com.simple.service.WxCouponCarService; | import com.simple.service.WxCouponCarService; | ||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCouponCar") | @RequestMapping("wxCouponCar") | ||||
| @Api(description = "停车发券相关接口") | @Api(description = "停车发券相关接口") | ||||
| public class WxCouponCarController extends BaseController | |||||
| { | |||||
| @Autowired | |||||
| public class WxCouponCarController extends BaseController { | |||||
| @Autowired | |||||
| private WxCouponCarService wxCouponCarService; | private WxCouponCarService wxCouponCarService; | ||||
| private Logger logger = Logger.getLogger(WxCouponCarController.class); | private Logger logger = Logger.getLogger(WxCouponCarController.class); | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | @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<WxCouponCar> page = wxCouponCarService.listAsPage(wxCouponCar, pageNum, pageSize); | final PageInfo<WxCouponCar> page = wxCouponCarService.listAsPage(wxCouponCar, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | @PostMapping("add") | ||||
| public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | ||||
| //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxCouponCarService.saveOrUpdate(wxCouponCar); | |||||
| wxCouponCarService.save(wxCouponCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| public ResultData update(@RequestBody WxCouponCar wxCouponCar) { | public ResultData update(@RequestBody WxCouponCar wxCouponCar) { | ||||
| wxCouponCarService.saveOrUpdate(wxCouponCar); | |||||
| wxCouponCarService.update(wxCouponCar); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @GetMapping("/del") | @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) { | public ResultData delete(Long id) { | ||||
| wxCouponCarService.deleteById(id); | wxCouponCarService.deleteById(id); | ||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | 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) { | public ResultData findById(Long id) { | ||||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponCarService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponCarService.getById(id)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -38,18 +38,9 @@ public class WxCouponChannelController extends BaseController | |||||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setTenantId(getTenantId()); | wxCouponChannel.setTenantId(getTenantId()); | ||||
| wxCouponChannel.setStatus(0); | wxCouponChannel.setStatus(0); | ||||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); | |||||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @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,"查询成功",wxCouponChannelService.getById(id)); | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.simple.common.ErrorCode; | |||||
| import com.simple.domain.po.WxCouponChannel; | import com.simple.domain.po.WxCouponChannel; | ||||
| import com.simple.domain.vo.WxCouponCVo; | import com.simple.domain.vo.WxCouponCVo; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
| @@ -28,10 +29,50 @@ public class WxCouponController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponService wxCouponService; | private WxCouponService wxCouponService; | ||||
| @ApiOperation("根据id查询接口") | |||||
| @ApiOperation("根据id(coupon)查询接口") | |||||
| @GetMapping("/detailC") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "couponId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData detail(String couponId) { | |||||
| if (StringUtils.isBlank(couponId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||||
| } | |||||
| Long couponIdL = 0L; | |||||
| try { | |||||
| couponIdL = Long.valueOf(couponId); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("id转换失败" + couponId); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponId); | |||||
| } | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setId(couponIdL); | |||||
| wxCoupon.setTenantId(getTenantId()); | |||||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCoupon); | |||||
| if (wxCouponCVo == null) | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| return new ResultData(wxCouponCVo); | |||||
| } | |||||
| @ApiOperation("根据id(couponChannel)查询接口") | |||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| public ResultData detail(@ModelAttribute WxCouponChannel wxCouponChannel) { | |||||
| if(wxCouponChannel == null) wxCouponChannel = new WxCouponChannel(); | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "couponChannelId", value = "couponChannelId", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData detailC(String couponChannelId) { | |||||
| if (StringUtils.isBlank(couponChannelId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId为空"); | |||||
| } | |||||
| Long couponChannelIdL = 0L; | |||||
| try { | |||||
| couponChannelIdL = Long.valueOf(couponChannelId); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("id转换失败" + couponChannelId); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId转换失败" + couponChannelId); | |||||
| } | |||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||||
| wxCouponChannel.setId(couponChannelIdL); | |||||
| wxCouponChannel.setTenantId(getTenantId()); | wxCouponChannel.setTenantId(getTenantId()); | ||||
| WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCouponChannel); | WxCouponCVo wxCouponCVo = wxCouponService.selectDetailForCUser(wxCouponChannel); | ||||
| if (wxCouponCVo == null) | if (wxCouponCVo == null) | ||||
| @@ -7,6 +7,7 @@ import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.vo.WxCouponOrderCVo; | import com.simple.domain.vo.WxCouponOrderCVo; | ||||
| import com.simple.enums.EnumCouponOrderStatus; | |||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| import com.simple.service.WxCouponOrderService; | import com.simple.service.WxCouponOrderService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -62,14 +63,21 @@ public class WxCouponOrderController extends BaseController { | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "couponOrderStatus", value="券状态状态:0,待使用 1,已核销 2,已过期 3,已作废", dataType="int", paramType = "query",required=false) | |||||
| }) | }) | ||||
| public ResultData list(Integer couponOrderStatus, Integer pageNum, Integer pageSize) { | |||||
| public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||||
| if(pageNum == null || pageSize == null) { | if(pageNum == null || pageSize == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| return wxCouponOrderService.listCUserVoAsPage(getUser().getId(), couponOrderStatus, pageNum, pageSize); | |||||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setCUserId(getUser().getId()); | |||||
| if (wxCouponOrder.getCouponOrderStatus() == null) | |||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.CreateDate_DESC); | |||||
| else if (wxCouponOrder.getCouponOrderStatus() == EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()) | |||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.CreateDate_DESC); | |||||
| else | |||||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.UpdateDate_DESC); | |||||
| return wxCouponOrderService.listCUserVoAsPage(wxCouponOrder, pageNum, pageSize); | |||||
| } | } | ||||
| @ApiOperation(value = "卡券详情接口") | @ApiOperation(value = "卡券详情接口") | ||||
| @@ -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); | |||||
| } | |||||
| } | |||||
| @@ -88,32 +88,53 @@ public class WxOrderController extends BaseController { | |||||
| @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\"}") | @ApiOperation(value = "下订单", notes = "{\"couponChannelId\":\"String\",\"couponId\":\"String\"}") | ||||
| @PostMapping("save") | @PostMapping("save") | ||||
| public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { | public ResultData saveOrder(@RequestBody Map<String, String> paramMap) { | ||||
| logger.info("OrderSave: " + paramMap.toString()); | |||||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| String couponChannelIdStr = paramMap.get("couponChannelId"); | String couponChannelIdStr = paramMap.get("couponChannelId"); | ||||
| String couponIdStr = paramMap.get("couponId"); | String couponIdStr = paramMap.get("couponId"); | ||||
| /* | |||||
| // TODO 修改支持banner图,获取不到couponChannelId问题 | |||||
| if (StringUtils.isBlank(couponChannelIdStr)) { | if (StringUtils.isBlank(couponChannelIdStr)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空"); | ||||
| } | } | ||||
| */ | |||||
| Long couponChannelId = 0L, couponId = 0L; | 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 (!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 (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) { | |||||
| logger.error("此券已下架:" + couponChannelIdStr); | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(), "此券已下架"); | |||||
| if (couponId <= 0 && !StringUtils.isBlank(couponIdStr)) { | |||||
| 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()); | |||||
| } | |||||
| } | } | ||||
| if (StringUtils.isBlank(couponIdStr)) { | |||||
| couponId = wxCouponChannel.getCouponId(); | |||||
| if (couponId <= 0) { | |||||
| logger.error("couponChannelId或者couponId不能为空"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId或者couponId不能为空"); | |||||
| } | } | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| try { | try { | ||||
| @@ -197,15 +218,27 @@ public class WxOrderController extends BaseController { | |||||
| // c端用户应该只能看到自己的订单 | // c端用户应该只能看到自己的订单 | ||||
| if (wxOrder == null) wxOrder = new WxOrder(); | if (wxOrder == null) wxOrder = new WxOrder(); | ||||
| wxOrder.setCUserId(getUser().getId()); | wxOrder.setCUserId(getUser().getId()); | ||||
| wxOrder.setSortColumns(WxOrder.Field.CreateDate_DESC); | |||||
| final PageInfo<WxOrderCVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize); | final PageInfo<WxOrderCVo> page = wxOrderService.listCUserVoAsPage(wxOrder, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("订单详情接口") | @ApiOperation("订单详情接口") | ||||
| @GetMapping("detail") | @GetMapping("detail") | ||||
| public ResultData list(@ModelAttribute WxOrder wxOrder) { | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="orderId",value="订单id",dataType="String", paramType = "query",required=true) | |||||
| }) | |||||
| public ResultData detail(String orderId) { | |||||
| // c端用户应该只能看到自己的订单细节 | // c端用户应该只能看到自己的订单细节 | ||||
| if (wxOrder == null) wxOrder = new WxOrder(); | |||||
| WxOrder wxOrder = new WxOrder(); | |||||
| Long id = 0L; | |||||
| try { | |||||
| id = Long.valueOf(orderId); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("parse orderId failed"); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "订单ID转换异常"); | |||||
| } | |||||
| wxOrder.setId(id); | |||||
| wxOrder.setCUserId(getUser().getId()); | wxOrder.setCUserId(getUser().getId()); | ||||
| WxOrderCVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | WxOrderCVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | ||||
| if (wxOrderCVo == null) | if (wxOrderCVo == null) | ||||
| @@ -39,4 +39,4 @@ mapper: | |||||
| - com.simple.common.CommonMapper | - com.simple.common.CommonMapper | ||||
| pay: | pay: | ||||
| real: false | |||||
| real: true | |||||
| @@ -71,6 +71,7 @@ public enum ErrorCode{ | |||||
| COUPON_IS_NOT_FREE(2021, "券不免费"), | COUPON_IS_NOT_FREE(2021, "券不免费"), | ||||
| COUPON_IS_TAKE_OFF(2022, "此券已下架"), | COUPON_IS_TAKE_OFF(2022, "此券已下架"), | ||||
| COUPON_CHANNEL_IS_EXISTED(2023, "券已投放过"), | |||||
| /** | /** | ||||
| * 车流 2040 | * 车流 2040 | ||||
| */ | */ | ||||
| @@ -83,6 +84,7 @@ public enum ErrorCode{ | |||||
| ETCP_STOP_FEE_FAIL(2054, "ETCP停车费失败"), | ETCP_STOP_FEE_FAIL(2054, "ETCP停车费失败"), | ||||
| ETCP_QUAN_TEMP_FAIL(2055, "ETCP优免券模板失败"), | ETCP_QUAN_TEMP_FAIL(2055, "ETCP优免券模板失败"), | ||||
| ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"), | ETCP_QUAN_SEND_FAIL(2056, "ETCP优免券发放失败"), | ||||
| ETCP_CMD_FAIL(2057, "ETCP网络异常"), | |||||
| TJD_BIND_FAIL(2060,"TJD绑车牌失败"), | TJD_BIND_FAIL(2060,"TJD绑车牌失败"), | ||||
| TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"), | TJD_UNBIND_FAIL(2061,"TJD解绑车牌失败"), | ||||
| @@ -99,10 +101,14 @@ public enum ErrorCode{ | |||||
| ORDER_IS_FAIL(3002, "订单失败"), | ORDER_IS_FAIL(3002, "订单失败"), | ||||
| ORDER_IS_NOT_FIND(3003, "订单不存在"), | ORDER_IS_NOT_FIND(3003, "订单不存在"), | ||||
| ORDER_IS_NOT_PAY(3004, "订单已不能进行支付"), | ORDER_IS_NOT_PAY(3004, "订单已不能进行支付"), | ||||
| ORDER_SAVE_ERR(3005,"订单保存失败"), | |||||
| ORDER_UPDATE_ERR(3006,"订单更新失败"), | |||||
| REMAIN_BACK_FAIL(3007, "库存恢复失败"), | |||||
| /** | /** | ||||
| * 卡券 | * 卡券 | ||||
| */ | */ | ||||
| COUPON_ORDER_SAVE_ERR(3999, "卡券保存失败"), | |||||
| COUPON_ORDER_IS_NULL(4000, "卡券不存在"), | COUPON_ORDER_IS_NULL(4000, "卡券不存在"), | ||||
| COUPON_ORDER_IS_USED(4001, "卡券已核销"), | COUPON_ORDER_IS_USED(4001, "卡券已核销"), | ||||
| COUPON_ORDER_IS_OVER_TIME(4002, "卡券已过期"), | COUPON_ORDER_IS_OVER_TIME(4002, "卡券已过期"), | ||||
| @@ -0,0 +1,37 @@ | |||||
| package com.simple.domain.dto; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * Created by syf on 2018/8/30. | |||||
| */ | |||||
| public class MarkingCouponDataReportDto { | |||||
| private Date startTime; | |||||
| private Date endTime; | |||||
| private Integer type; | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public Date getStartTime() { | |||||
| return startTime; | |||||
| } | |||||
| public void setStartTime(Date startTime) { | |||||
| this.startTime = startTime; | |||||
| } | |||||
| public Date getEndTime() { | |||||
| return endTime; | |||||
| } | |||||
| public void setEndTime(Date endTime) { | |||||
| this.endTime = endTime; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,36 @@ | |||||
| package com.simple.domain.dto; | |||||
| import java.util.Date; | |||||
| /** | |||||
| * Created by syf on 2018/8/30. | |||||
| */ | |||||
| public class MarkingSceneDataReportDto { | |||||
| private Date startTime; | |||||
| private Date endTime; | |||||
| private Integer type; | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public Date getStartTime() { | |||||
| return startTime; | |||||
| } | |||||
| public void setStartTime(Date startTime) { | |||||
| this.startTime = startTime; | |||||
| } | |||||
| public Date getEndTime() { | |||||
| return endTime; | |||||
| } | |||||
| public void setEndTime(Date endTime) { | |||||
| this.endTime = endTime; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| package com.simple.domain.dto; | |||||
| import com.simple.domain.po.WxMerchant; | |||||
| import com.simple.domain.vo.WxCouponCarVo; | |||||
| import javax.persistence.Transient; | |||||
| public class WxCouponCarDto extends WxCouponCarVo { | |||||
| private static final long serialVersionUID = -5721410270215370223L; | |||||
| @Transient | |||||
| private WxMerchant wxMerchant; | |||||
| public WxMerchant getWxMerchant() { | |||||
| return wxMerchant; | |||||
| } | |||||
| public void setWxMerchant(WxMerchant wxMerchant) { | |||||
| this.wxMerchant = wxMerchant; | |||||
| } | |||||
| } | |||||
| @@ -116,6 +116,20 @@ public class WxCUser implements Serializable { | |||||
| /*用户过期时间**/ | /*用户过期时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | ||||
| private Date expireTime; | private Date expireTime; | ||||
| //渠道名称 | |||||
| @Transient | |||||
| private String channelName; | |||||
| public String getChannelName() { | |||||
| return channelName; | |||||
| } | |||||
| public void setChannelName(String channelName) { | |||||
| this.channelName = channelName; | |||||
| } | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.simple.domain.po; | package com.simple.domain.po; | ||||
| import com.simple.domain.vo.WxCouponChannelVo; | |||||
| import javax.persistence.*; | import javax.persistence.*; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.math.*; | import java.math.*; | ||||
| @@ -20,13 +22,13 @@ public class WxCampaign implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @Transient | @Transient | ||||
| protected List<WxCoupon> coupons; | |||||
| protected List<WxCouponChannelVo> coupons; | |||||
| public List<WxCoupon> getCoupons() { | |||||
| public List<WxCouponChannelVo> getCoupons() { | |||||
| return coupons; | return coupons; | ||||
| } | } | ||||
| public void setCoupons(List<WxCoupon> coupons) { | |||||
| public void setCoupons(List<WxCouponChannelVo> coupons) { | |||||
| this.coupons = coupons; | this.coupons = coupons; | ||||
| } | } | ||||
| @@ -211,23 +213,23 @@ public class WxCampaign implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CoverImg_ASC("`cover_img` ASC"),CoverImg_DESC("`cover_img` DESC") | |||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ||||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||||
| ,DiscountPrice_ASC("`discountPrice` ASC"),DiscountPrice_DESC("`discountPrice` DESC") | |||||
| ,SubTitle_ASC("`sub_title` ASC"),SubTitle_DESC("`sub_title` DESC") | |||||
| ,UsePrice_ASC("`use_price` ASC"),UsePrice_DESC("`use_price` DESC") | |||||
| ,DiscountPrice_ASC("`discount_price` ASC"),DiscountPrice_DESC("`discount_price` DESC") | |||||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ||||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||||
| ,ImgDetail_ASC("`imgDetail` ASC"),ImgDetail_DESC("`imgDetail` DESC") | |||||
| ,ValidStartDate_ASC("`valid_start_date` ASC"),ValidStartDate_DESC("`valid_start_date` DESC") | |||||
| ,ValidEndDate_ASC("`valid_end_date` ASC"),ValidEndDate_DESC("`valid_end_date` DESC") | |||||
| ,ImgDetail_ASC("`img_detail` ASC"),ImgDetail_DESC("`img_detail` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,CouponIds_ASC("`couponIds` ASC"),CouponIds_DESC("`couponIds` DESC") | |||||
| ,MechantId_ASC("`mechantId` ASC"),MechantId_DESC("`mechantId` DESC") | |||||
| ,SortNum_ASC("`sortNum` ASC"),SortNum_DESC("`sortNum` DESC") | |||||
| ,CouponIds_ASC("`coupon_ids` ASC"),CouponIds_DESC("`coupon_ids` DESC") | |||||
| ,MechantId_ASC("`mechant_id` ASC"),MechantId_DESC("`mechantId` DESC") | |||||
| ,SortNum_ASC("`sort_num` ASC"),SortNum_DESC("`sortNum` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") | |||||
| ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") | |||||
| ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") | |||||
| ,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -260,7 +262,7 @@ public class WxCampaign implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -105,6 +105,9 @@ public class WxCoupon implements Serializable { | |||||
| /*面额**/ | /*面额**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | ||||
| private Integer price; | private Integer price; | ||||
| /*单位**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单位(0:rmb分 1:小时)",name="unit") | |||||
| private Integer unit; | |||||
| /*剩余库存**/ | /*剩余库存**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | ||||
| private Integer remainInventory; | private Integer remainInventory; | ||||
| @@ -228,6 +231,12 @@ public class WxCoupon implements Serializable { | |||||
| public void setPrice(Integer _price) { | public void setPrice(Integer _price) { | ||||
| price = _price; | price = _price; | ||||
| } | } | ||||
| public Integer getUnit() { | |||||
| return unit; | |||||
| } | |||||
| public void setUnit(Integer _unit) { | |||||
| unit = _unit; | |||||
| } | |||||
| public Integer getRemainInventory() { | public Integer getRemainInventory() { | ||||
| return remainInventory; | return remainInventory; | ||||
| } | } | ||||
| @@ -318,31 +327,31 @@ public class WxCoupon implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||||
| ,CoverImg_ASC("`cover_img` ASC"),CoverImg_DESC("`cover_img` DESC") | |||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ||||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||||
| ,SalePrice_ASC("`salePrice` ASC"),SalePrice_DESC("`salePrice` DESC") | |||||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||||
| ,UseLimitQuantity_ASC("`useLimitQuantity` ASC"),UseLimitQuantity_DESC("`useLimitQuantity` DESC") | |||||
| ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") | |||||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||||
| ,SendStartDate_ASC("`sendStartDate` ASC"),SendStartDate_DESC("`sendStartDate` DESC") | |||||
| ,SendEndDate_ASC("`sendEndDate` ASC"),SendEndDate_DESC("`sendEndDate` DESC") | |||||
| ,ValidType_ASC("`validType` ASC"),ValidType_DESC("`validType` DESC") | |||||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||||
| ,ValidDays_ASC("`validDays` ASC"),ValidDays_DESC("`validDays` DESC") | |||||
| ,SubTitle_ASC("`sub_title` ASC"),SubTitle_DESC("`sub_title` DESC") | |||||
| ,SalePrice_ASC("`sale_price` ASC"),SalePrice_DESC("`sale_price` DESC") | |||||
| ,UsePrice_ASC("`use_price` ASC"),UsePrice_DESC("`use_price` DESC") | |||||
| ,UseLimitQuantity_ASC("`use_limit_quantity` ASC"),UseLimitQuantity_DESC("`use_limit_quantity` DESC") | |||||
| ,TargetAd_ASC("`target_ad` ASC"),TargetAd_DESC("`target_ad` DESC") | |||||
| ,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC") | |||||
| ,SendStartDate_ASC("`send_start_date` ASC"),SendStartDate_DESC("`send_start_date` DESC") | |||||
| ,SendEndDate_ASC("`send_end_date` ASC"),SendEndDate_DESC("`send_end_ate` DESC") | |||||
| ,ValidType_ASC("`valid_type` ASC"),ValidType_DESC("`valid_type` DESC") | |||||
| ,ValidStartDate_ASC("`valid_start_date` ASC"),ValidStartDate_DESC("`valid_start_date` DESC") | |||||
| ,ValidEndDate_ASC("`valid_end_date` ASC"),ValidEndDate_DESC("`valid_end_date` DESC") | |||||
| ,ValidDays_ASC("`valid_days` ASC"),ValidDays_DESC("`valid_days` DESC") | |||||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ||||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | ||||
| ,RemainInventory_ASC("`remainInventory` ASC"),RemainInventory_DESC("`remainInventory` DESC") | |||||
| ,RemainInventory_ASC("`remain_inventory` ASC"),RemainInventory_DESC("`remain_inventory` DESC") | |||||
| ,Inventory_ASC("`inventory` ASC"),Inventory_DESC("`inventory` DESC") | ,Inventory_ASC("`inventory` ASC"),Inventory_DESC("`inventory` DESC") | ||||
| ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` DESC") | ,Remark_ASC("`remark` ASC"),Remark_DESC("`remark` DESC") | ||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | ||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| @@ -376,7 +385,7 @@ public class WxCoupon implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -43,7 +43,7 @@ public class WxCouponCar implements Serializable { | |||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| private Long tenantId; | |||||
| private String tenantId; | |||||
| /*停车场ID**/ | /*停车场ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="停车场ID",name="parkId") | @io.swagger.annotations.ApiModelProperty(value="停车场ID",name="parkId") | ||||
| private Long parkId; | private Long parkId; | ||||
| @@ -62,10 +62,10 @@ public class WxCouponCar implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| public Long getTenantId() { | |||||
| public String getTenantId() { | |||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| public void setTenantId(Long _tenantId) { | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | tenantId = _tenantId; | ||||
| } | } | ||||
| public Long getParkId() { | public Long getParkId() { | ||||
| @@ -17,8 +17,6 @@ public class WxCouponChannel implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @Transient | |||||
| protected List<Long> couponIds; | |||||
| @Transient | @Transient | ||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @@ -44,6 +42,15 @@ public class WxCouponChannel implements Serializable { | |||||
| } | } | ||||
| @Transient | |||||
| protected List<Long> couponIds; | |||||
| public List<Long> getCouponIds() { | |||||
| return couponIds; | |||||
| } | |||||
| public void setCouponIds(List<Long> couponIds) { | |||||
| this.couponIds = couponIds; | |||||
| } | |||||
| /*租户ID**/ | /*租户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | ||||
| @@ -82,6 +89,11 @@ public class WxCouponChannel implements Serializable { | |||||
| /*更新时间**/ | /*更新时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | ||||
| private Date updateDate; | private Date updateDate; | ||||
| /*更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="子频道ID",name="subTargetId") | |||||
| private Long subTargetId; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -154,12 +166,13 @@ public class WxCouponChannel implements Serializable { | |||||
| public void setUpdateDate(Date _updateDate) { | public void setUpdateDate(Date _updateDate) { | ||||
| updateDate = _updateDate; | updateDate = _updateDate; | ||||
| } | } | ||||
| public List<Long> getCouponIds() { | |||||
| return couponIds; | |||||
| } | |||||
| public void setCouponIds(List<Long> couponIds) { | |||||
| this.couponIds = couponIds; | |||||
| public Long getSubTargetId() { | |||||
| return subTargetId; | |||||
| } | |||||
| public void setSubTargetId(Long subTargetId) { | |||||
| this.subTargetId = subTargetId; | |||||
| } | } | ||||
| @@ -167,19 +180,19 @@ public class WxCouponChannel implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,CouponStatus_ASC("`couponStatus` ASC"),CouponStatus_DESC("`couponStatus` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,CouponStatus_ASC("`coupon_status` ASC"),CouponStatus_DESC("`coupon_status` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | ||||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | ||||
| ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") | |||||
| ,TargetAd_ASC("`target_ad` ASC"),TargetAd_DESC("`target_ad` DESC") | |||||
| ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | ||||
| ,BeginTime_ASC("`beginTime` ASC"),BeginTime_DESC("`beginTime` DESC") | |||||
| ,EndTime_ASC("`endTime` ASC"),EndTime_DESC("`endTime` DESC") | |||||
| ,BeginTime_ASC("`begin_time` ASC"),BeginTime_DESC("`begin_time` DESC") | |||||
| ,EndTime_ASC("`end_time` ASC"),EndTime_DESC("`end_time` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -213,6 +226,8 @@ public class WxCouponChannel implements Serializable { | |||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -1,14 +1,13 @@ | |||||
| package com.simple.domain.po; | package com.simple.domain.po; | ||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.text.DecimalFormat; | import java.text.DecimalFormat; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| @Table(name = "wx_coupon_order") | @Table(name = "wx_coupon_order") | ||||
| public class WxCouponOrder implements Serializable { | public class WxCouponOrder implements Serializable { | ||||
| private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
| @@ -205,26 +204,26 @@ public class WxCouponOrder implements Serializable { | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | ||||
| TenantId_ASC("`tenantId` ASC"), | |||||
| TenantId_DESC("`tenantId` DESC"), | |||||
| CouponId_ASC("`couponId` ASC"), | |||||
| CouponId_DESC("`couponId` DESC"), | |||||
| CUserId_ASC("`cUserId` ASC"), | |||||
| CUserId_DESC("`cUserId` DESC"), | |||||
| BUserId_ASC("`bUserId` ASC"), | |||||
| BUserId_DESC("`bUserId` DESC"), | |||||
| OrderId_ASC("`orderId` ASC"), | |||||
| OrderId_DESC("`orderId` DESC"), | |||||
| ExpiredTime_ASC("`expiredTime` ASC"), | |||||
| ExpiredTime_DESC("`expiredTime` DESC"), | |||||
| CouponOrderStatus_ASC("`couponOrderStatus` ASC"), | |||||
| CouponOrderStatus_DESC("`couponOrderStatus` DESC"), | |||||
| CreateDate_ASC("`createDate` ASC"), | |||||
| CreateDate_DESC("`createDate` DESC"), | |||||
| UpdateDate_ASC("`updateDate` ASC"), | |||||
| UpdateDate_DESC("`updateDate` DESC"), | |||||
| CouponPrice_ASC("`couponPrice` ASC"), | |||||
| CouponPrice_DESC("`couponPrice` DESC"); | |||||
| TenantId_ASC("`tenant_id` ASC"), | |||||
| TenantId_DESC("`tenant_id` DESC"), | |||||
| CouponId_ASC("`coupon_id` ASC"), | |||||
| CouponId_DESC("`coupon_id` DESC"), | |||||
| CUserId_ASC("`c_user_id` ASC"), | |||||
| CUserId_DESC("`c_user_id` DESC"), | |||||
| BUserId_ASC("`b_user_id` ASC"), | |||||
| BUserId_DESC("`b_user_id` DESC"), | |||||
| OrderId_ASC("`order_id` ASC"), | |||||
| OrderId_DESC("`order_id` DESC"), | |||||
| ExpiredTime_ASC("`expired_time` ASC"), | |||||
| ExpiredTime_DESC("`expired_time` DESC"), | |||||
| CouponOrderStatus_ASC("`coupon_order_status` ASC"), | |||||
| CouponOrderStatus_DESC("`coupon_order_status` DESC"), | |||||
| CreateDate_ASC("`create_date` ASC"), | |||||
| CreateDate_DESC("`create_date` DESC"), | |||||
| UpdateDate_ASC("`update_date` ASC"), | |||||
| UpdateDate_DESC("`update_date` DESC"), | |||||
| CouponPrice_ASC("`coupon_price` ASC"), | |||||
| CouponPrice_DESC("`coupon_price` DESC"); | |||||
| private String value; | private String value; | ||||
| Field(String value) { | Field(String value) { | ||||
| @@ -259,6 +258,7 @@ public class WxCouponOrder implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns=sb.toString(); | |||||
| } | } | ||||
| @@ -85,6 +85,13 @@ public class WxMall implements Serializable { | |||||
| @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl") | @io.swagger.annotations.ApiModelProperty(value="商场图标",name="imgUrl") | ||||
| private String 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() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -180,6 +187,22 @@ public class WxMall implements Serializable { | |||||
| this.imgUrl = _imgUrl; | 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 | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| @@ -167,18 +167,18 @@ public class WxOrder implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,OrderNumber_ASC("`orderNumber` ASC"),OrderNumber_DESC("`orderNumber` DESC") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | |||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | |||||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||||
| ,PaymentType_ASC("`paymentType` ASC"),PaymentType_DESC("`paymentType` DESC") | |||||
| ,OrderNumber_ASC("`order_number` ASC"),OrderNumber_DESC("`order_number` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") | |||||
| ,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC") | |||||
| ,BUserId_ASC("`b_user_id` ASC"),BUserId_DESC("`b_user_id` DESC") | |||||
| ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") | |||||
| ,PaymentType_ASC("`payment_type` ASC"),PaymentType_DESC("`payment_type` DESC") | |||||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ||||
| ,PaymentTime_ASC("`paymentTime` ASC"),PaymentTime_DESC("`paymentTime` DESC") | |||||
| ,OrderStatus_ASC("`orderStatus` ASC"),OrderStatus_DESC("`orderStatus` DESC") | |||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ,PaymentTime_ASC("`payment_time` ASC"),PaymentTime_DESC("`payment_time` DESC") | |||||
| ,OrderStatus_ASC("`order_status` ASC"),OrderStatus_DESC("`order_status` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | ||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| @@ -212,6 +212,7 @@ public class WxOrder implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -101,12 +101,12 @@ public class WxTags implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ,Type1_ASC("`type1` ASC"),Type1_DESC("`type1` DESC") | ,Type1_ASC("`type1` ASC"),Type1_DESC("`type1` DESC") | ||||
| ,Type2_ASC("`type2` ASC"),Type2_DESC("`type2` DESC") | ,Type2_ASC("`type2` ASC"),Type2_DESC("`type2` DESC") | ||||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -139,6 +139,8 @@ public class WxTags implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -0,0 +1,132 @@ | |||||
| 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_channel") | |||||
| public class WxUserChannel implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> 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<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="channelName") | |||||
| private String channelName; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="sceneAddress") | |||||
| private String sceneAddress; | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="description") | |||||
| private String description; | |||||
| public String getChannelName() { | |||||
| return channelName; | |||||
| } | |||||
| public void setChannelName(String _channelName) { | |||||
| channelName = _channelName; | |||||
| } | |||||
| public String getSceneAddress() { | |||||
| return sceneAddress; | |||||
| } | |||||
| public void setSceneAddress(String _sceneAddress) { | |||||
| sceneAddress = _sceneAddress; | |||||
| } | |||||
| public String getDescription() { | |||||
| return description; | |||||
| } | |||||
| public void setDescription(String _description) { | |||||
| description = _description; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,ChannelName_ASC("`channelName` ASC"),ChannelName_DESC("`channelName` DESC") | |||||
| ,SceneAddress_ASC("`sceneAddress` ASC"),SceneAddress_DESC("`sceneAddress` DESC") | |||||
| ,Description_ASC("`description` ASC"),Description_DESC("`description` 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(WxUserChannel.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<Field> 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,222 @@ | |||||
| 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<Long> 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<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /***/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="tenantId") | |||||
| private String tenantId; | |||||
| /*日期字符串**/ | |||||
| @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 getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| 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") | |||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` 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<Field> 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)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -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; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,92 @@ | |||||
| package com.simple.domain.vo; | |||||
| /** | |||||
| * Created by syf on 2018/8/28. | |||||
| */ | |||||
| public class MarkingCouponDataReportVo { | |||||
| //券领取张数 couponCount | |||||
| //券领取人数 couponUserCount | |||||
| //券核销张数 verifyCount | |||||
| //券核销人数 verifyUserCount | |||||
| private String createTime; | |||||
| public Long getCouponId() { | |||||
| return couponId; | |||||
| } | |||||
| public void setCouponId(Long couponId) { | |||||
| this.couponId = couponId; | |||||
| } | |||||
| public String getTitle() { | |||||
| return title; | |||||
| } | |||||
| public void setTitle(String title) { | |||||
| this.title = title; | |||||
| } | |||||
| public String getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(String type) { | |||||
| this.type = type; | |||||
| } | |||||
| private Long couponId; //券id | |||||
| private String title; //券名称 | |||||
| private String type; //券类型 | |||||
| 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; | |||||
| } | |||||
| @@ -0,0 +1,89 @@ | |||||
| 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; | |||||
| 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; | |||||
| } | |||||
| 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; | |||||
| } | |||||
| public Integer getCarCount() { | |||||
| return carCount; | |||||
| } | |||||
| public void setCarCount(Integer carCount) { | |||||
| this.carCount = carCount; | |||||
| } | |||||
| public String getVerifyPercent() { | |||||
| return verifyPercent; | |||||
| } | |||||
| public void setVerifyPercent(String verifyPercent) { | |||||
| this.verifyPercent = verifyPercent; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,54 @@ | |||||
| package com.simple.domain.vo; | |||||
| /** | |||||
| * Created by syf on 2018/8/30. | |||||
| * | |||||
| * 场景营销数据VO | |||||
| */ | |||||
| public class MarkingSceneDataVo { | |||||
| private int carCount; //进车数量 | |||||
| private int sendCount; //发券数 | |||||
| private int verifyCount; //核销数 | |||||
| private String verifyPercent; //核销比 | |||||
| private String xTime; //时间 | |||||
| public int getCarCount() { | |||||
| return carCount; | |||||
| } | |||||
| public void setCarCount(int carCount) { | |||||
| this.carCount = carCount; | |||||
| } | |||||
| public int getSendCount() { | |||||
| return sendCount; | |||||
| } | |||||
| public void setSendCount(int sendCount) { | |||||
| this.sendCount = sendCount; | |||||
| } | |||||
| public int getVerifyCount() { | |||||
| return verifyCount; | |||||
| } | |||||
| public void setVerifyCount(int verifyCount) { | |||||
| this.verifyCount = verifyCount; | |||||
| } | |||||
| public String getVerifyPercent() { | |||||
| return verifyPercent; | |||||
| } | |||||
| public void setVerifyPercent(String verifyPercent) { | |||||
| this.verifyPercent = verifyPercent; | |||||
| } | |||||
| public String getxTime() { | |||||
| return xTime; | |||||
| } | |||||
| public void setxTime(String xTime) { | |||||
| this.xTime = xTime; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,74 @@ | |||||
| package com.simple.domain.vo; | |||||
| /** | |||||
| * Created by syf on 2018/8/30. | |||||
| */ | |||||
| public class TouchUsersReportVo { | |||||
| private String xTime; | |||||
| private int uv; | |||||
| private int pv; | |||||
| private int userCount; //领取人数 | |||||
| private int couponCount; //领取券数 | |||||
| private int verifyUserCount; //核销人数 | |||||
| public int getVerifyCount() { | |||||
| return verifyCount; | |||||
| } | |||||
| public void setVerifyCount(int verifyCount) { | |||||
| this.verifyCount = verifyCount; | |||||
| } | |||||
| private int verifyCount; //核销量 | |||||
| public String getxTime() { | |||||
| return xTime; | |||||
| } | |||||
| public void setxTime(String xTime) { | |||||
| this.xTime = xTime; | |||||
| } | |||||
| public int getUv() { | |||||
| return uv; | |||||
| } | |||||
| public void setUv(int uv) { | |||||
| this.uv = uv; | |||||
| } | |||||
| public int getPv() { | |||||
| return pv; | |||||
| } | |||||
| public void setPv(int pv) { | |||||
| this.pv = pv; | |||||
| } | |||||
| public int getUserCount() { | |||||
| return userCount; | |||||
| } | |||||
| public void setUserCount(int userCount) { | |||||
| this.userCount = userCount; | |||||
| } | |||||
| public int getCouponCount() { | |||||
| return couponCount; | |||||
| } | |||||
| public void setCouponCount(int couponCount) { | |||||
| this.couponCount = couponCount; | |||||
| } | |||||
| public int getVerifyUserCount() { | |||||
| return verifyUserCount; | |||||
| } | |||||
| public void setVerifyUserCount(int verifyUserCount) { | |||||
| this.verifyUserCount = verifyUserCount; | |||||
| } | |||||
| } | |||||
| @@ -15,7 +15,7 @@ public class UserStructureVo implements Serializable{ | |||||
| //名称 | //名称 | ||||
| private String name; | private String name; | ||||
| //数量 | //数量 | ||||
| private String count; | |||||
| private long count; | |||||
| //百分比 | //百分比 | ||||
| private String percentage; | private String percentage; | ||||
| //序号 | //序号 | ||||
| @@ -32,10 +32,10 @@ public class UserStructureVo implements Serializable{ | |||||
| public void setName(String name) { | public void setName(String name) { | ||||
| this.name = name; | this.name = name; | ||||
| } | } | ||||
| public String getCount() { | |||||
| public long getCount() { | |||||
| return count; | return count; | ||||
| } | } | ||||
| public void setCount(String count) { | |||||
| public void setCount(long count) { | |||||
| this.count = count; | this.count = count; | ||||
| } | } | ||||
| public String getPercentage() { | public String getPercentage() { | ||||
| @@ -122,6 +122,9 @@ public class WxCouponCVo implements Serializable { | |||||
| /*面额**/ | /*面额**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | ||||
| private Integer price; | private Integer price; | ||||
| /*单位**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||||
| private Integer unit; | |||||
| /*剩余库存**/ | /*剩余库存**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | @io.swagger.annotations.ApiModelProperty(value="剩余库存",name="remainInventory") | ||||
| private Integer remainInventory; | private Integer remainInventory; | ||||
| @@ -310,6 +313,15 @@ public class WxCouponCVo implements Serializable { | |||||
| public void setPrice(Integer _price) { | public void setPrice(Integer _price) { | ||||
| price = _price; | price = _price; | ||||
| } | } | ||||
| public Integer getUnit() { | |||||
| return unit; | |||||
| } | |||||
| public void setUnit(Integer unit) { | |||||
| this.unit = unit; | |||||
| } | |||||
| public Integer getRemainInventory() { | public Integer getRemainInventory() { | ||||
| return remainInventory; | return remainInventory; | ||||
| } | } | ||||
| @@ -0,0 +1,347 @@ | |||||
| 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<Long> 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<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> 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="车场厂商类型1:ETCP,2:TJD",name="vendorType") | |||||
| private String vendorType; | |||||
| /*车场厂商相关信息**/ | |||||
| @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 getVendorType() { | |||||
| return vendorType; | |||||
| } | |||||
| public void setVendorType(String vendorType) { | |||||
| this.vendorType = vendorType; | |||||
| } | |||||
| 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; | |||||
| } | |||||
| } | |||||
| @@ -39,6 +39,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { | |||||
| /*面额**/ | /*面额**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | ||||
| private Integer price; | private Integer price; | ||||
| /*单位**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||||
| private Integer unit; | |||||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | @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; | return price; | ||||
| } | } | ||||
| public Integer getUnit() { | |||||
| return unit; | |||||
| } | |||||
| public void setUnit(Integer unit) { | |||||
| this.unit = unit; | |||||
| } | |||||
| public Integer getUseLimitQuantity() { | public Integer getUseLimitQuantity() { | ||||
| return useLimitQuantity; | return useLimitQuantity; | ||||
| } | } | ||||
| @@ -85,6 +85,13 @@ public class WxOrderCVo extends WxCouponOrder{ | |||||
| private Date updateDate; | 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**/ | /*商户id**/ | ||||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | ||||
| @@ -179,7 +186,6 @@ public class WxOrderCVo extends WxCouponOrder{ | |||||
| public Long getCouponId() { | public Long getCouponId() { | ||||
| return couponId; | return couponId; | ||||
| } | } | ||||
| public void setCouponId(Long _couponId) { | public void setCouponId(Long _couponId) { | ||||
| this.couponId = _couponId; | this.couponId = _couponId; | ||||
| } | } | ||||
| @@ -221,6 +227,18 @@ public class WxOrderCVo extends WxCouponOrder{ | |||||
| updateDate = _updateDate; | 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() { | public Integer getType() { | ||||
| return type; | return type; | ||||
| @@ -0,0 +1,39 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumCouponChannelType { | |||||
| COUPON_CHANNEL_ID_LIST(1, "列表"), | |||||
| COUPON_CHANNEL_ID_TIMED(2, "限时抢购"), | |||||
| COUPON_CHANNEL_ID_CAMPAIN(3, "幻灯片"), | |||||
| ; | |||||
| ; | |||||
| public static EnumCouponChannelType getEnum(Integer code) { | |||||
| for (EnumCouponChannelType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumCouponChannelType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -5,11 +5,9 @@ package com.simple.enums; | |||||
| */ | */ | ||||
| public enum EnumCouponStatus { | public enum EnumCouponStatus { | ||||
| // 0-草稿/待生效;1-已生效/已发布/已投放;2-已下架; | |||||
| COUPON_STATUS_DRAFT(0, "草稿"), | |||||
| COUPON_STATUS_THROW_IN(1, "已投放"), | |||||
| COUPON_STATUS_TAKE_OFFF(2, "已下架"), | |||||
| // 0-可投放;1-已作废; | |||||
| COUPON_STATUS_THROW_IN(0, "可投放"), | |||||
| COUPON_STATUS_TAKE_OFFF(1, "已作废"), | |||||
| ; | ; | ||||
| public static EnumCouponStatus getEnum(Integer code) { | public static EnumCouponStatus getEnum(Integer code) { | ||||
| @@ -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; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,37 @@ | |||||
| package com.simple.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumDateAmtType { | |||||
| // 0 交易记录 1.核销记录; | |||||
| PAY_RECORD(0, "交易记录"), | |||||
| VERIFY_RECORD(1, "核销记录"), | |||||
| ; | |||||
| public static EnumDateAmtType getEnum(Integer code) { | |||||
| for (EnumDateAmtType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumDateAmtType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -5,7 +5,7 @@ package com.simple.enums; | |||||
| */ | */ | ||||
| public enum EnumOrderStatus { | public enum EnumOrderStatus { | ||||
| // 0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款);3-未退款/待退款;4-已退款;5-退款失败 | |||||
| // 0-待付款;1-已支付;2-已取消(限定时间内未付款);3-待退款;4-已退款;5-退款失败 | |||||
| ORDER_STATUS_PENDING_PAYMENT(0, "待付款"), | ORDER_STATUS_PENDING_PAYMENT(0, "待付款"), | ||||
| ORDER_STATUS_PAYMENT_SUCCESS(1, "已支付"), | ORDER_STATUS_PAYMENT_SUCCESS(1, "已支付"), | ||||
| @@ -8,6 +8,7 @@ import com.simple.domain.po.WxCUserCar; | |||||
| public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | public interface WxCUserCarMapper extends CommonMapper<WxCUserCar, Long> { | ||||
| List<WxCUserCar> findList(WxCUserCar wxCUserCar); | List<WxCUserCar> findList(WxCUserCar wxCUserCar); | ||||
| Integer countList(WxCUserCar wxCUserCar); | |||||
| @@ -2,6 +2,8 @@ package com.simple.mapper; | |||||
| import java.util.List; | import java.util.List; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | import com.simple.domain.dto.WxCuerBasicInfoDto; | ||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| @@ -15,5 +17,9 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||||
| WxCUser findByToken(String token); | WxCUser findByToken(String token); | ||||
| long findCountBySex(WxCuerBasicInfoDto dto); | |||||
| long findCount(WxCuerBasicInfoDto dto); | |||||
| List<WxCUser> listByChannel(@Param("sceneList")List<String> sceneList); | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.simple.mapper; | |||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.po.WxCarCmdLog; | import com.simple.domain.po.WxCarCmdLog; | ||||
| import com.simple.domain.vo.MarkingSceneDataVo; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -14,4 +15,6 @@ public interface WxCarCmdLogMapper extends CommonMapper<WxCarCmdLog, Long> { | |||||
| List<Map<String,Object>> queryHistory(HashMap<Object,Object> params); | List<Map<String,Object>> queryHistory(HashMap<Object,Object> params); | ||||
| List<Map<String, Object>> queryTodayCar(HashMap<Object,Object> params); | List<Map<String, Object>> queryTodayCar(HashMap<Object,Object> params); | ||||
| List<MarkingSceneDataVo> queryForSceneRepotyHistoryCar(HashMap<String,Object> params); | |||||
| } | } | ||||
| @@ -2,12 +2,29 @@ package com.simple.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.vo.MarkingSceneDataReportVo; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxCouponActionLog; | import com.simple.domain.po.WxCouponActionLog; | ||||
| public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, String> { | public interface WxCouponActionLogMapper extends CommonMapper<WxCouponActionLog, String> { | ||||
| List<WxCouponActionLog> findList(WxCouponActionLog wxCouponActionLog); | List<WxCouponActionLog> 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<MarkingSceneDataReportVo> sceneDataMap(HashMap<String,Object> params); | |||||
| List<MarkingSceneDataReportVo> sceneDataMapJoinCouponOrder(HashMap<String,Object> params); | |||||
| List<MarkingSceneDataReportVo> sceneDataList(HashMap<String,Object> params); | |||||
| List<MarkingSceneDataReportVo> sceneDataJoinCouponOrderList(HashMap<String,Object> params); | |||||
| @@ -2,6 +2,8 @@ package com.simple.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.domain.vo.WxCouponCarVo; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxCouponCar; | import com.simple.domain.po.WxCouponCar; | ||||
| @@ -10,8 +12,10 @@ public interface WxCouponCarMapper extends CommonMapper<WxCouponCar, String> { | |||||
| List<WxCouponCar> findList(WxCouponCar wxCouponCar); | List<WxCouponCar> findList(WxCouponCar wxCouponCar); | ||||
| Integer findTemplateAmtCount(Long templateId); | |||||
| Integer findTemplateAvailCount(Long templateId); | |||||
| WxCouponCarVo selectCouponCarDetail(WxCoupon coupon); | |||||
| } | } | ||||
| @@ -13,10 +13,10 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel); | List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel); | ||||
| void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | void updateStatusByCouponId(WxCouponChannel wxCouponChannel); | ||||
| void offExpiriedCouponChannelByEndTime(); | |||||
| void offExpiriedCouponChannelByValidDate(); | |||||
| } | } | ||||
| @@ -11,11 +11,9 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findList(WxCoupon wxCoupon); | List<WxCoupon> findList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findEnableList(WxCoupon wxCoupon); | |||||
| List<WxCoupon> findCanSendList(WxCoupon wxCoupon); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | WxCouponCVo selectDetailForCUser(WxCouponChannel wxCouponChannel); | ||||
| WxCouponCVo selectDetailForCUserC(WxCoupon wxCoupon); | |||||
| void reduceInventory(@Param("id")Long id,@Param("number")Integer number); | |||||
| } | } | ||||
| @@ -2,23 +2,60 @@ package com.simple.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.vo.WxCouponOrderBVo; | |||||
| import com.simple.domain.vo.WxCouponOrderCVo; | |||||
| import com.simple.domain.vo.*; | |||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | ||||
| List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | List<WxCouponOrder> findList(WxCouponOrder wxCouponOrder); | ||||
| Integer countList(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrder> findListOfUnverifiedByDate(Map dateMap); | |||||
| List<WxCouponOrder> findListOfOrderedByDate(Map dateMap); | |||||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | ||||
| List<WxCouponOrderBVo> findListOfUnverifiedByDateForBUser(Map dateMap); | |||||
| List<WxCouponOrderBVo> findListOfOrderedByDateForBUser(Map dateMap); | |||||
| List<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(Map dateMap); | List<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(Map dateMap); | ||||
| List<WxCouponOrderCVo> findListOfCUser(Map paramMap); | |||||
| WxCouponOrderCVo selectDetailOfCUser(Map paramMap); | |||||
| WxCouponOrderCVo selectDetailOfUser(Map paramMap); | |||||
| List<WxCouponOrderCVo> findListOfCUser(WxCouponOrder wxCouponOrder); | |||||
| List<WxCouponOrderBVo> findListOfAdmin(WxCouponOrder wxCouponOrder); | |||||
| //营销报表 券数据图表 | |||||
| List<MarkingCouponDataReportVo> couponDataMap(HashMap<String,Object> params); | |||||
| //营销报表 券数据报表 | |||||
| List<MarkingCouponDataReportVo> couponDataList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | |||||
| //营销报表 触达用户数 | |||||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); //返回日期格式yy-MM-dd | |||||
| /** | |||||
| * 查询商场领券数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int findCountByDateLimit(@Param("tenantId")String tenantId,@Param("startTime") Date startTime,@Param("endTime")Date endTime); | |||||
| /** | |||||
| * 日期分组 消费总数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| List<CUserDateAmountVo> 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); | |||||
| List<WxCouponOrderCVo> findListOfAdmin(WxCouponOrder wxCouponOrder); | |||||
| } | } | ||||
| @@ -11,6 +11,8 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| List<WxOrder> findList(WxOrder wxOrder); | List<WxOrder> findList(WxOrder wxOrder); | ||||
| Integer countList(WxOrder wxOrder); | |||||
| List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | List<WxOrder> findListOfUnpaidOrderByDate(Map dateMap); | ||||
| List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | List<WxOrderCVo> findListOfCUser(WxOrder wxOrder); | ||||
| @@ -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.WxUserChannel; | |||||
| public interface WxUserChannelMapper extends CommonMapper<WxUserChannel, Long> { | |||||
| List<WxUserChannel> findList(WxUserChannel wxUserChannel); | |||||
| List<WxUserChannel> findDistinctChannel(); | |||||
| } | |||||
| @@ -0,0 +1,20 @@ | |||||
| 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<WxUserVisit, Long> { | |||||
| List<WxUserVisit> findList(WxUserVisit wxUserVisit); | |||||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); | |||||
| } | |||||
| @@ -1,18 +0,0 @@ | |||||
| package com.simple.schedule; | |||||
| import org.springframework.context.annotation.Configuration; | |||||
| import org.springframework.scheduling.annotation.EnableScheduling; | |||||
| @Configuration | |||||
| @EnableScheduling | |||||
| public class SchedulingConfig { //implements SchedulingConfigurer { | |||||
| // @Override | |||||
| // public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { | |||||
| // ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); | |||||
| // scheduler.setPoolSize(10); | |||||
| // scheduler.initialize(); | |||||
| // taskRegistrar.setTaskScheduler(scheduler); | |||||
| // } | |||||
| } | |||||
| @@ -9,4 +9,6 @@ public interface DataTowerService { | |||||
| Map<String,Object> queryCar(String tenantId); | Map<String,Object> queryCar(String tenantId); | ||||
| Map<String,Object> queryCustomer(String tenantId); | |||||
| } | } | ||||
| @@ -0,0 +1,28 @@ | |||||
| 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; | |||||
| import com.simple.domain.vo.MarkingSceneDataVo; | |||||
| import com.simple.domain.vo.TouchUsersReportVo; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * Created by syf on 2018/8/28. | |||||
| */ | |||||
| public interface MarkingDataReportService { | |||||
| Map<String,Object> getCouponDate(String tenantId); | |||||
| Map<String,Object> getSceneData(String tenantId); | |||||
| PageInfo<MarkingCouponDataReportVo> getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<TouchUsersReportVo> getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize); | |||||
| List<TouchUsersReportVo> getTouchUsersReportData(String tenantId); | |||||
| } | |||||
| @@ -1,5 +1,7 @@ | |||||
| package com.simple.service; | package com.simple.service; | ||||
| import java.util.List; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | import com.simple.domain.dto.WxCuerBasicInfoDto; | ||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| @@ -55,9 +57,20 @@ public interface WxCUserService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | /** | ||||
| * 根据性别统计数量 | |||||
| * 统计数量 | |||||
| * @param dto | * @param dto | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| long findCountBySex(WxCuerBasicInfoDto dto); | |||||
| long findCount(WxCuerBasicInfoDto dto); | |||||
| /** | |||||
| * 通过渠道获取会员信息 | |||||
| * @param channel | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCUser> listByChannel(List<String> sceneList, Integer pageIndex, Integer pageSize); | |||||
| } | } | ||||
| @@ -1,8 +1,9 @@ | |||||
| package com.simple.service; | package com.simple.service; | ||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.domain.po.WxCouponCar; | import com.simple.domain.po.WxCouponCar; | ||||
| import com.simple.domain.vo.WxCouponCarVo; | |||||
| public interface WxCouponCarService { | public interface WxCouponCarService { | ||||
| @@ -24,12 +25,19 @@ public interface WxCouponCarService { | |||||
| */ | */ | ||||
| WxCouponCar getById(Long id); | WxCouponCar getById(Long id); | ||||
| /** | |||||
| /** | |||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxCouponCar record); | |||||
| void save(WxCouponCar record); | |||||
| /** | |||||
| * 更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void update(WxCouponCar record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -37,11 +45,28 @@ public interface WxCouponCarService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * 根据templateId获取分配总数 | |||||
| * | |||||
| * @param templateId | |||||
| */ | |||||
| Integer getAmtCountByTemplateId(Long templateId); | |||||
| /** | |||||
| * 根据templateId获取库存总数 | |||||
| * | |||||
| * @param templateId | |||||
| */ | |||||
| Integer getAvaibleCountByTemplateId(Long templateId); | |||||
| /** | |||||
| * 根据coupon获得实体 | |||||
| * | |||||
| * @param coupon | |||||
| * @return | |||||
| */ | |||||
| WxCouponCarVo getByCoupon(WxCoupon coupon); | |||||
| @@ -1,10 +1,12 @@ | |||||
| package com.simple.service; | package com.simple.service; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCouponChannel; | import com.simple.domain.po.WxCouponChannel; | ||||
| import com.simple.domain.vo.WxCouponChannelVo; | import com.simple.domain.vo.WxCouponChannelVo; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| public interface WxCouponChannelService { | public interface WxCouponChannelService { | ||||
| @@ -12,14 +14,30 @@ public interface WxCouponChannelService { | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponChannel> listAsPage(WxCouponChannel record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询Vo分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize); | PageInfo<WxCouponChannelVo> listPageCAPI(WxCouponChannel record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询Vo分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxCouponChannelVo> listAPI(WxCouponChannel record); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| @@ -42,7 +60,7 @@ public interface WxCouponChannelService { | |||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| void addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime,Date endTime); | |||||
| ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime); | |||||
| void updateStatusByCouponId(Long couponId,String tenantId,int status); | void updateStatusByCouponId(Long couponId,String tenantId,int status); | ||||
| @@ -1,13 +1,11 @@ | |||||
| package com.simple.service; | package com.simple.service; | ||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.MallUserInfo; | |||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.po.WxMerchantBUser; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| public interface WxCouponOrderService { | public interface WxCouponOrderService { | ||||
| @@ -80,7 +78,7 @@ public interface WxCouponOrderService { | |||||
| * @param bUserId C端用户 | * @param bUserId C端用户 | ||||
| */ | */ | ||||
| ResultData listCUserVoAsPage(Long cUserId, Integer pageIndex, Integer pageSize, Integer status); | |||||
| ResultData listCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * C用户查券详情 | * C用户查券详情 | ||||
| @@ -107,4 +105,6 @@ public interface WxCouponOrderService { | |||||
| */ | */ | ||||
| ResultData listAdminAsPage(WxCouponOrder wxCouponOrder, Integer pageIndex, Integer pageSize); | ResultData listAdminAsPage(WxCouponOrder wxCouponOrder, Integer pageIndex, Integer pageSize); | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | |||||
| } | } | ||||
| @@ -19,15 +19,6 @@ public interface WxCouponService { | |||||
| */ | */ | ||||
| PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | PageInfo<WxCoupon> listAsPage(WxCoupon record, Integer pageIndex, Integer pageSize); | ||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 不分页 | * 不分页 | ||||
| @@ -57,14 +48,11 @@ public interface WxCouponService { | |||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| /** | |||||
| * | |||||
| */ | |||||
| PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize); | |||||
| WxCouponCVo selectDetailForCUser(WxCouponChannel record); | WxCouponCVo selectDetailForCUser(WxCouponChannel record); | ||||
| WxCouponCVo selectDetailForCUser(WxCoupon record); | |||||
| ResultData updateCoupon(WxCoupon wxCoupon); | ResultData updateCoupon(WxCoupon wxCoupon); | ||||
| void reduceInventory(Long id,Integer number); | |||||
| } | } | ||||
| @@ -0,0 +1,48 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxUserChannel; | |||||
| public interface WxUserChannelService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxUserChannel> listAsPage(WxUserChannel record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxUserChannel getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxUserChannel record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| List<WxUserChannel> findDistinctChannel(); | |||||
| } | |||||
| @@ -0,0 +1,49 @@ | |||||
| package com.simple.service; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxUserVisit; | |||||
| import com.simple.domain.vo.TouchUsersReportVo; | |||||
| public interface WxUserVisitService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param offset | |||||
| * @param limit | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxUserVisit> 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); | |||||
| List<TouchUsersReportVo> touchUsersReportList(HashMap<String,Object> params); | |||||
| } | |||||
| @@ -1,6 +1,8 @@ | |||||
| package com.simple.service.impl; | 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.WxMall; | |||||
| import com.simple.domain.po.WxMerchant; | import com.simple.domain.po.WxMerchant; | ||||
| import com.simple.domain.po.WxMerchantTradeDaily; | import com.simple.domain.po.WxMerchantTradeDaily; | ||||
| import com.simple.domain.po.WxShop; | import com.simple.domain.po.WxShop; | ||||
| @@ -8,12 +10,14 @@ import com.simple.enums.EnumCarCmd; | |||||
| import com.simple.mapper.*; | import com.simple.mapper.*; | ||||
| import com.simple.service.DataTowerService; | import com.simple.service.DataTowerService; | ||||
| import com.simple.utils.DateUtils; | 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.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.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.io.UnsupportedEncodingException; | |||||
| import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -39,6 +43,9 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| @Autowired | @Autowired | ||||
| WxCarCmdLogMapper wxCarCmdLogMapper; | WxCarCmdLogMapper wxCarCmdLogMapper; | ||||
| @Autowired | |||||
| WxMallMapper wxMallMapper; | |||||
| @Override | @Override | ||||
| @@ -223,6 +230,67 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| return datamap; | return datamap; | ||||
| } | } | ||||
| @Override | |||||
| public Map<String, Object> queryCustomer(String tenantId) { | |||||
| WxMall wxMall = new WxMall(); | |||||
| wxMall.setTenantId(tenantId); | |||||
| List<WxMall> list = wxMallMapper.findList(wxMall); | |||||
| wxMall = list.get(0); | |||||
| String username=wxMall.getWiwideId(); | |||||
| String authVal=encrypt(wxMall.getWiwideKey()); | |||||
| Map<String,String> params=new HashMap<>(); | |||||
| params.put("username",username); | |||||
| params.put("authVal",authVal); | |||||
| String token = HttpUtil.doPost(wxMall.getWiwideUrl(), params); | |||||
| Map<String, Object> 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(){ | public TreeMap getTimeTreeMap(){ | ||||
| TreeMap<Object,Object> timemap=new TreeMap(); | TreeMap<Object,Object> timemap=new TreeMap(); | ||||
| timemap.put("06:00",0); | timemap.put("06:00",0); | ||||
| @@ -248,4 +316,5 @@ public class DataTowerServiceImpl implements DataTowerService { | |||||
| } | } | ||||
| @@ -0,0 +1,338 @@ | |||||
| 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.WxCoupon; | |||||
| 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.enums.EnumCouponType; | |||||
| import com.simple.mapper.*; | |||||
| import com.simple.service.MarkingDataReportService; | |||||
| import com.simple.service.WxCouponService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.text.NumberFormat; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| /** | |||||
| * Created by syf on 2018/8/28. | |||||
| */ | |||||
| @Service | |||||
| public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| @Autowired | |||||
| private WxCouponOrderMapper wxCouponOrderMapper; | |||||
| @Autowired | |||||
| private WxCouponActionLogMapper wxCouponActionLogMapper; | |||||
| @Autowired | |||||
| private WxCarCmdLogMapper wxCarCmdLogMapper; | |||||
| @Autowired | |||||
| private WxUserVisitMapper wxUserVisitMapper; | |||||
| @Autowired | |||||
| private WxCouponMapper wxCouponMapper; | |||||
| //取本月第一天 | |||||
| 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; | |||||
| } | |||||
| /** | |||||
| * @param date 转换当前时间去掉时分秒 | |||||
| * @return | |||||
| */ | |||||
| private Date convertDate(Date date) { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.setTime(date); | |||||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||||
| c.set(Calendar.MINUTE, 0); | |||||
| c.set(Calendar.SECOND, 0); | |||||
| c.set(Calendar.MILLISECOND, 0); | |||||
| Date result = c.getTime(); | |||||
| return result; | |||||
| } | |||||
| private Date convertDateAndAdd(Date date, int addDayAmount) { | |||||
| Calendar c = Calendar.getInstance(); | |||||
| c.setTime(date); | |||||
| 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 result = c.getTime(); | |||||
| return result; | |||||
| } | |||||
| //取的当月券数据 | |||||
| @Override | |||||
| public Map<String, Object> 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<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| params.put("startTime", getFirstDayOfMonth()); | |||||
| params.put("endTime", addDay(1)); | |||||
| List<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataMap(params); | |||||
| //查询券领取人数 | |||||
| HashMap<String, Object> returnMap = new HashMap<>(); | |||||
| returnMap.put("couponUpDay", couponUpDay);//比昨日提升 | |||||
| returnMap.put("couponUpWeek", couponUpWeek);//比上周提升 | |||||
| returnMap.put("todayCouponCount", todayCouponCount);//今日领取数 | |||||
| returnMap.put("couponDataMap", couponDatalist); | |||||
| return returnMap; | |||||
| } | |||||
| @Override | |||||
| public Map<String, Object> 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<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| params.put("startTime", getFirstDayOfMonth()); | |||||
| params.put("endTime", addDay(1)); | |||||
| //停车发券数 停车发券被核销数 核销发券数 核销发券被核销数 | |||||
| List<MarkingSceneDataReportVo> list = wxCouponActionLogMapper.sceneDataMap(params); | |||||
| //停车发券被核销数 | |||||
| HashMap<String, Object> params1 = new HashMap<>(); | |||||
| params1.put("tenantId", tenantId); | |||||
| params1.put("startTime", getFirstDayOfMonth()); | |||||
| params1.put("endTime", addDay(1)); | |||||
| params1.put("channelType", 3);//停车 | |||||
| List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params1); | |||||
| Map<String, Integer> parkCountMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | |||||
| //核销发券被核销数 | |||||
| HashMap<String, Object> params2 = new HashMap<>(); | |||||
| params2.put("tenantId", tenantId); | |||||
| params2.put("startTime", getFirstDayOfMonth()); | |||||
| params2.put("endTime", addDay(1)); | |||||
| params2.put("channelType", 4);//核销 | |||||
| List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataMapJoinCouponOrder(params2); | |||||
| Map<String, Integer> 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<String, Object> returnMap = new HashMap<>(); | |||||
| returnMap.put("sceneDownDay", sceneDownDay);//比昨日下降 | |||||
| returnMap.put("sceneUpWeek", sceneUpWeek);//比上周提升 | |||||
| returnMap.put("todaySceneCount", todaySceneCount);//今日领取数 | |||||
| returnMap.put("sceneDataMap", list); | |||||
| return returnMap; | |||||
| } | |||||
| @Override | |||||
| public PageInfo<MarkingCouponDataReportVo> getCouponDateList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||||
| HashMap<String, Object> 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<MarkingCouponDataReportVo> couponDatalist = wxCouponOrderMapper.couponDataList(params); | |||||
| if(couponDatalist.isEmpty()){ | |||||
| return new PageInfo<>(couponDatalist); | |||||
| } | |||||
| List<Long> couponIds = couponDatalist.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList()); | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setTenantId(tenantId); | |||||
| wxCoupon.setIds(couponIds); | |||||
| List<WxCoupon> wxCoupons = wxCouponMapper.findList(wxCoupon); | |||||
| Map<Long,WxCoupon> map = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId, p -> p)); | |||||
| for (MarkingCouponDataReportVo temp:couponDatalist) { | |||||
| if(map.get(temp.getCouponId())!=null){ | |||||
| temp.setTitle(map.get(temp.getCouponId()).getTitle()); | |||||
| String typeName = EnumCouponType.getEnum(map.get(temp.getCouponId()).getType()).getMessage(); | |||||
| temp.setType(typeName); | |||||
| } | |||||
| } | |||||
| return new PageInfo<>(couponDatalist); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<MarkingSceneDataVo> getSceneDataList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||||
| HashMap<String, Object> 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<MarkingSceneDataReportVo> templist = wxCouponActionLogMapper.sceneDataList(params); | |||||
| List<MarkingSceneDataVo> list = new ArrayList<>(); | |||||
| for (MarkingSceneDataReportVo temp: templist) { | |||||
| MarkingSceneDataVo vo = new MarkingSceneDataVo(); | |||||
| vo.setxTime(temp.getxTime()); | |||||
| if(markingCouponDataReportDto.getType()==1) { | |||||
| vo.setSendCount(temp.getParkSendCount()); | |||||
| }else{ | |||||
| vo.setSendCount(temp.getVerifySendCount()); | |||||
| } | |||||
| list.add(vo); | |||||
| } | |||||
| Map<String, Integer> countMap = new HashMap<>(); | |||||
| if(markingCouponDataReportDto.getType()==1){ //停车 | |||||
| //停车发券被核销数 | |||||
| HashMap<String, Object> params1 = new HashMap<>(); | |||||
| params1.put("tenantId", tenantId); | |||||
| params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params1.put("channelType", 3);//停车 | |||||
| List<MarkingSceneDataReportVo> list1 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params1); | |||||
| countMap = list1.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | |||||
| }else{ | |||||
| //核销发券被核销数 | |||||
| HashMap<String, Object> params2 = new HashMap<>(); | |||||
| params2.put("tenantId", tenantId); | |||||
| params2.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params2.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params2.put("channelType", 4);//核销 | |||||
| List<MarkingSceneDataReportVo> list2 = wxCouponActionLogMapper.sceneDataJoinCouponOrderList(params2); | |||||
| countMap = list2.stream().collect(Collectors.toMap(MarkingSceneDataReportVo::getxTime, p -> p.getTempCount())); | |||||
| } | |||||
| //获取车辆进场数 | |||||
| HashMap<String, Object> params3 = new HashMap<>(); | |||||
| params3.put("tenantId", tenantId); | |||||
| params3.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params3.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| params3.put("cmdType", 601);//核销 | |||||
| List<MarkingSceneDataVo> markingSceneDataVos = wxCarCmdLogMapper.queryForSceneRepotyHistoryCar(params3); | |||||
| Map<String,Integer> carCountMap = markingSceneDataVos.stream().collect(Collectors.toMap(MarkingSceneDataVo::getxTime, p -> p.getCarCount())); | |||||
| for (MarkingSceneDataVo vo : list) { | |||||
| vo.setVerifyCount(countMap.get(vo.getxTime()) == null ? 0 : countMap.get(vo.getxTime())); | |||||
| vo.setCarCount(carCountMap.get(vo.getxTime()) == null ? 0 : carCountMap.get(vo.getxTime())); | |||||
| if(vo.getSendCount()==0||vo.getVerifyCount()==0){ | |||||
| vo.setVerifyPercent(vo.getVerifyCount()+":"+vo.getSendCount()); | |||||
| }else { | |||||
| int gcd = gcd(vo.getSendCount(), vo.getVerifyCount()); | |||||
| vo.setVerifyPercent(vo.getVerifyCount() / gcd + "/" + vo.getSendCount() / gcd); | |||||
| } | |||||
| } | |||||
| return new PageInfo<>(list); | |||||
| } | |||||
| @Override | |||||
| public PageInfo<TouchUsersReportVo> getTouchUsersReportList(String tenantId, MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageIndex, Integer pageSize) { | |||||
| //获取领取人数 | |||||
| //获取领取量 | |||||
| //获取核销人数 | |||||
| //核销量 | |||||
| HashMap<String, Object> 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<TouchUsersReportVo> couponDatalist = wxCouponOrderMapper.touchUsersReportList(params); | |||||
| //查询UV PV | |||||
| HashMap<String, Object> params1 = new HashMap<>(); | |||||
| params1.put("tenantId", tenantId); | |||||
| params1.put("startTime", convertDate(markingCouponDataReportDto.getStartTime())); | |||||
| params1.put("endTime", convertDateAndAdd(convertDate(markingCouponDataReportDto.getEndTime()), 1)); | |||||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params1); | |||||
| Map<String,TouchUsersReportVo> 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 new PageInfo<>(couponDatalist); | |||||
| } | |||||
| @Override | |||||
| public List<TouchUsersReportVo> getTouchUsersReportData(String tenantId){ | |||||
| //查询UV PV | |||||
| HashMap<String, Object> params = new HashMap<>(); | |||||
| params.put("tenantId", tenantId); | |||||
| params.put("startTime", getFirstDayOfMonth()); | |||||
| params.put("endTime", addDay(1)); | |||||
| List<TouchUsersReportVo> wxUserVisitList = wxUserVisitMapper.touchUsersReportList(params); | |||||
| return wxUserVisitList; | |||||
| } | |||||
| //计算最大公约数 | |||||
| public int gcd(int x, int y){ // 这个是运用辗转相除法求 两个数的 最大公约数 看不懂可以百度 // 下 | |||||
| if(y == 0) | |||||
| return x; | |||||
| else | |||||
| return gcd(y,x%y); | |||||
| } | |||||
| } | |||||
| @@ -29,7 +29,7 @@ public class WxCUserCarServiceImpl implements WxCUserCarService { | |||||
| @Override | @Override | ||||
| public Integer countUserCar(WxCUserCar record) { | public Integer countUserCar(WxCUserCar record) { | ||||
| return wxCUserCarMapper.selectCount(record); | |||||
| return wxCUserCarMapper.countList(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -63,10 +63,18 @@ public class WxCUserServiceImpl implements WxCUserService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public long findCountBySex(WxCuerBasicInfoDto dto) { | |||||
| return wxCUserMapper.findCountBySex(dto); | |||||
| public long findCount(WxCuerBasicInfoDto dto) { | |||||
| return wxCUserMapper.findCount(dto); | |||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCUser> listByChannel(List<String> sceneList, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserMapper.listByChannel(sceneList)); | |||||
| } | |||||
| } | } | ||||
| @@ -1,13 +1,29 @@ | |||||
| package com.simple.service.impl; | package com.simple.service.impl; | ||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | |||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import com.simple.domain.po.WxCampaign; | import com.simple.domain.po.WxCampaign; | ||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.domain.po.WxCouponChannel; | |||||
| import com.simple.enums.EnumCouponChannelStatus; | |||||
| import com.simple.enums.EnumCouponChannelType; | |||||
| import com.simple.enums.EnumCouponStatus; | |||||
| import com.simple.exception.MallinkException; | |||||
| import com.simple.mapper.WxCampaignMapper; | import com.simple.mapper.WxCampaignMapper; | ||||
| import com.simple.mapper.WxCouponChannelMapper; | |||||
| import com.simple.service.WxCampaignService; | import com.simple.service.WxCampaignService; | ||||
| import com.simple.service.WxCouponChannelService; | |||||
| import com.simple.service.WxCouponService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Service | @Service | ||||
| public class WxCampaignServiceImpl implements WxCampaignService { | public class WxCampaignServiceImpl implements WxCampaignService { | ||||
| @@ -15,6 +31,14 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| @Autowired | @Autowired | ||||
| WxCampaignMapper wxCampaignMapper; | WxCampaignMapper wxCampaignMapper; | ||||
| @Autowired | |||||
| WxCouponChannelMapper wxCouponChannelMapper; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| WxCouponChannelService wxCouponChannelService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCampaign> listAsPage(WxCampaign record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -26,16 +50,106 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| return wxCampaignMapper.selectByPrimaryKey(id); | return wxCampaignMapper.selectByPrimaryKey(id); | ||||
| } | } | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxCampaign record) { | public void saveOrUpdate(WxCampaign record) { | ||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| IdWorker idWorker = new IdWorker(0, 0); | IdWorker idWorker = new IdWorker(0, 0); | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| wxCampaignMapper.insertSelective(record); | wxCampaignMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| wxCampaignMapper.updateByPrimaryKeySelective(record); | wxCampaignMapper.updateByPrimaryKeySelective(record); | ||||
| } | } | ||||
| record = wxCampaignMapper.selectByPrimaryKey(record); | |||||
| if (record.getStatus() == 0) | |||||
| addOrUpdateBatch(JSONArray.parseArray(record.getCouponIds(),String.class),record); | |||||
| else | |||||
| delBatch(record); | |||||
| } | |||||
| public void delBatch(WxCampaign record) { | |||||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | |||||
| wxCouponChannelQuery.setTenantId(record.getTenantId()); | |||||
| wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannelQuery.setSubTargetId(record.getId()); | |||||
| List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | |||||
| if (wxCouponChannels.size() > 0) { | |||||
| for (WxCouponChannel ch : wxCouponChannels) { | |||||
| ch.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); | |||||
| ch.setUpdateDate(new Date()); | |||||
| wxCouponChannelMapper.updateByPrimaryKeySelective(ch); | |||||
| } | |||||
| } | |||||
| } | |||||
| public void addOrUpdateBatch(List<String> ids, WxCampaign record) { | |||||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | |||||
| wxCouponChannelQuery.setTenantId(record.getTenantId()); | |||||
| wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannelQuery.setSubTargetId(record.getId()); | |||||
| List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | |||||
| for (String couponIdStr:ids) { | |||||
| Long couponId = Long.parseLong(couponIdStr); | |||||
| 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()); | |||||
| wxCouponChannels.get(i).setUpdateDate(new Date()); | |||||
| wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i)); | |||||
| } | |||||
| } | |||||
| } | |||||
| public void saveOrUpdateCouponChannel(Long couponId, List<WxCouponChannel> wxCouponChannels, WxCampaign record){ | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId); | |||||
| if (wxCoupon == null) { | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| if (wxCoupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) { | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| if (wxCoupon.getValidEndDate() != null && wxCoupon.getValidEndDate().before(new Date())) { | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| for (int i = 0; i < wxCouponChannels.size(); i++) { | |||||
| if (wxCouponChannels.get(i).getCouponId().longValue() == couponId.longValue()) { | |||||
| wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| wxCouponChannels.get(i).setBeginTime(record.getValidStartDate()); | |||||
| wxCouponChannels.get(i).setEndTime(record.getValidEndDate()); | |||||
| wxCouponChannels.get(i).setUpdateDate(new Date()); | |||||
| wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i)); | |||||
| wxCouponChannels.remove(i); | |||||
| return; | |||||
| } | |||||
| } | |||||
| 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()); | |||||
| wxCouponChannel.setType(wxCoupon.getType()); | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||||
| wxCouponChannel.setTenantId(wxCoupon.getTenantId()); | |||||
| wxCouponChannel.setBusiness(wxCoupon.getBusiness()); | |||||
| wxCouponChannel.setTitle(wxCoupon.getTitle()); | |||||
| wxCouponChannel.setSubTargetId(record.getId()); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| wxCouponChannel.setId(idWorker.nextId()); | |||||
| wxCouponChannelMapper.insertSelective(wxCouponChannel); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1,14 +1,14 @@ | |||||
| package com.simple.service.impl; | package com.simple.service.impl; | ||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.domain.po.WxCoupon; | |||||
| import com.simple.domain.po.WxCouponCar; | import com.simple.domain.po.WxCouponCar; | ||||
| import com.simple.domain.vo.WxCouponCarVo; | |||||
| import com.simple.mapper.WxCouponCarMapper; | import com.simple.mapper.WxCouponCarMapper; | ||||
| import com.simple.service.WxCouponCarService; | import com.simple.service.WxCouponCarService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.simple.common.IdWorker; | |||||
| @Service | @Service | ||||
| public class WxCouponCarServiceImpl implements WxCouponCarService { | public class WxCouponCarServiceImpl implements WxCouponCarService { | ||||
| @@ -28,25 +28,35 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { | |||||
| } | } | ||||
| @Override | @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); | wxCouponCarMapper.insertSelective(record); | ||||
| } else { | |||||
| wxCouponCarMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void update(WxCouponCar record) { | |||||
| wxCouponCarMapper.updateByPrimaryKey(record); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxCouponCarMapper.deleteByPrimaryKey(id); | wxCouponCarMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public Integer getAmtCountByTemplateId(Long templateId) { | |||||
| return wxCouponCarMapper.findTemplateAmtCount(templateId); | |||||
| } | |||||
| @Override | |||||
| public Integer getAvaibleCountByTemplateId(Long templateId) { | |||||
| return wxCouponCarMapper.findTemplateAvailCount(templateId); | |||||
| } | |||||
| @Override | |||||
| public WxCouponCarVo getByCoupon(WxCoupon coupon) { | |||||
| return wxCouponCarMapper.selectCouponCarDetail(coupon); | |||||
| } | |||||
| @@ -5,6 +5,8 @@ import java.util.stream.Collectors; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | import com.simple.domain.po.WxCouponChannel; | ||||
| import com.simple.domain.vo.WxCouponChannelVo; | import com.simple.domain.vo.WxCouponChannelVo; | ||||
| @@ -62,14 +64,23 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void addBatch(String[] ids,String[] channelId,String tanantId,Date beginTime,Date endTime) { | |||||
| public ResultData addBatch(String[] ids, String[] channelId, String tanantId, Date beginTime, Date endTime) { | |||||
| boolean result = false; | |||||
| for (String targetIdstr:channelId) { | for (String targetIdstr:channelId) { | ||||
| Integer targetId = Integer.parseInt(targetIdstr); | Integer targetId = Integer.parseInt(targetIdstr); | ||||
| for (String couponidstr:ids) { | for (String couponidstr:ids) { | ||||
| Long couponid = Long.parseLong(couponidstr); | Long couponid = Long.parseLong(couponidstr); | ||||
| addCuponChannel(couponid,targetId,tanantId,beginTime,endTime); | |||||
| boolean addResult = addCuponChannel(couponid,targetId,tanantId,beginTime,endTime); | |||||
| if(addResult){ | |||||
| result = true; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| if(result) { | |||||
| return new ResultData(); | |||||
| }else { | |||||
| return new ResultData(Result.ERROR,"请确认券状态,及有效期"); | |||||
| } | |||||
| } | } | ||||
| @@ -82,8 +93,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponChannel.setCouponId(couponId); | wxCouponChannel.setCouponId(couponId); | ||||
| } | } | ||||
| @Transactional | |||||
| public void addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){ | |||||
| public boolean addCuponChannel(Long couponid,Integer channelId,String tanantId,Date beginTime,Date endTime){ | |||||
| WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | WxCouponChannel wxCouponChannelQuery = new WxCouponChannel(); | ||||
| wxCouponChannelQuery.setTenantId(tanantId); | wxCouponChannelQuery.setTenantId(tanantId); | ||||
| @@ -93,18 +104,22 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery); | ||||
| if(wxCouponChannels.size()>0){ | if(wxCouponChannels.size()>0){ | ||||
| logger.debug(couponid+"已经投放过了"); | logger.debug(couponid+"已经投放过了"); | ||||
| return; | |||||
| return false; | |||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(couponid); | WxCoupon wxCoupon = wxCouponService.getById(couponid); | ||||
| if(wxCoupon==null){ | |||||
| logger.debug(couponid+"没有查到对应的券信息"); | |||||
| return false; | |||||
| } | |||||
| if(wxCoupon.getStatus()!=0) { | if(wxCoupon.getStatus()!=0) { | ||||
| logger.debug(wxCoupon.getId()+"状态不对"); | logger.debug(wxCoupon.getId()+"状态不对"); | ||||
| return; | |||||
| return false; | |||||
| } | } | ||||
| if(wxCoupon.getValidEndDate().before(endTime)){ | |||||
| if(wxCoupon.getValidEndDate()!=null&&wxCoupon.getValidEndDate().before(endTime)){ | |||||
| logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); | logger.debug(wxCoupon.getId()+"发放时间不能晚于使用时间"); | ||||
| return; | |||||
| return false; | |||||
| } | } | ||||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | WxCouponChannel wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setEndTime(endTime); | wxCouponChannel.setEndTime(endTime); | ||||
| @@ -119,6 +134,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| wxCouponChannel.setBusiness(wxCoupon.getBusiness()); | wxCouponChannel.setBusiness(wxCoupon.getBusiness()); | ||||
| wxCouponChannel.setTitle(wxCoupon.getTitle()); | wxCouponChannel.setTitle(wxCoupon.getTitle()); | ||||
| saveOrUpdate(wxCouponChannel); | saveOrUpdate(wxCouponChannel); | ||||
| return true; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -149,5 +165,24 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return new PageInfo<>(wxCouponChannelVoList); | return new PageInfo<>(wxCouponChannelVoList); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponChannelVo> listAPI(WxCouponChannel record) { | |||||
| List<WxCouponChannelVo> wxCouponChannelVoList = new ArrayList<>(); | |||||
| wxCouponChannelVoList = wxCouponChannelMapper.findVoList(record); | |||||
| if(wxCouponChannelVoList.isEmpty()){ | |||||
| return wxCouponChannelVoList; | |||||
| } | |||||
| List<Long> couponIds = wxCouponChannelVoList.stream().map(p->p.getCouponId()).distinct().collect(Collectors.toList()); | |||||
| WxCoupon wxCoupon = new WxCoupon(); | |||||
| wxCoupon.setIds(couponIds); | |||||
| List<WxCoupon> wxCoupons = wxCouponService.findList(wxCoupon); | |||||
| Map<Long,WxCoupon> couponNamesMap = wxCoupons.stream().collect(Collectors.toMap(WxCoupon::getId,p->p)); | |||||
| for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { | |||||
| if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ | |||||
| wxcouponVo.setWxCoupon(couponNamesMap.get(wxcouponVo.getCouponId())); | |||||
| } | |||||
| } | |||||
| return wxCouponChannelVoList; | |||||
| } | |||||
| } | } | ||||
| @@ -1,25 +1,30 @@ | |||||
| package com.simple.service.impl; | package com.simple.service.impl; | ||||
| import cn.afterturn.easypoi.excel.ExcelExportUtil; | |||||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | |||||
| import cn.afterturn.easypoi.excel.entity.TemplateExportParams; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.*; | import com.simple.domain.po.*; | ||||
| import com.simple.domain.vo.WxCouponOrderBVo; | |||||
| import com.simple.domain.vo.WxCouponOrderCVo; | import com.simple.domain.vo.WxCouponOrderCVo; | ||||
| import com.simple.enums.EnumCouponOrderStatus; | import com.simple.enums.EnumCouponOrderStatus; | ||||
| import com.simple.enums.EnumCouponStatus; | |||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| import com.simple.mapper.*; | import com.simple.mapper.*; | ||||
| import com.simple.service.WxCouponOrderService; | import com.simple.service.WxCouponOrderService; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.apache.poi.ss.usermodel.Workbook; | |||||
| import org.aspectj.apache.bcel.classfile.ConstantString; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.io.*; | |||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -134,7 +139,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if(isVerified) | if(isVerified) | ||||
| list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); | ||||
| else | else | ||||
| list = wxCouponOrderMapper.findListOfUnverifiedByDate(dateMap); | |||||
| list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | |||||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | logger.info("find " + list.size() + " coupon order from " + startDate + " to " + new Date()); | ||||
| int total_price = 0; | int total_price = 0; | ||||
| for (WxCouponOrder couponOrder : list) { | for (WxCouponOrder couponOrder : list) { | ||||
| @@ -146,27 +151,15 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| if (isVerified) | if (isVerified) | ||||
| resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap))); | resultMap.put("list", PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap))); | ||||
| else | 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); | return new ResultData(resultMap); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData listCUserVoAsPage(Long cUserId, Integer status, Integer pageIndex, Integer pageSize) { | |||||
| public ResultData listCUserVoAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | |||||
| WxCUser wxCuser = wxCUserMapper.selectByPrimaryKey(cUserId); | |||||
| if(wxCuser == null){ | |||||
| logger.error("用户不存在:"+ cUserId); | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||||
| } | |||||
| Map paramMap = new HashMap(); | |||||
| paramMap.put("cUserId", cUserId); | |||||
| paramMap.put("tenantId", wxCuser.getTenantId()); | |||||
| if (status != null) | |||||
| paramMap.put("status", status); | |||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfCUser(paramMap))); | |||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfCUser(record))); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -182,7 +175,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| paramMap.put("tenantId", wxCuser.getTenantId()); | paramMap.put("tenantId", wxCuser.getTenantId()); | ||||
| paramMap.put("couponOrderId", couponOrderId); | paramMap.put("couponOrderId", couponOrderId); | ||||
| WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.selectDetailOfCUser(paramMap); | |||||
| WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.selectDetailOfUser(paramMap); | |||||
| if (wxCouponOrderCVo == null) | if (wxCouponOrderCVo == null) | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| return new ResultData(wxCouponOrderCVo); | return new ResultData(wxCouponOrderCVo); | ||||
| @@ -206,7 +199,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| paramMap.put("merchantId", wxMerchant.getId()); | paramMap.put("merchantId", wxMerchant.getId()); | ||||
| paramMap.put("tenantId", wxMerchant.getTenantId()); | paramMap.put("tenantId", wxMerchant.getTenantId()); | ||||
| paramMap.put("couponOrderId", couponOrderId); | paramMap.put("couponOrderId", couponOrderId); | ||||
| WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.selectDetailOfCUser(paramMap); | |||||
| WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderMapper.selectDetailOfUser(paramMap); | |||||
| if (wxCouponOrderCVo == null) | if (wxCouponOrderCVo == null) | ||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| return new ResultData(wxCouponOrderCVo); | return new ResultData(wxCouponOrderCVo); | ||||
| @@ -218,6 +211,66 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrder))); | return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfAdmin(wxCouponOrder))); | ||||
| } | } | ||||
| @Override | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | |||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | |||||
| wxCouponOrder.setTenantId(tenantId); | |||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findList(wxCouponOrder); | |||||
| String filepath="./uploads/"; | |||||
| File savefile = new File(filepath); | |||||
| if (!savefile.exists()) { | |||||
| savefile.mkdirs(); | |||||
| } | |||||
| Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WxCouponOrder.class, list); | |||||
| FileOutputStream fos = null; | |||||
| try { | |||||
| String filename=UUID.randomUUID()+".xlsx"; | |||||
| filepath=filepath+filename; | |||||
| fos = new FileOutputStream(filepath); | |||||
| workbook.write(fos); | |||||
| fos.close(); | |||||
| downFile(filepath,filename,response,request); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| public void downFile(String filePath,String filename, HttpServletResponse response, | |||||
| HttpServletRequest req) throws IOException { | |||||
| try { | |||||
| response.reset(); | |||||
| response.setContentType("bin"); | |||||
| String agent = req.getHeader("user-agent"); | |||||
| if (agent.contains("Firefox")) { | |||||
| response.setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + new String(filename.getBytes("GB2312"), | |||||
| "ISO-8859-1")); | |||||
| } else { | |||||
| response | |||||
| .setHeader("Content-disposition", | |||||
| "attachment; filename=" | |||||
| + java.net.URLEncoder.encode(filename, | |||||
| "UTF-8")); | |||||
| } | |||||
| // 循环取出流中的数据 | |||||
| byte[] b = new byte[1024]; | |||||
| int len; | |||||
| InputStream inStream = new FileInputStream(filePath); | |||||
| while ((len = inStream.read(b)) > 0) | |||||
| response.getOutputStream().write(b, 0, len); | |||||
| inStream.close(); | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData verify(Long couponOrderId, Long bUserId) { | public ResultData verify(Long couponOrderId, Long bUserId) { | ||||
| @@ -6,15 +6,14 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.po.WxCouponSend; | import com.simple.domain.po.WxCouponSend; | ||||
| import com.simple.domain.po.WxMallConfig; | |||||
| import com.simple.mapper.WxCouponSendMapper; | import com.simple.mapper.WxCouponSendMapper; | ||||
| import com.simple.service.WxCouponActionLogService; | |||||
| import com.simple.service.WxCouponOrderService; | |||||
| import com.simple.service.WxCouponSendService; | |||||
| import com.simple.service.WxCouponService; | |||||
| import com.simple.service.*; | |||||
| import org.apache.commons.lang.time.DateUtils; | import org.apache.commons.lang.time.DateUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| @Service | @Service | ||||
| public class WxCouponSendServiceImpl implements WxCouponSendService { | public class WxCouponSendServiceImpl implements WxCouponSendService { | ||||
| @@ -27,6 +26,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | @Autowired | ||||
| WxCouponActionLogService wxCouponActionLogService; | WxCouponActionLogService wxCouponActionLogService; | ||||
| @Autowired | |||||
| WxMallConfigService wxMallConfigService; | |||||
| @Override | @Override | ||||
| @@ -57,24 +58,40 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| @Transactional | |||||
| public void sendCouponToUser(String tenantId, Long cUserId, int type) { | public void sendCouponToUser(String tenantId, Long cUserId, int type) { | ||||
| //查询开关是否打开 | //查询开关是否打开 | ||||
| //查询停车或者核销的券 | |||||
| //查询停车或者核销的券 stopCarCouponSwitch verifyConponSwitch | |||||
| WxCouponSend wxCouponSendQuery = new WxCouponSend(); | WxCouponSend wxCouponSendQuery = new WxCouponSend(); | ||||
| wxCouponSendQuery.setTenantId(tenantId); | wxCouponSendQuery.setTenantId(tenantId); | ||||
| int actionLogType=0; | int actionLogType=0; | ||||
| String configKey=""; | |||||
| if(type==2){ | if(type==2){ | ||||
| //停车 | //停车 | ||||
| wxCouponSendQuery.setSendType(2); | wxCouponSendQuery.setSendType(2); | ||||
| actionLogType=3; | actionLogType=3; | ||||
| configKey="stopCarCouponSwitch"; | |||||
| } | } | ||||
| if(type==3){ | if(type==3){ | ||||
| //核销 | //核销 | ||||
| wxCouponSendQuery.setSendType(3); | wxCouponSendQuery.setSendType(3); | ||||
| actionLogType=4; | actionLogType=4; | ||||
| configKey="verifyConponSwitch"; | |||||
| }else{ | }else{ | ||||
| return; | return; | ||||
| } | } | ||||
| WxMallConfig wxMallConfigQuery = new WxMallConfig(); | |||||
| wxMallConfigQuery.setKey(configKey); | |||||
| wxMallConfigQuery.setTenantId(tenantId); | |||||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfigQuery, 1, 1); | |||||
| if(page.getSize()>0) { | |||||
| WxMallConfig config = page.getList().get(0); | |||||
| if(config.getValue()==1){ | |||||
| return; | |||||
| } | |||||
| } | |||||
| List<WxCouponSend> wxCouponSends = wxCouponSendMapper.findList(wxCouponSendQuery); | List<WxCouponSend> wxCouponSends = wxCouponSendMapper.findList(wxCouponSendQuery); | ||||
| for (WxCouponSend send:wxCouponSends) { | for (WxCouponSend send:wxCouponSends) { | ||||
| WxCoupon wxCoupon= wxCouponService.getById(send.getCouponId()); | WxCoupon wxCoupon= wxCouponService.getById(send.getCouponId()); | ||||
| @@ -85,6 +102,9 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| wxCouponOrder.setCouponPrice(0); | wxCouponOrder.setCouponPrice(0); | ||||
| wxCouponOrder.setCreateDate(new Date()); | wxCouponOrder.setCreateDate(new Date()); | ||||
| if (wxCoupon.getValidType() == 1) { //时间范围区间 | if (wxCoupon.getValidType() == 1) { //时间范围区间 | ||||
| if(new Date().after(wxCoupon.getValidEndDate())){ | |||||
| continue; | |||||
| } | |||||
| wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | wxCouponOrder.setExpiredTime(wxCoupon.getValidEndDate()); | ||||
| } else { | } else { | ||||
| Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | Date date = DateUtils.addDays(new Date(), wxCoupon.getValidDays()); | ||||
| @@ -93,10 +113,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| wxCouponOrder.setTenantId(wxCoupon.getTenantId()); | wxCouponOrder.setTenantId(wxCoupon.getTenantId()); | ||||
| Long couponOrderId = wxCouponOrderService.insertOne(wxCouponOrder); | Long couponOrderId = wxCouponOrderService.insertOne(wxCouponOrder); | ||||
| wxCouponActionLogService.addOne(tenantId, wxCoupon.getId(), couponOrderId, actionLogType, send.getId()); | wxCouponActionLogService.addOne(tenantId, wxCoupon.getId(), couponOrderId, actionLogType, send.getId()); | ||||
| wxCouponService.reduceInventory(wxCoupon.getId(),1); | |||||
| } | } | ||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -22,13 +22,13 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| @Service | @Service | ||||
| public class WxCouponServiceImpl implements WxCouponService { | public class WxCouponServiceImpl implements WxCouponService { | ||||
| @Autowired | |||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | WxCouponMapper wxCouponMapper; | ||||
| @Autowired | |||||
| @Autowired | |||||
| WxCouponChannelService wxCouponChannelService; | WxCouponChannelService wxCouponChannelService; | ||||
| @Autowired | |||||
| @Autowired | |||||
| WxCouponSendService wxCouponSendService; | WxCouponSendService wxCouponSendService; | ||||
| @@ -37,11 +37,6 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findList(record)); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findEnableList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findEnableList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<WxCoupon> findList(WxCoupon record) { | public List<WxCoupon> findList(WxCoupon record) { | ||||
| return wxCouponMapper.findList(record); | return wxCouponMapper.findList(record); | ||||
| @@ -57,7 +52,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| record.setId(idWorker.nextId()); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxCouponMapper.insertSelective(record); | wxCouponMapper.insertSelective(record); | ||||
| } else { | } else { | ||||
| wxCouponMapper.updateByPrimaryKeySelective(record); | wxCouponMapper.updateByPrimaryKeySelective(record); | ||||
| @@ -70,30 +65,35 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| wxCouponMapper.deleteByPrimaryKey(id); | wxCouponMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCoupon> findCanSendList(WxCoupon record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponMapper.findCanSendList(record)); | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | public WxCouponCVo selectDetailForCUser(WxCouponChannel record) { | ||||
| return wxCouponMapper.selectDetailForCUser(record); | return wxCouponMapper.selectDetailForCUser(record); | ||||
| } | } | ||||
| @Override | |||||
| public WxCouponCVo selectDetailForCUser(WxCoupon record) { | |||||
| return wxCouponMapper.selectDetailForCUserC(record); | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional | @Transactional | ||||
| public ResultData updateCoupon(WxCoupon wxCoupon) { | public ResultData updateCoupon(WxCoupon wxCoupon) { | ||||
| WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | WxCoupon query = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); | ||||
| if(wxCoupon.getStatus()!=null){ | |||||
| if(wxCoupon.getStatus()==1){ //已作废 | |||||
| if (wxCoupon.getStatus() != null) { | |||||
| if (query.getStatus() == 0 && wxCoupon.getStatus() == 1) { | |||||
| //作废所有投放频道 | //作废所有投放频道 | ||||
| wxCouponChannelService.updateStatusByCouponId(wxCoupon.getId(),query.getTenantId(),1); | |||||
| wxCouponSendService.updateStatusByCouponId(query.getId(),query.getTenantId(),1); | |||||
| wxCouponChannelService.updateStatusByCouponId(wxCoupon.getId(), query.getTenantId(), 1); | |||||
| wxCouponSendService.updateStatusByCouponId(query.getId(), query.getTenantId(), 1); | |||||
| } | } | ||||
| } | } | ||||
| return new ResultData(saveOrUpdate(wxCoupon)); | return new ResultData(saveOrUpdate(wxCoupon)); | ||||
| } | } | ||||
| @Override | |||||
| public void reduceInventory(Long id, Integer number) { | |||||
| wxCouponMapper.reduceInventory(id,number); | |||||
| } | |||||
| } | } | ||||
| @@ -4,12 +4,10 @@ import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import com.simple.common.ResultData; | |||||
| import com.simple.domain.po.WxCUser; | import com.simple.domain.po.WxCUser; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import com.simple.domain.po.WxOrder; | import com.simple.domain.po.WxOrder; | ||||
| import com.simple.domain.vo.WxCouponOrderCVo; | |||||
| import com.simple.domain.vo.WxOrderCVo; | import com.simple.domain.vo.WxOrderCVo; | ||||
| import com.simple.enums.*; | import com.simple.enums.*; | ||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| @@ -22,10 +20,9 @@ import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import java.util.Calendar; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| @Service | @Service | ||||
| public class WxOrderServiceImpl implements WxOrderService { | public class WxOrderServiceImpl implements WxOrderService { | ||||
| @@ -75,7 +72,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| orderQ.setCUserId(user.getId()); | orderQ.setCUserId(user.getId()); | ||||
| orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | orderQ.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| try { | try { | ||||
| countOrder = wxOrderMapper.selectCount(orderQ); | |||||
| countOrder = wxOrderMapper.countList(orderQ); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | ||||
| @@ -86,7 +83,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| couponOrderQ.setCUserId(user.getId()); | couponOrderQ.setCUserId(user.getId()); | ||||
| couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | ||||
| try { | try { | ||||
| countCouponOrder = wxCouponOrderMapper.selectCount(couponOrderQ); | |||||
| countCouponOrder = wxCouponOrderMapper.countList(couponOrderQ); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | ||||
| @@ -122,7 +119,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL); | throw new MallinkException(ErrorCode.DB_FAIL); | ||||
| } | } | ||||
| if (count > coupon.getUseLimitQuantity()) { | |||||
| if (count >= coupon.getUseLimitQuantity()) { | |||||
| //解锁 | //解锁 | ||||
| redisLock.unlock(couponIdStr, timeStr); | redisLock.unlock(couponIdStr, timeStr); | ||||
| logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | logger.error("此券购买数量已超限, couponId: " + couponIdStr + ", count: " + count); | ||||
| @@ -161,11 +158,11 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| coupon = wxCouponMapper.selectByPrimaryKey(couponId); | coupon = wxCouponMapper.selectByPrimaryKey(couponId); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("券未找到, e:" + e.getMessage()); | logger.error("券未找到, e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到:" + couponIdStr); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | } | ||||
| if (coupon == null) { | if (coupon == null) { | ||||
| logger.error("券未找到, " + couponIdStr); | logger.error("券未找到, " + couponIdStr); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到:" + couponIdStr); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | } | ||||
| coupon.setRemainInventory(coupon.getRemainInventory() + 1); | coupon.setRemainInventory(coupon.getRemainInventory() + 1); | ||||
| @@ -173,8 +170,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| wxCouponMapper.updateByPrimaryKeySelective(coupon); | wxCouponMapper.updateByPrimaryKeySelective(coupon); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("库存+1失败, e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存+1失败, e:" + e.getMessage()); | |||||
| logger.error("数据库更新失败,库存+1失败, e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存恢复失败"); | |||||
| } finally { | } finally { | ||||
| //解锁 | //解锁 | ||||
| redisLock.unlock(couponIdStr, timeStr); | redisLock.unlock(couponIdStr, timeStr); | ||||
| @@ -214,12 +211,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| */ | */ | ||||
| // 减库存操作 | // 减库存操作 | ||||
| try { | |||||
| stockReduce(user, coupon, couponIdStr); | |||||
| } catch (Exception e) { | |||||
| logger.error("减库存失败, couponId: " + couponIdStr); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), "减库存失败, couponId: " + couponIdStr); | |||||
| } | |||||
| stockReduce(user, coupon, couponIdStr); | |||||
| Date curr = new Date(); | Date curr = new Date(); | ||||
| @@ -250,10 +242,10 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| // 保存订单 | // 保存订单 | ||||
| wxOrderMapper.insertSelective(record); | wxOrderMapper.insertSelective(record); | ||||
| } catch (RuntimeException e) { | } catch (RuntimeException e) { | ||||
| // 加库存 | |||||
| // 库存恢复 | |||||
| stockBack(record); | stockBack(record); | ||||
| logger.error("保存订单:" + e.getMessage()); | logger.error("保存订单:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), "保存订单失败:" + record.toString()); | |||||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | |||||
| } | } | ||||
| return record; | return record; | ||||
| @@ -268,28 +260,44 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| */ | */ | ||||
| private void createCouponOrder(WxCUser user, WxOrder order, WxCoupon coupon) { | private void createCouponOrder(WxCUser user, WxOrder order, WxCoupon coupon) { | ||||
| Date curr = new Date(); | 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); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| try { | |||||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||||
| couponOrder.setId(idWorker.nextId()); | |||||
| couponOrder.setTenantId(user.getTenantId()); | |||||
| couponOrder.setCouponId(order.getCouponId()); | |||||
| couponOrder.setCUserId(user.getId()); | |||||
| couponOrder.setOrderId(order.getOrderNumber()); | |||||
| couponOrder.setExpiredTime(valid_date); | |||||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||||
| couponOrder.setCreateDate(curr); | |||||
| couponOrder.setUpdateDate(curr); | |||||
| couponOrder.setCouponPrice(order.getPayment()); | |||||
| wxCouponOrderMapper.insertSelective(couponOrder); | |||||
| } catch (RuntimeException e) { | |||||
| logger.error("WxCouponOrder:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), "couponOrder保存失败!"); | |||||
| Date valid_date = null; | |||||
| if (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode()) | |||||
| valid_date = coupon.getValidEndDate(); | |||||
| else { | |||||
| Calendar calendar = Calendar.getInstance(); | |||||
| calendar.setTime(curr); | |||||
| 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(); | |||||
| WxCouponOrder couponOrder = new WxCouponOrder(); | |||||
| couponOrder.setId(idWorker.nextId()); | |||||
| couponOrder.setTenantId(user.getTenantId()); | |||||
| couponOrder.setCouponId(order.getCouponId()); | |||||
| couponOrder.setCUserId(user.getId()); | |||||
| couponOrder.setOrderId(order.getOrderNumber()); | |||||
| couponOrder.setExpiredTime(valid_date); | |||||
| couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); | |||||
| couponOrder.setCreateDate(curr); | |||||
| couponOrder.setUpdateDate(curr); | |||||
| couponOrder.setCouponPrice(order.getPayment()); | |||||
| wxCouponOrderMapper.insertSelective(couponOrder); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -315,7 +323,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | ||||
| logger.error("券已下架, couponId: " + couponIdStr); | logger.error("券已下架, couponId: " + couponIdStr); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_INVALID); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | } | ||||
| if (coupon.getSalePrice() != 0) { | if (coupon.getSalePrice() != 0) { | ||||
| logger.error("券不免费, couponId: " + couponIdStr); | logger.error("券不免费, couponId: " + couponIdStr); | ||||
| @@ -350,21 +358,22 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| wxOrderMapper.insertSelective(record); | wxOrderMapper.insertSelective(record); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| //加库存 | |||||
| // 库存恢复 | |||||
| stockBack(record); | stockBack(record); | ||||
| logger.error("保存订单:" + e.getMessage()); | logger.error("保存订单:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | |||||
| } | } | ||||
| // 创建couponOrder | // 创建couponOrder | ||||
| try { | try { | ||||
| createCouponOrder(user, record, coupon); | createCouponOrder(user, record, coupon); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| // 库存恢复 | |||||
| stockBack(record); | |||||
| logger.error("保存订单:" + e.getMessage()); | logger.error("保存订单:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||||
| } | } | ||||
| return record; | return record; | ||||
| } | } | ||||
| @@ -379,7 +388,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | if (coupon.getStatus() == EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode()) { | ||||
| logger.error("券已下架, couponId: " + updateOrder.getCouponId()); | logger.error("券已下架, couponId: " + updateOrder.getCouponId()); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_INVALID); | |||||
| throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | } | ||||
| WxCUser user = wxCUserMapper.selectByPrimaryKey(updateOrder.getCUserId()); | WxCUser user = wxCUserMapper.selectByPrimaryKey(updateOrder.getCUserId()); | ||||
| if (user == null) { | if (user == null) { | ||||
| @@ -395,14 +404,14 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| ret = wxOrderMapper.updateByPrimaryKey(updateOrder); | ret = wxOrderMapper.updateByPrimaryKey(updateOrder); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("订单更新失败:" + e.getMessage()); | logger.error("订单更新失败:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(), "订单更新失败:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_UPDATE_ERR); | |||||
| } | } | ||||
| // 创建couponOrder | // 创建couponOrder | ||||
| try { | try { | ||||
| createCouponOrder(user, updateOrder, coupon); | createCouponOrder(user, updateOrder, coupon); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("保存订单:" + e.getMessage()); | logger.error("保存订单:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_SAVE_ERR); | |||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| @@ -418,19 +427,19 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| stockBack(updateOrder); | stockBack(updateOrder); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("库存+1失败, e:" + e.getMessage()); | logger.error("库存+1失败, e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "库存+1失败, e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | |||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| updateOrder.setOrderStatus(enumOrderStatus.getCode()); | |||||
| updateOrder.setUpdateDate(currentDate); | |||||
| int ret = 0; | int ret = 0; | ||||
| try { | try { | ||||
| updateOrder.setOrderStatus(enumOrderStatus.getCode()); | |||||
| updateOrder.setUpdateDate(currentDate); | |||||
| ret = wxOrderMapper.updateByPrimaryKey(updateOrder); | ret = wxOrderMapper.updateByPrimaryKey(updateOrder); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("订单状态更新失败, e:" + e.getMessage()); | logger.error("订单状态更新失败, e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "订单状态更新失败, e:" + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.ORDER_UPDATE_ERR); | |||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| @@ -0,0 +1,56 @@ | |||||
| package com.simple.service.impl; | |||||
| import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.simple.domain.po.WxUserChannel; | |||||
| import com.simple.mapper.WxUserChannelMapper; | |||||
| import com.simple.service.WxUserChannelService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import com.simple.common.IdWorker; | |||||
| @Service | |||||
| public class WxUserChannelServiceImpl implements WxUserChannelService { | |||||
| @Autowired | |||||
| WxUserChannelMapper wxUserChannelMapper; | |||||
| @Override | |||||
| public PageInfo<WxUserChannel> listAsPage(WxUserChannel record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxUserChannelMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxUserChannel getById(Long id) { | |||||
| return wxUserChannelMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxUserChannel record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| IdWorker idWorker = new IdWorker(0, 0); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxUserChannelMapper.insertSelective(record); | |||||
| } else { | |||||
| wxUserChannelMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxUserChannelMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<WxUserChannel> findDistinctChannel() { | |||||
| return wxUserChannelMapper.findDistinctChannel(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,60 @@ | |||||
| 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.domain.vo.TouchUsersReportVo; | |||||
| 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<WxUserVisit> 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); | |||||
| } | |||||
| @Override | |||||
| public List<TouchUsersReportVo> touchUsersReportList(HashMap<String, Object> params) { | |||||
| return wxUserVisitMapper.touchUsersReportList(params); | |||||
| } | |||||
| } | |||||
| @@ -71,5 +71,10 @@ | |||||
| select <include refid="allColumns" /> from wx_c_user_car | select <include refid="allColumns" /> from wx_c_user_car | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <select id="countList" parameterType="com.simple.domain.po.WxCUserCar" resultType="java.lang.Integer"> | |||||
| select count(*) from wx_c_user_car | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -184,13 +184,31 @@ | |||||
| where `token` = #{token} | where `token` = #{token} | ||||
| </select> | </select> | ||||
| <select id="findCountBySex" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long"> | |||||
| select count(id) from wx_c_user where gender =#{sex} | |||||
| <select id="findCount" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long"> | |||||
| select count(id) from wx_c_user where 1=1 | |||||
| <if test=" null != sex "> | |||||
| and gender =#{sex} | |||||
| </if> | |||||
| <if test=" null != startTime "> | <if test=" null != startTime "> | ||||
| and create_date >= #{startTime} | and create_date >= #{startTime} | ||||
| </if> | </if> | ||||
| <if test=" null != endTime"> | <if test=" null != endTime"> | ||||
| and create_date <= #{endTime} | and create_date <= #{endTime} | ||||
| </if> | </if> | ||||
| <if test="null != tenantId"> | |||||
| and tenant_id =#{tenantId} | |||||
| </if> | |||||
| </select> | |||||
| <select id ="listByChannel" resultMap="BaseResultMap" parameterType="java.util.List"> | |||||
| select id,nick_name,phone,create_date,scene_address from wx_c_user where 1=1 | |||||
| <if test =" sceneList!= null "> | |||||
| and scene_address in | |||||
| <foreach collection="sceneList" index="index" item="scene" open="(" separator="," close=")"> | |||||
| #{scene} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||
| @@ -84,6 +84,13 @@ | |||||
| and create_date BETWEEN #{startdate} and #{enddate} | and create_date BETWEEN #{startdate} and #{enddate} | ||||
| ) c group by c.create_time | ) c group by c.create_time | ||||
| </select> | </select> | ||||
| <select id="queryForSceneRepotyHistoryCar" resultType="com.simple.domain.vo.MarkingSceneDataVo" parameterType="hashmap"> | |||||
| select DATE_FORMAT(create_date,'%Y-%m-%d') xTime, count(c.id) carCount | |||||
| from wx_car_cmd_log c where tenant_id = #{tenantId} and cmd_type=#{cmdType} | |||||
| and create_date BETWEEN #{startTime} and #{endTime} | |||||
| group by xTime | |||||
| </select> | |||||