| @@ -11,8 +11,8 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -23,36 +23,35 @@ import java.util.List; | |||
| @Api(description = "精准投放接口") | |||
| @RestController | |||
| @RequestMapping("couponInject") | |||
| public class CouponInjectController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class CouponInjectController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private CouponInjectService couponInjectService; | |||
| @Autowired | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| private Logger logger = Logger.getLogger(CouponInjectController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute CouponInject couponInject, Integer pageNum, Integer pageSize) { | |||
| if (null == couponInject) couponInject = new CouponInject(); | |||
| if(couponInject.getStatus()!=null&&couponInject.getStatus()==-1){ | |||
| if (null == couponInject) couponInject = new CouponInject(); | |||
| if (couponInject.getStatus() != null && couponInject.getStatus() == -1) { | |||
| couponInject.setStatus(null); | |||
| } | |||
| final PageInfo<CouponInject> page = couponInjectService.listAsPage(couponInject, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody CouponInject couponInject) { | |||
| couponInject.setTenantId(getUser().getTenantId()); | |||
| couponInject.setMUserId(getUser().getId()); | |||
| if(couponInject.getSendType()==0){ | |||
| if (couponInject.getSendType() == 0) { | |||
| couponInject.setSendTime(new Date()); | |||
| } | |||
| //Assert.notNull(couponInject.getName(), "角色名不能为空"); | |||
| @@ -75,25 +74,24 @@ public class CouponInjectController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| couponInjectService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| CouponInject couponInject = couponInjectService.getById(id); | |||
| if(couponInject!=null) { | |||
| if (couponInject != null) { | |||
| List<Long> tagids = JSON.parseArray(couponInject.getTags(), Long.class); | |||
| couponInject.setWxChooseTagVo(wxCUserTagsService.findChooseTag(tagids)); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",couponInject); | |||
| return new ResultData(Result.SUCCESS, "查询成功", couponInject); | |||
| } | |||
| } | |||
| @@ -4,7 +4,8 @@ import com.simple.common.ResultData; | |||
| import com.simple.service.DataTowerService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -17,8 +18,7 @@ import java.util.Map; | |||
| @RequestMapping("datatower") | |||
| public class DataTowerController extends BaseController { | |||
| private Logger logger = Logger.getLogger(DataTowerController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private DataTowerService dataTowerService; | |||
| @@ -28,7 +28,7 @@ public class DataTowerController extends BaseController { | |||
| @PostMapping("/queryRunning") | |||
| public ResultData queryRunning() { | |||
| Map<String,Object> data=dataTowerService.queryRunning(getTenantId()); | |||
| Map<String, Object> data = dataTowerService.queryRunning(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @@ -38,7 +38,7 @@ public class DataTowerController extends BaseController { | |||
| @PostMapping("/queryCar") | |||
| public ResultData queryCar() { | |||
| Map<String,Object> data=dataTowerService.queryCar(getTenantId()); | |||
| Map<String, Object> data = dataTowerService.queryCar(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @@ -47,7 +47,7 @@ public class DataTowerController extends BaseController { | |||
| @PostMapping("/queryCustomer") | |||
| public ResultData queryCustomer() { | |||
| Map<String,Object> data=dataTowerService.queryCustomer(getTenantId()); | |||
| Map<String, Object> data = dataTowerService.queryCustomer(getTenantId()); | |||
| return new ResultData(data); | |||
| } | |||
| @@ -1,15 +1,5 @@ | |||
| package com.simple.controller; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| import org.apache.shiro.subject.Subject; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.MallRolePermission; | |||
| @@ -18,44 +8,44 @@ import com.simple.domain.po.MallUserRole; | |||
| import com.simple.service.MallRolePermissionService; | |||
| import com.simple.service.MallUserRoleService; | |||
| import com.simple.shiro.UserSession; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.UsernamePasswordToken; | |||
| import org.apache.shiro.subject.Subject; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.StringUtils; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @Api(description="登录相关接口") | |||
| @Api(description = "登录相关接口") | |||
| public class HomeController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| // @Autowired | |||
| // private MallRoleService sysRoleService; | |||
| // | |||
| // @Autowired | |||
| // private MallPermissionService sysPermissionService; | |||
| @Autowired | |||
| private MallUserRoleService mallUserRoleService; | |||
| @Autowired | |||
| private MallRolePermissionService mallRolePermissionService; | |||
| // @GetMapping("login") | |||
| // public ResultData login() { | |||
| // return new ResultData(Result.UNLOGIN, "用户未登录"); | |||
| // } | |||
| @ApiOperation("登录") | |||
| @PostMapping("/doLogin") | |||
| public ResultData login(@RequestBody MallUserInfo user) { | |||
| ResultData data = new ResultData(); | |||
| ResultData data = new ResultData(); | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| return new ResultData(ResultData.ERROR,"用户名或者密码错误"); | |||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||
| } | |||
| try { | |||
| Subject subject = SecurityUtils.getSubject(); | |||
| UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); | |||
| subject.login(token); | |||
| Subject subject = SecurityUtils.getSubject(); | |||
| UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); | |||
| subject.login(token); | |||
| // List<MallRole> roleList = sysRoleService.findRoleByUserId(user.getId()); | |||
| // if (null != roleList && roleList.size() > 0) { | |||
| // List<MallPermission> permissionList = sysPermissionService | |||
| @@ -63,33 +53,34 @@ public class HomeController { | |||
| // user.setRole(roleList); | |||
| // user.setPermission(permissionList); | |||
| // } | |||
| MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| 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<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); | |||
| 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); | |||
| } | |||
| data.data=info; | |||
| }catch(Exception e) { | |||
| return new ResultData(ResultData.ERROR,"用户名或者密码错误"); | |||
| data.data = info; | |||
| } catch (Exception e) { | |||
| return new ResultData(ResultData.ERROR, "用户名或者密码错误"); | |||
| } | |||
| return data; | |||
| } | |||
| @ApiOperation("登出") | |||
| @GetMapping("/logout") | |||
| public ResultData login() { | |||
| @@ -1,18 +1,19 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.service.MallPermissionService; | |||
| import org.apache.shiro.util.Assert; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.service.MallPermissionService; | |||
| /** | |||
| * @author chenkx | |||
| * @date 2018-01-05. | |||
| @@ -20,16 +21,17 @@ import com.simple.service.MallPermissionService; | |||
| @RestController | |||
| @RequestMapping("permission") | |||
| public class MallPermissionController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| MallPermissionService mallPermissionService; | |||
| @GetMapping("alllist") | |||
| public ResultData alllist(String ava) { | |||
| MallPermission record = new MallPermission(); | |||
| record.setAvailable(ava); | |||
| PageInfo<MallPermission> permissions= mallPermissionService.listAsPage(record, 1, 10000); | |||
| record.setAvailable(ava); | |||
| PageInfo<MallPermission> permissions = mallPermissionService.listAsPage(record, 1, 10000); | |||
| return new ResultData(Result.SUCCESS, "查询成功", permissions.getList()); | |||
| } | |||
| @@ -51,7 +53,7 @@ public class MallPermissionController { | |||
| mallPermissionService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| public ResultData findById(Long id) { | |||
| mallPermissionService.getById(id); | |||
| @@ -1,18 +1,5 @@ | |||
| package com.simple.controller; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| @@ -20,16 +7,24 @@ import com.simple.domain.po.MallRole; | |||
| import com.simple.domain.po.MallRolePermission; | |||
| import com.simple.service.MallRolePermissionService; | |||
| import com.simple.service.MallRoleService; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("role") | |||
| @Api(description="角色相关接口") | |||
| @Api(description = "角色相关接口") | |||
| public class MallRoleController extends BaseController { | |||
| private Logger logger = Logger.getLogger(MallRoleController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private MallRoleService sysRoleService; | |||
| @@ -39,47 +34,48 @@ public class MallRoleController extends BaseController { | |||
| @GetMapping("list") | |||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | |||
| String tenantId = getTenantId(); | |||
| sysRole.setTenantId(tenantId); | |||
| String tenantId = getTenantId(); | |||
| sysRole.setTenantId(tenantId); | |||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||
| for(MallRole r:page.getList()) { | |||
| MallRolePermission p = new MallRolePermission(); | |||
| p.setRoleId(r.getId()); | |||
| p.setTenantId(tenantId); | |||
| PageInfo<MallRolePermission> pers = sysRolePermissionService.listAsPage(p, 1, 1000); | |||
| String menus =""; | |||
| for(MallRolePermission rp:pers.getList()) { | |||
| menus+=rp.getPermissionId()+","; | |||
| } | |||
| if(menus.length()>1) { | |||
| menus=menus.substring(0, menus.length()-1); | |||
| } | |||
| r.setMenus(menus); | |||
| for (MallRole r : page.getList()) { | |||
| MallRolePermission p = new MallRolePermission(); | |||
| p.setRoleId(r.getId()); | |||
| p.setTenantId(tenantId); | |||
| PageInfo<MallRolePermission> pers = sysRolePermissionService.listAsPage(p, 1, 1000); | |||
| String menus = ""; | |||
| for (MallRolePermission rp : pers.getList()) { | |||
| menus += rp.getPermissionId() + ","; | |||
| } | |||
| if (menus.length() > 1) { | |||
| menus = menus.substring(0, menus.length() - 1); | |||
| } | |||
| r.setMenus(menus); | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("saveOrUpdate") | |||
| public ResultData saveOrUpdate(@RequestBody MallRole sysRole ) { | |||
| String tenantId = getTenantId(); | |||
| int count = sysRoleService.countByName(sysRole.getName(), sysRole.getId()); | |||
| if(count>0) { | |||
| return new ResultData(ResultData.ERROR,"角色名已存在"); | |||
| } | |||
| sysRole.setTenantId(tenantId); | |||
| sysRoleService.saveOrUpdate(sysRole); | |||
| public ResultData saveOrUpdate(@RequestBody MallRole sysRole) { | |||
| String tenantId = getTenantId(); | |||
| int count = sysRoleService.countByName(sysRole.getName(), sysRole.getId()); | |||
| if (count > 0) { | |||
| return new ResultData(ResultData.ERROR, "角色名已存在"); | |||
| } | |||
| sysRole.setTenantId(tenantId); | |||
| sysRoleService.saveOrUpdate(sysRole); | |||
| // SysRolePermissionService.deleteById(id); | |||
| if(StringUtils.isNoneBlank(sysRole.getMenus())) { | |||
| List<Long> mIds =new ArrayList<>(); | |||
| for(String mId:sysRole.getMenus().split(",")) { | |||
| mIds.add(Long.valueOf(mId)); | |||
| } | |||
| sysRolePermissionService.savePermissions(tenantId,sysRole.getId(), mIds.toArray(new Long[] {}));; | |||
| } | |||
| return new ResultData(); | |||
| if (StringUtils.isNoneBlank(sysRole.getMenus())) { | |||
| List<Long> mIds = new ArrayList<>(); | |||
| for (String mId : sysRole.getMenus().split(",")) { | |||
| mIds.add(Long.valueOf(mId)); | |||
| } | |||
| sysRolePermissionService.savePermissions(tenantId, sysRole.getId(), mIds.toArray(new Long[]{})); | |||
| ; | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(MallRole sysRole) { | |||
| @@ -92,15 +88,14 @@ public class MallRoleController extends BaseController { | |||
| @PostMapping("update") | |||
| public ResultData update(MallRole sysRole) { | |||
| if (sysRole.getName() != null) { | |||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||
| Assert.isTrue(!checkUnique(sysRole.getName(), sysRole.getId()), "角色名已存在"); | |||
| } | |||
| sysRoleService.saveOrUpdate(sysRole); | |||
| // Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("/del") | |||
| public ResultData delete(@RequestBody MallRole sysRole) { | |||
| @@ -111,10 +106,10 @@ public class MallRoleController extends BaseController { | |||
| @GetMapping("setPermission") | |||
| public ResultData setPermission(Long roleId, String perId) { | |||
| Assert.notNull(perId,"请选择权限"); | |||
| Assert.notNull(perId, "请选择权限"); | |||
| /*String[] perIds = perId.split(","); | |||
| SysRolePermissionService.savePermissions(roleId, perIds);*/ | |||
| //TODO | |||
| //TODO | |||
| return new ResultData(Result.SUCCESS, "设置角色权限成功", null); | |||
| } | |||
| @@ -1,26 +1,22 @@ | |||
| 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; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.service.*; | |||
| import com.simple.shiro.PasswordHelper; | |||
| import com.simple.shiro.UserSession; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| /** | |||
| * @author chenkx | |||
| @@ -31,15 +27,17 @@ import io.swagger.annotations.ApiOperation; | |||
| @RequestMapping("user") | |||
| public class MallUserInfoController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| MallUserInfoService userInfoService; | |||
| @Autowired | |||
| MallUserRoleService userRoleService; | |||
| @Autowired | |||
| MallRoleService mallRoleService; | |||
| @Autowired | |||
| MallUserRoleService mallUserRoleService; | |||
| @@ -51,35 +49,35 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "用户分页接口", response = String.class) | |||
| @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); | |||
| for(MallUserInfo u:page.getList()) { | |||
| MallUserRole r =new MallUserRole(); | |||
| r.setUid(u.getId()); | |||
| PageInfo<MallUserRole> ur = userRoleService.listAsPage(r, 1, 1); | |||
| if(ur.getSize()>0) { | |||
| MallRole role = mallRoleService.getById(ur.getList().get(0).getRoleId()); | |||
| if (role != null) { | |||
| for (MallUserInfo u : page.getList()) { | |||
| MallUserRole r = new MallUserRole(); | |||
| r.setUid(u.getId()); | |||
| PageInfo<MallUserRole> ur = userRoleService.listAsPage(r, 1, 1); | |||
| if (ur.getSize() > 0) { | |||
| MallRole role = mallRoleService.getById(ur.getList().get(0).getRoleId()); | |||
| if (role != null) { | |||
| u.setRoleName(role.getName()); | |||
| u.setRoleId(role.getId()); | |||
| } | |||
| } | |||
| u.setPassword(null);//不返回密码 | |||
| } | |||
| u.setPassword(null);//不返回密码 | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation(value = "用户详情接口", response = String.class) | |||
| @GetMapping("detail") | |||
| public ResultData detail(Long id){ | |||
| public ResultData detail(Long id) { | |||
| final MallUserInfo user = userInfoService.getById(id); | |||
| return new ResultData(user); | |||
| } | |||
| @ApiOperation(value = "创建用户接口", response = String.class) | |||
| @PostMapping("add") | |||
| public ResultData createUser(@RequestBody MallUserInfo userInfo){ | |||
| public ResultData createUser(@RequestBody MallUserInfo userInfo) { | |||
| Assert.notNull(userInfo.getUsername(), "用户名不能为空"); | |||
| Assert.isTrue(checkUnique(userInfo.getUsername(), 0), "重复的用户名"); | |||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||
| @@ -87,18 +85,18 @@ public class MallUserInfoController extends BaseController { | |||
| passwordHelper.encryptPassword(userInfo); | |||
| userInfo.setTenantId(getTenantId()); | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| if(userInfo.getRoleId()!=null) { | |||
| MallUserRole r = new MallUserRole(); | |||
| r.setRoleId(userInfo.getRoleId()); | |||
| r.setUid(userInfo.getId()); | |||
| userRoleService.saveOrUpdate(r); | |||
| if (userInfo.getRoleId() != null) { | |||
| MallUserRole r = new MallUserRole(); | |||
| r.setRoleId(userInfo.getRoleId()); | |||
| r.setUid(userInfo.getId()); | |||
| userRoleService.saveOrUpdate(r); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation(value = "修改用户接口", response = String.class) | |||
| @PostMapping("update") | |||
| public ResultData updateUser(@RequestBody MallUserInfo userInfo){ | |||
| public ResultData updateUser(@RequestBody MallUserInfo userInfo) { | |||
| Assert.notNull(userInfo.getUsername(), "用户名不能为空"); | |||
| Assert.isTrue(checkUnique(userInfo.getUsername(), 1), "重复的用户名"); | |||
| // Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||
| @@ -107,12 +105,12 @@ public class MallUserInfoController extends BaseController { | |||
| userInfo.setPassword(null); | |||
| userInfo.setTenantId(getTenantId()); | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| if(userInfo.getRoleId()!=null) { | |||
| userRoleService.deleteByUserId(userInfo.getId()); | |||
| MallUserRole r = new MallUserRole(); | |||
| r.setRoleId(userInfo.getRoleId()); | |||
| r.setUid(userInfo.getId()); | |||
| userRoleService.saveOrUpdate(r); | |||
| if (userInfo.getRoleId() != null) { | |||
| userRoleService.deleteByUserId(userInfo.getId()); | |||
| MallUserRole r = new MallUserRole(); | |||
| r.setRoleId(userInfo.getRoleId()); | |||
| r.setUid(userInfo.getId()); | |||
| userRoleService.saveOrUpdate(r); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @@ -121,12 +119,13 @@ public class MallUserInfoController extends BaseController { | |||
| @PostMapping("/del") | |||
| public ResultData deleteUser(@RequestBody MallUserInfo userInfo) { | |||
| userInfoService.deleteById(userInfo.getId()); | |||
| return new ResultData(); | |||
| } | |||
| /** | |||
| * 启用,停用用户 | |||
| * | |||
| * @param userId | |||
| * @param status | |||
| * @return | |||
| @@ -143,7 +142,7 @@ public class MallUserInfoController extends BaseController { | |||
| @ApiOperation(value = "用户添加角色接口", response = String.class) | |||
| @PostMapping("setRoles") | |||
| public ResultData setRoles(Long userId,String roleIds) { | |||
| public ResultData setRoles(Long userId, String roleIds) { | |||
| /*String[] roIds = roleIds.split(","); | |||
| List<MallUserRole> u2rs = new ArrayList<>(roIds.length); | |||
| for (String roleId : roIds) { | |||
| @@ -169,40 +168,40 @@ public class MallUserInfoController extends BaseController { | |||
| } | |||
| return true; | |||
| } | |||
| @GetMapping("hasButtonPermission") | |||
| public ResultData hasButtonPermission(String permissions){ | |||
| Map<String,Boolean> map=new HashMap<>(); | |||
| for(String name:permissions.split(",")){ | |||
| Long userId = (Long) | |||
| SecurityUtils.getSubject().getSession().getAttribute(UserSession.userId); | |||
| boolean has =userInfoService.hasButtonPermission(userId, name); | |||
| map.put(name, has); | |||
| } | |||
| public ResultData hasButtonPermission(String permissions) { | |||
| Map<String, Boolean> map = new HashMap<>(); | |||
| for (String name : permissions.split(",")) { | |||
| Long userId = (Long) | |||
| SecurityUtils.getSubject().getSession().getAttribute(UserSession.userId); | |||
| boolean has = userInfoService.hasButtonPermission(userId, name); | |||
| map.put(name, has); | |||
| } | |||
| // StringBuffer buffer = new StringBuffer(); | |||
| // for(Entry<String, Boolean> entrySet :map.entrySet()){ | |||
| // buffer.append("var "+entrySet.getKey()); | |||
| // buffer.append("="+entrySet.getValue()); | |||
| // buffer.append(";"); | |||
| // } | |||
| //return new ResultData(buffer.toString()); | |||
| return new ResultData(map); | |||
| //return new ResultData(buffer.toString()); | |||
| return new ResultData(map); | |||
| } | |||
| @GetMapping("getUser") | |||
| public ResultData getUserInfo(){ | |||
| MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| info.setPassword("保密"); | |||
| if (info.getIsAdmin() == 1) { // isAdmin | |||
| MallPermission q = new MallPermission(); | |||
| PageInfo<MallPermission> list = mallPermissionService.listAsPage(q,1,100); | |||
| public ResultData getUserInfo() { | |||
| MallUserInfo info = (MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| info.setPassword("保密"); | |||
| 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()+","; | |||
| for (MallPermission rp : list.getList()) { | |||
| menus += rp.getId() + ","; | |||
| } | |||
| if(menus.length()>0) { | |||
| menus = menus.substring(0, menus.length()-1); | |||
| if (menus.length() > 0) { | |||
| menus = menus.substring(0, menus.length() - 1); | |||
| } | |||
| info.setMenus(menus); | |||
| } else { | |||
| @@ -210,22 +209,22 @@ public class MallUserInfoController extends BaseController { | |||
| MallUserRole ur = new MallUserRole(); | |||
| ur.setUid(info.getId()); | |||
| PageInfo<MallUserRole> page = mallUserRoleService.listAsPage(ur, 1, 1); | |||
| if(page.getSize()>0) { | |||
| 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()+","; | |||
| for (MallRolePermission rp : listAsPage.getList()) { | |||
| menus += rp.getPermissionId() + ","; | |||
| } | |||
| if(menus.length()>0) { | |||
| menus = menus.substring(0, menus.length()-1); | |||
| if (menus.length() > 0) { | |||
| menus = menus.substring(0, menus.length() - 1); | |||
| } | |||
| info.setMenus(menus); | |||
| } | |||
| } | |||
| return new ResultData(info); | |||
| return new ResultData(info); | |||
| } | |||
| } | |||
| @@ -1,12 +1,12 @@ | |||
| package com.simple.controller; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.MarkingCouponDataReportDto; | |||
| import com.simple.service.MarkingDataReportService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| @@ -18,11 +18,13 @@ import org.springframework.web.bind.annotation.RestController; | |||
| */ | |||
| @RestController | |||
| @RequestMapping("markingDataReport") | |||
| @Api(description="营销报表接口") | |||
| @Api(description = "营销报表接口") | |||
| public class MarkingDataReportController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private MarkingDataReportService markingDataReportService; | |||
| @ApiOperation("查询券数据") | |||
| @GetMapping("/couponData") | |||
| public ResultData findCouponData() { | |||
| @@ -31,8 +33,8 @@ public class MarkingDataReportController extends BaseController { | |||
| @ApiOperation("查询券数据列表") | |||
| @GetMapping("/couponDataList") | |||
| public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getCouponDateList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||
| public ResultData findCouponDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getCouponDateList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("查询场景投放券数据") | |||
| @@ -43,8 +45,8 @@ public class MarkingDataReportController extends BaseController { | |||
| @ApiOperation("查询场景营销数据列表") | |||
| @GetMapping("/sceneDataList") | |||
| public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getSceneDataList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||
| public ResultData findSceneDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getSceneDataList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| @ApiOperation("查询触达用户数数据") | |||
| @@ -55,10 +57,9 @@ public class MarkingDataReportController extends BaseController { | |||
| @ApiOperation("查询触达用户数数据列表") | |||
| @GetMapping("/touchUsersDataList") | |||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto,Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(),markingCouponDataReportDto,pageNum,pageSize)); | |||
| public ResultData touchUsersDataList(@ModelAttribute MarkingCouponDataReportDto markingCouponDataReportDto, Integer pageNum, Integer pageSize) { | |||
| return new ResultData(markingDataReportService.getTouchUsersReportList(getTenantId(), markingCouponDataReportDto, pageNum, pageSize)); | |||
| } | |||
| } | |||
| @@ -1,69 +1,59 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.PushLimit; | |||
| import com.simple.service.PushLimitService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("pushLimit") | |||
| @Api(description="疲劳度相关接口") | |||
| public class PushLimitController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "疲劳度相关接口") | |||
| public class PushLimitController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private PushLimitService pushLimitService; | |||
| private Logger logger = Logger.getLogger(PushLimitController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| public ResultData list(@ModelAttribute PushLimit pushLimit) { | |||
| if (null == pushLimit) pushLimit = new PushLimit(); | |||
| pushLimit.setTenantId(getTenantId()); | |||
| if (null == pushLimit) pushLimit = new PushLimit(); | |||
| pushLimit.setTenantId(getTenantId()); | |||
| final PageInfo<PushLimit> page = pushLimitService.listAsPage(pushLimit, 1, 10); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody PushLimit pushLimit) { | |||
| pushLimit.setMsgAmount(null); | |||
| pushLimit.setMsgAmount(null); | |||
| pushLimitService.saveOrUpdate(pushLimit); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| pushLimitService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",pushLimitService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", pushLimitService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,15 +1,9 @@ | |||
| package com.simple.controller; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| import com.simple.common.ResultData; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| @@ -19,84 +13,86 @@ import org.springframework.web.bind.annotation.RequestParam; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import com.simple.common.ResultData; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| import java.util.UUID; | |||
| @RestController | |||
| @RequestMapping(value = "upload") | |||
| @Api(description="文件上传接口") | |||
| @Api(description = "文件上传接口") | |||
| public class UploadController { | |||
| private final Logger logger = LoggerFactory.getLogger(UploadController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Value("${fileUpload.path}") | |||
| private String filePath; | |||
| @Value("${fileUpload.server}") | |||
| private String server; | |||
| /** | |||
| * 上传文件 | |||
| * | |||
| * @param request | |||
| * @param multiReq | |||
| * @return | |||
| * @throws Exception | |||
| */ | |||
| @PostMapping(value = "/fileUpload", consumes="multipart/*" | |||
| ,headers="content-type=multipart/form-data" ) | |||
| @PostMapping(value = "/fileUpload", consumes = "multipart/*" | |||
| , headers = "content-type=multipart/form-data") | |||
| @ApiOperation("上传文件") | |||
| public ResultData fileUpload(@RequestParam("file") MultipartFile multiReq | |||
| ) { | |||
| ResultData data = new ResultData(); | |||
| FileOutputStream fos=null; | |||
| BufferedInputStream fs=null; | |||
| try { | |||
| File targetFile = new File(filePath); | |||
| if(!targetFile.exists()){ | |||
| targetFile.mkdirs(); | |||
| } | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||
| fileName=fileName+ multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| fos = new FileOutputStream(new File(filePath+File.separator+fileName)); | |||
| fs=(BufferedInputStream) multiReq.getInputStream(); | |||
| byte[] buffer=new byte[1024]; | |||
| int len=0; | |||
| while((len=fs.read(buffer))!=-1){ | |||
| fos.write(buffer, 0, len); | |||
| } | |||
| fos.close(); | |||
| fs.close(); | |||
| data.code=ResultData.SUCCESS; | |||
| Map<String,String> map = new HashMap<>(); | |||
| map.put("imgarray", server+"/"+fileName); | |||
| data.data=map; | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| data.code=ResultData.ERROR; | |||
| data.message="上传失败"; | |||
| }finally { | |||
| if(fos!=null) { | |||
| try { | |||
| fos.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if(fs!=null) { | |||
| try { | |||
| fs.close(); | |||
| }catch(IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| public ResultData fileUpload(@RequestParam("file") MultipartFile multiReq) { | |||
| ResultData data = new ResultData(); | |||
| FileOutputStream fos = null; | |||
| BufferedInputStream fs = null; | |||
| try { | |||
| File targetFile = new File(filePath); | |||
| if (!targetFile.exists()) { | |||
| targetFile.mkdirs(); | |||
| } | |||
| String fileName = UUID.randomUUID().toString(); | |||
| int dot = multiReq.getOriginalFilename().lastIndexOf('.'); | |||
| fileName = fileName + multiReq.getOriginalFilename().substring(dot, multiReq.getOriginalFilename().length()); | |||
| fos = new FileOutputStream(new File(filePath + File.separator + fileName)); | |||
| fs = (BufferedInputStream) multiReq.getInputStream(); | |||
| byte[] buffer = new byte[1024]; | |||
| int len = 0; | |||
| while ((len = fs.read(buffer)) != -1) { | |||
| fos.write(buffer, 0, len); | |||
| } | |||
| fos.close(); | |||
| fs.close(); | |||
| data.code = ResultData.SUCCESS; | |||
| Map<String, String> map = new HashMap<>(); | |||
| map.put("imgarray", server + "/" + fileName); | |||
| data.data = map; | |||
| } catch (Exception e) { | |||
| e.printStackTrace(); | |||
| data.code = ResultData.ERROR; | |||
| data.message = "上传失败"; | |||
| } finally { | |||
| if (fos != null) { | |||
| try { | |||
| fos.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if (fs != null) { | |||
| try { | |||
| fs.close(); | |||
| } catch (IOException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| } | |||
| return data; | |||
| } | |||
| } | |||
| @@ -1,42 +1,38 @@ | |||
| package com.simple.controller; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxAdminLog; | |||
| import com.simple.service.WxAdminLogService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxAdminLog") | |||
| public class WxAdminLogController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxAdminLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxAdminLogService wxAdminLogService; | |||
| private Logger logger = Logger.getLogger(WxAdminLogController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxAdminLog wxAdminLog,Integer pageNum, Integer pageSize) { | |||
| if (null == wxAdminLog) wxAdminLog = new WxAdminLog(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxAdminLog wxAdminLog, Integer pageNum, Integer pageSize) { | |||
| if (null == wxAdminLog) wxAdminLog = new WxAdminLog(); | |||
| final PageInfo<WxAdminLog> page = wxAdminLogService.listAsPage(wxAdminLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxAdminLog wxAdminLog) { | |||
| //Assert.notNull(wxAdminLog.getName(), "角色名不能为空"); | |||
| @@ -48,25 +44,25 @@ public class WxAdminLogController extends BaseController | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxAdminLog wxAdminLog) { | |||
| String tenantId = getTenantId(); | |||
| wxAdminLog.setTenantId(tenantId); | |||
| String tenantId = getTenantId(); | |||
| wxAdminLog.setTenantId(tenantId); | |||
| wxAdminLogService.saveOrUpdate(wxAdminLog); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxAdminLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxAdminLogService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxAdminLogService.getById(id)); | |||
| } | |||
| @ApiOperation("PV计数") | |||
| @@ -77,5 +73,5 @@ public class WxAdminLogController extends BaseController | |||
| wxAdminLogService.saveLogCount(wxAdminLog); | |||
| return new ResultData(); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.service.WxAppinfoService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxAppinfo") | |||
| public class WxAppinfoController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxAppinfoController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxAppinfoService wxAppinfoService; | |||
| private Logger logger = Logger.getLogger(WxAppinfoController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxAppinfo wxAppinfo,Integer pageNum, Integer pageSize) { | |||
| if (null == wxAppinfo) wxAppinfo = new WxAppinfo(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxAppinfo wxAppinfo, Integer pageNum, Integer pageSize) { | |||
| if (null == wxAppinfo) wxAppinfo = new WxAppinfo(); | |||
| final PageInfo<WxAppinfo> page = wxAppinfoService.listAsPage(wxAppinfo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxAppinfo wxAppinfo) { | |||
| //Assert.notNull(wxAppinfo.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxAppinfoController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxAppinfoService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxAppinfoService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxBLog; | |||
| import com.simple.service.WxBLogService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxBLog") | |||
| public class WxBLogController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxBLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBLogService wxBLogService; | |||
| private Logger logger = Logger.getLogger(WxBLogController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBLog wxBLog,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBLog) wxBLog = new WxBLog(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBLog wxBLog, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBLog) wxBLog = new WxBLog(); | |||
| final PageInfo<WxBLog> page = wxBLogService.listAsPage(wxBLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBLog wxBLog) { | |||
| //Assert.notNull(wxBLog.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxBLogController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxBLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBLogService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBLogService.getById(id)); | |||
| } | |||
| } | |||
| @@ -7,7 +7,8 @@ import com.simple.domain.po.WxBillRent; | |||
| import com.simple.service.WxBillRentService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -15,21 +16,20 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxBillRent") | |||
| public class WxBillRentController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxBillRentService wxBillRentService; | |||
| public class WxBillRentController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Logger logger = Logger.getLogger(WxBillRentController.class); | |||
| @Autowired | |||
| private WxBillRentService wxBillRentService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBillRent wxBillRent,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillRent) wxBillRent = new WxBillRent(); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRent.setSortColumns(WxBillRent.Field.Id_DESC); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBillRent wxBillRent, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBillRent) wxBillRent = new WxBillRent(); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRent.setSortColumns(WxBillRent.Field.Id_DESC); | |||
| final PageInfo<Map<String, Object>> page = wxBillRentService.listAsPage(wxBillRent, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -40,28 +40,27 @@ public class WxBillRentController extends BaseController | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxBillRent.setTenantId(getTenantId()); | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS,"操作成功"); | |||
| return new ResultData(ResultData.SUCCESS, "操作成功"); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxBillRent wxBillRent) { | |||
| wxBillRentService.saveOrUpdate(wxBillRent); | |||
| return new ResultData(ResultData.SUCCESS,"操作成功"); | |||
| return new ResultData(ResultData.SUCCESS, "操作成功"); | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxBillRentService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBillRentService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBillRentService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxBusiness; | |||
| import com.simple.service.WxBusinessService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxBusiness") | |||
| public class WxBusinessController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxBusinessController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBusinessService wxBusinessService; | |||
| private Logger logger = Logger.getLogger(WxBusinessController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxBusiness wxBusiness,Integer pageNum, Integer pageSize) { | |||
| if (null == wxBusiness) wxBusiness = new WxBusiness(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxBusiness wxBusiness, Integer pageNum, Integer pageSize) { | |||
| if (null == wxBusiness) wxBusiness = new WxBusiness(); | |||
| final PageInfo<WxBusiness> page = wxBusinessService.listAsPage(wxBusiness, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxBusiness wxBusiness) { | |||
| //Assert.notNull(wxBusiness.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxBusinessController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxBusinessService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxBusinessService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxBusinessService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,12 +18,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCLog") | |||
| public class WxCLogController extends BaseController | |||
| { | |||
| public class WxCLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCLogService wxCLogService; | |||
| private Logger logger = Logger.getLogger(WxCLogController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -13,7 +13,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -25,6 +26,8 @@ import java.util.Map; | |||
| @RequestMapping("wxCUserBasicInfo") | |||
| @Api(description = "会员管理相关接口") | |||
| public class WxCUserBasicInfoController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @@ -43,8 +46,6 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private Logger logger = Logger.getLogger(WxCUserBasicInfoController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -54,7 +55,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||
| if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfoDto(); | |||
| String tenantId = getTenantId(); | |||
| wxCUserBasicInfo.setTenantId(tenantId); | |||
| PageInfo<Map<String,Object>> page = wxCUserBasicInfoService.queryListMap(wxCUserBasicInfo, pageNum, pageSize); | |||
| PageInfo<Map<String, Object>> page = wxCUserBasicInfoService.queryListMap(wxCUserBasicInfo, pageNum, pageSize); | |||
| // PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize); | |||
| // if (page.getSize() == 0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone()) | |||
| // && wxCUserBasicInfo.getEndTime() == null && wxCUserBasicInfo.getStartTime() == null | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUserCar; | |||
| import com.simple.service.WxCUserCarService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCUserCar") | |||
| public class WxCUserCarController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxCUserCarController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserCarService wxCUserCarService; | |||
| private Logger logger = Logger.getLogger(WxCUserCarController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCar,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserCar) wxCUserCar = new WxCUserCar(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCUserCar wxCUserCar, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserCar) wxCUserCar = new WxCUserCar(); | |||
| final PageInfo<WxCUserCar> page = wxCUserCarService.listAsPage(wxCUserCar, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCUserCar wxCUserCar) { | |||
| //Assert.notNull(wxCUserCar.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxCUserCarController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCUserCarService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserCarService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserCarService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,12 +18,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCUser") | |||
| public class WxCUserController extends BaseController | |||
| { | |||
| public class WxCUserController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| private Logger logger = Logger.getLogger(WxCUserController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -10,6 +10,8 @@ import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -30,7 +32,8 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCUserData") | |||
| @Api(description="会员首页报表数据") | |||
| public class WxCUserDataController extends BaseController{ | |||
| public class WxCUserDataController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUserTags; | |||
| import com.simple.service.WxCUserTagsService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCUserTags") | |||
| public class WxCUserTagsController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxCUserTagsController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| private Logger logger = Logger.getLogger(WxCUserTagsController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCUserTags wxCUserTags,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserTags) wxCUserTags = new WxCUserTags(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCUserTags wxCUserTags, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCUserTags) wxCUserTags = new WxCUserTags(); | |||
| final PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(wxCUserTags, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCUserTags wxCUserTags) { | |||
| //Assert.notNull(wxCUserTags.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxCUserTagsController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCUserTagsService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCUserTagsService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCUserTagsService.getById(id)); | |||
| } | |||
| } | |||
| @@ -6,11 +6,9 @@ import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCampaign; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.vo.WxCouponChannelVo; | |||
| import com.simple.enums.EnumCouponChannelType; | |||
| import com.simple.enums.EnumCouponStatus; | |||
| import com.simple.service.WxCampaignService; | |||
| import com.simple.service.WxCouponChannelService; | |||
| import com.simple.service.WxCouponService; | |||
| @@ -19,40 +17,39 @@ import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import static com.simple.domain.po.WxCampaign.Field.SortNum_ASC; | |||
| @RestController | |||
| @RequestMapping("wxCampaign") | |||
| @Api(description="促销和banner接口") | |||
| public class WxCampaignController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "促销和banner接口") | |||
| public class WxCampaignController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCampaignService wxCampaignService; | |||
| @Autowired | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| private Logger logger = Logger.getLogger(WxCampaignController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCampaign wxCampaign, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||
| if(wxCampaign.getStatus()!=null&&wxCampaign.getStatus()==-1){ | |||
| wxCampaign.setStatus(null); | |||
| if (null == wxCampaign) wxCampaign = new WxCampaign(); | |||
| if (wxCampaign.getStatus() != null && wxCampaign.getStatus() == -1) { | |||
| wxCampaign.setStatus(null); | |||
| } | |||
| wxCampaign.setTenantId(getTenantId()); | |||
| wxCampaign.setSortColumns(SortNum_ASC); | |||
| @@ -60,16 +57,16 @@ public class WxCampaignController extends BaseController | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCampaign wxCampaign) { | |||
| //Assert.notNull(wxCampaign.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| // int sortNum = wxCampaignService.getMaxSortNum(getTenantId()); | |||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| if (StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||
| }else { | |||
| } else { | |||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | |||
| } | |||
| wxCampaign.setStatus(0); | |||
| @@ -82,10 +79,10 @@ public class WxCampaignController extends BaseController | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCampaign wxCampaign) { | |||
| if(StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| if (StringUtils.isNotBlank(wxCampaign.getCouponIds())) { | |||
| String[] arys = wxCampaign.getCouponIds().split(","); | |||
| wxCampaign.setCouponIds(JSON.toJSONString(arys)); | |||
| }else { | |||
| } else { | |||
| wxCampaign.setCouponIds(JSONArray.toJSONString(new String[0])); | |||
| } | |||
| wxCampaignService.saveOrUpdate(wxCampaign); | |||
| @@ -94,47 +91,47 @@ public class WxCampaignController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCampaignService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | |||
| if (wxCampaign != null) { | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(0); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||
| } | |||
| WxCampaign wxCampaign = wxCampaignService.getById(id); | |||
| if (wxCampaign != null) { | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | |||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | |||
| wxCouponChannel.setStatus(0); | |||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listAPI(wxCouponChannel); | |||
| wxCampaign.setCoupons(couponList); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | |||
| } | |||
| @ApiOperation("调整顺序") | |||
| @GetMapping("/move") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="sourceId",value="",dataType="Long", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="targetId",value="",dataType="Long", paramType = "query",required=true)}) | |||
| public ResultData move(Long sourceId,Long targetId) { | |||
| WxCampaign source = wxCampaignService.getById(sourceId); | |||
| @ApiImplicitParam(name = "sourceId", value = "", dataType = "Long", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "targetId", value = "", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData move(Long sourceId, Long targetId) { | |||
| WxCampaign source = wxCampaignService.getById(sourceId); | |||
| WxCampaign target = wxCampaignService.getById(targetId); | |||
| if(source==null||target==null){ | |||
| if (source == null || target == null) { | |||
| return new ResultData(Result.ERROR, "调整顺序失败", null); | |||
| } | |||
| int temp =source.getSortNum(); | |||
| int temp = source.getSortNum(); | |||
| source.setSortNum(target.getSortNum()); | |||
| target.setSortNum(temp); | |||
| wxCampaignService.saveOrUpdate(source); | |||
| wxCampaignService.saveOrUpdate(target); | |||
| return new ResultData(Result.SUCCESS, "调整顺序成功", null); | |||
| } | |||
| } | |||
| @@ -1,11 +1,11 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.domain.po.WxCUserCar; | |||
| import com.simple.domain.po.WxCarCmdLog; | |||
| import com.simple.domain.po.WxPark; | |||
| import com.simple.enums.EnumCarCmd; | |||
| import com.simple.enums.EnumCarVendor; | |||
| import com.simple.enums.EnumCouponSendType; | |||
| @@ -13,11 +13,14 @@ import com.simple.enums.EnumETCPCode; | |||
| import com.simple.service.*; | |||
| import com.simple.utils.ETCPUtil; | |||
| import com.simple.utils.TJDCarUtil; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| @@ -26,11 +29,10 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/carCallback") | |||
| public class WxCarCallBackController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxCarCallBackController.class); | |||
| public class WxCarCallBackController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| ETCPUtil etcp = new ETCPUtil(); | |||
| ETCPUtil etcp = new ETCPUtil(); | |||
| TJDCarUtil tjd = new TJDCarUtil(); | |||
| @@ -52,19 +54,19 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * ETCP 车辆入场通知 | |||
| * { | |||
| * "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||
| * "plateNumber": "渝 ATX061", | |||
| * "parkName": "ETCP 智慧停车场", | |||
| * "parkId": "1", | |||
| * "entranceTime": "2017-08-20 12:59:54", | |||
| * "userType": "76", | |||
| * "pushTime": "2017-08-20 12:59:57", | |||
| * "fixParkingId": "U7", | |||
| * "remainingDays": "11" | |||
| * "synId": "4ebd80ff-cfcf-462a-94cb-727e9fa9547c", | |||
| * "plateNumber": "渝 ATX061", | |||
| * "parkName": "ETCP 智慧停车场", | |||
| * "parkId": "1", | |||
| * "entranceTime": "2017-08-20 12:59:54", | |||
| * "userType": "76", | |||
| * "pushTime": "2017-08-20 12:59:57", | |||
| * "fixParkingId": "U7", | |||
| * "remainingDays": "11" | |||
| * } | |||
| */ | |||
| */ | |||
| @PostMapping(value = "/etcpParkInCallback") | |||
| public Result etcpParkInCallback(@RequestBody Map<String,String> paramMap) { | |||
| public Result etcpParkInCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpParkInCallback: " + paramMap.toString()); | |||
| Date currentDate = new Date(); | |||
| WxCarCmdLog wxCarCmdLog = new WxCarCmdLog(); | |||
| @@ -82,7 +84,7 @@ public class WxCarCallBackController extends BaseController | |||
| parkQ.setParkId(etcpParkId); | |||
| WxPark park = wxParkService.getByObj(parkQ); | |||
| if (park == null) { | |||
| logger.error("etcpParkInCallback: ETCP车场未找到"+ etcpParkId); | |||
| logger.error("etcpParkInCallback: ETCP车场未找到" + etcpParkId); | |||
| //return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| } else { | |||
| tenantId = park.getTenantId(); | |||
| @@ -92,8 +94,8 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("etcpParkInCallback: 入库错误 "+ paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||
| logger.error("etcpParkInCallback: 入库错误 " + paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| // 停车发券 | |||
| @@ -106,7 +108,7 @@ public class WxCarCallBackController extends BaseController | |||
| userCarQ.setVendorType(EnumCarVendor.CAR_ETCP.getCode()); | |||
| // TODO 可能多用户关联同一张车牌 | |||
| List<WxCUserCar> userCarList = wxCUserCarService.getList(userCarQ); | |||
| for(WxCUserCar userCar: userCarList) { | |||
| for (WxCUserCar userCar : userCarList) { | |||
| wxCouponSendService.sendCouponToUser(tenantId, userCar.getCUserId(), EnumCouponSendType.CAR_STOP.getCode()); | |||
| } | |||
| } | |||
| @@ -118,23 +120,23 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * ETCP 车辆出场通知 | |||
| * { | |||
| * "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||
| * "plateNumber": "渝 ATX061", | |||
| * "parkName": "ETCP 智慧停车场", | |||
| * "parkId": "1", | |||
| * "entranceTime": "2017-08-17 18:44:19", | |||
| * "userType": "76", | |||
| * "pushTime": "2017-08-20 11:57:51", | |||
| * "exitTime": "2017-08-19 12:07:19", | |||
| * "stayedTime": 148980, | |||
| * "receivableFee": 0, | |||
| * "paidServiceFee": 0, | |||
| * "fixParkingId": "U7", | |||
| * "remainingDays": "12" | |||
| * "synId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||
| * "plateNumber": "渝 ATX061", | |||
| * "parkName": "ETCP 智慧停车场", | |||
| * "parkId": "1", | |||
| * "entranceTime": "2017-08-17 18:44:19", | |||
| * "userType": "76", | |||
| * "pushTime": "2017-08-20 11:57:51", | |||
| * "exitTime": "2017-08-19 12:07:19", | |||
| * "stayedTime": 148980, | |||
| * "receivableFee": 0, | |||
| * "paidServiceFee": 0, | |||
| * "fixParkingId": "U7", | |||
| * "remainingDays": "12" | |||
| * } | |||
| */ | |||
| */ | |||
| @PostMapping(value = "/etcpParkOutCallback") | |||
| public Result etcpParkOutCallback(@RequestBody Map<String,String> paramMap) { | |||
| public Result etcpParkOutCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpParkOutCallback: " + paramMap.toString()); | |||
| Date currentDate = new Date(); | |||
| @@ -151,7 +153,7 @@ public class WxCarCallBackController extends BaseController | |||
| parkQ.setParkId(etcpParkId); | |||
| WxPark park = wxParkService.getByObj(parkQ); | |||
| if (park == null) { | |||
| logger.error("etcpParkOutCallback: ETCP车场未找到 "+ etcpParkId); | |||
| logger.error("etcpParkOutCallback: ETCP车场未找到 " + etcpParkId); | |||
| //return new Result(ErrorCode.CAR_PARK_NOT_FOUND.getCode(), "ETCP车场未找到"+ etcpParkId); | |||
| } else { | |||
| wxCarCmdLog.setTenantId(park.getTenantId()); | |||
| @@ -160,8 +162,8 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("etcpParkOutCallback: 入库错误 "+ paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||
| logger.error("etcpParkOutCallback: 入库错误 " + paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| // TODO 如果此车关联了停车优免券,自动把优免券设为已使用 | |||
| @@ -172,12 +174,12 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * ETCP 车辆解绑通知 | |||
| * { | |||
| * "plateNumber": "渝 ATX061", | |||
| * "time": "2017-08-20 11:57:51" | |||
| * "plateNumber": "渝 ATX061", | |||
| * "time": "2017-08-20 11:57:51" | |||
| * } | |||
| */ | |||
| */ | |||
| @PostMapping(value = "/etcpUnbindCarCallBack") | |||
| public Result etcpUnbindCarCallBack(@RequestBody Map<String,String> paramMap) { | |||
| public Result etcpUnbindCarCallBack(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpUnbindCarCallBack: " + paramMap.toString()); | |||
| String carNumber = paramMap.get("plateNumber"); | |||
| @@ -193,8 +195,8 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("etcpUnbindCarCallBack: 入库错误 "+ paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||
| logger.error("etcpUnbindCarCallBack: 入库错误 " + paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| WxCUserCar userCarQ = new WxCUserCar(); | |||
| @@ -213,16 +215,16 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * ETCP 主动支付结果通知 | |||
| * { | |||
| * "plateNumber": "渝 ATX061", | |||
| * "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||
| * "fee": 7.65, | |||
| * "paidServiceFee": 0.07, | |||
| * "coupon": 0, | |||
| * "time": "2017-08-20 11:57:51" | |||
| * "plateNumber": "渝 ATX061", | |||
| * "orderId": "fd92f645-880e-4c2a-9d7d-7081a2488181", | |||
| * "fee": 7.65, | |||
| * "paidServiceFee": 0.07, | |||
| * "coupon": 0, | |||
| * "time": "2017-08-20 11:57:51" | |||
| * } | |||
| */ | |||
| */ | |||
| @PostMapping(value = "/etcpPaidCallback") | |||
| public Result etcpPaidCallback(@RequestBody Map<String,String> paramMap) { | |||
| public Result etcpPaidCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("etcpPaidCallback: " + paramMap.toString()); | |||
| String carNumber = paramMap.get("plateNumber"); | |||
| @@ -238,8 +240,8 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("etcpPaidCallback: 入库错误 "+ paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误"+paramMap.toString()); | |||
| logger.error("etcpPaidCallback: 入库错误 " + paramMap.toString()); | |||
| return new Result(ErrorCode.DB_FAIL.getCode(), "入库错误" + paramMap.toString()); | |||
| } | |||
| // 营销 - 短信 | |||
| @@ -250,23 +252,23 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * TJD 车辆入场通知 | |||
| * { | |||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||
| * "outCarId": "45454545454", | |||
| * "carNum": "京A45413", | |||
| * "carNumColor ": "blue", | |||
| * "inDt": "20170319202020", | |||
| * "parkName": "测试停车场", | |||
| * "parkId": "5836b8b52ada463ebc6199579f029561", | |||
| * "lon": "74.000272", | |||
| * "lat": "159.768703", | |||
| * "wLon": "123.523032", | |||
| * "wLat": "35.430735", | |||
| * "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||
| * "canFindCar": "0" | |||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||
| * "outCarId": "45454545454", | |||
| * "carNum": "京A45413", | |||
| * "carNumColor ": "blue", | |||
| * "inDt": "20170319202020", | |||
| * "parkName": "测试停车场", | |||
| * "parkId": "5836b8b52ada463ebc6199579f029561", | |||
| * "lon": "74.000272", | |||
| * "lat": "159.768703", | |||
| * "wLon": "123.523032", | |||
| * "wLat": "35.430735", | |||
| * "payUrl": "http://prep.tingjiandan.com/tcweixin/letter/prePay/payInPark.html?prePayType=16&channel=10001", | |||
| * "canFindCar": "0" | |||
| * } | |||
| */ | |||
| */ | |||
| @RequestMapping(value = "/tjdParkInCallback") | |||
| public Map tjdParkInCallback(@RequestBody Map<String,String> paramMap) { | |||
| public Map tjdParkInCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("tjdParkInCallback: " + paramMap.toString()); | |||
| Map map = new HashMap(); | |||
| @@ -278,9 +280,9 @@ public class WxCarCallBackController extends BaseController | |||
| parkQ.setParkId(tjdParkId); | |||
| WxPark park = wxParkService.getByObj(parkQ); | |||
| if (park == null) { | |||
| logger.error("tjdParkInCallback: 停简单车场未找到"+ tjdParkId); | |||
| logger.error("tjdParkInCallback: 停简单车场未找到" + tjdParkId); | |||
| map.put("isSuccess", "0"); | |||
| map.put("errorMsg", "停简单车场未找到"+ tjdParkId); | |||
| map.put("errorMsg", "停简单车场未找到" + tjdParkId); | |||
| return map; | |||
| } | |||
| @@ -295,10 +297,10 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("tjdParkInCallback: 入库错误"+ paramMap.toString()); | |||
| logger.error("tjdParkInCallback: 入库错误" + paramMap.toString()); | |||
| map.put("isSuccess", "0"); | |||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||
| return map; | |||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||
| return map; | |||
| } | |||
| map.put("isSuccess", "0"); | |||
| @@ -309,17 +311,17 @@ public class WxCarCallBackController extends BaseController | |||
| /** | |||
| * TJD 车辆出场通知 | |||
| * { | |||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||
| * "outDt": "20170319232020", | |||
| * "lon": "74.000272", | |||
| * "lat": "159.768703", | |||
| * "wLon": "123.523032", | |||
| * "wLat": "35.430735", | |||
| * "parkAmount": "5.20" | |||
| * "tradeId": "5836b8b52ada463ebc6199579f029565", | |||
| * "outDt": "20170319232020", | |||
| * "lon": "74.000272", | |||
| * "lat": "159.768703", | |||
| * "wLon": "123.523032", | |||
| * "wLat": "35.430735", | |||
| * "parkAmount": "5.20" | |||
| * } | |||
| */ | |||
| */ | |||
| @RequestMapping(value = "/tjdParkoutCallback") | |||
| public Map tjdParkOutCallback(@RequestBody Map<String,String> paramMap) { | |||
| public Map tjdParkOutCallback(@RequestBody Map<String, String> paramMap) { | |||
| logger.info("tjdParkoutCallback: " + paramMap.toString()); | |||
| Map map = new HashMap(); | |||
| @@ -336,15 +338,15 @@ public class WxCarCallBackController extends BaseController | |||
| try { | |||
| wxCarCmdLogService.saveOrUpdate(wxCarCmdLog); | |||
| } catch (Exception e) { | |||
| logger.error("tjdParkoutCallback: 入库错误"+ paramMap.toString()); | |||
| logger.error("tjdParkoutCallback: 入库错误" + paramMap.toString()); | |||
| map.put("isSuccess", "0"); | |||
| map.put("errorMsg", "入库错误"+ paramMap.toString()); | |||
| return map; | |||
| map.put("errorMsg", "入库错误" + paramMap.toString()); | |||
| return map; | |||
| } | |||
| map.put("isSuccess", "0"); | |||
| map.put("errorMsg", ""); | |||
| return map; | |||
| } | |||
| } | |||
| @@ -1,40 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCarCmdLog; | |||
| import com.simple.service.WxCarCmdLogService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCarCmdLogs") | |||
| public class WxCarCmdLogController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxCarCmdLogController.class); | |||
| public class WxCarCmdLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @Autowired | |||
| private WxCarCmdLogService wxCarCmdLogService; | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCarCmdLog wxCarCmdLogs,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLog(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCarCmdLog wxCarCmdLogs, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCarCmdLogs) wxCarCmdLogs = new WxCarCmdLog(); | |||
| final PageInfo<WxCarCmdLog> page = wxCarCmdLogService.listAsPage(wxCarCmdLogs, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCarCmdLog wxCarCmdLog) { | |||
| //Assert.notNull(wxCarCmdLogs.getName(), "角色名不能为空"); | |||
| @@ -52,19 +50,18 @@ public class WxCarCmdLogController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCarCmdLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCarCmdLogService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCarCmdLogService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,16 +1,12 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCounponDto; | |||
| import com.simple.domain.dto.WxCouponCarDto; | |||
| import com.simple.domain.po.*; | |||
| import com.simple.domain.vo.WxCouponCarVo; | |||
| import com.simple.enums.EnumCarCmd; | |||
| import com.simple.enums.EnumCarVendor; | |||
| import com.simple.enums.EnumCouponStatus; | |||
| import com.simple.service.*; | |||
| @@ -19,26 +15,22 @@ import com.simple.utils.TJDCarUtil; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import io.swagger.models.auth.In; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.apache.poi.hmef.attribute.MAPIAttribute; | |||
| import org.omg.PortableInterceptor.INACTIVE; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/car") | |||
| public class WxCarController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxCarController.class); | |||
| public class WxCarController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| ETCPUtil etcp = new ETCPUtil(); | |||
| ETCPUtil etcp = new ETCPUtil(); | |||
| TJDCarUtil tjd = new TJDCarUtil(); | |||
| @@ -69,7 +61,7 @@ public class WxCarController extends BaseController | |||
| return wxPark; | |||
| } | |||
| @ApiOperation(value = "获取车场支持的厂家",notes="{}") | |||
| @ApiOperation(value = "获取车场支持的厂家", notes = "{}") | |||
| @GetMapping("/getVendor") | |||
| public ResultData getVendor() { | |||
| MallUserInfo user = getUser(); | |||
| @@ -121,9 +113,9 @@ public class WxCarController extends BaseController | |||
| " ]}}\n") | |||
| @GetMapping("/quanTemplate") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="merchantId",value="商户ID",dataType="String", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParam(name = "merchantId", value = "商户ID", dataType = "String", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData quanTemplate(String merchantId, Integer pageNum, Integer pageSize) { | |||
| logger.info("quanTemplate: " + merchantId); | |||
| MallUserInfo user = getUser(); | |||
| @@ -216,16 +208,16 @@ public class WxCarController extends BaseController | |||
| WxCoupon wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(user.getTenantId()); | |||
| wxCoupon.setMerchantId(coupon.getMerchantId()); | |||
| if(StringUtils.isNotEmpty(coupon.getSalePriceStr())){ | |||
| wxCoupon.setSalePrice((int)(Double.parseDouble(coupon.getSalePriceStr())*100)); | |||
| if (StringUtils.isNotEmpty(coupon.getSalePriceStr())) { | |||
| wxCoupon.setSalePrice((int) (Double.parseDouble(coupon.getSalePriceStr()) * 100)); | |||
| } | |||
| if(StringUtils.isNotEmpty(coupon.getUsePriceStr())){ | |||
| wxCoupon.setUsePrice((int)(Double.parseDouble(coupon.getUsePriceStr())*100)); | |||
| if (StringUtils.isNotEmpty(coupon.getUsePriceStr())) { | |||
| wxCoupon.setUsePrice((int) (Double.parseDouble(coupon.getUsePriceStr()) * 100)); | |||
| } | |||
| if(StringUtils.isNotEmpty(coupon.getPriceStr())){ | |||
| wxCoupon.setPrice((int)(Double.parseDouble(coupon.getPriceStr())*100)); | |||
| if (StringUtils.isNotEmpty(coupon.getPriceStr())) { | |||
| wxCoupon.setPrice((int) (Double.parseDouble(coupon.getPriceStr()) * 100)); | |||
| } | |||
| if(StringUtils.isNotBlank(coupon.getBusiness())) { | |||
| if (StringUtils.isNotBlank(coupon.getBusiness())) { | |||
| String[] arys = coupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| } | |||
| @@ -278,7 +270,7 @@ public class WxCarController extends BaseController | |||
| @ApiOperation("优免券模板已分配总数") | |||
| @GetMapping("/templateAmtCount") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="templateId",value="模板ID",dataType="Long", paramType = "query",required=true)}) | |||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData getTemplateAmountSum(Long templateId) { | |||
| Map map = new HashMap(); | |||
| Integer amountCount = 0; | |||
| @@ -294,7 +286,7 @@ public class WxCarController extends BaseController | |||
| @ApiOperation("优免券模板库存总数") | |||
| @GetMapping("/templateAvaiCount") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="templateId",value="模板ID",dataType="Long", paramType = "query",required=true)}) | |||
| @ApiImplicitParam(name = "templateId", value = "模板ID", dataType = "Long", paramType = "query", required = true)}) | |||
| public ResultData getTemplateAvailSum(Long templateId) { | |||
| Map map = new HashMap(); | |||
| Integer availCount = 0; | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxChannel; | |||
| import com.simple.service.WxChannelService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxChannel") | |||
| public class WxChannelController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxChannelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxChannelService wxChannelService; | |||
| private Logger logger = Logger.getLogger(WxChannelController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxChannel wxChannel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxChannel) wxChannel = new WxChannel(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxChannel wxChannel, Integer pageNum, Integer pageSize) { | |||
| if (null == wxChannel) wxChannel = new WxChannel(); | |||
| final PageInfo<WxChannel> page = wxChannelService.listAsPage(wxChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxChannel wxChannel) { | |||
| //Assert.notNull(wxChannel.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxChannelController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxChannelService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxChannelService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponActionLog; | |||
| import com.simple.service.WxCouponActionLogService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCouponActionLog") | |||
| public class WxCouponActionLogController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxCouponActionLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponActionLogService wxCouponActionLogService; | |||
| private Logger logger = Logger.getLogger(WxCouponActionLogController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponActionLog wxCouponActionLog,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponActionLog) wxCouponActionLog = new WxCouponActionLog(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponActionLog wxCouponActionLog, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponActionLog) wxCouponActionLog = new WxCouponActionLog(); | |||
| final PageInfo<WxCouponActionLog> page = wxCouponActionLogService.listAsPage(wxCouponActionLog, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponActionLog wxCouponActionLog) { | |||
| //Assert.notNull(wxCouponActionLog.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxCouponActionLogController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponActionLogService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponActionLogService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponActionLogService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponCar; | |||
| import com.simple.service.WxCouponCarService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCouponCar") | |||
| public class WxCouponCarController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxCouponCarController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponCarService wxCouponCarService; | |||
| private Logger logger = Logger.getLogger(WxCouponCarController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponCar wxCouponCar,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponCar) wxCouponCar = new WxCouponCar(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponCar wxCouponCar, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponCar) wxCouponCar = new WxCouponCar(); | |||
| final PageInfo<WxCouponCar> page = wxCouponCarService.listAsPage(wxCouponCar, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponCar wxCouponCar) { | |||
| //Assert.notNull(wxCouponCar.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxCouponCarController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponCarService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponCarService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponCarService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,24 +1,22 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.simple.domain.dto.WxCouponChannelDto; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.domain.po.WxChannel; | |||
| import com.simple.domain.vo.WxCouponChannelVo; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCouponChannelDto; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.vo.WxCouponChannelVo; | |||
| import com.simple.service.WxCouponChannelService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @@ -26,50 +24,47 @@ import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxCouponChannel") | |||
| @Api(description="优惠券投放接口") | |||
| public class WxCouponChannelController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @Api(description = "优惠券投放接口") | |||
| public class WxCouponChannelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| private Logger logger = Logger.getLogger(WxCouponChannelController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | |||
| if(wxCouponChannel.getStatus()!=null&&wxCouponChannel.getStatus()==-1){ | |||
| wxCouponChannel.setStatus(null); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponChannel wxCouponChannel, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel(); | |||
| if (wxCouponChannel.getStatus() != null && wxCouponChannel.getStatus() == -1) { | |||
| wxCouponChannel.setStatus(null); | |||
| } | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| wxCouponChannel.setSortColumns(WxCouponChannel.Field.Id_DESC); | |||
| final PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCAPI(wxCouponChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponChannel wxCouponChannel) { | |||
| wxCouponChannel.setTenantId(getUser().getTenantId()); | |||
| if(wxCouponChannel.getCouponId()!=null&&wxCouponChannel.getStatus()!=null){ | |||
| if (wxCouponChannel.getCouponId() != null && wxCouponChannel.getStatus() != null) { | |||
| WxCouponChannel orignal = wxCouponChannelService.getById(wxCouponChannel.getId()); | |||
| if(orignal.getStatus()==1&&wxCouponChannel.getStatus()==0){ | |||
| if (orignal.getStatus() == 1 && wxCouponChannel.getStatus() == 0) { | |||
| //查找是否该券 在该频道有其他上架 | |||
| WxCouponChannel query = new WxCouponChannel(); | |||
| query.setTenantId(orignal.getTenantId()); | |||
| query.setCouponId(orignal.getCouponId()); | |||
| query.setStatus(0);//已上架 | |||
| query.setTargetAd(orignal.getTargetAd()); | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query,1,1).getList(); | |||
| if(list!=null&&list.size()>0){ | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(query, 1, 1).getList(); | |||
| if (list != null && list.size() > 0) { | |||
| //不能修改 | |||
| return new ResultData(Result.ERROR,"不允许同一个券,多个投放"); | |||
| return new ResultData(Result.ERROR, "不允许同一个券,多个投放"); | |||
| } | |||
| } | |||
| @@ -80,17 +75,17 @@ public class WxCouponChannelController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponChannelService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id)); | |||
| } | |||
| @ApiOperation("批量新增") | |||
| @@ -99,30 +94,27 @@ public class WxCouponChannelController extends BaseController | |||
| String[] ids = wxCouponChannelDto.getCouponIds().split(","); | |||
| String[] channelId = wxCouponChannelDto.getChannelId().split(","); | |||
| MallUserInfo user = getUser(); | |||
| return wxCouponChannelService.addBatch(ids,channelId,user.getTenantId(),wxCouponChannelDto.getBeginTime(),wxCouponChannelDto.getEndTime()); | |||
| return wxCouponChannelService.addBatch(ids, channelId, user.getTenantId(), wxCouponChannelDto.getBeginTime(), wxCouponChannelDto.getEndTime()); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findChannelByCouponId") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findChannelByCouponId(Long id) { | |||
| List<Integer> channellist = new ArrayList<>(); | |||
| List<Integer> channellist = new ArrayList<>(); | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| wxCouponChannel.setStatus(0); | |||
| wxCouponChannel.setCouponId(id); | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel,1,5).getList(); | |||
| if(list.isEmpty()){ | |||
| return new ResultData(Result.SUCCESS,"查询成功", ""); | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel, 1, 5).getList(); | |||
| if (list.isEmpty()) { | |||
| return new ResultData(Result.SUCCESS, "查询成功", ""); | |||
| } | |||
| for (WxCouponChannel temp:list) { | |||
| for (WxCouponChannel temp : list) { | |||
| channellist.add(temp.getTargetAd()); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功", JSON.toJSONString(channellist)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", JSON.toJSONString(channellist)); | |||
| } | |||
| } | |||
| @@ -1,59 +1,51 @@ | |||
| package com.simple.controller; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.service.WxCouponChannelService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCounponDto; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.po.WxMerchant; | |||
| import com.simple.service.WxCouponChannelService; | |||
| import com.simple.service.WxCouponService; | |||
| import com.simple.service.WxMerchantService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.ArrayList; | |||
| import java.util.Collections; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| @RestController | |||
| @RequestMapping("wxCoupon") | |||
| @Api(description="优惠券接口") | |||
| public class WxCouponController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "优惠券接口") | |||
| public class WxCouponController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| private Logger logger = Logger.getLogger(WxCouponController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| wxCoupon.setSortColumns(WxCoupon.Field.Id_DESC); | |||
| @@ -64,37 +56,37 @@ public class WxCouponController extends BaseController | |||
| List<WxCoupon> wxCouponList = page.getList(); | |||
| if(wxCouponList.isEmpty()){ | |||
| if (wxCouponList.isEmpty()) { | |||
| return new ResultData(page); | |||
| } | |||
| List<Long> ids = wxCouponList.stream().map(p->p.getId()).collect(Collectors.toList()); | |||
| List<Long> ids = wxCouponList.stream().map(p -> p.getId()).collect(Collectors.toList()); | |||
| WxCouponChannel wxCouponChannel = new WxCouponChannel(); | |||
| wxCouponChannel.setTenantId(getTenantId()); | |||
| wxCouponChannel.setCouponIds(ids); | |||
| wxCouponChannel.setStatus(0); | |||
| //上架状态 | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel,1,10000).getList(); | |||
| if(!list.isEmpty()){ | |||
| List<WxCouponChannel> list = wxCouponChannelService.listAsPage(wxCouponChannel, 1, 10000).getList(); | |||
| if (!list.isEmpty()) { | |||
| Map<Long, List<WxCouponChannel>> groupBy = list.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); | |||
| for (WxCoupon temp:wxCouponList) { | |||
| for (WxCoupon temp : wxCouponList) { | |||
| if(groupBy.get(temp.getId())!=null){ | |||
| List<Integer> channels=new ArrayList<>(); | |||
| for (WxCouponChannel tempchannel:groupBy.get(temp.getId())) { | |||
| if(!channels.contains(tempchannel.getTargetAd())) { | |||
| if (groupBy.get(temp.getId()) != null) { | |||
| List<Integer> channels = new ArrayList<>(); | |||
| for (WxCouponChannel tempchannel : groupBy.get(temp.getId())) { | |||
| if (!channels.contains(tempchannel.getTargetAd())) { | |||
| channels.add(tempchannel.getTargetAd()); | |||
| } | |||
| } | |||
| String sss = JSON.toJSONString(channels); | |||
| temp.setChannels(sss); | |||
| }else{ | |||
| } else { | |||
| temp.setChannels(""); | |||
| } | |||
| } | |||
| }else{ | |||
| for (WxCoupon temp:wxCouponList) { | |||
| } else { | |||
| for (WxCoupon temp : wxCouponList) { | |||
| temp.setChannels(""); | |||
| } | |||
| @@ -103,76 +95,76 @@ public class WxCouponController extends BaseController | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCoupon wxCoupon) { | |||
| //Assert.notNull(wxCoupon.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| if(StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())){ | |||
| wxCoupon.setSalePrice((int)(Double.parseDouble(wxCoupon.getSalePriceStr())*100)); | |||
| if (StringUtils.isNotEmpty(wxCoupon.getSalePriceStr())) { | |||
| wxCoupon.setSalePrice((int) (Double.parseDouble(wxCoupon.getSalePriceStr()) * 100)); | |||
| } | |||
| if (StringUtils.isNotEmpty(wxCoupon.getUsePriceStr())) { | |||
| wxCoupon.setUsePrice((int) (Double.parseDouble(wxCoupon.getUsePriceStr()) * 100)); | |||
| } | |||
| if(StringUtils.isNotEmpty(wxCoupon.getUsePriceStr())){ | |||
| wxCoupon.setUsePrice((int)(Double.parseDouble(wxCoupon.getUsePriceStr())*100)); | |||
| if (StringUtils.isNotEmpty(wxCoupon.getPriceStr())) { | |||
| wxCoupon.setPrice((int) (Double.parseDouble(wxCoupon.getPriceStr()) * 100)); | |||
| } | |||
| if(StringUtils.isNotEmpty(wxCoupon.getPriceStr())){ | |||
| wxCoupon.setPrice((int)(Double.parseDouble(wxCoupon.getPriceStr())*100)); | |||
| if (StringUtils.isNotBlank(wxCoupon.getBusiness())) { | |||
| String[] arys = wxCoupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| } | |||
| if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { | |||
| String[] arys = wxCoupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| } | |||
| wxCoupon.setTenantId(getUser().getTenantId()); | |||
| wxCoupon.setChannels(""); | |||
| Long id = wxCouponService.saveOrUpdate(wxCoupon); | |||
| Long id = wxCouponService.saveOrUpdate(wxCoupon); | |||
| return new ResultData(id); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCoupon wxCoupon) { | |||
| if(wxCoupon.getId()==null) { | |||
| return new ResultData(ResultData.ERROR,"缺少id"); | |||
| } | |||
| if(StringUtils.isNotBlank(wxCoupon.getBusiness())) { | |||
| String[] arys = wxCoupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| if (wxCoupon.getId() == null) { | |||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||
| } | |||
| if (StringUtils.isNotBlank(wxCoupon.getBusiness())) { | |||
| String[] arys = wxCoupon.getBusiness().split(","); | |||
| wxCoupon.setBusiness(JSON.toJSONString(arys)); | |||
| } | |||
| return wxCouponService.updateCoupon(wxCoupon); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| WxCoupon c = wxCouponService.getById(id); | |||
| WxCounponDto dto = new WxCounponDto(); | |||
| org.springframework.beans.BeanUtils.copyProperties(c, dto); | |||
| WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); | |||
| dto.setWxMerchant(merchant); | |||
| return new ResultData(Result.SUCCESS,"查询成功",dto); | |||
| WxCoupon c = wxCouponService.getById(id); | |||
| WxCounponDto dto = new WxCounponDto(); | |||
| org.springframework.beans.BeanUtils.copyProperties(c, dto); | |||
| WxMerchant merchant = wxMerchantService.getById(c.getMerchantId()); | |||
| dto.setWxMerchant(merchant); | |||
| return new ResultData(Result.SUCCESS, "查询成功", dto); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("send/list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon,Integer pageNum, Integer pageSize) { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData sendList(@ModelAttribute WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| wxCoupon.setTenantId(getTenantId()); | |||
| wxCoupon.setStatus(0); | |||
| return new ResultData(wxCouponService.listAsPage(wxCoupon, pageNum, pageSize)); | |||
| } | |||
| } | |||
| @@ -7,7 +7,8 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| @@ -19,33 +20,31 @@ import javax.servlet.http.HttpServletResponse; | |||
| @RestController | |||
| @RequestMapping("wxCouponOrder") | |||
| @Api(description="核销和用户卡券查询接口") | |||
| public class WxCouponOrderController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "核销和用户卡券查询接口") | |||
| public class WxCouponOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| private Logger logger = Logger.getLogger(WxCouponOrderController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponOrder wxCouponOrder, Integer pageNum, Integer pageSize) { | |||
| if (wxCouponOrder == null) wxCouponOrder= new WxCouponOrder(); | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrder(); | |||
| wxCouponOrder.setTenantId(getTenantId()); | |||
| wxCouponOrder.setSortColumns(WxCouponOrder.Field.Id_DESC); | |||
| return wxCouponOrderService.listAdminAsPage(wxCouponOrder, pageNum, pageSize); | |||
| } | |||
| @RequestMapping("/exportData") | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response){ | |||
| public void exportData(HttpServletRequest request, HttpServletResponse response) { | |||
| wxCouponOrderService.exportData(request,response,getTenantId()); | |||
| wxCouponOrderService.exportData(request, response, getTenantId()); | |||
| } | |||
| } | |||
| @@ -1,63 +1,59 @@ | |||
| package com.simple.controller; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.service.WxCouponService; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.domain.po.WxCouponSend; | |||
| import com.simple.service.WxCouponSendService; | |||
| import com.simple.service.WxCouponService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxCouponSend") | |||
| public class WxCouponSendController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxCouponSendController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponSendService wxCouponSendService; | |||
| @Autowired | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| private Logger logger = Logger.getLogger(WxCouponSendController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponSend wxCouponSend) { | |||
| if (null == wxCouponSend){ | |||
| return new ResultData(Result.ERROR,"参数不对"); | |||
| if (null == wxCouponSend) { | |||
| return new ResultData(Result.ERROR, "参数不对"); | |||
| } | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| wxCouponSend.setStatus(0); | |||
| List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend,1,1).getList(); | |||
| if(wxCouponSendList!=null&&!wxCouponSendList.isEmpty()){ | |||
| return new ResultData(Result.ERROR,"已经添加过该券"); | |||
| List<WxCouponSend> wxCouponSendList = wxCouponSendService.listAsPage(wxCouponSend, 1, 1).getList(); | |||
| if (wxCouponSendList != null && !wxCouponSendList.isEmpty()) { | |||
| return new ResultData(Result.ERROR, "已经添加过该券"); | |||
| } | |||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | |||
| if(wxCoupon.getStatus()!=0||wxCoupon.getSendType()!=2){ | |||
| return new ResultData(Result.ERROR,"该券的状态有问题"); | |||
| if (wxCoupon.getStatus() != 0 || wxCoupon.getSendType() != 2) { | |||
| return new ResultData(Result.ERROR, "该券的状态有问题"); | |||
| } | |||
| wxCouponSend.setMerchantId(wxCoupon.getMerchantId()); | |||
| @@ -74,26 +70,25 @@ public class WxCouponSendController extends BaseController | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| wxCouponSend.setTenantId(getTenantId()); | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponSendService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponSendService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponSendService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,49 +1,46 @@ | |||
| package com.simple.controller; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponSpread; | |||
| import com.simple.service.WxCouponSpreadService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxCouponSpread") | |||
| @Api(description="推广接口") | |||
| public class WxCouponSpreadController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "推广接口") | |||
| public class WxCouponSpreadController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponSpreadService wxCouponSpreadService; | |||
| private Logger logger = Logger.getLogger(WxCouponSpreadController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSpread wxCouponSpread,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponSpread) wxCouponSpread = new WxCouponSpread(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSpread wxCouponSpread, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponSpread) wxCouponSpread = new WxCouponSpread(); | |||
| final PageInfo<WxCouponSpread> page = wxCouponSpreadService.listAsPage(wxCouponSpread, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponSpread wxCouponSpread) { | |||
| if(wxCouponSpread.getCouponId()==null){ | |||
| return new ResultData(Result.ERROR,"没有找到券id"); | |||
| if (wxCouponSpread.getCouponId() == null) { | |||
| return new ResultData(Result.ERROR, "没有找到券id"); | |||
| } | |||
| //Assert.notNull(wxCouponSpread.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| @@ -60,35 +57,34 @@ public class WxCouponSpreadController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponSpreadService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponSpreadService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponSpreadService.getById(id)); | |||
| } | |||
| @ApiOperation("根据卡券id查询接口") | |||
| @GetMapping("/findByCouponId") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findByCouponId(Long id) { | |||
| WxCouponSpread result = null; | |||
| if(id!=null){ | |||
| WxCouponSpread wxCouponSpread = new WxCouponSpread(); | |||
| if (id != null) { | |||
| WxCouponSpread wxCouponSpread = new WxCouponSpread(); | |||
| wxCouponSpread.setCouponId(id); | |||
| List<WxCouponSpread> list = wxCouponSpreadService.findList(wxCouponSpread); | |||
| if(!list.isEmpty()){ | |||
| if (!list.isEmpty()) { | |||
| result = list.get(0); | |||
| } | |||
| } | |||
| return new ResultData(Result.SUCCESS,"查询成功",result); | |||
| return new ResultData(Result.SUCCESS, "查询成功", result); | |||
| } | |||
| } | |||
| @@ -1,44 +1,40 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponType; | |||
| import com.simple.service.WxCouponTypeService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxCouponType") | |||
| @Api(description="优惠券类型相关接口") | |||
| public class WxCouponTypeController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "优惠券类型相关接口") | |||
| public class WxCouponTypeController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponTypeService wxCouponTypeService; | |||
| private Logger logger = Logger.getLogger(WxCouponTypeController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponType wxCouponType,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponType) wxCouponType = new WxCouponType(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCouponType wxCouponType, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponType) wxCouponType = new WxCouponType(); | |||
| final PageInfo<WxCouponType> page = wxCouponTypeService.listAsPage(wxCouponType, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponType wxCouponType) { | |||
| //Assert.notNull(wxCouponType.getName(), "角色名不能为空"); | |||
| @@ -56,19 +52,18 @@ public class WxCouponTypeController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponTypeService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponTypeService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponTypeService.getById(id)); | |||
| } | |||
| } | |||
| @@ -7,25 +7,25 @@ import com.simple.domain.po.WxGroup; | |||
| import com.simple.service.WxGroupService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxGroup") | |||
| public class WxGroupController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxGroupService wxGroupService; | |||
| public class WxGroupController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Logger logger = Logger.getLogger(WxGroupController.class); | |||
| @Autowired | |||
| private WxGroupService wxGroupService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxGroup wxGroup,Integer pageNum, Integer pageSize) { | |||
| if (null == wxGroup) wxGroup = new WxGroup(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxGroup wxGroup, Integer pageNum, Integer pageSize) { | |||
| if (null == wxGroup) wxGroup = new WxGroup(); | |||
| final PageInfo<WxGroup> page = wxGroupService.listAsPage(wxGroup, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -45,18 +45,17 @@ public class WxGroupController extends BaseController | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| wxGroupService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxGroupService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxGroupService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| @@ -24,12 +25,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxLevelConfig") | |||
| @Api(description="等级权益相关接口") | |||
| public class WxLevelConfigController extends BaseController | |||
| { | |||
| public class WxLevelConfigController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxLevelConfigService wxLevelConfigService; | |||
| private Logger logger = Logger.getLogger(WxLevelConfigController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -8,25 +8,25 @@ import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.service.WxMallApplyService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMallApply") | |||
| public class WxMallApplyController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxMallApplyService wxMallApplyService; | |||
| public class WxMallApplyController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Logger logger = Logger.getLogger(WxMallApplyController.class); | |||
| @Autowired | |||
| private WxMallApplyService wxMallApplyService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMallApply wxMallApply,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMallApply) wxMallApply = new WxMallApply(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMallApply wxMallApply, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMallApply) wxMallApply = new WxMallApply(); | |||
| final PageInfo<WxMallApply> page = wxMallApplyService.listAsPage(wxMallApply, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -46,16 +46,16 @@ public class WxMallApplyController extends BaseController | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| wxMallApplyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMallApplyService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallApplyService.getById(id)); | |||
| } | |||
| @@ -70,6 +70,6 @@ public class WxMallApplyController extends BaseController | |||
| wxMsgValidationcode.setType(type); | |||
| return wxMallApplyService.sendvalidationcode(wxMsgValidationcode); | |||
| } | |||
| } | |||
| @@ -8,18 +8,18 @@ import com.simple.service.WxMallBuildingService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMallBuilding") | |||
| public class WxMallBuildingController extends BaseController | |||
| { | |||
| public class WxMallBuildingController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallBuildingService wxMallBuildingService; | |||
| private Logger logger = Logger.getLogger(WxMallBuildingController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -1,81 +1,75 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMallConfig; | |||
| import com.simple.service.WxMallConfigService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMallConfig") | |||
| @Api(description="停车发券和核销发劵接口") | |||
| public class WxMallConfigController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "停车发券和核销发劵接口") | |||
| public class WxMallConfigController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallConfigService wxMallConfigService; | |||
| private Logger logger = Logger.getLogger(WxMallConfigController.class); | |||
| @ApiOperation("获取停车劵开关") | |||
| @GetMapping("getStopCarConpon") | |||
| public ResultData getStopCarConpon() { | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("stopCarCouponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if(page.getSize()>0) { | |||
| WxMallConfig config = page.getList().get(0); | |||
| return new ResultData(config); | |||
| } | |||
| return new ResultData(); | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("stopCarCouponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| WxMallConfig config = page.getList().get(0); | |||
| return new ResultData(config); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("获取核销劵开关") | |||
| @GetMapping("getVerifyConpon") | |||
| public ResultData getVerifyConpon() { | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("verifyConponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if(page.getSize()>0) { | |||
| WxMallConfig config = page.getList().get(0); | |||
| return new ResultData(config); | |||
| } | |||
| return new ResultData(); | |||
| WxMallConfig wxMallConfig = new WxMallConfig(); | |||
| wxMallConfig.setKey("verifyConponSwitch"); | |||
| wxMallConfig.setTenantId(getTenantId()); | |||
| PageInfo<WxMallConfig> page = wxMallConfigService.listAsPage(wxMallConfig, 1, 1); | |||
| if (page.getSize() > 0) { | |||
| WxMallConfig config = page.getList().get(0); | |||
| return new ResultData(config); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateStopCarConpon") | |||
| @ApiOperation("修改停车开关") | |||
| public ResultData updateStopCarConpon(@RequestBody WxMallConfig wxMallConfig) { | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| // temp.setKey("stopCarCouponSwitch"); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| return new ResultData(); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| return new ResultData(); | |||
| } | |||
| @PostMapping("updateVerifyConpon") | |||
| @ApiOperation("修改核销开关") | |||
| public ResultData updateVerifyConpon(@RequestBody WxMallConfig wxMallConfig) { | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| WxMallConfig temp = new WxMallConfig(); | |||
| // temp.setKey("verifyConponSwitch"); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| return new ResultData(); | |||
| temp.setValue(wxMallConfig.getValue()); | |||
| temp.setId(wxMallConfig.getId()); | |||
| wxMallConfigService.saveOrUpdate(temp); | |||
| return new ResultData(); | |||
| } | |||
| // @ApiOperation("分页列表接口") | |||
| // @GetMapping("list") | |||
| // @ApiImplicitParams({ | |||
| @@ -117,7 +111,6 @@ public class WxMallConfigController extends BaseController | |||
| // public ResultData findById(Long id) { | |||
| // return new ResultData(Result.SUCCESS,"查询成功",wxMallConfigService.getById(id)); | |||
| // } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,12 +18,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxMall") | |||
| public class WxMallController extends BaseController | |||
| { | |||
| public class WxMallController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| private Logger logger = Logger.getLogger(WxMallController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,12 +18,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxMallFloor") | |||
| public class WxMallFloorController extends BaseController | |||
| { | |||
| public class WxMallFloorController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallFloorService wxMallFloorService; | |||
| private Logger logger = Logger.getLogger(WxMallFloorController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -10,7 +10,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -18,12 +19,11 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxMerchantBUser") | |||
| public class WxMerchantBUserController extends BaseController | |||
| { | |||
| public class WxMerchantBUserController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantBUserService wxMerchantBUserService; | |||
| private Logger logger = Logger.getLogger(WxMerchantBUserController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -8,7 +8,8 @@ import com.simple.service.WxMerchantService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,11 +18,11 @@ import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxMerchant") | |||
| public class WxMerchantController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| private Logger logger = Logger.getLogger(WxMerchantController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -9,26 +9,26 @@ import com.simple.service.WxMerchantShopService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMerchantShop") | |||
| public class WxMerchantShopController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMerchantShopController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantShopService wxMerchantShopService; | |||
| private Logger logger = Logger.getLogger(WxMerchantShopController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantShop wxMerchantShop,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| final PageInfo<WxMerchantShop> page = wxMerchantShopService.listAsPage(wxMerchantShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -36,16 +36,16 @@ public class WxMerchantShopController extends BaseController | |||
| @ApiOperation("获取关联商铺信息") | |||
| @GetMapping("queryShopList") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData queryShopList(@ModelAttribute WxMerchantShop wxMerchantShop,Integer pageNum, Integer pageSize) { | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData queryShopList(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||
| final PageInfo<WxShop> page = wxMerchantShopService.queryShopList(wxMerchantShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchantShop wxMerchantShop) { | |||
| //Assert.notNull(wxMerchantShop.getName(), "角色名不能为空"); | |||
| @@ -63,19 +63,18 @@ public class WxMerchantShopController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMerchantShopService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantShopService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantShopService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMerchantTradeDaily; | |||
| import com.simple.service.WxMerchantTradeDailyService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMerchantTradeDaily") | |||
| public class WxMerchantTradeDailyController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMerchantTradeDailyController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMerchantTradeDailyService wxMerchantTradeDailyService; | |||
| private Logger logger = Logger.getLogger(WxMerchantTradeDailyController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantTradeDaily) wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMerchantTradeDaily wxMerchantTradeDaily, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMerchantTradeDaily) wxMerchantTradeDaily = new WxMerchantTradeDaily(); | |||
| final PageInfo<WxMerchantTradeDaily> page = wxMerchantTradeDailyService.listAsPage(wxMerchantTradeDaily, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMerchantTradeDaily wxMerchantTradeDaily) { | |||
| //Assert.notNull(wxMerchantTradeDaily.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxMerchantTradeDailyController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMerchantTradeDailyService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMerchantTradeDailyService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantTradeDailyService.getById(id)); | |||
| } | |||
| } | |||
| @@ -8,7 +8,8 @@ import com.simple.service.WxMsgCallbackService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -16,26 +17,25 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxMsgCallback") | |||
| public class WxMsgCallbackController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMsgCallbackController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgCallbackService wxMsgCallbackService; | |||
| private Logger logger = Logger.getLogger(WxMsgCallbackController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgCallback wxMsgCallback,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgCallback) wxMsgCallback = new WxMsgCallback(); | |||
| wxMsgCallback.setTenantId(getTenantId()); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgCallback wxMsgCallback, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgCallback) wxMsgCallback = new WxMsgCallback(); | |||
| wxMsgCallback.setTenantId(getTenantId()); | |||
| final PageInfo<WxMsgCallback> page = wxMsgCallbackService.listAsPage(wxMsgCallback, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgCallback wxMsgCallback) { | |||
| //Assert.notNull(wxMsgCallback.getName(), "角色名不能为空"); | |||
| @@ -54,41 +54,41 @@ public class WxMsgCallbackController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMsgCallbackService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgCallbackService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgCallbackService.getById(id)); | |||
| } | |||
| @RequestMapping(value = "/receivemsg/{bid}") | |||
| public void receivemsg(@PathVariable String bid, @RequestParam Map<String,String> param) { | |||
| public void receivemsg(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| //解析param数据插入数据库中 | |||
| String item = param.get("item"); | |||
| String sign = param.get("sign"); | |||
| String tenantId=getTenantId(); | |||
| wxMsgCallbackService.saveOrUpdate(tenantId,bid,item,sign); | |||
| String tenantId = getTenantId(); | |||
| wxMsgCallbackService.saveOrUpdate(tenantId, bid, item, sign); | |||
| } | |||
| @RequestMapping(value = "/receivemodel/{bid}") | |||
| public void receivemodel(@PathVariable String bid, @RequestParam Map<String,String> param) { | |||
| public void receivemodel(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receivemodel(getTenantId(),bid,param); | |||
| wxMsgCallbackService.receivemodel(getTenantId(), bid, param); | |||
| } | |||
| @RequestMapping(value = "/receiveverifymodel/{bid}") | |||
| public void receiveverifymodel(@PathVariable String bid, @RequestParam Map<String,String> param) { | |||
| public void receiveverifymodel(@PathVariable String bid, @RequestParam Map<String, String> param) { | |||
| //解析param数据插入数据库中 | |||
| wxMsgCallbackService.receiveverifymodel(bid,param); | |||
| wxMsgCallbackService.receiveverifymodel(bid, param); | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxMsgConfig; | |||
| import com.simple.service.WxMsgConfigService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgConfig") | |||
| public class WxMsgConfigController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMsgConfigController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgConfigService wxMsgConfigService; | |||
| private Logger logger = Logger.getLogger(WxMsgConfigController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgConfig wxMsgConfig,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgConfig) wxMsgConfig = new WxMsgConfig(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgConfig wxMsgConfig, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgConfig) wxMsgConfig = new WxMsgConfig(); | |||
| final PageInfo<WxMsgConfig> page = wxMsgConfigService.listAsPage(wxMsgConfig, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgConfig wxMsgConfig) { | |||
| //Assert.notNull(wxMsgConfig.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxMsgConfigController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMsgConfigService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgConfigService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgConfigService.getById(id)); | |||
| } | |||
| } | |||
| @@ -10,7 +10,8 @@ import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| @@ -21,26 +22,25 @@ import java.util.UUID; | |||
| @RestController | |||
| @RequestMapping("wxMsg") | |||
| public class WxMsgController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMsgController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgService wxMsgService; | |||
| private Logger logger = Logger.getLogger(WxMsgController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsg wxMsg,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsg) wxMsg = new WxMsg(); | |||
| wxMsg.setTenantId(getTenantId()); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsg wxMsg, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsg) wxMsg = new WxMsg(); | |||
| wxMsg.setTenantId(getTenantId()); | |||
| final PageInfo<WxMsg> page = wxMsgService.listAsPage(wxMsg, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsg wxMsg) { | |||
| //Assert.notNull(wxMsg.getName(), "角色名不能为空"); | |||
| @@ -59,41 +59,41 @@ public class WxMsgController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMsgService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgService.getById(id)); | |||
| } | |||
| @RequestMapping("/excleupload") | |||
| public ResultData excleupload(@RequestParam("file") MultipartFile file) { | |||
| if (file.isEmpty()) { | |||
| return new ResultData(Result.SUCCESS,"上传文件不能为空"); | |||
| return new ResultData(Result.SUCCESS, "上传文件不能为空"); | |||
| } | |||
| String filename= UUID.randomUUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); | |||
| File path=new File(Constant.fileDirectory); | |||
| if(!path.exists()){ | |||
| String filename = UUID.randomUUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); | |||
| File path = new File(Constant.fileDirectory); | |||
| if (!path.exists()) { | |||
| path.mkdirs(); | |||
| } | |||
| String filepath= Constant.fileDirectory+File.separator+filename; | |||
| String filepath = Constant.fileDirectory + File.separator + filename; | |||
| try { | |||
| FileOutputStream out=new FileOutputStream(new File(filepath)); | |||
| FileOutputStream out = new FileOutputStream(new File(filepath)); | |||
| IOUtils.write(file.getBytes(), out); | |||
| IOUtils.closeQuietly(out); | |||
| } catch (Exception e) { | |||
| return new ResultData(Result.ERROR,"上传失败"); | |||
| return new ResultData(Result.ERROR, "上传失败"); | |||
| } | |||
| return new ResultData(Result.SUCCESS,"上传成功",filepath); | |||
| return new ResultData(Result.SUCCESS, "上传成功", filepath); | |||
| } | |||
| } | |||
| @@ -8,39 +8,39 @@ import com.simple.service.WxMsgModelService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgModel") | |||
| public class WxMsgModelController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMsgModelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgModelService wxMsgModelService; | |||
| private Logger logger = Logger.getLogger(WxMsgModelController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgModel wxMsgModel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgModel) wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgModel wxMsgModel, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgModel) wxMsgModel = new WxMsgModel(); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| final PageInfo<WxMsgModel> page = wxMsgModelService.listAsPage(wxMsgModel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgModel wxMsgModel) { | |||
| //Assert.notNull(wxMsgModel.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxMsgModel.setTenantId(getTenantId()); | |||
| return wxMsgModelService.saveOrUpdate(wxMsgModel); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @@ -51,25 +51,24 @@ public class WxMsgModelController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMsgModelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgModelService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgModelService.getById(id)); | |||
| } | |||
| @ApiOperation("获取所有数据") | |||
| @GetMapping("getmodellist") | |||
| public ResultData getmodellist() { | |||
| return wxMsgModelService.getmodellist(getTenantId()); | |||
| return wxMsgModelService.getmodellist(getTenantId()); | |||
| } | |||
| } | |||
| @@ -14,26 +14,25 @@ import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgSignature") | |||
| public class WxMsgSignatureController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxMsgSignatureController extends BaseController { | |||
| @Autowired | |||
| private WxMsgSignatureService wxMsgSignatureService; | |||
| private Logger logger = Logger.getLogger(WxMsgSignatureController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgSignature wxMsgSignature,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgSignature) wxMsgSignature = new WxMsgSignature(); | |||
| wxMsgSignature.setTenantId(getTenantId()); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgSignature wxMsgSignature, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgSignature) wxMsgSignature = new WxMsgSignature(); | |||
| wxMsgSignature.setTenantId(getTenantId()); | |||
| final PageInfo<WxMsgSignature> page = wxMsgSignatureService.listAsPage(wxMsgSignature, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxMsgSignature wxMsgSignature) { | |||
| //Assert.notNull(wxMsgSignature.getName(), "角色名不能为空"); | |||
| @@ -52,17 +51,17 @@ public class WxMsgSignatureController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxMsgSignatureService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgSignatureService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgSignatureService.getById(id)); | |||
| } | |||
| @ApiOperation("获取所有数据") | |||
| @@ -70,6 +69,6 @@ public class WxMsgSignatureController extends BaseController | |||
| public ResultData getmodellist() { | |||
| return wxMsgSignatureService.getsignaturelist(getTenantId()); | |||
| } | |||
| } | |||
| @@ -7,19 +7,19 @@ import com.simple.domain.po.WxMsgValidationcode; | |||
| import com.simple.service.WxMsgValidationcodeService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgValidationcode") | |||
| public class WxMsgValidationcodeController extends BaseController | |||
| { | |||
| public class WxMsgValidationcodeController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgValidationcodeService wxMsgValidationcodeService; | |||
| private Logger logger = Logger.getLogger(WxMsgValidationcodeController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @@ -7,25 +7,25 @@ import com.simple.domain.po.WxMsgValidationcodeModel; | |||
| import com.simple.service.WxMsgValidationcodeModelService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxMsgValidationcodeModel") | |||
| public class WxMsgValidationcodeModelController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxMsgValidationcodeModelService wxMsgValidationcodeModelService; | |||
| public class WxMsgValidationcodeModelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Logger logger = Logger.getLogger(WxMsgValidationcodeModelController.class); | |||
| @Autowired | |||
| private WxMsgValidationcodeModelService wxMsgValidationcodeModelService; | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxMsgValidationcodeModel wxMsgValidationcodeModel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgValidationcodeModel) wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxMsgValidationcodeModel wxMsgValidationcodeModel, Integer pageNum, Integer pageSize) { | |||
| if (null == wxMsgValidationcodeModel) wxMsgValidationcodeModel = new WxMsgValidationcodeModel(); | |||
| final PageInfo<WxMsgValidationcodeModel> page = wxMsgValidationcodeModelService.listAsPage(wxMsgValidationcodeModel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @@ -45,18 +45,17 @@ public class WxMsgValidationcodeModelController extends BaseController | |||
| } | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData delete(String id) { | |||
| wxMsgValidationcodeModelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="String", paramType = "query",required=true) | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "String", paramType = "query", required = true) | |||
| public ResultData findById(String id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxMsgValidationcodeModelService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxMsgValidationcodeModelService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,9 +18,8 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxOrder") | |||
| public class WxOrderController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxOrderController.class); | |||
| public class WxOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxOrderService wxOrderService; | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxPark; | |||
| import com.simple.service.WxParkService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxPark") | |||
| public class WxParkController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxParkController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxParkService wxParkService; | |||
| private Logger logger = Logger.getLogger(WxParkController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxPark wxPark,Integer pageNum, Integer pageSize) { | |||
| if (null == wxPark) wxPark = new WxPark(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxPark wxPark, Integer pageNum, Integer pageSize) { | |||
| if (null == wxPark) wxPark = new WxPark(); | |||
| final PageInfo<WxPark> page = wxParkService.listAsPage(wxPark, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxPark wxPark) { | |||
| //Assert.notNull(wxPark.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxParkController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxParkService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxParkService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxParkService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,12 +18,11 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxPayAccount") | |||
| public class WxPayAccountController extends BaseController | |||
| { | |||
| public class WxPayAccountController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPayAccountService wxPayAccountService; | |||
| private Logger logger = Logger.getLogger(WxPayAccountController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -9,8 +9,9 @@ import com.simple.service.WxProfitSharingOrderService; | |||
| import com.simple.service.WxRefundOrderService; | |||
| import com.simple.utils.XmlUtil; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.jdom.JDOMException; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.http.MediaType; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -28,7 +29,7 @@ import java.util.TreeMap; | |||
| @RequestMapping("/wxPay/notify") | |||
| public class WxPayController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxPayController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @@ -2,7 +2,8 @@ package com.simple.controller; | |||
| import com.simple.service.WxAppinfoService; | |||
| import com.simple.service.WxProfitSharingOrderService; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -18,9 +19,8 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxPayOrder") | |||
| public class WxPayOrderController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxPayOrderController.class); | |||
| public class WxPayOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @@ -11,7 +11,8 @@ import com.simple.service.WxProfitSharingReceiverService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -20,13 +21,13 @@ import java.util.List; | |||
| @RestController | |||
| @RequestMapping("wxProfitSharingReceiver") | |||
| public class WxProfitSharingReceiverController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||
| @Autowired | |||
| private WxMerchantService wxMerchantService; | |||
| private Logger logger = Logger.getLogger(WxProfitSharingReceiverController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -1,6 +1,7 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -20,11 +21,11 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/refund") | |||
| public class WxRefundOrderController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxRefundOrderService wxRefundOrderService; | |||
| private Logger logger = Logger.getLogger(WxRefundOrderController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @@ -7,19 +7,19 @@ import com.simple.domain.po.WxRentContract; | |||
| import com.simple.service.WxRentContractService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxRentContract") | |||
| public class WxRentContractController extends BaseController | |||
| { | |||
| public class WxRentContractController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxRentContractService wxRentContractService; | |||
| private Logger logger = Logger.getLogger(WxRentContractController.class); | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxScoreHistory; | |||
| import com.simple.service.WxScoreHistoryService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxScoreHistory") | |||
| public class WxScoreHistoryController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxScoreHistoryController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxScoreHistoryService wxScoreHistoryService; | |||
| private Logger logger = Logger.getLogger(WxScoreHistoryController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxScoreHistory wxScoreHistory,Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreHistory) wxScoreHistory = new WxScoreHistory(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreHistory wxScoreHistory, Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreHistory) wxScoreHistory = new WxScoreHistory(); | |||
| final PageInfo<WxScoreHistory> page = wxScoreHistoryService.listAsPage(wxScoreHistory, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreHistory wxScoreHistory) { | |||
| //Assert.notNull(wxScoreHistory.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxScoreHistoryController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxScoreHistoryService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxScoreHistoryService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreHistoryService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,50 +1,46 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxScoreRules; | |||
| import com.simple.service.WxScoreRulesService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxScoreRules") | |||
| @Api(description="成长值规则相关接口") | |||
| public class WxScoreRulesController extends BaseController | |||
| { | |||
| @Autowired | |||
| @Api(description = "成长值规则相关接口") | |||
| public class WxScoreRulesController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxScoreRulesService wxScoreRulesService; | |||
| private Logger logger = Logger.getLogger(WxScoreRulesController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxScoreRules wxScoreRules,Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreRules) wxScoreRules = new WxScoreRules(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreRules wxScoreRules, Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreRules) wxScoreRules = new WxScoreRules(); | |||
| final PageInfo<WxScoreRules> page = wxScoreRulesService.listAsPage(wxScoreRules, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreRules wxScoreRules) { | |||
| //Assert.notNull(wxScoreRules.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxScoreRules.setTenantId(getTenantId()); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| wxScoreRules.setTenantId(getTenantId()); | |||
| wxScoreRulesService.saveOrUpdate(wxScoreRules); | |||
| return new ResultData(); | |||
| } | |||
| @@ -57,19 +53,18 @@ public class WxScoreRulesController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxScoreRulesService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxScoreRulesService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreRulesService.getById(id)); | |||
| } | |||
| } | |||
| @@ -1,41 +1,38 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxScoreValidityPeriod; | |||
| import com.simple.service.WxScoreValidityPeriodService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxScoreValidityPeriod") | |||
| public class WxScoreValidityPeriodController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxScoreValidityPeriodController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxScoreValidityPeriodService wxScoreValidityPeriodService; | |||
| private Logger logger = Logger.getLogger(WxScoreValidityPeriodController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxScoreValidityPeriod wxScoreValidityPeriod,Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreValidityPeriod) wxScoreValidityPeriod = new WxScoreValidityPeriod(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxScoreValidityPeriod wxScoreValidityPeriod, Integer pageNum, Integer pageSize) { | |||
| if (null == wxScoreValidityPeriod) wxScoreValidityPeriod = new WxScoreValidityPeriod(); | |||
| final PageInfo<WxScoreValidityPeriod> page = wxScoreValidityPeriodService.listAsPage(wxScoreValidityPeriod, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxScoreValidityPeriod wxScoreValidityPeriod) { | |||
| //Assert.notNull(wxScoreValidityPeriod.getName(), "角色名不能为空"); | |||
| @@ -53,19 +50,18 @@ public class WxScoreValidityPeriodController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxScoreValidityPeriodService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxScoreValidityPeriodService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxScoreValidityPeriodService.getById(id)); | |||
| } | |||
| } | |||
| @@ -3,13 +3,13 @@ package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxShop; | |||
| import com.simple.service.WxShopService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -17,28 +17,27 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("wxShop") | |||
| public class WxShopController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxShopService wxShopService; | |||
| public class WxShopController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| private Logger logger = Logger.getLogger(WxShopController.class); | |||
| @Autowired | |||
| private WxShopService wxShopService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxShop wxShop,Integer pageNum, Integer pageSize) { | |||
| if (null == wxShop) wxShop = new WxShop(); | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShop.setSortColumns(WxShop.Field.Id_DESC); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxShop wxShop, Integer pageNum, Integer pageSize) { | |||
| if (null == wxShop) wxShop = new WxShop(); | |||
| wxShop.setTenantId(getTenantId()); | |||
| wxShop.setSortColumns(WxShop.Field.Id_DESC); | |||
| final PageInfo<Map<String,Object>> page = wxShopService.listMapAsPage(wxShop, pageNum, pageSize); | |||
| final PageInfo<Map<String, Object>> page = wxShopService.listMapAsPage(wxShop, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxShop wxShop) { | |||
| //Assert.notNull(wxShop.getName(), "角色名不能为空"); | |||
| @@ -57,32 +56,32 @@ public class WxShopController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxShopService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxShopService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxShopService.getById(id)); | |||
| } | |||
| @ApiOperation("获取商铺数据") | |||
| @GetMapping("getShopListByShopNumber") | |||
| @ApiImplicitParam(name="shopNumber",value="shopNumber",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "shopNumber", value = "shopNumber", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getbshoplist(String shopNumber) { | |||
| return wxShopService.getbshoplist(getTenantId(),shopNumber); | |||
| return wxShopService.getbshoplist(getTenantId(), shopNumber); | |||
| } | |||
| @ApiOperation("获取商户商铺数据") | |||
| @GetMapping("getMerchantShopByShopId") | |||
| @ApiImplicitParam(name="shopId",value="shopId",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "shopId", value = "shopId", dataType = "String", paramType = "query", required = true) | |||
| public ResultData getMerchantShopByShopId(String shopId) { | |||
| return wxShopService.getMerchantShopByShopId(getTenantId(),shopId); | |||
| return wxShopService.getMerchantShopByShopId(getTenantId(), shopId); | |||
| } | |||
| } | |||
| @@ -6,7 +6,8 @@ import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -26,16 +27,15 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxTags") | |||
| @Api(description="标签弹窗接口") | |||
| public class WxTagsController extends BaseController | |||
| { | |||
| public class WxTagsController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxTagsService wxTagsService; | |||
| @Autowired | |||
| private WxCUserTagsService wxCUserTagsService; | |||
| private Logger logger = Logger.getLogger(WxTagsController.class); | |||
| @GetMapping("getAllList") | |||
| @ApiOperation("标签弹窗接口") | |||
| public ResultData getAllList() { | |||
| @@ -1,41 +1,37 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxUserChannel; | |||
| import com.simple.service.WxUserChannelService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @RestController | |||
| @RequestMapping("wxUserChannel") | |||
| public class WxUserChannelController extends BaseController | |||
| { | |||
| @Autowired | |||
| public class WxUserChannelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxUserChannelService wxUserChannelService; | |||
| private Logger logger = Logger.getLogger(WxUserChannelController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxUserChannel wxUserChannel,Integer pageNum, Integer pageSize) { | |||
| if (null == wxUserChannel) wxUserChannel = new WxUserChannel(); | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxUserChannel wxUserChannel, Integer pageNum, Integer pageSize) { | |||
| if (null == wxUserChannel) wxUserChannel = new WxUserChannel(); | |||
| final PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(wxUserChannel, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxUserChannel wxUserChannel) { | |||
| //Assert.notNull(wxUserChannel.getName(), "角色名不能为空"); | |||
| @@ -53,19 +49,18 @@ public class WxUserChannelController extends BaseController | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData delete(Long id) { | |||
| wxUserChannelService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxUserChannelService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxUserChannelService.getById(id)); | |||
| } | |||
| } | |||
| @@ -5,6 +5,8 @@ import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxUserCouponDto; | |||
| import com.simple.service.WxUserCouponService; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| @@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @RequestMapping("wxUserCoupon") | |||
| public class WxUserCouponController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @@ -1,20 +1,5 @@ | |||
| package com.simple.controller; | |||
| import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.ArrayList; | |||
| import java.util.Calendar; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.dto.WxCUserBasicInfoDto; | |||
| @@ -25,228 +10,235 @@ import com.simple.enums.EnumAgeInfo; | |||
| import com.simple.service.WxCUserBasicInfoService; | |||
| import com.simple.service.WxCUserService; | |||
| import com.simple.service.WxUserChannelService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.text.NumberFormat; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.*; | |||
| @RestController | |||
| @Api(description="会员洞察") | |||
| @Api(description = "会员洞察") | |||
| @RequestMapping("userAnalysis") | |||
| public class WxUserStructureController extends BaseController{ | |||
| @Autowired | |||
| public class WxUserStructureController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxUserChannelService wxUserChannelService; | |||
| @ApiOperation("查询会员性别结构") | |||
| @GetMapping("/findUserSexStructure") | |||
| public ResultData findUserSexStructure( | |||
| Date startTime,Date endTime | |||
| ) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime =c.getTime(); | |||
| } | |||
| //保密 | |||
| dto.setSex(0); | |||
| long secrecy = getCount(dto); | |||
| dto.setSex(1); | |||
| long boy = getCount(dto); | |||
| dto.setSex(2); | |||
| long girl=getCount(dto); | |||
| Long all =secrecy+boy+girl; | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| vos.add(getVo(boy, all, "男",1)); | |||
| vos.add(getVo(girl, all, "女",2)); | |||
| vos.add(getVo(secrecy, all, "保密",3)); | |||
| return new ResultData(vos); | |||
| } | |||
| @ApiOperation("查询会员年龄结构") | |||
| @GetMapping("/findUserAgeStructure") | |||
| public ResultData findUserAgeStructure( Date startTime,Date endTime) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime =c.getTime(); | |||
| } | |||
| dto.setEndTime(endTime); | |||
| long all =wxCUserBasicInfoService.findCountByAge(dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for(EnumAgeInfo a:EnumAgeInfo.values()) { | |||
| c.clear(); | |||
| c.setTime(new Date()); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| long count = getCountByAge(a, c,dto); | |||
| vos.add(getVo(count, all, a.getDesc(),a.getSortNum())); | |||
| } | |||
| return new ResultData(vos); | |||
| } | |||
| @ApiOperation("查询会员数量") | |||
| @GetMapping("/findUserDataCount") | |||
| public ResultData findUserCount(Date startTime,Date endTime) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if(endTime!=null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime =c.getTime(); | |||
| } | |||
| long allCount = wxCUserService.findCount(dto);//总量 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE,0); | |||
| c.set(Calendar.SECOND,0); | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long todayCount= wxCUserService.findCount( dto);//今天新增 | |||
| List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数 | |||
| int j=1; | |||
| for(int i=29;i>=0;i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count= wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); | |||
| vo.setCount(count); | |||
| newCountVos.add(vo); | |||
| } | |||
| List<UserStructureVo> allCountVos = new ArrayList<>();//累计会员数 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| dto.setEndTime(c.getTime()); | |||
| dto.setStartTime(null); | |||
| long firstDay = wxCUserService.findCount(dto);//统计的第一天总数 | |||
| int i =0; | |||
| long sumCount=0; | |||
| for(UserStructureVo v:newCountVos) { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| sumCount+=v.getCount(); | |||
| vo.setCount(firstDay+sumCount); | |||
| vo.setName(v.getName()); | |||
| vo.setSortNum(i+1); | |||
| allCountVos.add(vo); | |||
| i++; | |||
| } | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//累计会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("allCountVos", allCountVos);//累计会员列表( 日期和数量list) | |||
| map.put("newCountVos", newCountVos);//新增会员列表(日期和数量list) | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("拓客分析") | |||
| @GetMapping("/findUserByChannel") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData findUserByChannel(String channelName,Integer pageNum, Integer pageSize) { | |||
| List<String> sceneList =null; | |||
| if(StringUtils.isNotBlank(channelName)) { | |||
| WxUserChannel c= new WxUserChannel(); | |||
| c.setChannelName(channelName); | |||
| PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 100); | |||
| if(page.getSize()>0) { | |||
| sceneList = new ArrayList<>(); | |||
| for(WxUserChannel wuc:page.getList()) { | |||
| sceneList.add(wuc.getSceneAddress()); | |||
| } | |||
| } | |||
| } | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(sceneList, pageNum, pageSize); | |||
| for(WxCUser u:page.getList()) { | |||
| WxUserChannel c= new WxUserChannel(); | |||
| c.setSceneAddress(u.getSceneAddress()); | |||
| PageInfo<WxUserChannel> uc = wxUserChannelService.listAsPage(c, 1, 1); | |||
| if(uc.getSize()>0) { | |||
| u.setChannelName(uc.getList().get(0).getChannelName()); | |||
| }else { | |||
| u.setChannelName("其他来源"); | |||
| } | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("获取用户所有渠道") | |||
| @GetMapping("/findAllUserChannel") | |||
| public ResultData findAllUserChannel() { | |||
| List<WxUserChannel> channels=wxUserChannelService.findDistinctChannel(); | |||
| List<String> vos = new ArrayList<>(); | |||
| for(WxUserChannel w:channels) { | |||
| vos.add(w.getChannelName()); | |||
| } | |||
| return new ResultData(vos); | |||
| } | |||
| private long getCountByAge(EnumAgeInfo a,Calendar c, WxCUserBasicInfoDto dto ) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| c.clear(); | |||
| c.setTime(startTime); | |||
| c.add(Calendar.YEAR,a.getEnd()-a.getStart()); | |||
| Date endTime = c.getTime(); | |||
| dto.setBirthStartTime(startTime); | |||
| dto.setBirthEndTime(endTime); | |||
| return wxCUserBasicInfoService.findCountByAge(dto); | |||
| } | |||
| //通过性别获取数量 | |||
| private long getCount(WxCUserBasicInfoDto dto) { | |||
| // wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic | |||
| //所有这里不需要再去查basic | |||
| return wxCUserService.findCount(dto); | |||
| } | |||
| private UserStructureVo getVo(long count,long all,String name,Integer num) { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(num); | |||
| vo.setName(name); | |||
| vo.setCount(count); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| if(all>0) { | |||
| vo.setPercentage(nf.format(new Long(count).doubleValue()/new Long(all).doubleValue())); | |||
| }else { | |||
| vo.setPercentage("0.00%"); | |||
| } | |||
| return vo; | |||
| } | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @Autowired | |||
| private WxUserChannelService wxUserChannelService; | |||
| @ApiOperation("查询会员性别结构") | |||
| @GetMapping("/findUserSexStructure") | |||
| public ResultData findUserSexStructure(Date startTime, Date endTime) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if (endTime != null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime = c.getTime(); | |||
| } | |||
| //保密 | |||
| dto.setSex(0); | |||
| long secrecy = getCount(dto); | |||
| dto.setSex(1); | |||
| long boy = getCount(dto); | |||
| dto.setSex(2); | |||
| long girl = getCount(dto); | |||
| Long all = secrecy + boy + girl; | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| vos.add(getVo(boy, all, "男", 1)); | |||
| vos.add(getVo(girl, all, "女", 2)); | |||
| vos.add(getVo(secrecy, all, "保密", 3)); | |||
| return new ResultData(vos); | |||
| } | |||
| @ApiOperation("查询会员年龄结构") | |||
| @GetMapping("/findUserAgeStructure") | |||
| public ResultData findUserAgeStructure(Date startTime, Date endTime) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if (endTime != null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime = c.getTime(); | |||
| } | |||
| dto.setEndTime(endTime); | |||
| long all = wxCUserBasicInfoService.findCountByAge(dto); | |||
| List<UserStructureVo> vos = new ArrayList<>(); | |||
| Calendar c = Calendar.getInstance(); | |||
| for (EnumAgeInfo a : EnumAgeInfo.values()) { | |||
| c.clear(); | |||
| c.setTime(new Date()); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| long count = getCountByAge(a, c, dto); | |||
| vos.add(getVo(count, all, a.getDesc(), a.getSortNum())); | |||
| } | |||
| return new ResultData(vos); | |||
| } | |||
| @ApiOperation("查询会员数量") | |||
| @GetMapping("/findUserDataCount") | |||
| public ResultData findUserCount(Date startTime, Date endTime) { | |||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||
| dto.setTenantId(getTenantId()); | |||
| dto.setStartTime(startTime); | |||
| if (endTime != null) { | |||
| Calendar c = Calendar.getInstance(); | |||
| c.setTime(endTime); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| endTime = c.getTime(); | |||
| } | |||
| long allCount = wxCUserService.findCount(dto);//总量 | |||
| Calendar c = Calendar.getInstance(); | |||
| c.set(Calendar.HOUR_OF_DAY, 0); | |||
| c.set(Calendar.MINUTE, 0); | |||
| c.set(Calendar.SECOND, 0); | |||
| Date today = c.getTime(); | |||
| dto.setStartTime(today); | |||
| dto.setEndTime(null); | |||
| long todayCount = wxCUserService.findCount(dto);//今天新增 | |||
| List<UserStructureVo> newCountVos = new ArrayList<>();//每日新增会员数 | |||
| int j = 1; | |||
| for (int i = 29; i >= 0; i--) { | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -i); | |||
| dto.setStartTime(c.getTime()); | |||
| c.add(Calendar.DAY_OF_YEAR, 1); | |||
| dto.setEndTime(c.getTime()); | |||
| long count = wxCUserService.findCount(dto); | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(j); | |||
| j++; | |||
| vo.setName(new SimpleDateFormat("MM-dd").format(dto.getStartTime())); | |||
| vo.setCount(count); | |||
| newCountVos.add(vo); | |||
| } | |||
| List<UserStructureVo> allCountVos = new ArrayList<>();//累计会员数 | |||
| c.clear(); | |||
| c.setTime(today); | |||
| c.add(Calendar.DAY_OF_YEAR, -30); | |||
| dto.setEndTime(c.getTime()); | |||
| dto.setStartTime(null); | |||
| long firstDay = wxCUserService.findCount(dto);//统计的第一天总数 | |||
| int i = 0; | |||
| long sumCount = 0; | |||
| for (UserStructureVo v : newCountVos) { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| sumCount += v.getCount(); | |||
| vo.setCount(firstDay + sumCount); | |||
| vo.setName(v.getName()); | |||
| vo.setSortNum(i + 1); | |||
| allCountVos.add(vo); | |||
| i++; | |||
| } | |||
| Map<String, Object> map = new HashMap<>(); | |||
| map.put("allCount", allCount);//累计会员总数 | |||
| map.put("todayCount", todayCount);//今日新增会员数 | |||
| map.put("allCountVos", allCountVos);//累计会员列表( 日期和数量list) | |||
| map.put("newCountVos", newCountVos);//新增会员列表(日期和数量list) | |||
| return new ResultData(map); | |||
| } | |||
| @ApiOperation("拓客分析") | |||
| @GetMapping("/findUserByChannel") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData findUserByChannel(String channelName, Integer pageNum, Integer pageSize) { | |||
| List<String> sceneList = null; | |||
| if (StringUtils.isNotBlank(channelName)) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setChannelName(channelName); | |||
| PageInfo<WxUserChannel> page = wxUserChannelService.listAsPage(c, 1, 100); | |||
| if (page.getSize() > 0) { | |||
| sceneList = new ArrayList<>(); | |||
| for (WxUserChannel wuc : page.getList()) { | |||
| sceneList.add(wuc.getSceneAddress()); | |||
| } | |||
| } | |||
| } | |||
| PageInfo<WxCUser> page = wxCUserService.listByChannel(sceneList, pageNum, pageSize); | |||
| for (WxCUser u : page.getList()) { | |||
| WxUserChannel c = new WxUserChannel(); | |||
| c.setSceneAddress(u.getSceneAddress()); | |||
| PageInfo<WxUserChannel> uc = wxUserChannelService.listAsPage(c, 1, 1); | |||
| if (uc.getSize() > 0) { | |||
| u.setChannelName(uc.getList().get(0).getChannelName()); | |||
| } else { | |||
| u.setChannelName("其他来源"); | |||
| } | |||
| } | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("获取用户所有渠道") | |||
| @GetMapping("/findAllUserChannel") | |||
| public ResultData findAllUserChannel() { | |||
| List<WxUserChannel> channels = wxUserChannelService.findDistinctChannel(); | |||
| List<String> vos = new ArrayList<>(); | |||
| for (WxUserChannel w : channels) { | |||
| vos.add(w.getChannelName()); | |||
| } | |||
| return new ResultData(vos); | |||
| } | |||
| private long getCountByAge(EnumAgeInfo a, Calendar c, WxCUserBasicInfoDto dto) { | |||
| c.add(Calendar.YEAR, -a.getEnd()); | |||
| Date startTime = c.getTime(); | |||
| c.clear(); | |||
| c.setTime(startTime); | |||
| c.add(Calendar.YEAR, a.getEnd() - a.getStart()); | |||
| Date endTime = c.getTime(); | |||
| dto.setBirthStartTime(startTime); | |||
| dto.setBirthEndTime(endTime); | |||
| return wxCUserBasicInfoService.findCountByAge(dto); | |||
| } | |||
| //通过性别获取数量 | |||
| private long getCount(WxCUserBasicInfoDto dto) { | |||
| // wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic | |||
| //所有这里不需要再去查basic | |||
| return wxCUserService.findCount(dto); | |||
| } | |||
| private UserStructureVo getVo(long count, long all, String name, Integer num) { | |||
| UserStructureVo vo = new UserStructureVo(); | |||
| vo.setSortNum(num); | |||
| vo.setName(name); | |||
| vo.setCount(count); | |||
| NumberFormat nf = NumberFormat.getPercentInstance(); | |||
| nf.setMinimumFractionDigits(2);//控制保留小数点后几位,2:表示保留2位小数点 | |||
| if (all > 0) { | |||
| vo.setPercentage(nf.format(new Long(count).doubleValue() / new Long(all).doubleValue())); | |||
| } else { | |||
| vo.setPercentage("0.00%"); | |||
| } | |||
| return vo; | |||
| } | |||
| } | |||