| | |
| | | import com.stylefeng.guns.modular.account.util.OssUploadUtil; |
| | | import com.stylefeng.guns.modular.shunfeng.service.IDriverRideService; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.model.vo.BalanceRecordVo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.util.WeChatUtil; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 用户控制器 |
| | | */ |
| | | @Slf4j |
| | | @Api |
| | | @RestController |
| | | @RequestMapping("") |
| | |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | @Autowired |
| | | private ITravelCardService travelCardService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | return userInfoService.phoneLoginBindingWeChat(userId, jscode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 我的余额(获取余额记录列表) |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/balanceRecord") |
| | | @ApiOperation(value = "用户余额记录", tags = {"用户端-余额记录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1充值,2消费)", name = "type", required = false, dataType = "Integer"), |
| | | @ApiImplicitParam(value = "开始时间", name = "startDate", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "结束时间", name = "endDate", required = false, dataType = "String"), |
| | | }) |
| | | public ResultUtil balanceRecord(HttpServletRequest request, Integer type, String startDate, String endDate){ |
| | | try { |
| | | Integer userId = userInfoService.getUserIdFormRedis(request); |
| | | if(null == userId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<BalanceRecordVo> recordVoList = travelCardService.getBalanceModifyRecord(userId, type, startDate, endDate); |
| | | return ResultUtil.success(recordVoList); |
| | | }catch (Exception e){ |
| | | log.error("用户余额记录-异常:", e); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 用户出行卡兑换 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/user/travelCardExchange") |
| | | @ApiOperation(value = "用户出行卡兑换", tags = {"用户端-出行卡兑换"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "出行卡号", name = "cardNo", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "出行卡密码", name = "cardPassword", required = true, dataType = "String"), |
| | | }) |
| | | public ResultUtil travelCardExchange(HttpServletRequest request, String cardNo, String cardPassword){ |
| | | try { |
| | | Integer userId = userInfoService.getUserIdFormRedis(request); |
| | | if(null == userId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | BigDecimal amount = travelCardService.travelCardExchange(userId, cardNo, cardPassword); |
| | | return ResultUtil.success(amount); |
| | | }catch (Exception e) { |
| | | log.error("用户出行卡兑换-异常:", e); |
| | | return ResultUtil.error(e.getMessage()); |
| | | } |
| | | } |
| | | } |