| @@ -12,7 +12,6 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.MallPermission; | import com.simple.domain.po.MallPermission; | ||||
| import com.simple.service.MallPermissionService; | import com.simple.service.MallPermissionService; | ||||
| import com.simple.service.MallRolePermissionService; | |||||
| /** | /** | ||||
| * @author chenkx | * @author chenkx | ||||
| @@ -27,17 +27,15 @@ import io.swagger.annotations.Api; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("role") | @RequestMapping("role") | ||||
| @Api(description="角色相关接口") | @Api(description="角色相关接口") | ||||
| public class MallRoleController extends BaseController{ | |||||
| public class MallRoleController extends BaseController { | |||||
| private Logger logger = Logger.getLogger(MallRoleController.class); | |||||
| @Autowired | @Autowired | ||||
| private MallRoleService sysRoleService; | private MallRoleService sysRoleService; | ||||
| @Autowired | @Autowired | ||||
| private MallRolePermissionService sysRolePermissionService; | private MallRolePermissionService sysRolePermissionService; | ||||
| private Logger logger = Logger.getLogger(MallRoleController.class); | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | ||||
| @@ -3,6 +3,8 @@ package com.simple.controller; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import com.simple.domain.po.*; | |||||
| import com.simple.service.*; | |||||
| import org.apache.shiro.SecurityUtils; | import org.apache.shiro.SecurityUtils; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.util.Assert; | import org.springframework.util.Assert; | ||||
| @@ -14,14 +16,6 @@ import org.springframework.web.bind.annotation.RestController; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.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.PasswordHelper; | ||||
| import com.simple.shiro.UserSession; | import com.simple.shiro.UserSession; | ||||
| @@ -35,7 +29,7 @@ import io.swagger.annotations.ApiOperation; | |||||
| @Api(value = "API - UserInfoController", description = "用户接口") | @Api(value = "API - UserInfoController", description = "用户接口") | ||||
| @RestController | @RestController | ||||
| @RequestMapping("user") | @RequestMapping("user") | ||||
| public class MallUserInfoController { | |||||
| public class MallUserInfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| MallUserInfoService userInfoService; | MallUserInfoService userInfoService; | ||||
| @@ -48,12 +42,17 @@ public class MallUserInfoController { | |||||
| @Autowired | @Autowired | ||||
| MallUserRoleService mallUserRoleService; | MallUserRoleService mallUserRoleService; | ||||
| @Autowired | |||||
| MallPermissionService mallPermissionService; | |||||
| @Autowired | @Autowired | ||||
| MallRolePermissionService mallRolePermissionService; | MallRolePermissionService mallRolePermissionService; | ||||
| @ApiOperation(value = "用户分页接口", response = String.class) | @ApiOperation(value = "用户分页接口", response = String.class) | ||||
| @GetMapping("lists") | @GetMapping("lists") | ||||
| public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize){ | public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize){ | ||||
| userInfo.setTenantId(getTenantId()); | |||||
| final PageInfo<MallUserInfo> page = userInfoService.listAsPage(userInfo, pageNum, pageSize); | final PageInfo<MallUserInfo> page = userInfoService.listAsPage(userInfo, pageNum, pageSize); | ||||
| for(MallUserInfo u:page.getList()) { | for(MallUserInfo u:page.getList()) { | ||||
| MallUserRole r =new MallUserRole(); | MallUserRole r =new MallUserRole(); | ||||
| @@ -61,8 +60,10 @@ public class MallUserInfoController { | |||||
| PageInfo<MallUserRole> ur = userRoleService.listAsPage(r, 1, 1); | PageInfo<MallUserRole> ur = userRoleService.listAsPage(r, 1, 1); | ||||
| if(ur.getSize()>0) { | if(ur.getSize()>0) { | ||||
| MallRole role = mallRoleService.getById(ur.getList().get(0).getRoleId()); | 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);//不返回密码 | u.setPassword(null);//不返回密码 | ||||
| } | } | ||||
| @@ -84,6 +85,7 @@ public class MallUserInfoController { | |||||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | Assert.notNull(userInfo.getPassword(), "密码不能为空"); | ||||
| PasswordHelper passwordHelper = new PasswordHelper(); | PasswordHelper passwordHelper = new PasswordHelper(); | ||||
| passwordHelper.encryptPassword(userInfo); | passwordHelper.encryptPassword(userInfo); | ||||
| userInfo.setTenantId(getTenantId()); | |||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| if(userInfo.getRoleId()!=null) { | if(userInfo.getRoleId()!=null) { | ||||
| MallUserRole r = new MallUserRole(); | MallUserRole r = new MallUserRole(); | ||||
| @@ -103,6 +105,7 @@ public class MallUserInfoController { | |||||
| // PasswordHelper passwordHelper = new PasswordHelper(); | // PasswordHelper passwordHelper = new PasswordHelper(); | ||||
| // passwordHelper.encryptPassword(userInfo); | // passwordHelper.encryptPassword(userInfo); | ||||
| userInfo.setPassword(null); | userInfo.setPassword(null); | ||||
| userInfo.setTenantId(getTenantId()); | |||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| if(userInfo.getRoleId()!=null) { | if(userInfo.getRoleId()!=null) { | ||||
| userRoleService.deleteByUserId(userInfo.getId()); | userRoleService.deleteByUserId(userInfo.getId()); | ||||
| @@ -133,6 +136,7 @@ public class MallUserInfoController { | |||||
| public ResultData modifyStatus(Long userId, Integer status) { | public ResultData modifyStatus(Long userId, Integer status) { | ||||
| MallUserInfo userInfo = userInfoService.getById(userId); | MallUserInfo userInfo = userInfoService.getById(userId); | ||||
| userInfo.setStatus(status); | userInfo.setStatus(status); | ||||
| userInfo.setTenantId(getTenantId()); | |||||
| userInfoService.saveOrUpdate(userInfo); | userInfoService.saveOrUpdate(userInfo); | ||||
| return new ResultData(userInfo); | return new ResultData(userInfo); | ||||
| } | } | ||||
| @@ -190,27 +194,38 @@ public class MallUserInfoController { | |||||
| public ResultData getUserInfo(){ | public ResultData getUserInfo(){ | ||||
| MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | ||||
| info.setPassword("保密"); | info.setPassword("保密"); | ||||
| // System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); | |||||
| MallUserRole ur = new MallUserRole(); | |||||
| ur.setUid(info.getId()); | |||||
| PageInfo<MallUserRole> 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<MallRolePermission> 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<MallPermission> 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<MallUserRole> 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<MallRolePermission> 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); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import java.text.DecimalFormat; | |||||
| import java.text.NumberFormat; | import java.text.NumberFormat; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -9,7 +10,6 @@ import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.springframework.beans.BeanUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | import org.springframework.web.bind.annotation.GetMapping; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | 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.common.ResultData; | ||||
| import com.simple.domain.dto.WxCuerBasicInfoDto; | import com.simple.domain.dto.WxCuerBasicInfoDto; | ||||
| import com.simple.domain.vo.CUserDateAmountVo; | |||||
| import com.simple.domain.vo.TouchUsersReportVo; | import com.simple.domain.vo.TouchUsersReportVo; | ||||
| import com.simple.domain.vo.UserStructureVo; | import com.simple.domain.vo.UserStructureVo; | ||||
| import com.simple.service.WxCUserService; | import com.simple.service.WxCUserService; | ||||
| import com.simple.service.WxCouponOrderService; | |||||
| import com.simple.service.WxUserVisitService; | import com.simple.service.WxUserVisitService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| @@ -34,6 +36,8 @@ public class WxCUserDataController extends BaseController{ | |||||
| private WxCUserService wxCUserService; | private WxCUserService wxCUserService; | ||||
| @Autowired | @Autowired | ||||
| private WxUserVisitService wxUserVisitService; | private WxUserVisitService wxUserVisitService; | ||||
| @Autowired | |||||
| private WxCouponOrderService wxCouponOrderService; | |||||
| @GetMapping("findUserCountData") | @GetMapping("findUserCountData") | ||||
| @ApiOperation("查询用户数量接口") | @ApiOperation("查询用户数量接口") | ||||
| @@ -96,14 +100,15 @@ public class WxCUserDataController extends BaseController{ | |||||
| weekPercentage= nf.format(new Double(todayCount).doubleValue()); | weekPercentage= nf.format(new Double(todayCount).doubleValue()); | ||||
| } | } | ||||
| Map<String,Object> map = new HashMap<>(); | Map<String,Object> 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("dayPercentage",dayPercentage);//日环比 | ||||
| map.put("weekPercentage",weekPercentage); //周同比 | map.put("weekPercentage",weekPercentage); //周同比 | ||||
| return new ResultData(map); | return new ResultData(map); | ||||
| } | } | ||||
| @ApiOperation("查询用户活跃量") | |||||
| @GetMapping("findUserVisitData") | @GetMapping("findUserVisitData") | ||||
| public ResultData findUserVisitData() { | public ResultData findUserVisitData() { | ||||
| HashMap<String, Object> params =new HashMap<>(); | HashMap<String, Object> params =new HashMap<>(); | ||||
| @@ -136,7 +141,7 @@ public class WxCUserDataController extends BaseController{ | |||||
| c.add(Calendar.DAY_OF_YEAR, -i); | c.add(Calendar.DAY_OF_YEAR, -i); | ||||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | ||||
| UserStructureVo vo = new UserStructureVo(); | UserStructureVo vo = new UserStructureVo(); | ||||
| vo.setName(dayStr); | |||||
| vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); | |||||
| vo.setSortNum(j); | vo.setSortNum(j); | ||||
| j++; | j++; | ||||
| if(dateMap.get(dayStr)!=null) { | if(dateMap.get(dayStr)!=null) { | ||||
| @@ -156,7 +161,7 @@ public class WxCUserDataController extends BaseController{ | |||||
| c.add(Calendar.DAY_OF_YEAR, -i); | c.add(Calendar.DAY_OF_YEAR, -i); | ||||
| String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | String dayStr = new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); | ||||
| UserStructureVo vo = new UserStructureVo(); | UserStructureVo vo = new UserStructureVo(); | ||||
| vo.setName(dayStr); | |||||
| vo.setName(new SimpleDateFormat("MM-dd").format(c.getTime())); | |||||
| vo.setSortNum(j); | vo.setSortNum(j); | ||||
| if(dateMap.get(dayStr)!=null) { | if(dateMap.get(dayStr)!=null) { | ||||
| TouchUsersReportVo rv = dateMap.get(dayStr); | TouchUsersReportVo rv = dateMap.get(dayStr); | ||||
| @@ -175,7 +180,6 @@ public class WxCUserDataController extends BaseController{ | |||||
| if(i==7) { | if(i==7) { | ||||
| dayOfWeekCount=vo.getCount(); | dayOfWeekCount=vo.getCount(); | ||||
| } | } | ||||
| monthVos.add(vo); | monthVos.add(vo); | ||||
| j++; | j++; | ||||
| } | } | ||||
| @@ -198,12 +202,98 @@ public class WxCUserDataController extends BaseController{ | |||||
| Map<String,Object> mapVo =new HashMap<>(); | Map<String,Object> mapVo =new HashMap<>(); | ||||
| mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | mapVo.put("yesterdayCount", yesterdayCount);//昨日活跃数 | ||||
| mapVo.put("thisMonthCount", thisMonthCount);//近一个月活跃数 | 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("dayPercentage",dayPercentage);//日环比 | ||||
| mapVo.put("weekPercentage",weekPercentage); //周同比 | mapVo.put("weekPercentage",weekPercentage); //周同比 | ||||
| return new ResultData(mapVo); | 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<CUserDateAmountVo> datas = wxCouponOrderService.queryPriceTotalGroup(tenantId, sTime, eTime); | |||||
| Map<String,Integer> 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<UserStructureVo> 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<String,Object> 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); | |||||
| } | |||||
| } | } | ||||
| @@ -109,13 +109,13 @@ public class WxCouponController extends BaseController | |||||
| //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| if(StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())){ | 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())){ | 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())){ | 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())) { | if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { | ||||
| String[] arys = wxCoupon.getBusiness().split(","); | String[] arys = wxCoupon.getBusiness().split(","); | ||||
| @@ -6,6 +6,7 @@ import java.util.Date; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import com.simple.enums.EnumAppType; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpEntity; | import org.springframework.http.HttpEntity; | ||||
| @@ -19,7 +20,10 @@ import org.springframework.web.client.RestTemplate; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | 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.domain.po.WxUserVisit; | ||||
| import com.simple.service.WxAppinfoService; | |||||
| import com.simple.service.WxUserVisitService; | import com.simple.service.WxUserVisitService; | ||||
| @Component | @Component | ||||
| @@ -37,24 +41,41 @@ public class WxAppVisitSchedule { | |||||
| @Autowired | @Autowired | ||||
| private WxUserVisitService wxUserVisitService; | private WxUserVisitService wxUserVisitService; | ||||
| @Autowired | |||||
| private WxAppinfoService WxAppinfoService; | |||||
| // @Scheduled(cron = "0 */1 * * * *?") | // @Scheduled(cron = "0 */1 * * * *?") | ||||
| @Scheduled(cron = "0 0 4 * * ? ") | |||||
| @Scheduled(cron = "0 0 9 * * ? ") | |||||
| public void start() { | public void start() { | ||||
| try { | try { | ||||
| Calendar c =Calendar.getInstance(); | Calendar c =Calendar.getInstance(); | ||||
| c.add(Calendar.DAY_OF_YEAR, -1); | c.add(Calendar.DAY_OF_YEAR, -1); | ||||
| Date time = c.getTime(); | Date time = c.getTime(); | ||||
| String yesterday = new SimpleDateFormat("yyyyMMdd").format(time); | String yesterday = new SimpleDateFormat("yyyyMMdd").format(time); | ||||
| getData(yesterday); | |||||
| // "wx8eb8275b78db4ede", "76c43df01296998d8ce12383f213ac10"; | |||||
| WxAppinfo appInfo = new WxAppinfo(); | |||||
| appInfo.setType(EnumAppType.C.getCode()); | |||||
| PageInfo<WxAppinfo> page = WxAppinfoService.listAsPage(appInfo, 1, 10000); | |||||
| for(WxAppinfo w :page.getList()) { | |||||
| w.getAppId(); | |||||
| w.getSecret(); | |||||
| w.getTenantId(); | |||||
| //TODO 因为数据库表里数据问题,暂时不通过这种方式处理 | |||||
| } | |||||
| // TODO hardcode appId | |||||
| String appId = "wx8eb8275b78db4ede"; | |||||
| String key ="76c43df01296998d8ce12383f213ac10"; | |||||
| String talentId ="456"; | |||||
| getData(yesterday,appId,key,talentId); | |||||
| }catch(Exception e) { | }catch(Exception e) { | ||||
| logger.error("获取微信访问数据失败",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(); | HttpHeaders headers = new HttpHeaders(); | ||||
| headers.setContentType(MediaType.APPLICATION_JSON); | headers.setContentType(MediaType.APPLICATION_JSON); | ||||
| Map<String, String> map = new HashMap<String, String>(); | Map<String, String> map = new HashMap<String, String>(); | ||||
| @@ -79,6 +100,7 @@ public class WxAppVisitSchedule { | |||||
| // "visit_depth":3.1311,"session_cnt":61,"visit_pv":645,"visit_uv_new":3} | // "visit_depth":3.1311,"session_cnt":61,"visit_pv":645,"visit_uv_new":3} | ||||
| logger.info(JSON.toJSONString(itemMap)); | logger.info(JSON.toJSONString(itemMap)); | ||||
| WxUserVisit v = new WxUserVisit(); | WxUserVisit v = new WxUserVisit(); | ||||
| // TODO hardcode appId | |||||
| v.setAppId("wx8eb8275b78db4ede"); | v.setAppId("wx8eb8275b78db4ede"); | ||||
| String time = itemMap.get("ref_date")+""; | String time = itemMap.get("ref_date")+""; | ||||
| Date date = new SimpleDateFormat("yyyyMMdd").parse(time); | Date date = new SimpleDateFormat("yyyyMMdd").parse(time); | ||||
| @@ -91,6 +113,7 @@ public class WxAppVisitSchedule { | |||||
| v.setStayTimeSession(itemMap.get("stay_time_session")+""); | v.setStayTimeSession(itemMap.get("stay_time_session")+""); | ||||
| v.setVisitDepth(itemMap.get("visit_depth")+""); | v.setVisitDepth(itemMap.get("visit_depth")+""); | ||||
| v.setStayTimeUv(itemMap.get("stay_time_uv")+""); | v.setStayTimeUv(itemMap.get("stay_time_uv")+""); | ||||
| v.setTenantId(talentId); | |||||
| wxUserVisitService.saveOrUpdate(v); | wxUserVisitService.saveOrUpdate(v); | ||||
| } | } | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: mallone | username: mallone | ||||
| password: m@1l0ne123@# | password: m@1l0ne123@# | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: root | username: root | ||||
| password: 1234qwer | password: 1234qwer | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -88,12 +88,12 @@ public class WxRefundOrderController extends BaseController { | |||||
| try { | try { | ||||
| payOrder = wxPayOrderService.getByObj(payOrderQ); | payOrder = wxPayOrderService.getByObj(payOrderQ); | ||||
| } catch (Exception e) { | } 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) { | 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(); | WxRefundOrder refundOrderQ = new WxRefundOrder(); | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: mallone | username: mallone | ||||
| password: m@1l0ne123@# | password: m@1l0ne123@# | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: root | username: root | ||||
| password: 1234qwer | password: 1234qwer | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.simple.controller; | package com.simple.controller; | ||||
| import com.simple.domain.vo.WxCouponChannelVo; | import com.simple.domain.vo.WxCouponChannelVo; | ||||
| import com.simple.enums.EnumCouponChannelStatus; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -37,7 +38,7 @@ public class WxCouponChannelController extends BaseController | |||||
| public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { | public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { | ||||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | ||||
| wxCouponChannel.setTenantId(getTenantId()); | wxCouponChannel.setTenantId(getTenantId()); | ||||
| wxCouponChannel.setStatus(0); | |||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | |||||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); | wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC); | ||||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -19,6 +19,7 @@ import org.apache.log4j.Logger; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.HashMap; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @@ -93,4 +94,22 @@ public class WxCouponOrderController extends BaseController { | |||||
| return wxCouponOrderService.detailCUserVo(getUser().getId(), couponOrderId); | 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); | |||||
| } | |||||
| } | } | ||||
| @@ -18,6 +18,7 @@ import com.simple.domain.po.WxCUserCar; | |||||
| import com.simple.service.WxAppinfoService; | import com.simple.service.WxAppinfoService; | ||||
| import com.simple.service.WxCUserCarService; | import com.simple.service.WxCUserCarService; | ||||
| import com.simple.service.WxCUserService; | import com.simple.service.WxCUserService; | ||||
| import com.simple.utils.CheckUtil; | |||||
| import com.simple.utils.IPUtil; | import com.simple.utils.IPUtil; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -32,6 +33,10 @@ import org.springframework.web.context.request.RequestContextHolder; | |||||
| import org.springframework.web.context.request.ServletRequestAttributes; | import org.springframework.web.context.request.ServletRequestAttributes; | ||||
| import javax.servlet.http.HttpServletRequest; | 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.Date; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -56,7 +61,7 @@ public class WxUserGrantController extends BaseController { | |||||
| */ | */ | ||||
| @AuthIgnore | @AuthIgnore | ||||
| @PostMapping("/login") | @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<String, String> map) { | public ResultData userLogin(@RequestBody Map<String, String> map) { | ||||
| logger.debug(map.toString()); | logger.debug(map.toString()); | ||||
| @@ -65,6 +70,8 @@ public class WxUserGrantController extends BaseController { | |||||
| String appId = map.get("appId"); | String appId = map.get("appId"); | ||||
| String code = map.get("code"); | String code = map.get("code"); | ||||
| String sceneAddress = map.get("sceneAddress"); | String sceneAddress = map.get("sceneAddress"); | ||||
| String longitude = map.get("longitude"); | |||||
| String latitude = map.get("latitude"); | |||||
| //登录凭证不能为空 | //登录凭证不能为空 | ||||
| if (StringUtils.isBlank(appId)) { | if (StringUtils.isBlank(appId)) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "appId不能为空"); | ||||
| @@ -80,22 +87,24 @@ public class WxUserGrantController extends BaseController { | |||||
| String token = null; | String token = null; | ||||
| String session_key = null; | String session_key = null; | ||||
| String openId = null; | String openId = null; | ||||
| HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |||||
| String ipaddress = IPUtil.getIpAddr(request); | |||||
| try { | try { | ||||
| WxMaJscode2SessionResult session = wxMaService.jsCode2SessionInfo(code); | WxMaJscode2SessionResult session = wxMaService.jsCode2SessionInfo(code); | ||||
| //获取会话密钥(session_key) | //获取会话密钥(session_key) | ||||
| session_key = session.getSessionKey(); | session_key = session.getSessionKey(); | ||||
| openId = session.getOpenid(); | 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); | resultMap.put("openId", openId); | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage(), e); | logger.error(e.getMessage(), e); | ||||
| return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); | return new ResultData(ErrorCode.SESSION_KEY_DECODE_ERR, resultMap); | ||||
| } | } | ||||
| HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); | |||||
| String ipaddress = IPUtil.getIpAddr(request); | |||||
| WxCUser user = new WxCUser(); | WxCUser user = new WxCUser(); | ||||
| user.setTenantId(wxAppinfo.getTenantId()); | |||||
| user.setAppId(appId); | user.setAppId(appId); | ||||
| user.setOpenId(openId); | user.setOpenId(openId); | ||||
| @@ -108,6 +117,10 @@ public class WxUserGrantController extends BaseController { | |||||
| user1.setSessionKey(session_key); | user1.setSessionKey(session_key); | ||||
| if (user1.getSceneAddress() == null) | if (user1.getSceneAddress() == null) | ||||
| user1.setSceneAddress(sceneAddress); | user1.setSceneAddress(sceneAddress); | ||||
| if (!StringUtils.isBlank(longitude)) | |||||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||||
| if (!StringUtils.isBlank(latitude)) | |||||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||||
| // TODO 成长值 | // TODO 成长值 | ||||
| wxCUserService.saveOrUpdate(user1); | wxCUserService.saveOrUpdate(user1); | ||||
| resultMap.put("token", token); | resultMap.put("token", token); | ||||
| @@ -119,6 +132,10 @@ public class WxUserGrantController extends BaseController { | |||||
| if (user.getSceneAddress() == null) | if (user.getSceneAddress() == null) | ||||
| user.setSceneAddress(sceneAddress); | user.setSceneAddress(sceneAddress); | ||||
| user.setSessionKey(session_key); | user.setSessionKey(session_key); | ||||
| if (!StringUtils.isBlank(longitude)) | |||||
| user.setLongitude(BigDecimal.valueOf(Double.valueOf(longitude))); | |||||
| if (!StringUtils.isBlank(latitude)) | |||||
| user.setLatitude(BigDecimal.valueOf(Double.valueOf(latitude))); | |||||
| // TODO 成长值 | // TODO 成长值 | ||||
| wxCUserService.saveOrUpdate(user); | wxCUserService.saveOrUpdate(user); | ||||
| resultMap.put("token", token); | resultMap.put("token", token); | ||||
| @@ -319,5 +336,34 @@ public class WxUserGrantController extends BaseController { | |||||
| return new ResultData(Result.SUCCESS,"获取查询成功", list); | 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(); | |||||
| } | |||||
| } | } | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: mallone | username: mallone | ||||
| password: m@1l0ne123@# | password: m@1l0ne123@# | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -5,7 +5,7 @@ spring: | |||||
| username: root | username: root | ||||
| password: 1234qwer | password: 1234qwer | ||||
| type: com.alibaba.druid.pool.DruidDataSource | type: com.alibaba.druid.pool.DruidDataSource | ||||
| driver-class-name: com.mysql.jdbc.Driver | |||||
| driver_class: com.mysql.cj.jdbc.Driver | |||||
| filters: stat | filters: stat | ||||
| maxActive: 20 | maxActive: 20 | ||||
| initialSize: 1 | initialSize: 1 | ||||
| @@ -205,20 +205,20 @@ public class CouponInject implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ,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") | ,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") | ,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; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -252,6 +252,8 @@ public class CouponInject implements Serializable { | |||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -40,11 +40,6 @@ public class MallPermission implements Serializable { | |||||
| this.ids = ids; | this.ids = ids; | ||||
| } | } | ||||
| /*租户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||||
| private String tenantId; | |||||
| /*权限名称[LIKE]**/ | /*权限名称[LIKE]**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="权限名称[LIKE]",name="name") | @io.swagger.annotations.ApiModelProperty(value="权限名称[LIKE]",name="name") | ||||
| private String name; | private String name; | ||||
| @@ -85,12 +80,6 @@ public class MallPermission implements Serializable { | |||||
| private Integer sortLte; | private Integer sortLte; | ||||
| @Transient | @Transient | ||||
| private Integer sortLt; | private Integer sortLt; | ||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public String getName() { | public String getName() { | ||||
| return name; | return name; | ||||
| } | } | ||||
| @@ -193,7 +182,6 @@ public class MallPermission implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ,Available_ASC("`available` ASC"),Available_DESC("`available` DESC") | ,Available_ASC("`available` ASC"),Available_DESC("`available` DESC") | ||||
| ,ParentId_ASC("`parentId` ASC"),ParentId_DESC("`parentId` DESC") | ,ParentId_ASC("`parentId` ASC"),ParentId_DESC("`parentId` DESC") | ||||
| @@ -116,6 +116,12 @@ public class WxCUser implements Serializable { | |||||
| /*用户过期时间**/ | /*用户过期时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | @io.swagger.annotations.ApiModelProperty(value="用户过期时间",name="expireTime") | ||||
| private Date expireTime; | private Date expireTime; | ||||
| /*经度**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") | |||||
| private BigDecimal longitude; | |||||
| /*纬度**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="纬度",name="latitude") | |||||
| private BigDecimal latitude; | |||||
| //渠道名称 | //渠道名称 | ||||
| @Transient | @Transient | ||||
| @@ -275,35 +281,51 @@ public class WxCUser implements Serializable { | |||||
| expireTime = _expireTime; | 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 | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,OpenId_ASC("`openId` ASC"),OpenId_DESC("`openId` DESC") | |||||
| ,UnionId_ASC("`unionId` ASC"),UnionId_DESC("`unionId` DESC") | |||||
| ,NickName_ASC("`nickName` ASC"),NickName_DESC("`nickName` DESC") | |||||
| ,Gender_ASC("`gender` ASC"),Gender_DESC("`gender` DESC") | |||||
| ,AvatarUrl_ASC("`avatarUrl` ASC"),AvatarUrl_DESC("`avatarUrl` DESC") | |||||
| ,Phone_ASC("`phone` ASC"),Phone_DESC("`phone` DESC") | |||||
| ,PurePhone_ASC("`purePhone` ASC"),PurePhone_DESC("`purePhone` 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") | |||||
| ,Scene_ASC("`scene` ASC"),Scene_DESC("`scene` DESC") | |||||
| ,SceneAddress_ASC("`sceneAddress` ASC"),SceneAddress_DESC("`sceneAddress` DESC") | |||||
| ,SessionKey_ASC("`sessionKey` ASC"),SessionKey_DESC("`sessionKey` 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") | |||||
| ,Token_ASC("`token` ASC"),Token_DESC("`token` DESC") | |||||
| ,ExpireTime_ASC("`expireTime` ASC"),ExpireTime_DESC("`expireTime` 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; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -336,6 +358,8 @@ public class WxCUser implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -232,9 +232,9 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| ,Poins_ASC("`poins` ASC"),Poins_DESC("`poins` DESC") | ,Poins_ASC("`poins` ASC"),Poins_DESC("`poins` DESC") | ||||
| ,TagId_ASC("`tagId` ASC"),TagId_DESC("`tagId` DESC") | ,TagId_ASC("`tagId` ASC"),TagId_DESC("`tagId` DESC") | ||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` 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") | ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | ||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| @@ -268,6 +268,8 @@ public class WxCUserBasicInfo implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -111,13 +111,13 @@ public class WxCUserCar implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,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; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -150,7 +150,7 @@ public class WxCUserCar implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| public void setSortColumns(String sortColumns) | public void setSortColumns(String sortColumns) | ||||
| @@ -151,17 +151,17 @@ public class WxPark implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||||
| ,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") | ,Addr_ASC("`addr` ASC"),Addr_DESC("`addr` DESC") | ||||
| ,Number_ASC("`number` ASC"),Number_DESC("`number` 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; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -92,10 +92,10 @@ public class WxPayAccount implements Serializable { | |||||
| public static enum Field | public static enum Field | ||||
| { | { | ||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | ||||
| ,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") | |||||
| ; | ; | ||||
| private String value; | private String value; | ||||
| Field(String value){ | Field(String value){ | ||||
| @@ -128,6 +128,8 @@ public class WxPayAccount implements Serializable { | |||||
| sb.append(","); | sb.append(","); | ||||
| sb.append(fields[k].toString()); | sb.append(fields[k].toString()); | ||||
| } | } | ||||
| this.sortColumns = sb.toString(); | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.simple.domain.vo; | package com.simple.domain.vo; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.text.DecimalFormat; | |||||
| /** | /** | ||||
| * 会员结构vo | * 会员结构vo | ||||
| * @author jinguo | * @author jinguo | ||||
| @@ -20,6 +21,27 @@ public class UserStructureVo implements Serializable{ | |||||
| private String percentage; | private String percentage; | ||||
| //序号 | //序号 | ||||
| private Integer sortNum; | 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() { | public Integer getSortNum() { | ||||
| return sortNum; | return sortNum; | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.simple.domain.vo; | |||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | import com.simple.domain.po.WxCouponChannel; | ||||
| import com.simple.domain.po.WxMerchant; | |||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @@ -56,6 +57,9 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { | |||||
| @Transient | @Transient | ||||
| private String priceStr; | private String priceStr; | ||||
| @Transient | |||||
| private String merchantName; | |||||
| /*限领张数**/ | /*限领张数**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") | @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") | ||||
| private Integer useLimitQuantity; | private Integer useLimitQuantity; | ||||
| @@ -173,6 +177,15 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { | |||||
| this.priceStr = priceStr; | this.priceStr = priceStr; | ||||
| } | } | ||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| public WxCouponChannelVo(){} | public WxCouponChannelVo(){} | ||||
| public WxCouponChannelVo setWxCoupon (WxCoupon wxCoupon){ | public WxCouponChannelVo setWxCoupon (WxCoupon wxCoupon){ | ||||
| this.coverImg=wxCoupon.getCoverImg(); | this.coverImg=wxCoupon.getCoverImg(); | ||||
| @@ -188,5 +201,10 @@ public class WxCouponChannelVo extends WxCouponChannel implements Serializable { | |||||
| return this; | return this; | ||||
| } | } | ||||
| public WxCouponChannelVo setWxMerchant (WxMerchant wxMerchant){ | |||||
| this.merchantName=wxMerchant.getName(); | |||||
| return this; | |||||
| } | |||||
| } | } | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.simple.domain.vo; | package com.simple.domain.vo; | ||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.simple.domain.po.WxCouponOrder; | import com.simple.domain.po.WxCouponOrder; | ||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| @@ -56,15 +57,19 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "操作券B端小程序用户ID", name = "bUserId") | @io.swagger.annotations.ApiModelProperty(value = "操作券B端小程序用户ID", name = "bUserId") | ||||
| private Long bUserId; | private Long bUserId; | ||||
| /*用户订单ID**/ | /*用户订单ID**/ | ||||
| @Excel(name="订单号",width = 20) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") | @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") | ||||
| private Long orderId; | private Long orderId; | ||||
| /*该订单对应券的实际过期时间**/ | /*该订单对应券的实际过期时间**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") | @io.swagger.annotations.ApiModelProperty(value = "该订单对应券的实际过期时间 ", name = "expiredTime") | ||||
| private Date expiredTime; | private Date expiredTime; | ||||
| /*状态:0,待使用 1,已核销 2,已过期 3,已作废 **/ | /*状态: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") | @io.swagger.annotations.ApiModelProperty(value = "状态:0,待使用 1,已核销 2,已过期 3,已作废 ", name = "couponOrderStatus") | ||||
| private Integer couponOrderStatus; | private Integer couponOrderStatus; | ||||
| /***/ | /***/ | ||||
| @Excel(name="交易时间",width = 20,exportFormat="yyyy-MM-dd",orderNum = "3") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| /***/ | /***/ | ||||
| @@ -82,6 +87,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | ||||
| private String title; | private String title; | ||||
| /*售价(适用于类型2,3,4,5)**/ | /*售价(适用于类型2,3,4,5)**/ | ||||
| @Excel(name="交易价格",width = 20,orderNum = "2") | |||||
| @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | ||||
| private Integer salePrice; | private Integer salePrice; | ||||
| /*使用条件金额(适用于类型1,2,3,4)**/ | /*使用条件金额(适用于类型1,2,3,4)**/ | ||||
| @@ -97,6 +103,7 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| private String bUserName; | private String bUserName; | ||||
| /*c用户绑定的手机号**/ | /*c用户绑定的手机号**/ | ||||
| @Excel(name="手机号",width = 20,orderNum = "1") | |||||
| @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | @io.swagger.annotations.ApiModelProperty(value="用户绑定的手机号",name="cUserPhone") | ||||
| private String cUserPhone; | private String cUserPhone; | ||||
| @@ -193,18 +200,20 @@ public class WxCouponOrderBVo extends WxCouponOrder{ | |||||
| price = _price; | 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 { | public static enum Field { | ||||
| @@ -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; | |||||
| } | |||||
| } | |||||
| @@ -1,10 +1,14 @@ | |||||
| package com.simple.mapper; | package com.simple.mapper; | ||||
| import java.util.*; | |||||
| import com.simple.common.CommonMapper; | import com.simple.common.CommonMapper; | ||||
| import com.simple.domain.po.WxCouponOrder; | |||||
| import com.simple.domain.vo.*; | import com.simple.domain.vo.*; | ||||
| import org.apache.ibatis.annotations.Param; | 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<WxCouponOrder, Long> { | public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | ||||
| @@ -13,6 +13,8 @@ public class WxRefundOrderP { | |||||
| private String out_refund_no; // 商户退款单号 | private String out_refund_no; // 商户退款单号 | ||||
| private Integer total_fee; // 支付金额 | private Integer total_fee; // 支付金额 | ||||
| private Integer refund_fee; // 退款金额 | private Integer refund_fee; // 退款金额 | ||||
| private String refund_desc; // 退款原因 | |||||
| private String notify_url; // 回调接口 | |||||
| public String getAppid() { | public String getAppid() { | ||||
| return appid; | return appid; | ||||
| @@ -86,6 +88,22 @@ public class WxRefundOrderP { | |||||
| this.refund_fee = refund_fee; | 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 | @Override | ||||
| public String toString() { | public String toString() { | ||||
| final StringBuilder sb = new StringBuilder("WxRefundOrder{"); | final StringBuilder sb = new StringBuilder("WxRefundOrder{"); | ||||
| @@ -3,10 +3,16 @@ package com.simple.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCouponOrder; | 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.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| public interface WxCouponOrderService { | public interface WxCouponOrderService { | ||||
| /** | /** | ||||
| @@ -107,4 +113,23 @@ public interface WxCouponOrderService { | |||||
| void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId); | ||||
| /** | |||||
| * 日期分组 消费总数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| List<CUserDateAmountVo> queryPriceTotalGroup(String tenantId, Date startTime,Date endTime); | |||||
| /** | |||||
| * 查询时间段内消费总数 | |||||
| * @param tenantId | |||||
| * @param startTime | |||||
| * @param endTime | |||||
| * @return | |||||
| */ | |||||
| int queryPriceTotal(String tenantId, Date startTime, Date endTime); | |||||
| } | } | ||||
| @@ -87,4 +87,6 @@ public interface WxOrderService { | |||||
| WxOrderCVo detailCUserVo(WxOrder record); | WxOrderCVo detailCUserVo(WxOrder record); | ||||
| void stockBack(WxOrder updateOrder); | |||||
| } | } | ||||
| @@ -9,8 +9,10 @@ import com.simple.common.Result; | |||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.WxCoupon; | import com.simple.domain.po.WxCoupon; | ||||
| import com.simple.domain.po.WxCouponChannel; | import com.simple.domain.po.WxCouponChannel; | ||||
| import com.simple.domain.po.WxMerchant; | |||||
| import com.simple.domain.vo.WxCouponChannelVo; | import com.simple.domain.vo.WxCouponChannelVo; | ||||
| import com.simple.mapper.WxCouponChannelMapper; | import com.simple.mapper.WxCouponChannelMapper; | ||||
| import com.simple.mapper.WxMerchantMapper; | |||||
| import com.simple.service.WxCouponChannelService; | import com.simple.service.WxCouponChannelService; | ||||
| import com.simple.service.WxCouponService; | import com.simple.service.WxCouponService; | ||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| @@ -26,6 +28,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Autowired | @Autowired | ||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | |||||
| WxMerchantMapper wxMerchantMapper; | |||||
| private Logger logger = Logger.getLogger(getClass()); | private Logger logger = Logger.getLogger(getClass()); | ||||
| @@ -160,6 +164,11 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { | for (WxCouponChannelVo wxcouponVo:wxCouponChannelVoList) { | ||||
| if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ | if(couponNamesMap.get(wxcouponVo.getCouponId())!=null){ | ||||
| wxcouponVo.setWxCoupon(couponNamesMap.get(wxcouponVo.getCouponId())); | 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); | return new PageInfo<>(wxCouponChannelVoList); | ||||
| @@ -2,21 +2,22 @@ package com.simple.service.impl; | |||||
| import cn.afterturn.easypoi.excel.ExcelExportUtil; | import cn.afterturn.easypoi.excel.ExcelExportUtil; | ||||
| import cn.afterturn.easypoi.excel.entity.ExportParams; | import cn.afterturn.easypoi.excel.entity.ExportParams; | ||||
| import cn.afterturn.easypoi.excel.entity.TemplateExportParams; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.ErrorCode; | import com.simple.common.ErrorCode; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import com.simple.common.ResultData; | import com.simple.common.ResultData; | ||||
| import com.simple.domain.po.*; | 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.domain.vo.WxCouponOrderCVo; | ||||
| import com.simple.enums.EnumCouponOrderStatus; | import com.simple.enums.EnumCouponOrderStatus; | ||||
| import com.simple.exception.MallinkException; | import com.simple.exception.MallinkException; | ||||
| import com.simple.mapper.*; | import com.simple.mapper.*; | ||||
| import com.simple.service.WxCouponOrderService; | import com.simple.service.WxCouponOrderService; | ||||
| import com.simple.service.WxOrderService; | |||||
| import org.apache.log4j.Logger; | import org.apache.log4j.Logger; | ||||
| import org.apache.poi.ss.usermodel.Workbook; | import org.apache.poi.ss.usermodel.Workbook; | ||||
| import org.aspectj.apache.bcel.classfile.ConstantString; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | import org.springframework.transaction.annotation.Propagation; | ||||
| @@ -48,6 +49,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxCUserMapper wxCUserMapper; | WxCUserMapper wxCUserMapper; | ||||
| @Autowired | |||||
| WxOrderService wxOrderService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponOrder> listAsPage(WxCouponOrder record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findList(record)); | ||||
| @@ -215,7 +219,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | public void exportData(HttpServletRequest request, HttpServletResponse response, String tenantId) { | ||||
| WxCouponOrder wxCouponOrder = new WxCouponOrder(); | WxCouponOrder wxCouponOrder = new WxCouponOrder(); | ||||
| wxCouponOrder.setTenantId(tenantId); | wxCouponOrder.setTenantId(tenantId); | ||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findList(wxCouponOrder); | |||||
| List<WxCouponOrderBVo> list = wxCouponOrderMapper.findListOfAdmin(wxCouponOrder); | |||||
| String filepath="./uploads/"; | String filepath="./uploads/"; | ||||
| File savefile = new File(filepath); | File savefile = new File(filepath); | ||||
| @@ -223,7 +227,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| savefile.mkdirs(); | savefile.mkdirs(); | ||||
| } | } | ||||
| Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WxCouponOrder.class, list); | |||||
| Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), WxCouponOrderBVo.class, list); | |||||
| FileOutputStream fos = null; | FileOutputStream fos = null; | ||||
| try { | try { | ||||
| String filename=UUID.randomUUID()+".xlsx"; | String filename=UUID.randomUUID()+".xlsx"; | ||||
| @@ -369,7 +373,26 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); | logger.error("db failed: couponOrder-" + couponOrderId + ", e:" + e.getMessage()); | ||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| // 库存回复+1 | |||||
| wxOrderService.stockBack(wxOrder); | |||||
| return new ResultData(wxCouponOrder); | return new ResultData(wxCouponOrder); | ||||
| } | } | ||||
| @Override | |||||
| public List<CUserDateAmountVo> 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); | |||||
| } | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.simple.common.IdWorker; | import com.simple.common.IdWorker; | ||||
| import com.simple.domain.po.*; | import com.simple.domain.po.*; | ||||
| import com.simple.enums.EnumAppType; | |||||
| import com.simple.enums.EnumCarVendor; | import com.simple.enums.EnumCarVendor; | ||||
| import com.simple.mapper.*; | import com.simple.mapper.*; | ||||
| import com.simple.service.WxMerchantService; | import com.simple.service.WxMerchantService; | ||||
| @@ -87,7 +88,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| WxAppinfo wxAppinfo = new WxAppinfo(); | WxAppinfo wxAppinfo = new WxAppinfo(); | ||||
| wxAppinfo.setTenantId(wxMerchant.getTenantId()); | wxAppinfo.setTenantId(wxMerchant.getTenantId()); | ||||
| wxAppinfo.setType(1); | |||||
| wxAppinfo.setType(EnumAppType.B.getCode()); | |||||
| wxAppinfo = wxAppinfoMapper.findList(wxAppinfo).get(0); | wxAppinfo = wxAppinfoMapper.findList(wxAppinfo).get(0); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -140,7 +140,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| } | } | ||||
| private void stockBack(WxOrder updateOrder) { | |||||
| @Override | |||||
| public void stockBack(WxOrder updateOrder) { | |||||
| // 已取消/已退款,库存加1 | // 已取消/已退款,库存加1 | ||||
| // 获取订单相关coupon | // 获取订单相关coupon | ||||
| Long couponId = updateOrder.getCouponId(); | Long couponId = updateOrder.getCouponId(); | ||||
| @@ -230,6 +230,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| // 创建退款订单 | // 创建退款订单 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| Long id = idWorker.nextId(); | Long id = idWorker.nextId(); | ||||
| String out_refund_id = String.valueOf(id); | |||||
| Date currentDate = new Date(); | Date currentDate = new Date(); | ||||
| record.setId(id); | record.setId(id); | ||||
| @@ -261,30 +262,40 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| wxRefundOrderP.setAppid(appInfo.getAppId()); | wxRefundOrderP.setAppid(appInfo.getAppId()); | ||||
| wxRefundOrderP.setMch_id(payAccount.getMchId()); | wxRefundOrderP.setMch_id(payAccount.getMchId()); | ||||
| wxRefundOrderP.setNonce_str(noncestr); | wxRefundOrderP.setNonce_str(noncestr); | ||||
| if (record.getTransactionId() == null) | |||||
| if (record.getTransactionId() != null) | |||||
| wxRefundOrderP.setTransaction_id(record.getTransactionId()); | wxRefundOrderP.setTransaction_id(record.getTransactionId()); | ||||
| wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); | wxRefundOrderP.setOut_trade_no(record.getPayOrderNo()); | ||||
| wxRefundOrderP.setOut_refund_no(out_refund_id); | |||||
| wxRefundOrderP.setTotal_fee(record.getTotalFee()); | wxRefundOrderP.setTotal_fee(record.getTotalFee()); | ||||
| wxRefundOrderP.setRefund_fee(record.getRefundFee()); | wxRefundOrderP.setRefund_fee(record.getRefundFee()); | ||||
| wxRefundOrderP.setRefund_desc("B端商户退款"); | |||||
| wxRefundOrderP.setNotify_url(payAccount.getNotifyUrl() + "/refund"); | |||||
| if (isReal) { | if (isReal) { | ||||
| Map signMap = new HashMap(); | Map signMap = new HashMap(); | ||||
| try { | try { | ||||
| signMap = BeanUtils.toStringMap(wxRefundOrderP); | signMap = BeanUtils.toStringMap(wxRefundOrderP); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("退款签名异常"); | |||||
| logger.error("退款命令生辰: " + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "退款签名异常"); | ||||
| } | } | ||||
| String signAgent = WxPayment.createSign(signMap, payAccount.getApiKey()); | String signAgent = WxPayment.createSign(signMap, payAccount.getApiKey()); | ||||
| signMap.put("sign", signAgent); | signMap.put("sign", signAgent); | ||||
| String response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getApiKey()); | |||||
| String response = null; | |||||
| try { | |||||
| response = WxPay.orderRefund(signMap, payAccount.getCertPath(), payAccount.getMchId()); | |||||
| } catch (Exception e) { | |||||
| logger.error("退款异常: " + e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.REFUND_ORDER_ERROR.getCode(), "退款异常"); | |||||
| } | |||||
| logger.info("微信退款订单:" + wxRefundOrderP.toString() + ", response: " + response.toString()); | logger.info("微信退款订单:" + wxRefundOrderP.toString() + ", response: " + response.toString()); | ||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | Map<String, String> returnMap = WxPayment.xmlToMap(response); | ||||
| String result_no = returnMap.get("result_code"); | String result_no = returnMap.get("result_code"); | ||||
| String refund_id = returnMap.get("refund_id"); | String refund_id = returnMap.get("refund_id"); | ||||
| // 设置 微信退款订单号 | // 设置 微信退款订单号 | ||||
| record.setRefundId(refund_id); | record.setRefundId(refund_id); | ||||
| record.setRefundVendor(EnumPayWay.PAY_WAY_WEAPP.getCode()); | |||||
| if ("SUCCESS".equals(result_no)) { | if ("SUCCESS".equals(result_no)) { | ||||
| logger.error("微信退款订单申请成功: " + returnMap.toString()); | logger.error("微信退款订单申请成功: " + returnMap.toString()); | ||||
| try { | try { | ||||
| @@ -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<arr.length; i++) { | |||||
| sb.append(arr[i]); | |||||
| } | |||||
| //sha1加密 | |||||
| String tmpStr = getSHA1Str(sb.toString()); | |||||
| //加密字符串与signature比较的时候忽略大小写 | |||||
| return tmpStr.equals(signature.toUpperCase()); | |||||
| } | |||||
| private static String getSHA1Str(String content) { | |||||
| MessageDigest md = null; | |||||
| String tmpStr = null; | |||||
| try { | |||||
| md = MessageDigest.getInstance("SHA-1"); | |||||
| // 将三个参数字符串拼接成一个字符串进行 shal 加密 | |||||
| byte[] digest = md.digest(content.toString().getBytes()); | |||||
| tmpStr = byteToStr(digest); | |||||
| } catch (NoSuchAlgorithmException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return tmpStr; | |||||
| } | |||||
| /** | |||||
| * 将字节数组转换为十六进制字符串 | |||||
| * @param digest | |||||
| * @return | |||||
| */ | |||||
| private static String byteToStr(byte[] digest) { | |||||
| String strDigest = ""; | |||||
| for(int i = 0; i < digest.length; i++){ | |||||
| strDigest += byteToHexStr(digest[i]); | |||||
| } | |||||
| return strDigest; | |||||
| } | |||||
| /** | |||||
| * 将字节转换为十六进制字符串 | |||||
| * @param b | |||||
| * @return | |||||
| */ | |||||
| private static String byteToHexStr(byte b) { | |||||
| char[] Digit = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; | |||||
| char[] tempArr = new char[2]; | |||||
| tempArr[0] = Digit[(b >>> 4) & 0X0F]; | |||||
| tempArr[1] = Digit[b & 0X0F]; | |||||
| String s = new String(tempArr); | |||||
| return s; | |||||
| } | |||||
| } | |||||
| @@ -3,7 +3,6 @@ | |||||
| <mapper namespace="com.simple.mapper.MallPermissionMapper"> | <mapper namespace="com.simple.mapper.MallPermissionMapper"> | ||||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallPermission"> | <resultMap id="BaseResultMap" type="com.simple.domain.po.MallPermission"> | ||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | <result column="name" jdbcType="VARCHAR" property="name" /> | ||||
| <result column="available" jdbcType="VARCHAR" property="available" /> | <result column="available" jdbcType="VARCHAR" property="available" /> | ||||
| <result column="parent_id" jdbcType="BIGINT" property="parentId" /> | <result column="parent_id" jdbcType="BIGINT" property="parentId" /> | ||||
| @@ -15,7 +14,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `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` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -25,12 +24,7 @@ | |||||
| and `id` = #{id} | and `id` = #{id} | ||||
| </if> | </if> | ||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||||
| </if> | |||||
| <if test=" null != name "> | <if test=" null != name "> | ||||
| and `name` like concat('%', #{name},'%') | and `name` like concat('%', #{name},'%') | ||||
| @@ -193,7 +193,7 @@ | |||||
| and create_date >= #{startTime} | and create_date >= #{startTime} | ||||
| </if> | </if> | ||||
| <if test=" null != endTime"> | <if test=" null != endTime"> | ||||
| and create_date <= #{endTime} | |||||
| and create_date < #{endTime} | |||||
| </if> | </if> | ||||
| <if test="null != tenantId"> | <if test="null != tenantId"> | ||||
| and tenant_id =#{tenantId} | and tenant_id =#{tenantId} | ||||
| @@ -415,13 +415,13 @@ | |||||
| </select> | </select> | ||||
| <select id="queryPriceTotalGroup" resultType="com.simple.domain.vo.CUserDateAmountVo" > | <select id="queryPriceTotalGroup" resultType="com.simple.domain.vo.CUserDateAmountVo" > | ||||
| SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order | |||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY xTime | |||||
| SELECT DATE_FORMAT(create_date,'%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order | |||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} GROUP BY xTime | |||||
| </select> | </select> | ||||
| <select id="queryPriceTotal" resultType="java.lang.Integer" > | <select id="queryPriceTotal" resultType="java.lang.Integer" > | ||||
| SELECT SUM(coupon_price) from wx_coupon_order | SELECT SUM(coupon_price) from wx_coupon_order | ||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} | |||||
| where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date < #{endTime} | |||||
| </select> | </select> | ||||
| @@ -111,7 +111,8 @@ | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| </if> | |||||
| </if> | |||||
| and `refund_id` is not null | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | <if test=" null != sortColumns"> order by ${sortColumns} </if> | ||||
| </sql> | </sql> | ||||