From 77352e481da15acf5b6cdd6a830c03c7a2f83c9d Mon Sep 17 00:00:00 2001 From: gongbiao Date: Fri, 31 Aug 2018 12:50:15 +0800 Subject: [PATCH 01/28] =?UTF-8?q?[=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:=E5=AF=BC=E5=87=BAexcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/vo/WxCouponOrderBVo.java | 25 +++++++++++++------ .../simple/mapper/WxCouponOrderMapper.java | 8 ++++-- .../impl/WxCouponOrderServiceImpl.java | 7 +++--- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java index 232d643a4..a26dfe9f7 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponOrderBVo.java @@ -1,5 +1,6 @@ package com.simple.domain.vo; +import cn.afterturn.easypoi.excel.annotation.Excel; import com.simple.domain.po.WxCouponOrder; import javax.persistence.Id; @@ -56,15 +57,19 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @io.swagger.annotations.ApiModelProperty(value = "操作券B端小程序用户ID", name = "bUserId") private Long bUserId; /*用户订单ID**/ + @Excel(name="订单号",width = 20) @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") private Long orderId; /*该订单对应券的实际过期时间**/ @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") private Date expiredTime; /*状态:0,待使用 1,已核销 2,已过期 3,已作废 **/ + + @Excel(name="订单状态",width = 20,replace = { "可以退款_0", "已经使用_1","已经过期_2","已经退款_3"},orderNum = "4") @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") private Integer couponOrderStatus; /***/ + @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd",orderNum = "3") @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") private Date createDate; /***/ @@ -82,6 +87,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") private String title; /*售价(适用于类型2,3,4,5)**/ + @Excel(name="交易价格",width = 20,orderNum = "2") @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") private Integer salePrice; /*使用条件金额(适用于类型1,2,3,4)**/ @@ -97,6 +103,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ private String bUserName; /*c用户绑定的手机号**/ + @Excel(name="手机号",width = 20,orderNum = "1") @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") private String cUserPhone; @@ -193,18 +200,20 @@ public class WxCouponOrderBVo extends WxCouponOrder{ price = _price; } - public String getCUserPhone() { - return cUserPhone; + public String getbUserName() { + return bUserName; } - public void setCUserPhone(String _phone) { - cUserPhone = _phone; + + public void setbUserName(String bUserName) { + this.bUserName = bUserName; } - public String getBUserName() { - return bUserName; + public String getcUserPhone() { + return cUserPhone; } - public void setBUserName(String _name) { - this.bUserName = _name; + + public void setcUserPhone(String cUserPhone) { + this.cUserPhone = cUserPhone; } public static enum Field { diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java index d6a5b7cde..710789c09 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponOrderMapper.java @@ -1,10 +1,14 @@ package com.simple.mapper; -import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.po.WxCouponOrder; import com.simple.domain.vo.*; import org.apache.ibatis.annotations.Param; -import com.simple.domain.po.WxCouponOrder; + +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public interface WxCouponOrderMapper extends CommonMapper { diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java index f17de51c1..2b5efc0ba 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java @@ -2,13 +2,13 @@ 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.PageInfo; import com.simple.common.ErrorCode; import com.simple.common.IdWorker; import com.simple.common.ResultData; import com.simple.domain.po.*; +import com.simple.domain.vo.WxCouponOrderBVo; import com.simple.domain.vo.WxCouponOrderCVo; import com.simple.enums.EnumCouponOrderStatus; import com.simple.exception.MallinkException; @@ -16,7 +16,6 @@ import com.simple.mapper.*; import com.simple.service.WxCouponOrderService; 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.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -215,7 +214,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { WxCouponOrder wxCouponOrder = new WxCouponOrder(); wxCouponOrder.setTenantId(tenantId); - List list = wxCouponOrderMapper.findList(wxCouponOrder); + List list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); String filepath="./uploads/"; File savefile = new File(filepath); @@ -223,7 +222,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { savefile.mkdirs(); } - Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WxCouponOrder.class, list); + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WxCouponOrderBVo.class, list); FileOutputStream fos = null; try { String filename=UUID.randomUUID()+".xlsx"; From df8eef3e9d5bd05be7ae71bb5b3a9a3b8518596b Mon Sep 17 00:00:00 2001 From: hupeng Date: Fri, 31 Aug 2018 16:03:23 +0800 Subject: [PATCH 02/28] =?UTF-8?q?[C=E7=AB=AF][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E4=BF=AE=E6=94=B9C=E7=AB=AF=E7=9A=84=E5=88=B8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=8F=AF=E4=BB=A5=E6=98=BE=E7=A4=BA=E5=95=86=E6=88=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/domain/vo/WxCouponChannelVo.java | 18 ++++++++++++++++++ .../impl/WxCouponChannelServiceImpl.java | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java index 99fe69083..3c8fa40b1 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponChannelVo.java @@ -2,6 +2,7 @@ package com.simple.domain.vo; import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponChannel; +import com.simple.domain.po.WxMerchant; import javax.persistence.Transient; import java.io.Serializable; @@ -56,6 +57,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { @Transient private String priceStr; + @Transient + private String merchantName; + /*限领张数**/ @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") private Integer useLimitQuantity; @@ -173,6 +177,15 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { this.priceStr = priceStr; } + public String getMerchantName() { + return merchantName; + } + + public void setMerchantName(String merchantName) { + this.merchantName = merchantName; + } + + public WxCouponChannelVo(){} public WxCouponChannelVo setWxCoupon (WxCoupon wxCoupon){ this.coverImg=wxCoupon.getCoverImg(); @@ -188,5 +201,10 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { return this; } + public WxCouponChannelVo setWxMerchant (WxMerchant wxMerchant){ + + this.merchantName=wxMerchant.getName(); + return this; + } } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java index 3ea46f8ff..2fc9ad4df 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponChannelServiceImpl.java @@ -9,8 +9,10 @@ import com.simple.common.Result; import com.simple.common.ResultData; import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponChannel; +import com.simple.domain.po.WxMerchant; import com.simple.domain.vo.WxCouponChannelVo; import com.simple.mapper.WxCouponChannelMapper; +import com.simple.mapper.WxMerchantMapper; import com.simple.service.WxCouponChannelService; import com.simple.service.WxCouponService; import org.apache.log4j.Logger; @@ -26,6 +28,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { WxCouponChannelMapper wxCouponChannelMapper; @Autowired WxCouponService wxCouponService; + @Autowired + WxMerchantMapper wxMerchantMapper; private Logger logger = Logger.getLogger(getClass()); @@ -160,6 +164,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ wxcouponVo.setWxCoupon(couponNamesMap.get(wxcouponVo.getCouponId())); + WxMerchant wxMerchant = new WxMerchant(); + wxMerchant.setId(wxcouponVo.getMerchantId()); + wxMerchant = wxMerchantMapper.selectByPrimaryKey(wxMerchant); + if (wxMerchant != null) + wxcouponVo.setWxMerchant(wxMerchant); } } return new PageInfo<>(wxCouponChannelVoList); From f8790b35224026481d1bfa6f4db442cec84dcf25 Mon Sep 17 00:00:00 2001 From: hupeng Date: Fri, 31 Aug 2018 17:58:22 +0800 Subject: [PATCH 03/28] =?UTF-8?q?[C=E7=AB=AF][=E6=96=B0=E5=A2=9E]:?= =?UTF-8?q?=E6=A0=B8=E9=94=80=E6=9F=A5=E8=AF=A2=E7=8A=B6=E6=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCouponOrderController.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java index 9f7cbc007..d8f52d3e1 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponOrderController.java @@ -19,6 +19,7 @@ import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.Map; @RestController @@ -93,4 +94,22 @@ public class WxCouponOrderController extends BaseController { return wxCouponOrderService.detailCUserVo(getUser().getId(), couponOrderId); } + + @ApiOperation(value = "卡券状态接口") + @GetMapping("getStatus") + @ApiImplicitParams({ + @ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) + }) + public ResultData getStatus(String couponOrderId) { + + if(couponOrderId == null) { + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); + } + + Map res = new HashMap(); + + res.put("CouponOrderStatus",wxCouponOrderService.getById(Long.valueOf(couponOrderId)).getCouponOrderStatus() ); + + return new ResultData(res); + } } From 6672ee5c6b56ab853d8d845cfe842d9bc58eabcc Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Fri, 31 Aug 2018 19:56:23 +0800 Subject: [PATCH 04/28] =?UTF-8?q?[pv=20uv=E5=AE=9A=E6=97=B6=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1][=E4=BF=AE=E6=94=B9]=E6=97=B6=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/schedule/WxAppVisitSchedule.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java index 39c93d2b4..f40a460ab 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -19,7 +19,10 @@ import org.springframework.web.client.RestTemplate; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxAppinfo; import com.simple.domain.po.WxUserVisit; +import com.simple.service.WxAppinfoService; import com.simple.service.WxUserVisitService; @Component @@ -37,24 +40,40 @@ public class WxAppVisitSchedule { @Autowired private WxUserVisitService wxUserVisitService; + + @Autowired + private WxAppinfoService WxAppinfoService; // @Scheduled(cron = "0 */1 * * * *?") - @Scheduled(cron = "0 0 4 * * ? ") + @Scheduled(cron = "0 0 6 * * ? ") 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); +// "wx8eb8275b78db4ede", "76c43df01296998d8ce12383f213ac10"; + WxAppinfo appInfo = new WxAppinfo(); + appInfo.setType(2); + PageInfo page = WxAppinfoService.listAsPage(appInfo, 1, 10000); + for(WxAppinfo w :page.getList()) { + w.getAppId(); + w.getSecret(); + w.getTenantId(); + //TODO 因为数据库表里数据问题,暂时不通过这种方式处理 + } + String appId = "wx8eb8275b78db4ede"; + String key ="76c43df01296998d8ce12383f213ac10"; + String talentId ="456"; + getData(yesterday,appId,key,talentId); }catch(Exception e) { logger.error("获取微信访问数据失败",e); } } - private void getData(String yesterday) throws Exception { - String accessToken = getAccessToken("wx8eb8275b78db4ede", "76c43df01296998d8ce12383f213ac10"); + private void getData(String yesterday,String appId,String key,String talentId) throws Exception { + String accessToken = getAccessToken(appId, key); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); Map map = new HashMap(); @@ -91,6 +110,7 @@ public class WxAppVisitSchedule { v.setStayTimeSession(itemMap.get("stay_time_session")+""); v.setVisitDepth(itemMap.get("visit_depth")+""); v.setStayTimeUv(itemMap.get("stay_time_uv")+""); + v.setTenantId(talentId); wxUserVisitService.saveOrUpdate(v); } From 583380268736fab9ec60bea15633ab5f87efe78a Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Fri, 31 Aug 2018 19:56:23 +0800 Subject: [PATCH 05/28] =?UTF-8?q?[=E4=BC=9A=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B6=88=E8=B4=B9=E9=87=91=E9=A2=9D][=E6=96=B0=E5=A2=9E]?= =?UTF-8?q?=E6=B6=88=E8=B4=B9=E9=87=91=E9=A2=9D=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxCUserDataController.java | 108 ++++++++++++++++-- .../com/simple/domain/vo/UserStructureVo.java | 22 ++++ .../simple/service/WxCouponOrderService.java | 25 ++++ .../impl/WxCouponOrderServiceImpl.java | 18 +++ .../resources/mapper/WxCouponOrderMapper.xml | 6 +- 5 files changed, 167 insertions(+), 12 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java index cbb176207..6f9304468 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java @@ -1,5 +1,6 @@ package com.simple.controller; +import java.text.DecimalFormat; import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -9,7 +10,6 @@ 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; @@ -17,9 +17,11 @@ import org.springframework.web.bind.annotation.RestController; import com.simple.common.ResultData; import com.simple.domain.dto.WxCuerBasicInfoDto; +import com.simple.domain.vo.CUserDateAmountVo; import com.simple.domain.vo.TouchUsersReportVo; import com.simple.domain.vo.UserStructureVo; import com.simple.service.WxCUserService; +import com.simple.service.WxCouponOrderService; import com.simple.service.WxUserVisitService; import io.swagger.annotations.Api; @@ -34,6 +36,8 @@ public class WxCUserDataController extends BaseController{ private WxCUserService wxCUserService; @Autowired private WxUserVisitService wxUserVisitService; + @Autowired + private WxCouponOrderService wxCouponOrderService; @GetMapping("findUserCountData") @ApiOperation("查询用户数量接口") @@ -96,14 +100,15 @@ public class WxCUserDataController extends BaseController{ weekPercentage= nf.format(new Double(todayCount).doubleValue()); } Map map = new HashMap<>(); - map.put("allCount", allCount); - map.put("todayCount", todayCount); - map.put("newCountVos", newCountVos); + map.put("allCount", allCount);//会员总数 + map.put("todayCount", todayCount);//今日新增会员数 + map.put("newCountVos", newCountVos);//近一个月新增数列表 map.put("dayPercentage",dayPercentage);//日环比 map.put("weekPercentage",weekPercentage); //周同比 return new ResultData(map); } + @ApiOperation("查询用户活跃量") @GetMapping("findUserVisitData") public ResultData findUserVisitData() { HashMap params =new HashMap<>(); @@ -136,7 +141,7 @@ public class WxCUserDataController extends BaseController{ 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.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); vo.setSortNum(j); j++; if(dateMap.get(dayStr)!=null) { @@ -156,7 +161,7 @@ public class WxCUserDataController extends BaseController{ 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.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); vo.setSortNum(j); if(dateMap.get(dayStr)!=null) { TouchUsersReportVo rv = dateMap.get(dayStr); @@ -175,7 +180,6 @@ public class WxCUserDataController extends BaseController{ if(i==7) { dayOfWeekCount=vo.getCount(); } - monthVos.add(vo); j++; } @@ -198,12 +202,98 @@ public class WxCUserDataController extends BaseController{ Map mapVo =new HashMap<>(); mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 - mapVo.put("weekVos", weekVos);//上周活跃数 - mapVo.put("monthVos", monthVos);//上月活跃数 + mapVo.put("weekVos", weekVos);//上周活跃数列表 + mapVo.put("monthVos", monthVos);//上月活跃数列表 mapVo.put("dayPercentage",dayPercentage);//日环比 mapVo.put("weekPercentage",weekPercentage); //周同比 return new ResultData(mapVo); } + @ApiOperation("查询用户消费金额") + @GetMapping("findUserAmountData") + private ResultData findUserAmountData() { + String tenantId = getTenantId(); + Calendar c =Calendar.getInstance(); + Date today = c.getTime(); + 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();//明天0点 + c.add(Calendar.DAY_OF_YEAR, -30);//三十天前 + Date startTime = c.getTime(); + int thisMonthCount =wxCouponOrderService.queryPriceTotal(tenantId, startTime, endTime);//月消费金额 + c.clear(); + c.setTime(endTime); + Date eTime=c.getTime(); + c.add(Calendar.DAY_OF_YEAR, -8); + Date sTime =c.getTime(); + List datas = wxCouponOrderService.queryPriceTotalGroup(tenantId, sTime, eTime); + Map dataMap = new HashMap<>(); + for(CUserDateAmountVo v:datas) { + dataMap.put(v.getxTime(), v.getPrice()); + } + Integer todayCount=0;//今日金额数 + Integer yesterdayCount =0;//昨日金额数 + Integer dayOfWeekCount=0;//上周x + int j=0; + List weekCountVos = new ArrayList<>();//周消费金额 + for(int i=7;i>=0;i--) { + c.clear(); + c.setTime(today); + c.add(Calendar.DAY_OF_YEAR, -i); + String dateStr = new SimpleDateFormat("MM-dd").format(c.getTime()); + UserStructureVo vo = new UserStructureVo(); + vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); + vo.setSortNum(j); + if(dataMap.get(dateStr)!=null) { + int price= dataMap.get(dateStr); + vo.setPrice(price); + }else { + vo.setPrice(0); + } + if(i==0) { + todayCount =vo.getPrice(); + } + if(i==1) { + yesterdayCount =vo.getPrice(); + } + if(i==7) { + dayOfWeekCount=vo.getPrice(); + }else { + weekCountVos.add(vo); + } + j++; + + } + NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMinimumFractionDigits(2); + String dayPercentage =""; + if(yesterdayCount>0) { + Integer 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) { + Integer count =todayCount-dayOfWeekCount; + weekPercentage=nf.format(count.doubleValue()/new Double(dayOfWeekCount).doubleValue()); + }else { + weekPercentage= nf.format(new Double(todayCount).doubleValue()); + } + Map map =new HashMap<>(); + DecimalFormat df=new DecimalFormat("0.00"); + map.put("todayCount", df.format((float)todayCount/100));//今日消费金额 + String thisMonthCountStr = df.format((float)thisMonthCount/100); + map.put("thisMonthCount", thisMonthCountStr);//近一个月消费金额数 + map.put("dayPercentage",dayPercentage);//日环比 + map.put("weekPercentage",weekPercentage); //周同比 + map.put("weekCountVos", weekCountVos);//一周金额列表 + return new ResultData(map); + } + } + + diff --git a/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java b/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java index 21a641ff0..05e90a699 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/UserStructureVo.java @@ -1,6 +1,7 @@ package com.simple.domain.vo; import java.io.Serializable; +import java.text.DecimalFormat; /** * 会员结构vo * @author jinguo @@ -20,6 +21,27 @@ public class UserStructureVo implements Serializable{ private String percentage; //序号 private Integer sortNum; + + private Integer price; + + private String priceStr; + + public Integer getPrice() { + return price; + } + public void setPrice(Integer price) { + this.price = price; + } + 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 Integer getSortNum() { return sortNum; } diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java b/mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java index 6169ca752..cdc803472 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java @@ -3,10 +3,16 @@ package com.simple.service; import com.github.pagehelper.PageInfo; import com.simple.common.ResultData; import com.simple.domain.po.WxCouponOrder; +import com.simple.domain.vo.CUserDateAmountVo; + +import java.util.Date; +import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.ibatis.annotations.Param; + public interface WxCouponOrderService { /** @@ -107,4 +113,23 @@ public interface WxCouponOrderService { void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); + + /** + * 日期分组 消费总数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + List queryPriceTotalGroup(String tenantId, Date startTime,Date endTime); + /** + * 查询时间段内消费总数 + * @param tenantId + * @param startTime + * @param endTime + * @return + */ + int queryPriceTotal(String tenantId, Date startTime, Date endTime); + + } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java index 2b5efc0ba..1405197cd 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java @@ -8,6 +8,7 @@ import com.simple.common.ErrorCode; import com.simple.common.IdWorker; import com.simple.common.ResultData; import com.simple.domain.po.*; +import com.simple.domain.vo.CUserDateAmountVo; import com.simple.domain.vo.WxCouponOrderBVo; import com.simple.domain.vo.WxCouponOrderCVo; import com.simple.enums.EnumCouponOrderStatus; @@ -371,4 +372,21 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { return new ResultData(wxCouponOrder); } + + + @Override + public List queryPriceTotalGroup(String tenantId, Date startTime, Date endTime) { + + return wxCouponOrderMapper.queryPriceTotalGroup(tenantId, startTime, endTime); + } + + + + @Override + public int queryPriceTotal(String tenantId, Date startTime, Date endTime) { + return wxCouponOrderMapper.queryPriceTotal(tenantId, startTime, endTime); + } + + + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 633ab599b..693f2a5b8 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -415,13 +415,13 @@ From 718b56f6e391aadf0f96d8ace510c7da6d5173ed Mon Sep 17 00:00:00 2001 From: "jinguo24@163.com" Date: Sat, 1 Sep 2018 11:28:26 +0800 Subject: [PATCH 06/28] =?UTF-8?q?[=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]=E4=BF=AE=E6=94=B9=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=BA9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/schedule/WxAppVisitSchedule.java | 2 +- mallinkService/src/main/resources/mapper/WxCUserMapper.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java index f40a460ab..2325d772e 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -46,7 +46,7 @@ public class WxAppVisitSchedule { // @Scheduled(cron = "0 */1 * * * *?") - @Scheduled(cron = "0 0 6 * * ? ") + @Scheduled(cron = "0 0 9 * * ? ") public void start() { try { Calendar c =Calendar.getInstance(); diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index 08aacf5f6..13531a2fd 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -193,7 +193,7 @@ and create_date >= #{startTime} - and create_date <= #{endTime} + and create_date < #{endTime} and tenant_id =#{tenantId} From 34aba533c6ea8209a8fa64df66ddfc5cfa13658c Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Fri, 31 Aug 2018 11:49:41 +0800 Subject: [PATCH 07/28] =?UTF-8?q?[=E6=8E=92=E5=BA=8F][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?user=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/domain/po/WxCUser.java | 34 ++++++++++--------- .../simple/domain/po/WxCUserBasicInfo.java | 8 +++-- .../java/com/simple/domain/po/WxCUserCar.java | 16 ++++----- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java index cc72ec3e8..cb05dea3b 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java @@ -280,30 +280,30 @@ public class WxCUser implements Serializable { public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") - ,OpenId_ASC("`openId` ASC"),OpenId_DESC("`openId` DESC") - ,UnionId_ASC("`unionId` ASC"),UnionId_DESC("`unionId` DESC") - ,NickName_ASC("`nickName` ASC"),NickName_DESC("`nickName` DESC") + ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") + ,OpenId_ASC("`open_id` ASC"),OpenId_DESC("`open_id` DESC") + ,UnionId_ASC("`union_id` ASC"),UnionId_DESC("`union_id` DESC") + ,NickName_ASC("`nick_name` ASC"),NickName_DESC("`nick_name` DESC") ,Gender_ASC("`gender` ASC"),Gender_DESC("`gender` DESC") - ,AvatarUrl_ASC("`avatarUrl` ASC"),AvatarUrl_DESC("`avatarUrl` DESC") + ,AvatarUrl_ASC("`avatar_url` ASC"),AvatarUrl_DESC("`avatar_url` DESC") ,Phone_ASC("`phone` ASC"),Phone_DESC("`phone` DESC") - ,PurePhone_ASC("`purePhone` ASC"),PurePhone_DESC("`purePhone` DESC") + ,PurePhone_ASC("`pure_phone` ASC"),PurePhone_DESC("`pure_phone` DESC") ,City_ASC("`city` ASC"),City_DESC("`city` DESC") ,Province_ASC("`province` ASC"),Province_DESC("`province` DESC") ,Language_ASC("`language` ASC"),Language_DESC("`language` DESC") - ,CountryCode_ASC("`countryCode` ASC"),CountryCode_DESC("`countryCode` DESC") - ,RegisterIp_ASC("`registerIp` ASC"),RegisterIp_DESC("`registerIp` DESC") - ,VerifyCodePhone_ASC("`verifyCodePhone` ASC"),VerifyCodePhone_DESC("`verifyCodePhone` DESC") - ,QrcodeSource_ASC("`qrcodeSource` ASC"),QrcodeSource_DESC("`qrcodeSource` DESC") + ,CountryCode_ASC("`country_code` ASC"),CountryCode_DESC("`country_code` DESC") + ,RegisterIp_ASC("`register_ip` ASC"),RegisterIp_DESC("`register_ip` DESC") + ,VerifyCodePhone_ASC("`verify_code_phone` ASC"),VerifyCodePhone_DESC("`verify_code_phone` DESC") + ,QrcodeSource_ASC("`qrcode_source` ASC"),QrcodeSource_DESC("`qrcode_source` DESC") ,Scene_ASC("`scene` ASC"),Scene_DESC("`scene` DESC") - ,SceneAddress_ASC("`sceneAddress` ASC"),SceneAddress_DESC("`sceneAddress` DESC") - ,SessionKey_ASC("`sessionKey` ASC"),SessionKey_DESC("`sessionKey` DESC") + ,SceneAddress_ASC("`scene_address` ASC"),SceneAddress_DESC("`scene_address` DESC") + ,SessionKey_ASC("`session_key` ASC"),SessionKey_DESC("`session_key` DESC") ,Score_ASC("`score` ASC"),Score_DESC("`score` DESC") - ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") - ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") - ,AppId_ASC("`appId` ASC"),AppId_DESC("`appId` DESC") + ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") + ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") + ,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC") ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") - ,ExpireTime_ASC("`expireTime` ASC"),ExpireTime_DESC("`expireTime` DESC") + ,ExpireTime_ASC("`expire_time` ASC"),ExpireTime_DESC("`expire_time` DESC") ; private String value; Field(String value){ @@ -336,6 +336,8 @@ public class WxCUser implements Serializable { sb.append(","); sb.append(fields[k].toString()); } + + this.sortColumns = sb.toString(); } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index 6b8545109..a3b4d59fa 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java @@ -232,9 +232,9 @@ public class WxCUserBasicInfo implements Serializable { ,Poins_ASC("`poins` ASC"),Poins_DESC("`poins` DESC") ,TagId_ASC("`tagId` ASC"),TagId_DESC("`tagId` DESC") ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") - ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") - ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") + ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") + ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") ; private String value; @@ -268,6 +268,8 @@ public class WxCUserBasicInfo implements Serializable { sb.append(","); sb.append(fields[k].toString()); } + + this.sortColumns = sb.toString(); } diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserCar.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserCar.java index 0cf018354..d6a33bb7b 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserCar.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUserCar.java @@ -111,13 +111,13 @@ public class WxCUserCar implements Serializable { public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") - ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") - ,CarNumber_ASC("`carNumber` ASC"),CarNumber_DESC("`carNumber` DESC") - ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") - ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") - ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") - ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") + ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") + ,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC") + ,CarNumber_ASC("`car_number` ASC"),CarNumber_DESC("`car_number` DESC") + ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") + ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") + ,VendorType_ASC("`vendor_type` ASC"),VendorType_DESC("`vendor_type` DESC") + ,VendorParams_ASC("`vendor_params` ASC"),VendorParams_DESC("`vendor_params` DESC") ; private String value; Field(String value){ @@ -150,7 +150,7 @@ public class WxCUserCar implements Serializable { sb.append(","); sb.append(fields[k].toString()); } - + this.sortColumns = sb.toString(); } public void setSortColumns(String sortColumns) From b91b8f42f0c302a4c29172acbc1ee488628ad36c Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Fri, 31 Aug 2018 12:46:35 +0800 Subject: [PATCH 08/28] =?UTF-8?q?[=E7=94=A8Enum=E8=B7=9F=E8=B8=AAstatus][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:couponChannel=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxCouponChannelController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java b/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java index 13cd9183c..b8654cbe3 100644 --- a/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxCouponChannelController.java @@ -1,6 +1,7 @@ package com.simple.controller; import com.simple.domain.vo.WxCouponChannelVo; +import com.simple.enums.EnumCouponChannelStatus; import io.swagger.annotations.Api; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -37,7 +38,7 @@ public class WxCouponChannelController extends BaseController public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); wxCouponChannel.setTenantId(getTenantId()); - wxCouponChannel.setStatus(0); + wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); final PageInfo page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); return new ResultData(page); From f5dbc33f3ca131e6e6fe95743c3b41ae2c224c21 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sat, 1 Sep 2018 07:08:06 +0800 Subject: [PATCH 09/28] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=AA=8C=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserGrantController.java | 33 +++++++++ .../main/java/com/simple/utils/CheckUtil.java | 69 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100755 mallinkService/src/main/java/com/simple/utils/CheckUtil.java diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index aeea87bec..286d2ef8c 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -18,6 +18,7 @@ import com.simple.domain.po.WxCUserCar; import com.simple.service.WxAppinfoService; import com.simple.service.WxCUserCarService; import com.simple.service.WxCUserService; +import com.simple.utils.CheckUtil; import com.simple.utils.IPUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -32,6 +33,9 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -319,5 +323,34 @@ public class WxUserGrantController extends BaseController { return new ResultData(Result.SUCCESS,"获取查询成功", list); } + /** + * 微信消息服务验证 + * @param response + * @param request + * @throws IOException + */ + @RequestMapping(value = "/signature") + @ResponseBody + public void signature(HttpServletResponse response, HttpServletRequest request) throws IOException { + + + String signature = request.getParameter("signature"); + String timestamp = request.getParameter("timestamp"); + String nonce = request.getParameter("nonce"); + String echostr = request.getParameter("echostr"); + + logger.warn("收到的微信服务验证信息"+signature+"\n"+timestamp+"\n"+nonce+"\n"+echostr); + PrintWriter out = response.getWriter(); + /* + // 通过检验signature对请求进行校验,若校验成功则原样返回echostr,表示接入成功,否则接入失败 + if (CheckUtil.checkSignature(wp.getToken(), signature, timestamp, nonce)) { + out.print(echostr); + logger.warn("微信服务验证成功===================="+echostr); + System.out.println("微信服务验证成功!"); + } + */ + out.close(); + } + } diff --git a/mallinkService/src/main/java/com/simple/utils/CheckUtil.java b/mallinkService/src/main/java/com/simple/utils/CheckUtil.java new file mode 100755 index 000000000..8e50c39cf --- /dev/null +++ b/mallinkService/src/main/java/com/simple/utils/CheckUtil.java @@ -0,0 +1,69 @@ +package com.simple.utils; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +public class CheckUtil { + //token为自己定义的一个字符串 + public static boolean checkSignature(String token, String signature,String timestamp,String nonce) { + String[] arr = new String[]{token,timestamp,nonce}; + + //排序 + Arrays.sort(arr); + + //生成字符串 + StringBuffer sb = new StringBuffer(); + for(int i=0; i>> 4) & 0X0F]; + tempArr[1] = Digit[b & 0X0F]; + + String s = new String(tempArr); + return s; + } +} From 8cbf25a4bb94a90e8864618c3b6a84363708751e Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 14:10:18 +0800 Subject: [PATCH 10/28] =?UTF-8?q?[=E8=8F=9C=E5=8D=95][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?permisson=E5=8E=BB=E6=8E=89tenant=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MallPermissionController.java | 1 - .../simple/controller/MallRoleController.java | 8 +- .../controller/MallUserInfoController.java | 81 +++++++++++-------- .../com/simple/domain/po/MallPermission.java | 12 --- .../resources/mapper/MallPermissionMapper.xml | 10 +-- 5 files changed, 53 insertions(+), 59 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MallPermissionController.java b/mallinkAdmin/src/main/java/com/simple/controller/MallPermissionController.java index f0ac7ce96..858e0c21a 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MallPermissionController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MallPermissionController.java @@ -12,7 +12,6 @@ import com.simple.common.Result; import com.simple.common.ResultData; import com.simple.domain.po.MallPermission; import com.simple.service.MallPermissionService; -import com.simple.service.MallRolePermissionService; /** * @author chenkx diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MallRoleController.java b/mallinkAdmin/src/main/java/com/simple/controller/MallRoleController.java index e1c2e3016..6cf72708e 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MallRoleController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MallRoleController.java @@ -27,17 +27,15 @@ import io.swagger.annotations.Api; @RestController @RequestMapping("role") @Api(description="角色相关接口") -public class MallRoleController extends BaseController{ +public class MallRoleController extends BaseController { + + private Logger logger = Logger.getLogger(MallRoleController.class); @Autowired private MallRoleService sysRoleService; @Autowired private MallRolePermissionService sysRolePermissionService; - - - - private Logger logger = Logger.getLogger(MallRoleController.class); @GetMapping("list") public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { diff --git a/mallinkAdmin/src/main/java/com/simple/controller/MallUserInfoController.java b/mallinkAdmin/src/main/java/com/simple/controller/MallUserInfoController.java index 219383f82..f330dbccc 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/MallUserInfoController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/MallUserInfoController.java @@ -3,6 +3,8 @@ package com.simple.controller; import java.util.HashMap; import java.util.Map; +import com.simple.domain.po.*; +import com.simple.service.*; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.Assert; @@ -14,14 +16,6 @@ import org.springframework.web.bind.annotation.RestController; import com.github.pagehelper.PageInfo; import com.simple.common.ResultData; -import com.simple.domain.po.MallRole; -import com.simple.domain.po.MallRolePermission; -import com.simple.domain.po.MallUserInfo; -import com.simple.domain.po.MallUserRole; -import com.simple.service.MallRolePermissionService; -import com.simple.service.MallRoleService; -import com.simple.service.MallUserInfoService; -import com.simple.service.MallUserRoleService; import com.simple.shiro.PasswordHelper; import com.simple.shiro.UserSession; @@ -35,7 +29,7 @@ import io.swagger.annotations.ApiOperation; @Api(value = "API - UserInfoController", description = "用户接口") @RestController @RequestMapping("user") -public class MallUserInfoController { +public class MallUserInfoController extends BaseController { @Autowired MallUserInfoService userInfoService; @@ -48,12 +42,17 @@ public class MallUserInfoController { @Autowired MallUserRoleService mallUserRoleService; + + @Autowired + MallPermissionService mallPermissionService; + @Autowired MallRolePermissionService mallRolePermissionService; @ApiOperation(value = "用户分页接口", response = String.class) @GetMapping("lists") public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize){ + userInfo.setTenantId(getTenantId()); final PageInfo page = userInfoService.listAsPage(userInfo, pageNum, pageSize); for(MallUserInfo u:page.getList()) { MallUserRole r =new MallUserRole(); @@ -61,8 +60,10 @@ public class MallUserInfoController { PageInfo ur = userRoleService.listAsPage(r, 1, 1); if(ur.getSize()>0) { MallRole role = mallRoleService.getById(ur.getList().get(0).getRoleId()); - u.setRoleName(role.getName()); - u.setRoleId(role.getId()); + if (role != null) { + u.setRoleName(role.getName()); + u.setRoleId(role.getId()); + } } u.setPassword(null);//不返回密码 } @@ -84,6 +85,7 @@ public class MallUserInfoController { Assert.notNull(userInfo.getPassword(), "密码不能为空"); PasswordHelper passwordHelper = new PasswordHelper(); passwordHelper.encryptPassword(userInfo); + userInfo.setTenantId(getTenantId()); userInfoService.saveOrUpdate(userInfo); if(userInfo.getRoleId()!=null) { MallUserRole r = new MallUserRole(); @@ -103,6 +105,7 @@ public class MallUserInfoController { // PasswordHelper passwordHelper = new PasswordHelper(); // passwordHelper.encryptPassword(userInfo); userInfo.setPassword(null); + userInfo.setTenantId(getTenantId()); userInfoService.saveOrUpdate(userInfo); if(userInfo.getRoleId()!=null) { userRoleService.deleteByUserId(userInfo.getId()); @@ -133,6 +136,7 @@ public class MallUserInfoController { public ResultData modifyStatus(Long userId, Integer status) { MallUserInfo userInfo = userInfoService.getById(userId); userInfo.setStatus(status); + userInfo.setTenantId(getTenantId()); userInfoService.saveOrUpdate(userInfo); return new ResultData(userInfo); } @@ -190,27 +194,38 @@ public class MallUserInfoController { public ResultData getUserInfo(){ MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); info.setPassword("保密"); -// System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); - MallUserRole ur = new MallUserRole(); - ur.setUid(info.getId()); - PageInfo page = mallUserRoleService.listAsPage(ur, 1, 1); - if(page.getSize()>0) { - Long roleId = page.getList().get(0).getRoleId(); - MallRolePermission p = new MallRolePermission(); - p.setRoleId(roleId); - p.setTenantId(info.getTenantId()); - PageInfo listAsPage = mallRolePermissionService.listAsPage(p, 1, 100); - String menus = ""; - for(MallRolePermission rp :listAsPage.getList()) { - menus+=rp.getPermissionId()+","; - } - if(menus.length()>0) { - menus = menus.substring(0, menus.length()-1); - } - info.setMenus(menus); - } - ResultData data = new ResultData(); - data.data=info; - return data; + if (info.getIsAdmin() == 1) { // isAdmin + MallPermission q = new MallPermission(); + PageInfo list = mallPermissionService.listAsPage(q,1,100); + String menus = ""; + for(MallPermission rp :list.getList()) { + menus+=rp.getId()+","; + } + if(menus.length()>0) { + menus = menus.substring(0, menus.length()-1); + } + info.setMenus(menus); + } else { + // System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); + MallUserRole ur = new MallUserRole(); + ur.setUid(info.getId()); + PageInfo page = mallUserRoleService.listAsPage(ur, 1, 1); + if(page.getSize()>0) { + Long roleId = page.getList().get(0).getRoleId(); + MallRolePermission p = new MallRolePermission(); + p.setRoleId(roleId); + p.setTenantId(info.getTenantId()); + PageInfo listAsPage = mallRolePermissionService.listAsPage(p, 1, 100); + String menus = ""; + for(MallRolePermission rp :listAsPage.getList()) { + menus+=rp.getPermissionId()+","; + } + if(menus.length()>0) { + menus = menus.substring(0, menus.length()-1); + } + info.setMenus(menus); + } + } + return new ResultData(info); } } diff --git a/mallinkService/src/main/java/com/simple/domain/po/MallPermission.java b/mallinkService/src/main/java/com/simple/domain/po/MallPermission.java index d803518b1..de48a9d35 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/MallPermission.java +++ b/mallinkService/src/main/java/com/simple/domain/po/MallPermission.java @@ -40,11 +40,6 @@ public class MallPermission implements Serializable { this.ids = ids; } - - - /*租户ID**/ - @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") - private String tenantId; /*权限名称[LIKE]**/ @io.swagger.annotations.ApiModelProperty(value="权限名称[LIKE]",name="name") private String name; @@ -85,12 +80,6 @@ public class MallPermission implements Serializable { private Integer sortLte; @Transient private Integer sortLt; - public String getTenantId() { - return tenantId; - } - public void setTenantId(String _tenantId) { - tenantId = _tenantId; - } public String getName() { return name; } @@ -193,7 +182,6 @@ public class MallPermission implements Serializable { public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") ,Available_ASC("`available` ASC"),Available_DESC("`available` DESC") ,ParentId_ASC("`parentId` ASC"),ParentId_DESC("`parentId` DESC") diff --git a/mallinkService/src/main/resources/mapper/MallPermissionMapper.xml b/mallinkService/src/main/resources/mapper/MallPermissionMapper.xml index f6cdddd38..21d09e52d 100644 --- a/mallinkService/src/main/resources/mapper/MallPermissionMapper.xml +++ b/mallinkService/src/main/resources/mapper/MallPermissionMapper.xml @@ -3,7 +3,6 @@ - @@ -15,7 +14,7 @@ - `id`,`tenant_id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort` + `id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort` @@ -25,12 +24,7 @@ and `id` = #{id} - - - and `tenant_id` like concat('%', #{tenantId},'%') - - - + and `name` like concat('%', #{name},'%') From 67cd495a5f55e4dbb5ebcbb5817be0fd30bd1b78 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 14:13:17 +0800 Subject: [PATCH 11/28] =?UTF-8?q?[=E6=95=B0=E6=8D=AE=E5=BA=93driver?= =?UTF-8?q?=E5=8D=87=E7=BA=A7][=E6=96=B0=E5=A2=9E]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkAdmin/src/main/resources/application-dev.yml | 2 +- mallinkAdmin/src/main/resources/application-prod.yml | 2 +- mallinkBApi/src/main/resources/application-dev.yml | 2 +- mallinkBApi/src/main/resources/application-prod.yml | 2 +- mallinkCApi/src/main/resources/application-dev.yml | 2 +- mallinkCApi/src/main/resources/application-prod.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mallinkAdmin/src/main/resources/application-dev.yml b/mallinkAdmin/src/main/resources/application-dev.yml index 5c5754a03..86cf4f4c0 100644 --- a/mallinkAdmin/src/main/resources/application-dev.yml +++ b/mallinkAdmin/src/main/resources/application-dev.yml @@ -5,7 +5,7 @@ spring: username: mallone password: m@1l0ne123@# type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 diff --git a/mallinkAdmin/src/main/resources/application-prod.yml b/mallinkAdmin/src/main/resources/application-prod.yml index f4ef8febb..43cac8073 100644 --- a/mallinkAdmin/src/main/resources/application-prod.yml +++ b/mallinkAdmin/src/main/resources/application-prod.yml @@ -5,7 +5,7 @@ spring: username: root password: 1234qwer type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 diff --git a/mallinkBApi/src/main/resources/application-dev.yml b/mallinkBApi/src/main/resources/application-dev.yml index c40f720f9..eb2ea3414 100644 --- a/mallinkBApi/src/main/resources/application-dev.yml +++ b/mallinkBApi/src/main/resources/application-dev.yml @@ -5,7 +5,7 @@ spring: username: mallone password: m@1l0ne123@# type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 diff --git a/mallinkBApi/src/main/resources/application-prod.yml b/mallinkBApi/src/main/resources/application-prod.yml index 79193a5e4..d68a041aa 100644 --- a/mallinkBApi/src/main/resources/application-prod.yml +++ b/mallinkBApi/src/main/resources/application-prod.yml @@ -5,7 +5,7 @@ spring: username: root password: 1234qwer type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 diff --git a/mallinkCApi/src/main/resources/application-dev.yml b/mallinkCApi/src/main/resources/application-dev.yml index c40f720f9..eb2ea3414 100644 --- a/mallinkCApi/src/main/resources/application-dev.yml +++ b/mallinkCApi/src/main/resources/application-dev.yml @@ -5,7 +5,7 @@ spring: username: mallone password: m@1l0ne123@# type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 diff --git a/mallinkCApi/src/main/resources/application-prod.yml b/mallinkCApi/src/main/resources/application-prod.yml index 79193a5e4..d68a041aa 100644 --- a/mallinkCApi/src/main/resources/application-prod.yml +++ b/mallinkCApi/src/main/resources/application-prod.yml @@ -5,7 +5,7 @@ spring: username: root password: 1234qwer type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: com.mysql.jdbc.Driver + driver_class: com.mysql.cj.jdbc.Driver filters: stat maxActive: 20 initialSize: 1 From 7cff02e473b32d464fe40e60300386b23b1da439 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 14:54:06 +0800 Subject: [PATCH 12/28] =?UTF-8?q?[appType=E6=95=B4=E7=90=86][=E6=95=B4?= =?UTF-8?q?=E7=90=86]:appType=E6=8D=A2=E6=88=90enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/schedule/WxAppVisitSchedule.java | 3 +- .../java/com/simple/enums/EnumAppType.java | 38 +++++++++++++++++++ .../service/impl/WxMerchantServiceImpl.java | 3 +- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 mallinkService/src/main/java/com/simple/enums/EnumAppType.java diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java index 2325d772e..5248e4b6a 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -6,6 +6,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map; +import com.simple.enums.EnumAppType; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; @@ -55,7 +56,7 @@ public class WxAppVisitSchedule { String yesterday = new SimpleDateFormat("yyyyMMdd").format(time); // "wx8eb8275b78db4ede", "76c43df01296998d8ce12383f213ac10"; WxAppinfo appInfo = new WxAppinfo(); - appInfo.setType(2); + appInfo.setType(EnumAppType.C.getCode()); PageInfo page = WxAppinfoService.listAsPage(appInfo, 1, 10000); for(WxAppinfo w :page.getList()) { w.getAppId(); diff --git a/mallinkService/src/main/java/com/simple/enums/EnumAppType.java b/mallinkService/src/main/java/com/simple/enums/EnumAppType.java new file mode 100644 index 000000000..d55c2e406 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/enums/EnumAppType.java @@ -0,0 +1,38 @@ +package com.simple.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumAppType { + + // 1-B端, 2-C端 + + B(1, "B端"), + C(2, "C端") + ; + + public static EnumAppType getEnum(Integer code) { + for (EnumAppType value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumAppType(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java index b78648a71..2a599d4b5 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxMerchantServiceImpl.java @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.simple.common.IdWorker; import com.simple.domain.po.*; +import com.simple.enums.EnumAppType; import com.simple.enums.EnumCarVendor; import com.simple.mapper.*; import com.simple.service.WxMerchantService; @@ -87,7 +88,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { WxAppinfo wxAppinfo = new WxAppinfo(); wxAppinfo.setTenantId(wxMerchant.getTenantId()); - wxAppinfo.setType(1); + wxAppinfo.setType(EnumAppType.B.getCode()); wxAppinfo = wxAppinfoMapper.findList(wxAppinfo).get(0); final IdWorker idWorker = IdWorker.get(); From 780d2ff8c479127c0205f0b66ddb64b1531b60dd Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 14:56:58 +0800 Subject: [PATCH 13/28] =?UTF-8?q?[add=20TODO][=E6=95=B4=E7=90=86]:hardcode?= =?UTF-8?q?=20appId=EF=BC=8Cadd=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/schedule/WxAppVisitSchedule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java index 5248e4b6a..8492dd227 100644 --- a/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java +++ b/mallinkAdmin/src/main/java/com/simple/schedule/WxAppVisitSchedule.java @@ -64,6 +64,7 @@ public class WxAppVisitSchedule { w.getTenantId(); //TODO 因为数据库表里数据问题,暂时不通过这种方式处理 } + // TODO hardcode appId String appId = "wx8eb8275b78db4ede"; String key ="76c43df01296998d8ce12383f213ac10"; String talentId ="456"; @@ -99,6 +100,7 @@ public class WxAppVisitSchedule { // "visit_depth":3.1311,"session_cnt":61,"visit_pv":645,"visit_uv_new":3} logger.info(JSON.toJSONString(itemMap)); WxUserVisit v = new WxUserVisit(); + // TODO hardcode appId v.setAppId("wx8eb8275b78db4ede"); String time = itemMap.get("ref_date")+""; Date date = new SimpleDateFormat("yyyyMMdd").parse(time); From 513e6b821d0e7b4325b8e2f08fab6744de5a00c8 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 15:12:20 +0800 Subject: [PATCH 14/28] =?UTF-8?q?[=E5=88=B8=E4=BB=B7=E6=A0=BC=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98][=E4=BF=AE=E5=A4=8D]:=E5=88=B8?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E7=B2=BE=E7=A1=AE=E5=88=B0=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/controller/WxCouponController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index e62b9a77c..12bd3fe55 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -109,13 +109,13 @@ public class WxCouponController extends BaseController //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); if(StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())){ - wxCoupon.setSalePrice((int)Double.parseDouble(wxCoupon.getSalePriceStr())*100); + wxCoupon.setSalePrice((int)(Double.parseDouble(wxCoupon.getSalePriceStr()))*100); } if(StringUtils.isNotEmpty(wxCoupon.getUsePriceStr())){ - wxCoupon.setUsePrice((int)Double.parseDouble(wxCoupon.getUsePriceStr())*100); + wxCoupon.setUsePrice((int)(Double.parseDouble(wxCoupon.getUsePriceStr())*100)); } if(StringUtils.isNotEmpty(wxCoupon.getPriceStr())){ - wxCoupon.setPrice((int)Double.parseDouble(wxCoupon.getPriceStr())*100); + wxCoupon.setPrice((int)(Double.parseDouble(wxCoupon.getPriceStr())*100)); } if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { String[] arys = wxCoupon.getBusiness().split(","); From ca25be8ebfc5b7b843eda60ba3ef2646d73da0de Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 15:39:56 +0800 Subject: [PATCH 15/28] =?UTF-8?q?[=E5=88=B8=E4=BB=B7=E6=A0=BC=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98][=E4=BF=AE=E5=A4=8D]:=E5=88=B8?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E7=B2=BE=E7=A1=AE=E5=88=B0=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/simple/controller/WxCouponController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java index 12bd3fe55..54ffde4b3 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCouponController.java @@ -109,7 +109,7 @@ public class WxCouponController extends BaseController //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); if(StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())){ - wxCoupon.setSalePrice((int)(Double.parseDouble(wxCoupon.getSalePriceStr()))*100); + wxCoupon.setSalePrice((int)(Double.parseDouble(wxCoupon.getSalePriceStr())*100)); } if(StringUtils.isNotEmpty(wxCoupon.getUsePriceStr())){ wxCoupon.setUsePrice((int)(Double.parseDouble(wxCoupon.getUsePriceStr())*100)); From 01fd37d2471a4187df3d7d6c605882ab53f576c2 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 20:23:50 +0800 Subject: [PATCH 16/28] =?UTF-8?q?[=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95][?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0]:=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=8F=E7=BA=AC=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxUserGrantController.java | 9 ++- .../java/com/simple/domain/po/WxCUser.java | 70 ++++++++++++------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index 286d2ef8c..9eeabfb8b 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; +import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -60,7 +61,7 @@ public class WxUserGrantController extends BaseController { */ @AuthIgnore @PostMapping("/login") - @ApiOperation(value="用户登录", notes="{\"appId\":\"string\",\"code\":\"string\",\"scene\":\"string\",\"sceneAddress\":\"string\"}") + @ApiOperation(value="用户登录", notes="{\"appId\":\"string\",\"code\":\"string\",\"scene\":\"string\",\"sceneAddress\":\"string\",\"latitude\":\"string\",\"longitude\":\"string\"}") public ResultData userLogin(@RequestBody Map map) { logger.debug(map.toString()); @@ -69,6 +70,8 @@ public class WxUserGrantController extends BaseController { String appId = map.get("appId"); String code = map.get("code"); String sceneAddress = map.get("sceneAddress"); + String longitude = map.get("longtitude"); + String latitude = map.get("latitude"); //登录凭证不能为空 if (StringUtils.isBlank(appId)) { return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); @@ -112,6 +115,8 @@ public class WxUserGrantController extends BaseController { user1.setSessionKey(session_key); if (user1.getSceneAddress() == null) user1.setSceneAddress(sceneAddress); + user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); + user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user1); resultMap.put("token", token); @@ -123,6 +128,8 @@ public class WxUserGrantController extends BaseController { if (user.getSceneAddress() == null) user.setSceneAddress(sceneAddress); user.setSessionKey(session_key); + user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); + user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user); resultMap.put("token", token); diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java index cb05dea3b..f4d1ef70f 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxCUser.java @@ -116,6 +116,12 @@ public class WxCUser implements Serializable { /*用户过期时间**/ @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") private Date expireTime; + /*经度**/ + @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") + private BigDecimal longitude; + /*纬度**/ + @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") + private BigDecimal latitude; //渠道名称 @Transient @@ -275,35 +281,51 @@ public class WxCUser implements Serializable { expireTime = _expireTime; } + public BigDecimal getLongitude() { + return longitude; + } + + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + public BigDecimal getLatitude() { + return latitude; + } + + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") - ,OpenId_ASC("`open_id` ASC"),OpenId_DESC("`open_id` DESC") - ,UnionId_ASC("`union_id` ASC"),UnionId_DESC("`union_id` DESC") - ,NickName_ASC("`nick_name` ASC"),NickName_DESC("`nick_name` DESC") - ,Gender_ASC("`gender` ASC"),Gender_DESC("`gender` DESC") - ,AvatarUrl_ASC("`avatar_url` ASC"),AvatarUrl_DESC("`avatar_url` DESC") - ,Phone_ASC("`phone` ASC"),Phone_DESC("`phone` DESC") - ,PurePhone_ASC("`pure_phone` ASC"),PurePhone_DESC("`pure_phone` DESC") - ,City_ASC("`city` ASC"),City_DESC("`city` DESC") - ,Province_ASC("`province` ASC"),Province_DESC("`province` DESC") - ,Language_ASC("`language` ASC"),Language_DESC("`language` DESC") - ,CountryCode_ASC("`country_code` ASC"),CountryCode_DESC("`country_code` DESC") - ,RegisterIp_ASC("`register_ip` ASC"),RegisterIp_DESC("`register_ip` DESC") - ,VerifyCodePhone_ASC("`verify_code_phone` ASC"),VerifyCodePhone_DESC("`verify_code_phone` DESC") - ,QrcodeSource_ASC("`qrcode_source` ASC"),QrcodeSource_DESC("`qrcode_source` DESC") - ,Scene_ASC("`scene` ASC"),Scene_DESC("`scene` DESC") - ,SceneAddress_ASC("`scene_address` ASC"),SceneAddress_DESC("`scene_address` DESC") - ,SessionKey_ASC("`session_key` ASC"),SessionKey_DESC("`session_key` DESC") - ,Score_ASC("`score` ASC"),Score_DESC("`score` DESC") - ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") - ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") - ,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC") - ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") - ,ExpireTime_ASC("`expire_time` ASC"),ExpireTime_DESC("`expire_time` DESC") + ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") + ,OpenId_ASC("`open_id` ASC"),OpenId_DESC("`open_id` DESC") + ,UnionId_ASC("`union_id` ASC"),UnionId_DESC("`union_id` DESC") + ,NickName_ASC("`nick_name` ASC"),NickName_DESC("`nick_name` DESC") + ,Gender_ASC("`gender` ASC"),Gender_DESC("`gender` DESC") + ,AvatarUrl_ASC("`avatar_url` ASC"),AvatarUrl_DESC("`avatar_url` DESC") + ,Phone_ASC("`phone` ASC"),Phone_DESC("`phone` DESC") + ,PurePhone_ASC("`pure_phone` ASC"),PurePhone_DESC("`pure_phone` DESC") + ,City_ASC("`city` ASC"),City_DESC("`city` DESC") + ,Province_ASC("`province` ASC"),Province_DESC("`province` DESC") + ,Language_ASC("`language` ASC"),Language_DESC("`language` DESC") + ,CountryCode_ASC("`country_code` ASC"),CountryCode_DESC("`country_code` DESC") + ,RegisterIp_ASC("`register_ip` ASC"),RegisterIp_DESC("`register_ip` DESC") + ,VerifyCodePhone_ASC("`verify_code_phone` ASC"),VerifyCodePhone_DESC("`verify_code_phone` DESC") + ,QrcodeSource_ASC("`qrcode_source` ASC"),QrcodeSource_DESC("`qrcode_source` DESC") + ,Scene_ASC("`scene` ASC"),Scene_DESC("`scene` DESC") + ,SceneAddress_ASC("`scene_address` ASC"),SceneAddress_DESC("`scene_address` DESC") + ,SessionKey_ASC("`session_key` ASC"),SessionKey_DESC("`session_key` DESC") + ,Score_ASC("`score` ASC"),Score_DESC("`score` DESC") + ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") + ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") + ,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC") + ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") + ,ExpireTime_ASC("`expire_time` ASC"),ExpireTime_DESC("`expire_time` DESC") + ,Longitude_ASC("`longitude` ASC"),Longitude_DESC("`longitude` DESC") + ,Latitude_ASC("`latitude` ASC"),Latitude_DESC("`latitude` DESC") ; private String value; Field(String value){ From ff9f5a16a70331b51cfc7a27d30fa0e3dbd69363 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 20:25:06 +0800 Subject: [PATCH 17/28] =?UTF-8?q?[=E9=80=80=E6=AC=BE][=E6=96=B0=E5=A2=9E]:?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WxRefundOrderController.java | 8 +++---- .../com/simple/domain/po/WxPayAccount.java | 22 +++++++++++++++---- .../impl/WxRefundOrderServiceImpl.java | 12 +++++++--- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/mallinkBApi/src/main/java/com/simple/controller/WxRefundOrderController.java b/mallinkBApi/src/main/java/com/simple/controller/WxRefundOrderController.java index 89239c4db..fc9b9f350 100644 --- a/mallinkBApi/src/main/java/com/simple/controller/WxRefundOrderController.java +++ b/mallinkBApi/src/main/java/com/simple/controller/WxRefundOrderController.java @@ -88,12 +88,12 @@ public class WxRefundOrderController extends BaseController { try { payOrder = wxPayOrderService.getByObj(payOrderQ); } catch (Exception e) { - logger.error("payOrder不存在"); - return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND.getCode(), "支付订单不存在,无法退款"); + logger.error("支付订单不存在(payOrder不存在)"); + return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); } if (payOrder == null) { - logger.error("payOrder不存在"); - return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND.getCode(), "支付订单不存在,无法退款"); + logger.error("支付订单不存在(payOrder不存在)"); + return new ResultData(ErrorCode.PAY_ORDER_NOT_FOUND); } WxRefundOrder refundOrderQ = new WxRefundOrder(); diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java b/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java index 7da35bddd..1124cea4a 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java @@ -54,6 +54,9 @@ public class WxPayAccount implements Serializable { /*证书本地存放位置**/ @io.swagger.annotations.ApiModelProperty(value="证书本地存放位置",name="certPath") private String certPath; + /*证书密码**/ + @io.swagger.annotations.ApiModelProperty(value="证书密码",name="certPass") + private String certPass; public String getMchId() { return mchId; } @@ -79,6 +82,14 @@ public class WxPayAccount implements Serializable { certPath = _certPath; } + public String getCertPass() { + return certPass; + } + + public void setCertPass(String certPass) { + this.certPass = certPass; + } + public String getPayNotifyUrl() { return notifyUrl + "/pay"; } @@ -92,10 +103,11 @@ public class WxPayAccount implements Serializable { public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,MchId_ASC("`mchId` ASC"),MchId_DESC("`mchId` DESC") - ,ApiKey_ASC("`apiKey` ASC"),ApiKey_DESC("`apiKey` DESC") - ,NotifyUrl_ASC("`notifyUrl` ASC"),NotifyUrl_DESC("`notifyUrl` DESC") - ,CertPath_ASC("`certPath` ASC"),CertPath_DESC("`certPath` DESC") + ,MchId_ASC("`mch_id` ASC"),MchId_DESC("`mch_id` DESC") + ,ApiKey_ASC("`api_key` ASC"),ApiKey_DESC("`api_key` DESC") + ,NotifyUrl_ASC("`notify_url` ASC"),NotifyUrl_DESC("`notify_url` DESC") + ,CertPath_ASC("`cert_path` ASC"),CertPath_DESC("`cert_path` DESC") + ,CertPass_ASC("`cert_pass` ASC"),CertPass_DESC("`cert_pass` DESC") ; private String value; Field(String value){ @@ -128,6 +140,8 @@ public class WxPayAccount implements Serializable { sb.append(","); sb.append(fields[k].toString()); } + + this.sortColumns = sb.toString(); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java index 053739db5..ad4adf796 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java @@ -261,7 +261,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { wxRefundOrderP.setAppid(appInfo.getAppId()); wxRefundOrderP.setMch_id(payAccount.getMchId()); wxRefundOrderP.setNonce_str(noncestr); - if (record.getTransactionId() == null) + if (record.getTransactionId() != null) wxRefundOrderP.setTransaction_id(record.getTransactionId()); wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); wxRefundOrderP.setTotal_fee(record.getTotalFee()); @@ -272,13 +272,19 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { try { signMap = BeanUtils.toStringMap(wxRefundOrderP); } catch (Exception e) { - logger.error("退款签名异常"); + logger.error("退款命令生辰: " + e.getMessage()); throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); } String signAgent = WxPayment.createSign(signMap, payAccount.getApiKey()); signMap.put("sign", signAgent); - String response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getApiKey()); + String response = null; + try { + response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getCertPass()); + } catch (Exception e) { + logger.error("退款异常: " + e.getMessage()); + throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "退款异常"); + } logger.info("微信退款订单:" + wxRefundOrderP.toString() + ", response: " + response.toString()); Map returnMap = WxPayment.xmlToMap(response); String result_no = returnMap.get("result_code"); From 430d9c97f5c2c57d869c55612619b2edbf6c59cc Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 20:26:28 +0800 Subject: [PATCH 18/28] =?UTF-8?q?[=E6=8E=92=E5=BA=8F][=E6=B7=BB=E5=8A=A0]:?= =?UTF-8?q?park=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/domain/po/WxPark.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxPark.java b/mallinkService/src/main/java/com/simple/domain/po/WxPark.java index 7459a8e65..353963fec 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxPark.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxPark.java @@ -151,17 +151,17 @@ public class WxPark implements Serializable { public static enum Field { Id_ASC("`id` ASC"),Id_DESC("`id` DESC") - ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") - ,ImgUrl_ASC("`imgUrl` ASC"),ImgUrl_DESC("`imgUrl` DESC") + ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") + ,ImgUrl_ASC("`img_url` ASC"),ImgUrl_DESC("`img_url` DESC") ,Addr_ASC("`addr` ASC"),Addr_DESC("`addr` DESC") ,Number_ASC("`number` ASC"),Number_DESC("`number` DESC") - ,EntryExit_ASC("`entryExit` ASC"),EntryExit_DESC("`entryExit` DESC") - ,StopFee_ASC("`stopFee` ASC"),StopFee_DESC("`stopFee` DESC") - ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") - ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") - ,ParkId_ASC("`parkId` ASC"),ParkId_DESC("`parkId` DESC") - ,VendorType_ASC("`vendorType` ASC"),VendorType_DESC("`vendorType` DESC") - ,VendorParams_ASC("`vendorParams` ASC"),VendorParams_DESC("`vendorParams` DESC") + ,EntryExit_ASC("`entry_exit` ASC"),EntryExit_DESC("`entry_exit` DESC") + ,StopFee_ASC("`stop_fee` ASC"),StopFee_DESC("`stop_fee` DESC") + ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") + ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") + ,ParkId_ASC("`park_id` ASC"),ParkId_DESC("`park_id` DESC") + ,VendorType_ASC("`vendor_type` ASC"),VendorType_DESC("`vendor_type` DESC") + ,VendorParams_ASC("`vendor_params` ASC"),VendorParams_DESC("`vendor_params` DESC") ; private String value; Field(String value){ From d68f94e521a19523b1321874e4749c2a4607ce26 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 20:29:20 +0800 Subject: [PATCH 19/28] =?UTF-8?q?[=E6=8E=92=E5=BA=8F][=E6=B7=BB=E5=8A=A0]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/domain/po/CouponInject.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/CouponInject.java b/mallinkService/src/main/java/com/simple/domain/po/CouponInject.java index 42f4dce8b..d3ad2d069 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/CouponInject.java +++ b/mallinkService/src/main/java/com/simple/domain/po/CouponInject.java @@ -205,20 +205,20 @@ public class CouponInject implements Serializable { public static enum Field { 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") - ,MUserId_ASC("`mUserId` ASC"),MUserId_DESC("`mUserId` DESC") - ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") - ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") - ,CouponName_ASC("`couponName` ASC"),CouponName_DESC("`couponName` DESC") - ,SendTime_ASC("`sendTime` ASC"),SendTime_DESC("`sendTime` DESC") - ,SendAmount_ASC("`sendAmount` ASC"),SendAmount_DESC("`sendAmount` DESC") + ,MUserId_ASC("`m_user_id` ASC"),MUserId_DESC("`m_user_id` DESC") + ,SendType_ASC("`send_type` ASC"),SendType_DESC("`send_type` DESC") + ,CouponId_ASC("`coupon_id` ASC"),CouponId_DESC("`coupon_id` DESC") + ,CouponName_ASC("`coupon_name` ASC"),CouponName_DESC("`coupon_name` DESC") + ,SendTime_ASC("`send_time` ASC"),SendTime_DESC("`send_time` DESC") + ,SendAmount_ASC("`send_amount` ASC"),SendAmount_DESC("`send_amount` DESC") ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") - ,ErrorMsg_ASC("`errorMsg` ASC"),ErrorMsg_DESC("`errorMsg` DESC") + ,ErrorMsg_ASC("`error_msg` ASC"),ErrorMsg_DESC("`error_msg` DESC") ,Tags_ASC("`tags` ASC"),Tags_DESC("`tags` DESC") - ,ModelId_ASC("`modelId` ASC"),ModelId_DESC("`modelId` DESC") - ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") - ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") + ,ModelId_ASC("`model_id` ASC"),ModelId_DESC("`model_id` DESC") + ,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC") + ,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC") ; private String value; Field(String value){ @@ -252,6 +252,8 @@ public class CouponInject implements Serializable { sb.append(fields[k].toString()); } + this.sortColumns = sb.toString(); + } public void setSortColumns(String sortColumns) From a97d0261afaf3527ae7037d69ef8959dbcc0dc44 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 21:25:33 +0800 Subject: [PATCH 20/28] =?UTF-8?q?[=E9=80=80=E6=AC=BE][=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/domain/po/WxPayAccount.java | 12 ------------ .../service/impl/WxRefundOrderServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java b/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java index 1124cea4a..95f7ee127 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java +++ b/mallinkService/src/main/java/com/simple/domain/po/WxPayAccount.java @@ -54,9 +54,6 @@ public class WxPayAccount implements Serializable { /*证书本地存放位置**/ @io.swagger.annotations.ApiModelProperty(value="证书本地存放位置",name="certPath") private String certPath; - /*证书密码**/ - @io.swagger.annotations.ApiModelProperty(value="证书密码",name="certPass") - private String certPass; public String getMchId() { return mchId; } @@ -82,14 +79,6 @@ public class WxPayAccount implements Serializable { certPath = _certPath; } - public String getCertPass() { - return certPass; - } - - public void setCertPass(String certPass) { - this.certPass = certPass; - } - public String getPayNotifyUrl() { return notifyUrl + "/pay"; } @@ -107,7 +96,6 @@ public class WxPayAccount implements Serializable { ,ApiKey_ASC("`api_key` ASC"),ApiKey_DESC("`api_key` DESC") ,NotifyUrl_ASC("`notify_url` ASC"),NotifyUrl_DESC("`notify_url` DESC") ,CertPath_ASC("`cert_path` ASC"),CertPath_DESC("`cert_path` DESC") - ,CertPass_ASC("`cert_pass` ASC"),CertPass_DESC("`cert_pass` DESC") ; private String value; Field(String value){ diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java index ad4adf796..cd32d4292 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java @@ -280,7 +280,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { signMap.put("sign", signAgent); String response = null; try { - response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getCertPass()); + response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getMchId()); } catch (Exception e) { logger.error("退款异常: " + e.getMessage()); throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "退款异常"); From 5765c49087763cbe53867419fbdf51d00192a778 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 21:36:38 +0800 Subject: [PATCH 21/28] =?UTF-8?q?[=E9=80=80=E6=AC=BE][=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/service/impl/WxRefundOrderServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java index cd32d4292..be31e0355 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java @@ -264,6 +264,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { if (record.getTransactionId() != null) wxRefundOrderP.setTransaction_id(record.getTransactionId()); wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); + wxRefundOrderP.setOut_refund_no(String.valueOf(id)); wxRefundOrderP.setTotal_fee(record.getTotalFee()); wxRefundOrderP.setRefund_fee(record.getRefundFee()); @@ -291,6 +292,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { String refund_id = returnMap.get("refund_id"); // 设置 微信退款订单号 record.setRefundId(refund_id); + record.setRefundVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); if ("SUCCESS".equals(result_no)) { logger.error("微信退款订单申请成功: " + returnMap.toString()); try { From 8a877a5511d5814468aebf2dde5d48cd2e1d03be Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 21:37:29 +0800 Subject: [PATCH 22/28] =?UTF-8?q?[=E9=80=80=E6=AC=BE][=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/service/impl/WxRefundOrderServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java index be31e0355..ce088b84a 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java @@ -230,6 +230,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { // 创建退款订单 final IdWorker idWorker = IdWorker.get(); Long id = idWorker.nextId(); + String out_refund_id = String.valueOf(id); Date currentDate = new Date(); record.setId(id); @@ -264,7 +265,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { if (record.getTransactionId() != null) wxRefundOrderP.setTransaction_id(record.getTransactionId()); wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); - wxRefundOrderP.setOut_refund_no(String.valueOf(id)); + wxRefundOrderP.setOut_refund_no(out_refund_id); wxRefundOrderP.setTotal_fee(record.getTotalFee()); wxRefundOrderP.setRefund_fee(record.getRefundFee()); From 2eba5397b24ca7212b6f34c1f4e31dd307bd0ba4 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 21:45:29 +0800 Subject: [PATCH 23/28] =?UTF-8?q?[=E9=80=80=E6=AC=BE][=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/WxRefundOrderMapper.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml index f20bf75d5..823cad9fd 100644 --- a/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRefundOrderMapper.xml @@ -111,7 +111,8 @@ #{idItem} - + + and `refund_id` is not null order by ${sortColumns} From cc0cb4d15adc5447716359437376d5301bef30fa Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 21:59:43 +0800 Subject: [PATCH 24/28] =?UTF-8?q?[=E9=80=80=E5=88=B8=E9=80=80=E6=AC=BE][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/pay/WxRefundOrderP.java | 18 ++++++++++++++++++ .../com/simple/service/WxOrderService.java | 2 ++ .../service/impl/WxCouponOrderServiceImpl.java | 6 ++++++ .../service/impl/WxOrderServiceImpl.java | 3 ++- .../service/impl/WxRefundOrderServiceImpl.java | 2 ++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/simple/pay/WxRefundOrderP.java b/mallinkService/src/main/java/com/simple/pay/WxRefundOrderP.java index d83000ac1..09aa173c2 100644 --- a/mallinkService/src/main/java/com/simple/pay/WxRefundOrderP.java +++ b/mallinkService/src/main/java/com/simple/pay/WxRefundOrderP.java @@ -13,6 +13,8 @@ public class WxRefundOrderP { private String out_refund_no; // 商户退款单号 private Integer total_fee; // 支付金额 private Integer refund_fee; // 退款金额 + private String refund_desc; // 退款原因 + private String notify_url; // 回调接口 public String getAppid() { return appid; @@ -86,6 +88,22 @@ public class WxRefundOrderP { this.refund_fee = refund_fee; } + public String getRefund_desc() { + return refund_desc; + } + + public void setRefund_desc(String refund_desc) { + this.refund_desc = refund_desc; + } + + public String getNotify_url() { + return notify_url; + } + + public void setNotify_url(String notify_url) { + this.notify_url = notify_url; + } + @Override public String toString() { final StringBuilder sb = new StringBuilder("WxRefundOrder{"); diff --git a/mallinkService/src/main/java/com/simple/service/WxOrderService.java b/mallinkService/src/main/java/com/simple/service/WxOrderService.java index 24c7d638e..c5de8208e 100644 --- a/mallinkService/src/main/java/com/simple/service/WxOrderService.java +++ b/mallinkService/src/main/java/com/simple/service/WxOrderService.java @@ -87,4 +87,6 @@ public interface WxOrderService { WxOrderCVo detailCUserVo(WxOrder record); + void stockBack(WxOrder updateOrder); + } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java index 1405197cd..96749cf8d 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java @@ -15,6 +15,7 @@ import com.simple.enums.EnumCouponOrderStatus; import com.simple.exception.MallinkException; import com.simple.mapper.*; import com.simple.service.WxCouponOrderService; +import com.simple.service.WxOrderService; import org.apache.log4j.Logger; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; @@ -48,6 +49,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { @Autowired WxCUserMapper wxCUserMapper; + @Autowired + WxOrderService wxOrderService; + @Override public PageInfo listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); @@ -369,6 +373,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); } + // 库存回复+1 + wxOrderService.stockBack(wxOrder); return new ResultData(wxCouponOrder); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java index f5833eeb7..51197e495 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxOrderServiceImpl.java @@ -140,7 +140,8 @@ public class WxOrderServiceImpl implements WxOrderService { } } - private void stockBack(WxOrder updateOrder) { + @Override + public void stockBack(WxOrder updateOrder) { // 已取消/已退款,库存加1 // 获取订单相关coupon Long couponId = updateOrder.getCouponId(); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java index ce088b84a..5837d10bd 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxRefundOrderServiceImpl.java @@ -268,6 +268,8 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { wxRefundOrderP.setOut_refund_no(out_refund_id); wxRefundOrderP.setTotal_fee(record.getTotalFee()); wxRefundOrderP.setRefund_fee(record.getRefundFee()); + wxRefundOrderP.setRefund_desc("B端商户退款"); + wxRefundOrderP.setNotify_url(payAccount.getNotifyUrl() + "/refund"); if (isReal) { Map signMap = new HashMap(); From cf0ce3e3998b1227db6d378d4bc0ace07e151aa5 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 23:00:34 +0800 Subject: [PATCH 25/28] =?UTF-8?q?[C=E7=AB=AF=E7=99=BB=E5=BD=95][=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D]:=E4=BF=AE=E5=A4=8D=E7=BB=8F=E7=BA=AC=E5=BA=A6?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/simple/controller/WxUserGrantController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index 9eeabfb8b..ef55aaabc 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -70,7 +70,7 @@ public class WxUserGrantController extends BaseController { String appId = map.get("appId"); String code = map.get("code"); String sceneAddress = map.get("sceneAddress"); - String longitude = map.get("longtitude"); + String longitude = map.get("longitude"); String latitude = map.get("latitude"); //登录凭证不能为空 if (StringUtils.isBlank(appId)) { @@ -103,6 +103,7 @@ public class WxUserGrantController extends BaseController { return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); } WxCUser user = new WxCUser(); + user.setTenantId(wxAppinfo.getTenantId()); user.setAppId(appId); user.setOpenId(openId); From 63b04a6e0335499eb2972d65b13f51c0d3145205 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Sun, 2 Sep 2018 23:20:22 +0800 Subject: [PATCH 26/28] =?UTF-8?q?[=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=BB=8F=E7=BA=AC=E5=BA=A6][=E4=BF=AE=E5=A4=8D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/controller/WxUserGrantController.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index ef55aaabc..1f85fb7ad 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -116,8 +116,10 @@ public class WxUserGrantController extends BaseController { user1.setSessionKey(session_key); if (user1.getSceneAddress() == null) user1.setSceneAddress(sceneAddress); - user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); - user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); + if (longitude.length() > 0) + user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); + if (latitude.length() > 0) + user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user1); resultMap.put("token", token); @@ -129,8 +131,10 @@ public class WxUserGrantController extends BaseController { if (user.getSceneAddress() == null) user.setSceneAddress(sceneAddress); user.setSessionKey(session_key); - user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); - user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); + if (longitude.length() > 0) + user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); + if (latitude.length() > 0) + user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user); resultMap.put("token", token); From 88e61d16fbcd08764ae52dc814e803c5aef0a942 Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Mon, 3 Sep 2018 06:23:12 +0800 Subject: [PATCH 27/28] =?UTF-8?q?[=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95][?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/controller/WxUserGrantController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index 1f85fb7ad..bee95b2e9 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -116,9 +116,9 @@ public class WxUserGrantController extends BaseController { user1.setSessionKey(session_key); if (user1.getSceneAddress() == null) user1.setSceneAddress(sceneAddress); - if (longitude.length() > 0) + if (!StringUtils.isBlank(longitude)) user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); - if (latitude.length() > 0) + if (!StringUtils.isBlank(latitude)) user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user1); @@ -131,9 +131,9 @@ public class WxUserGrantController extends BaseController { if (user.getSceneAddress() == null) user.setSceneAddress(sceneAddress); user.setSessionKey(session_key); - if (longitude.length() > 0) + if (!StringUtils.isBlank(longitude)) user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); - if (latitude.length() > 0) + if (!StringUtils.isBlank(latitude)) user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); // TODO 成长值 wxCUserService.saveOrUpdate(user); From 021e1cf03117b49ec3b8c5bff7cc3293b455d82c Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Mon, 3 Sep 2018 06:30:54 +0800 Subject: [PATCH 28/28] =?UTF-8?q?[=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95][?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/simple/controller/WxUserGrantController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java index bee95b2e9..a8152c68b 100755 --- a/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java +++ b/mallinkCApi/src/main/java/com/simple/controller/WxUserGrantController.java @@ -87,21 +87,22 @@ public class WxUserGrantController extends BaseController { String token = null; String session_key = null; String openId = null; - HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); - String ipaddress = IPUtil.getIpAddr(request); try { WxMaJscode2SessionResult session = wxMaService.jsCode2SessionInfo(code); //获取会话密钥(session_key) session_key = session.getSessionKey(); openId = session.getOpenid(); - logger.info("session_key: " + session_key); - logger.info("openId: " + openId); + logger.info("session_key: " + session_key + ", openId: " + openId); resultMap.put("openId", openId); } catch (WxErrorException e) { logger.error(e.getMessage(), e); return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); } + + HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); + String ipaddress = IPUtil.getIpAddr(request); + WxCUser user = new WxCUser(); user.setTenantId(wxAppinfo.getTenantId()); user.setAppId(appId);