| @@ -1,14 +1,9 @@ | |||||
| package com.iformall.controller.basic; | package com.iformall.controller.basic; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMallBuilding; | |||||
| import com.iformall.service.WxMallBuildingService; | import com.iformall.service.WxMallBuildingService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -23,67 +18,6 @@ public class WxMallBuildingController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMallBuildingService wxMallBuildingService; | private WxMallBuildingService wxMallBuildingService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "商城-楼座-列表") | |||||
| public ResultData list(@ModelAttribute WxMallBuilding wxMallBuilding, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::list"); | |||||
| if (null == wxMallBuilding) wxMallBuilding = new WxMallBuilding(); | |||||
| final PageInfo<WxMallBuilding> page = wxMallBuildingService.listAsPage(wxMallBuilding, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| @SystemControllerLog(description = "商城-楼座-新增") | |||||
| public ResultData add(@RequestBody WxMallBuilding wxMallBuilding) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::add"); | |||||
| //Assert.notNull(wxMallBuilding.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| @SystemControllerLog(description = "商城-楼座-更新") | |||||
| public ResultData update(@RequestBody WxMallBuilding wxMallBuilding) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::update"); | |||||
| wxMallBuildingService.saveOrUpdate(wxMallBuilding); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-楼座-删除") | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::delete"); | |||||
| wxMallBuildingService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-楼座-查询") | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallBuildingService.getById(id)); | |||||
| } | |||||
| @ApiOperation("获取所有数据") | |||||
| @GetMapping("getbuildinglist") | |||||
| @SystemControllerLog(description = "商城-楼座-获取所有数据") | |||||
| public ResultData getbuildinglist() { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::getbuildinglist"); | |||||
| return wxMallBuildingService.getbuildinglist(getTenantId()); | |||||
| } | |||||
| @ApiOperation("获取楼层楼座数据") | @ApiOperation("获取楼层楼座数据") | ||||
| @GetMapping("getbuildingfloorlist") | @GetMapping("getbuildingfloorlist") | ||||
| @SystemControllerLog(description = "商城-楼座-获取楼层楼座数据") | @SystemControllerLog(description = "商城-楼座-获取楼层楼座数据") | ||||
| @@ -1,14 +1,10 @@ | |||||
| package com.iformall.controller.basic; | package com.iformall.controller.basic; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -23,58 +19,15 @@ public class WxMallController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "商城") | |||||
| public ResultData list(@ModelAttribute WxMall wxMall, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallController::list"); | |||||
| if (null == wxMall) wxMall = new WxMall(); | |||||
| final PageInfo<WxMall> page = wxMallService.listAsPage(wxMall, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| @SystemControllerLog(description = "商城-新增") | |||||
| public ResultData add(@RequestBody WxMall wxMall) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallController::add"); | |||||
| //Assert.notNull(wxMall.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxMallService.saveOrUpdate(wxMall); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | @ApiOperation("根据id更新接口") | ||||
| @PostMapping("update") | @PostMapping("update") | ||||
| @SystemControllerLog(description = "商城-更新") | @SystemControllerLog(description = "商城-更新") | ||||
| public ResultData update(@RequestBody WxMall wxMall) { | public ResultData update(@RequestBody WxMall wxMall) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMallController::update"); | logger.debug("[" + getIpAddr() + "] WxMallController::update"); | ||||
| wxMallService.saveOrUpdate(wxMall); | |||||
| wxMallService.update(wxMall); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-删除") | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallController::delete"); | |||||
| wxMallService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-查询") | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallService.getById(id)); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/mallinfoExt") | @GetMapping("/mallinfoExt") | ||||
| @SystemControllerLog(description = "商城-查询") | @SystemControllerLog(description = "商城-查询") | ||||
| @@ -1,91 +0,0 @@ | |||||
| package com.iformall.controller.basic; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxMallFloor; | |||||
| import com.iformall.service.WxMallFloorService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| @RestController | |||||
| @RequestMapping("wxMallFloor") | |||||
| public class WxMallFloorController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxMallFloorService wxMallFloorService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "商城-楼层-列表") | |||||
| public ResultData list(@ModelAttribute WxMallFloor wxMallFloor, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::list"); | |||||
| if (null == wxMallFloor) wxMallFloor = new WxMallFloor(); | |||||
| final PageInfo<WxMallFloor> page = wxMallFloorService.listAsPage(wxMallFloor, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| @SystemControllerLog(description = "商城-楼层-新增") | |||||
| public ResultData add(@RequestBody WxMallFloor wxMallFloor) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::add"); | |||||
| //Assert.notNull(wxMallFloor.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxMallFloorService.saveOrUpdate(wxMallFloor); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| @SystemControllerLog(description = "商城-楼层-更新") | |||||
| public ResultData update(@RequestBody WxMallFloor wxMallFloor) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::update"); | |||||
| wxMallFloorService.saveOrUpdate(wxMallFloor); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-楼层-删除") | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::delete"); | |||||
| wxMallFloorService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "商城-楼层-查询") | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMallFloorService.getById(id)); | |||||
| } | |||||
| @ApiOperation("获取所有数据") | |||||
| @GetMapping("getfloorlist") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "buildingId", value = "楼座ID", dataType = "Long", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "商城-楼座-楼层") | |||||
| public ResultData getfloorlist(Long buildingId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallFloorController::getfloorlist"); | |||||
| return wxMallFloorService.getfloorlist(getTenantId(), buildingId); | |||||
| } | |||||
| } | |||||
| @@ -1,13 +1,10 @@ | |||||
| package com.iformall.controller.basic; | package com.iformall.controller.basic; | ||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMerchantBUser; | |||||
| import com.iformall.service.WxMerchantBUserService; | import com.iformall.service.WxMerchantBUserService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -22,54 +19,6 @@ public class WxMerchantBUserController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantBUserService wxMerchantBUserService; | private WxMerchantBUserService wxMerchantBUserService; | ||||
| @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 WxMerchantBUser wxMerchantBUser, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::list"); | |||||
| if (null == wxMerchantBUser) wxMerchantBUser = new WxMerchantBUser(); | |||||
| final PageInfo<WxMerchantBUser> page = wxMerchantBUserService.listAsPage(wxMerchantBUser, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxMerchantBUser wxMerchantBUser) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::add"); | |||||
| //Assert.notNull(wxMerchantBUser.getName(), "角色名不能为空"); | |||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||||
| wxMerchantBUser.setTenantId(getTenantId()); | |||||
| Long id = wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||||
| return new ResultData(Result.SUCCESS, "添加成功", id); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxMerchantBUser wxMerchantBUser) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::update"); | |||||
| Long id = wxMerchantBUserService.saveOrUpdate(wxMerchantBUser); | |||||
| return new ResultData(Result.SUCCESS, "更新成功", id); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::delete"); | |||||
| wxMerchantBUserService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantBUserController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantBUserService.getById(id)); | |||||
| } | |||||
| @ApiOperation("手机号是否存在") | @ApiOperation("手机号是否存在") | ||||
| @GetMapping("/hasphone") | @GetMapping("/hasphone") | ||||
| @ApiImplicitParam(name = "phone", value = "phone", dataType = "String", paramType = "query", required = true) | @ApiImplicitParam(name = "phone", value = "phone", dataType = "String", paramType = "query", required = true) | ||||
| @@ -1,8 +1,6 @@ | |||||
| package com.iformall.controller.basic; | package com.iformall.controller.basic; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.WxMerchantShop; | import com.iformall.domain.po.WxMerchantShop; | ||||
| @@ -24,19 +22,6 @@ public class WxMerchantShopController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantShopService wxMerchantShopService; | private WxMerchantShopService wxMerchantShopService; | ||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "收银台-获得昨日刷卡列表") | |||||
| public ResultData list(@ModelAttribute WxMerchantShop wxMerchantShop, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::list"); | |||||
| if (null == wxMerchantShop) wxMerchantShop = new WxMerchantShop(); | |||||
| final PageInfo<WxMerchantShop> page = wxMerchantShopService.listAsPage(wxMerchantShop, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("获取关联商铺信息") | @ApiOperation("获取关联商铺信息") | ||||
| @GetMapping("queryShopList") | @GetMapping("queryShopList") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -49,39 +34,4 @@ public class WxMerchantShopController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| public ResultData add(@RequestBody WxMerchantShop wxMerchantShop) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::add"); | |||||
| wxMerchantShopService.saveOrUpdate(wxMerchantShop); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id更新接口") | |||||
| @PostMapping("update") | |||||
| public ResultData update(@RequestBody WxMerchantShop wxMerchantShop) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::update"); | |||||
| wxMerchantShopService.saveOrUpdate(wxMerchantShop); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::delete"); | |||||
| wxMerchantShopService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| @ApiOperation("根据id查询接口") | |||||
| @GetMapping("/findById") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxMerchantShopController::findById"); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxMerchantShopService.getById(id)); | |||||
| } | |||||
| } | } | ||||
| @@ -1,93 +0,0 @@ | |||||
| package com.iformall.controller.basic; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | |||||
| import com.iformall.service.WxMerchantService; | |||||
| import com.iformall.service.WxProfitSharingReceiverService; | |||||
| 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("wxProfitSharingReceiver") | |||||
| public class WxProfitSharingReceiverController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxProfitSharingReceiverService wxProfitSharingReceiverService; | |||||
| @Autowired | |||||
| private WxMerchantService wxMerchantService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "分账接收者-列表") | |||||
| public ResultData list(@ModelAttribute WxProfitSharingReceiver receiver, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::list"); | |||||
| if (null == receiver) receiver = new WxProfitSharingReceiver(); | |||||
| final PageInfo<WxProfitSharingReceiver> page = wxProfitSharingReceiverService.listAsPage(receiver, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| @ApiOperation("新增接口") | |||||
| @PostMapping("add") | |||||
| @SystemControllerLog(description = "分账接收者-新增") | |||||
| public ResultData add(@ModelAttribute WxProfitSharingReceiver receiver) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::add"); | |||||
| if (receiver == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| if (receiver.getMerchantId() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getReceiverType() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getReceiverComments() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getReceiverAccount() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getTrueName() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| WxMerchant merchant = wxMerchantService.getById(receiver.getMerchantId()); | |||||
| if (merchant == null) | |||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| return wxProfitSharingReceiverService.addReceiver(merchant, receiver); | |||||
| } | |||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("del") | |||||
| @SystemControllerLog(description = "分账接收者-删除") | |||||
| public ResultData delete(@ModelAttribute WxProfitSharingReceiver receiver) { | |||||
| logger.debug("[" + getIpAddr() + "] WxProfitSharingReceiverController::delete"); | |||||
| if (receiver == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| if (receiver.getMerchantId() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getReceiverType() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| if (receiver.getReceiverAccount() == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| WxMerchant merchant = wxMerchantService.getById(receiver.getMerchantId()); | |||||
| if (merchant == null) | |||||
| return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| return wxProfitSharingReceiverService.delReceiver(merchant); | |||||
| } | |||||
| } | |||||
| @@ -5,30 +5,37 @@ import com.iformall.domain.po.WxMall; | |||||
| public interface WxMallService { | public interface WxMallService { | ||||
| /** | |||||
| /** | |||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| * | * | ||||
| * @param record | * @param record | ||||
| * @param offset | |||||
| * @param limit | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxMall> listAsPage(WxMall record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| PageInfo<WxMall> listAsPage(WxMall record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| * | * | ||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxMall getById(Long id); | WxMall getById(Long id); | ||||
| /** | |||||
| * 保存或更新实体 | |||||
| /** | |||||
| * 保存实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| int save(WxMall record); | |||||
| /** | |||||
| * 更新实体 | |||||
| * | * | ||||
| * @param record | * @param record | ||||
| */ | */ | ||||
| void saveOrUpdate(WxMall record); | |||||
| int update(WxMall record); | |||||
| /** | /** | ||||
| * 根据Id删除实体 | * 根据Id删除实体 | ||||
| @@ -45,7 +52,6 @@ public interface WxMallService { | |||||
| WxMall getByTenantId(String id); | WxMall getByTenantId(String id); | ||||
| WxMall getByTenantIdExt(String id); | WxMall getByTenantIdExt(String id); | ||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.mapper.WxMallFloorMapper; | |||||
| import com.iformall.mapper.WxMallMapper; | import com.iformall.mapper.WxMallMapper; | ||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -64,18 +65,20 @@ public class WxMallServiceImpl implements WxMallService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void saveOrUpdate(WxMall record) { | |||||
| public int save(WxMall record) { | |||||
| if (record.getId() == null) { | if (record.getId() == null) { | ||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| Long id = idWorker.nextId(); | Long id = idWorker.nextId(); | ||||
| record.setId(id); | record.setId(id); | ||||
| record.setTenantId(String.valueOf(id)); | |||||
| wxMallMapper.insertSelective(record); | |||||
| } else { | |||||
| wxMallMapper.updateByPrimaryKeySelective(record); | |||||
| } | } | ||||
| if(StringUtils.isBlank(record.getTenantId())) { | |||||
| record.setTenantId(String.valueOf(record.getId())); | |||||
| } | |||||
| int ret = wxMallMapper.insertSelective(record); | |||||
| String key = Constant.MALL_KEY_PREV + String.valueOf(record.getId()); | String key = Constant.MALL_KEY_PREV + String.valueOf(record.getId()); | ||||
| // 缓存已存在,删除 | // 缓存已存在,删除 | ||||
| boolean hasKey = mallRedisTemplate.hasKey(key); | boolean hasKey = mallRedisTemplate.hasKey(key); | ||||
| @@ -83,6 +86,21 @@ public class WxMallServiceImpl implements WxMallService { | |||||
| mallRedisTemplate.delete(key); | mallRedisTemplate.delete(key); | ||||
| logger.info("更新mall,从缓存中删除mall token >> " + record.getId()); | logger.info("更新mall,从缓存中删除mall token >> " + record.getId()); | ||||
| } | } | ||||
| return ret; | |||||
| } | |||||
| @Override | |||||
| public int update(WxMall record) { | |||||
| int ret = wxMallMapper.updateByPrimaryKeySelective(record); | |||||
| String key = Constant.MALL_KEY_PREV + String.valueOf(record.getId()); | |||||
| // 缓存已存在,删除 | |||||
| boolean hasKey = mallRedisTemplate.hasKey(key); | |||||
| if(hasKey) { | |||||
| mallRedisTemplate.delete(key); | |||||
| logger.info("更新mall,从缓存中删除mall >> " + record.getId()); | |||||
| } | |||||
| return ret; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -94,7 +112,7 @@ public class WxMallServiceImpl implements WxMallService { | |||||
| boolean hasKey = mallRedisTemplate.hasKey(key); | boolean hasKey = mallRedisTemplate.hasKey(key); | ||||
| if(hasKey) { | if(hasKey) { | ||||
| mallRedisTemplate.delete(key); | mallRedisTemplate.delete(key); | ||||
| logger.info("更新mall,从缓存中删除mall token >> " + id); | |||||
| logger.info("更新mall,从缓存中删除mall >> " + id); | |||||
| } | } | ||||
| } | } | ||||
| @@ -43,7 +43,7 @@ public class WxMallController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxMallController::add"); | logger.debug("[" + getIpAddr() + "] WxMallController::add"); | ||||
| //Assert.notNull(wxMall.getName(), "角色名不能为空"); | //Assert.notNull(wxMall.getName(), "角色名不能为空"); | ||||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | ||||
| wxMallService.saveOrUpdate(wxMall); | |||||
| wxMallService.save(wxMall); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -52,7 +52,7 @@ public class WxMallController extends BaseController { | |||||
| @SystemControllerLog(description = "商城-更新") | @SystemControllerLog(description = "商城-更新") | ||||
| public ResultData update(@RequestBody WxMall wxMall) { | public ResultData update(@RequestBody WxMall wxMall) { | ||||
| logger.debug("[" + getIpAddr() + "] WxMallController::update"); | logger.debug("[" + getIpAddr() + "] WxMallController::update"); | ||||
| wxMallService.saveOrUpdate(wxMall); | |||||
| wxMallService.update(wxMall); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||