| @@ -9,7 +9,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.RequestMapping; | |||
| @@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| @RequestMapping("/api/wxBusiness") | |||
| @Api(description = "业态查询接口") | |||
| public class WxBusinessController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxBusinessController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxBusinessService wxBusinessService; | |||
| @@ -1,11 +1,9 @@ | |||
| package com.simple.controller; | |||
| import com.alibaba.fastjson.JSON; | |||
| 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; | |||
| @@ -16,35 +14,36 @@ 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.*; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import static com.simple.domain.po.WxCampaign.Field.SortNum_ASC; | |||
| @RestController | |||
| @RequestMapping("/api/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(); | |||
| @@ -54,41 +53,42 @@ public class WxCampaignController extends BaseController | |||
| final PageInfo<WxCampaign> page = wxCampaignService.listAsPage(wxCampaign, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @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); | |||
| } | |||
| } | |||
| @@ -17,7 +17,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.*; | |||
| @@ -29,9 +30,8 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/car") | |||
| @Api(description = "智慧停车相关接口") | |||
| 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(); | |||
| @@ -9,7 +9,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.*; | |||
| @@ -17,11 +18,10 @@ import org.springframework.web.bind.annotation.*; | |||
| @RequestMapping("wxCouponCar") | |||
| @Api(description = "停车发券相关接口") | |||
| 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("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -3,7 +3,8 @@ package com.simple.controller; | |||
| import com.simple.domain.vo.WxCouponChannelVo; | |||
| import com.simple.enums.EnumCouponChannelStatus; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.log4j.Logger; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @@ -21,9 +22,8 @@ import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("/api/wxCouponChannel") | |||
| @Api(description = "发券渠道相关接口") | |||
| public class WxCouponChannelController extends BaseController | |||
| { | |||
| private Logger logger = Logger.getLogger(WxCouponChannelController.class); | |||
| public class WxCouponChannelController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @@ -1,30 +1,28 @@ | |||
| package com.simple.controller; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.vo.WxCouponCVo; | |||
| import io.swagger.annotations.Api; | |||
| 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.*; | |||
| 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.WxCouponChannel; | |||
| import com.simple.domain.vo.WxCouponCVo; | |||
| import com.simple.service.WxCouponService; | |||
| 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; | |||
| @RestController | |||
| @RequestMapping("/api/wxCoupon") | |||
| @Api(description = "券类型相关接口") | |||
| public class WxCouponController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxCouponController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @@ -1,23 +1,22 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCouponOrder; | |||
| import com.simple.domain.vo.WxCouponOrderCVo; | |||
| import com.simple.enums.EnumCouponOrderStatus; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.service.WxCouponOrderService; | |||
| 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.*; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.ModelAttribute; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @@ -26,7 +25,7 @@ import java.util.Map; | |||
| @RequestMapping("/api/couponOrder") | |||
| @Api(description = "用户卡券查询接口") | |||
| public class WxCouponOrderController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxCouponOrderController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponOrderService wxCouponOrderService; | |||
| @@ -39,7 +38,7 @@ public class WxCouponOrderController extends BaseController { | |||
| }) | |||
| public ResultData list(@ModelAttribute WxCouponOrderCVo wxCouponOrder, Integer pageNum, Integer pageSize) { | |||
| if(pageNum == null || pageSize == null) { | |||
| if (pageNum == null || pageSize == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if (wxCouponOrder == null) wxCouponOrder = new WxCouponOrderCVo(); | |||
| @@ -60,7 +59,7 @@ public class WxCouponOrderController extends BaseController { | |||
| }) | |||
| public ResultData detail(String couponOrderId) { | |||
| if(couponOrderId == null) { | |||
| if (couponOrderId == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| @@ -74,13 +73,13 @@ public class WxCouponOrderController extends BaseController { | |||
| }) | |||
| public ResultData getStatus(String couponOrderId) { | |||
| if(couponOrderId == null) { | |||
| if (couponOrderId == null) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| Map res = new HashMap(); | |||
| res.put("CouponOrderStatus",wxCouponOrderService.getById(Long.valueOf(couponOrderId)).getCouponOrderStatus() ); | |||
| res.put("CouponOrderStatus", wxCouponOrderService.getById(Long.valueOf(couponOrderId)).getCouponOrderStatus()); | |||
| return new ResultData(res); | |||
| } | |||
| @@ -11,7 +11,8 @@ import com.simple.service.WxMallService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.log4j.Logger; | |||
| import org.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; | |||
| @@ -22,9 +23,9 @@ import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/mall") | |||
| @Api(description="商场信息相关接口") | |||
| @Api(description = "商场信息相关接口") | |||
| public class WxMallController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxMallController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMallService wxMallService; | |||
| @@ -43,7 +44,7 @@ public class WxMallController extends BaseController { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); | |||
| if (mall==null) { | |||
| if (mall == null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| Map resultMap = new HashMap(); | |||
| @@ -61,7 +62,7 @@ public class WxMallController extends BaseController { | |||
| return new ResultData(ErrorCode.APP_ID_NOT_FOUND); | |||
| } | |||
| WxMall mall = wxMallService.getByTenantId(appInfo.getTenantId()); | |||
| if (mall==null) { | |||
| if (mall == null) { | |||
| return new ResultData(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| return new ResultData(Result.SUCCESS, "查询成功", mall); | |||
| @@ -9,7 +9,8 @@ import com.simple.service.WxMsgValidationcodeService; | |||
| import io.swagger.annotations.Api; | |||
| 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.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| @@ -17,9 +18,9 @@ import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @RequestMapping("/api/wxMsgValidationcode") | |||
| @Api(description="短信验证相关接口") | |||
| @Api(description = "短信验证相关接口") | |||
| public class WxMsgValidationcodeController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxMsgValidationcodeController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxMsgValidationcodeService wxMsgValidationcodeService; | |||
| @@ -31,7 +32,6 @@ public class WxMsgValidationcodeController extends BaseController { | |||
| private WxMerchantService wxMerchantService; | |||
| @GetMapping("sendvalidationcode") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true), | |||
| @@ -1,29 +1,27 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxCouponChannel; | |||
| import com.simple.domain.po.WxOrder; | |||
| import com.simple.domain.vo.WxOrderCVo; | |||
| import com.simple.enums.EnumCouponChannelStatus; | |||
| import com.simple.enums.EnumCouponStatus; | |||
| import com.simple.enums.EnumOrderStatus; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.service.WxCouponChannelService; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 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.WxOrder; | |||
| import com.simple.service.WxOrderService; | |||
| 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.Map; | |||
| @@ -31,7 +29,7 @@ import java.util.Map; | |||
| @RequestMapping("/api/order/") | |||
| @Api(description = "订单相关接口") | |||
| public class WxOrderController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxOrderController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCouponChannelService wxCouponChannelService; | |||
| @@ -181,7 +179,7 @@ public class WxOrderController extends BaseController { | |||
| @ApiOperation(value = "订单已过期", notes = "{\"orderId\":\"string\"}") | |||
| @PostMapping("expired") | |||
| public ResultData expiredOrder(@RequestBody Map<String, String> paramMap) { | |||
| public ResultData expiredOrder(@RequestBody Map<String, String> paramMap) { | |||
| //Assert.notNull(wxOrders.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| String orderIdStr = paramMap.get("orderId"); | |||
| @@ -211,8 +209,8 @@ public class WxOrderController extends BaseController { | |||
| @ApiOperation("分页订单列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||
| }) | |||
| public ResultData list(@ModelAttribute WxOrder wxOrder, Integer pageNum, Integer pageSize) { | |||
| // c端用户应该只能看到自己的订单 | |||
| @@ -226,7 +224,7 @@ public class WxOrderController extends BaseController { | |||
| @ApiOperation("订单详情接口") | |||
| @GetMapping("detail") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="orderId",value="订单id",dataType="String", paramType = "query",required=true) | |||
| @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", paramType = "query", required = true) | |||
| }) | |||
| public ResultData detail(String orderId) { | |||
| // c端用户应该只能看到自己的订单细节 | |||
| @@ -240,14 +238,15 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| wxOrder.setId(id); | |||
| wxOrder.setCUserId(getUser().getId()); | |||
| WxOrderCVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| WxOrderCVo wxOrderCVo = wxOrderService.detailCUserVo(wxOrder); | |||
| if (wxOrderCVo == null) | |||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | |||
| return new ResultData(wxOrderCVo); | |||
| } | |||
| @ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") | |||
| @GetMapping("/findById") | |||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||
| String orderIdStr = paramMap.get("orderId"); | |||
| if (StringUtils.isBlank(orderIdStr)) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| @@ -1,26 +1,25 @@ | |||
| package com.simple.controller; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.domain.po.WxPark; | |||
| import com.simple.pay.WxPay; | |||
| import com.simple.service.WxParkService; | |||
| 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.*; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @RestController | |||
| @RequestMapping("/api/wxPark") | |||
| @Api(description = "停车相关接口接口") | |||
| public class WxParkController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxParkController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxParkService wxParkService; | |||
| @@ -1,51 +1,40 @@ | |||
| package com.simple.controller; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import com.simple.annotation.AuthIgnore; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.config.PayProperty; | |||
| import com.simple.domain.po.WxAppinfo; | |||
| import com.simple.domain.po.WxCUser; | |||
| import com.simple.enums.EnumPayStatus; | |||
| import com.simple.domain.po.WxPayOrder; | |||
| import com.simple.enums.EnumPayWay; | |||
| import com.simple.exception.BizMessageException; | |||
| import com.simple.exception.MallinkException; | |||
| import com.simple.pay.WxPayment; | |||
| import com.simple.service.WxPayOrderService; | |||
| import com.simple.utils.IPUtil; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.log4j.Logger; | |||
| import org.apache.commons.io.IOUtils; | |||
| 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.WxPayOrder; | |||
| import com.simple.service.WxPayOrderService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import sun.rmi.runtime.Log; | |||
| 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 javax.servlet.http.HttpServletRequest; | |||
| import java.nio.charset.Charset; | |||
| import java.util.Map; | |||
| @RestController | |||
| @RequestMapping("/api/pay") | |||
| @Api(description = "支付相关接口") | |||
| public class WxPayOrderController extends BaseController { | |||
| private Logger logger = Logger.getLogger(WxPayOrderController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private PayProperty payProperty; | |||
| @Autowired | |||
| @Autowired | |||
| private WxPayOrderService wxPayOrderService; | |||
| @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | |||
| @@ -74,10 +63,10 @@ public class WxPayOrderController extends BaseController { | |||
| record.setIp(IPUtil.getIpAddr(request)); | |||
| return wxPayOrderService.createPayOrder(payProperty.isReal(), appInfo, user, record, EnumPayWay.PAY_WAY_WECHAT); | |||
| } catch (MallinkException e) { | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| logger.error("payment wechat, order create error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage()); | |||
| } | |||
| } | |||
| @@ -86,10 +75,10 @@ public class WxPayOrderController extends BaseController { | |||
| @PostMapping("/updatePayOrder") | |||
| public ResultData updatePayOrder(@RequestBody Map<String, Object> paramMap) { | |||
| logger.info("/api/pay/updatePayOrder" + paramMap.toString()); | |||
| String payOrderIdStr = (String)paramMap.get("payOrderId"); | |||
| String orderIdStr = (String)paramMap.get("orderId"); | |||
| String reasonStr = (String)paramMap.get("reason"); | |||
| Integer status = (Integer)paramMap.get("status"); | |||
| String payOrderIdStr = (String) paramMap.get("payOrderId"); | |||
| String orderIdStr = (String) paramMap.get("orderId"); | |||
| String reasonStr = (String) paramMap.get("reason"); | |||
| Integer status = (Integer) paramMap.get("status"); | |||
| if (StringUtils.isBlank(orderIdStr)) { | |||
| logger.info("orderId不能为空: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||
| @@ -97,15 +86,15 @@ public class WxPayOrderController extends BaseController { | |||
| Long payOrderId = 0L, orderId = 0L; | |||
| try { | |||
| orderId = Long.valueOf(orderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("orderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "orderId参数不正确"); | |||
| } | |||
| if (!StringUtils.isBlank(payOrderIdStr)) { | |||
| try { | |||
| payOrderId = Long.valueOf(payOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| logger.error("payOrderId参数不正确: " + paramMap.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "payOrderId参数不正确"); | |||
| } | |||
| } | |||
| @@ -119,26 +108,26 @@ public class WxPayOrderController extends BaseController { | |||
| wxPayOrderService.handlePayOrderStatusUpdate(payOrder); | |||
| return new ResultData(Result.SUCCESS, "支付状态更新成功"); | |||
| } catch (MallinkException e) { | |||
| logger.error("支付状态更新失败2: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| logger.error("支付状态更新失败2: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| } catch (Exception e) { | |||
| logger.error("支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| logger.error("支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "支付状态更新失败3: " + payOrder.toString() + ", e:" + e.getMessage()); | |||
| } | |||
| } | |||
| @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 WxPayOrder wxPayOrder,Integer pageNum, Integer pageSize) { | |||
| if (null == wxPayOrder) wxPayOrder = new WxPayOrder(); | |||
| @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 WxPayOrder wxPayOrder, Integer pageNum, Integer pageSize) { | |||
| if (null == wxPayOrder) wxPayOrder = new WxPayOrder(); | |||
| final PageInfo<WxPayOrder> page = wxPayOrderService.listAsPage(wxPayOrder, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("/add") | |||
| public ResultData add(@RequestBody WxPayOrder wxPayOrder) { | |||
| //Assert.notNull(wxPayOrder.getName(), "角色名不能为空"); | |||
| @@ -156,19 +145,18 @@ public class WxPayOrderController 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) { | |||
| wxPayOrderService.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,"查询成功",wxPayOrderService.getById(id)); | |||
| return new ResultData(Result.SUCCESS, "查询成功", wxPayOrderService.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.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)); | |||
| } | |||
| } | |||
| @@ -46,7 +46,7 @@ import java.util.Map; | |||
| @RequestMapping("/api/user") | |||
| @Api(description = "用户登陆授权相关接口") | |||
| public class WxUserGrantController extends BaseController { | |||
| private final static Logger logger = LoggerFactory.getLogger(WxUserGrantController.class); | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| private WxCUserService wxCUserService; | |||
| @@ -98,8 +98,8 @@ public class WxCUser implements Serializable { | |||
| /*session key for 微信小程序**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="session key for 微信小程序",name="sessionKey") | |||
| private String sessionKey; | |||
| /*积分**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="积分",name="score") | |||
| /*成长值**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="成长值",name="score") | |||
| private Integer score; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||