|
@@ -1,5 +1,6 @@
|
|
package com.jpsoft.bus.modules.mobile.controller;
|
|
package com.jpsoft.bus.modules.mobile.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.crypto.symmetric.DES;
|
|
import cn.hutool.crypto.symmetric.DES;
|
|
import cn.hutool.db.sql.Order;
|
|
import cn.hutool.db.sql.Order;
|
|
@@ -9,21 +10,17 @@ import com.jpsoft.bus.config.OSSConfig;
|
|
import com.jpsoft.bus.modules.base.dto.PassengerOrderDTO;
|
|
import com.jpsoft.bus.modules.base.dto.PassengerOrderDTO;
|
|
import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
|
|
import com.jpsoft.bus.modules.base.entity.MergeOrderInfo;
|
|
import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
|
|
+import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
|
|
import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
-import com.jpsoft.bus.modules.bus.dto.NearbyShiftDTO;
|
|
|
|
-import com.jpsoft.bus.modules.bus.dto.NearbyStationDTO;
|
|
|
|
-import com.jpsoft.bus.modules.bus.dto.PassengerDetailDTO;
|
|
|
|
-import com.jpsoft.bus.modules.bus.dto.VehicleStationDTO;
|
|
|
|
|
|
+import com.jpsoft.bus.modules.base.service.ProblemFeedbackService;
|
|
|
|
+import com.jpsoft.bus.modules.bus.dto.*;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
import com.jpsoft.bus.modules.common.dto.Sort;
|
|
import com.jpsoft.bus.modules.common.utils.*;
|
|
import com.jpsoft.bus.modules.common.utils.*;
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+import io.swagger.annotations.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.gavaghan.geodesy.Ellipsoid;
|
|
import org.gavaghan.geodesy.Ellipsoid;
|
|
@@ -56,6 +53,12 @@ public class PassengerApiController {
|
|
@Autowired
|
|
@Autowired
|
|
private OSSConfig ossConfig;
|
|
private OSSConfig ossConfig;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ProblemFeedbackService problemFeedbackService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private PassengerMessageService passengerMessageService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private BaiduService baiduService;
|
|
private BaiduService baiduService;
|
|
|
|
|
|
@@ -199,7 +202,7 @@ public class PassengerApiController {
|
|
userId = userInfo.getId();
|
|
userId = userInfo.getId();
|
|
}
|
|
}
|
|
|
|
|
|
- token = JwtUtil.createToken(jwtSecret, String.valueOf(userId), DateTime.now().plusHours(6).toDate());
|
|
|
|
|
|
+ token = JwtUtil.createToken(jwtSecret, String.valueOf(userId), DateTime.now().plusDays(30).toDate());
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
map.put("token", token);
|
|
map.put("token", token);
|
|
@@ -907,4 +910,364 @@ public class PassengerApiController {
|
|
return messageResult;
|
|
return messageResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("passengerMessage")
|
|
|
|
+ @ApiOperation(value = "乘客过站消息")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> passengerMessage(String token, @RequestAttribute String subject,@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("openId",userInfo.getOpenId());
|
|
|
|
+ searchParams.put("payStatus","2");
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
+
|
|
|
|
+ Page<PassengerMessage> page = passengerMessageService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ List<PassengerMessage> passengerMessageList = page.getResult();
|
|
|
|
+ List<PassengerMessageDTO> list = new ArrayList<>();
|
|
|
|
+ if (passengerMessageList.size()>0){
|
|
|
|
+ for (PassengerMessage passengerMessage : passengerMessageList){
|
|
|
|
+ PassengerMessageDTO passengerMessageDTO = new PassengerMessageDTO();
|
|
|
|
+ PassengerInfo passengerInfo = passengerInfoService.get(passengerMessage.getPassengerId());
|
|
|
|
+
|
|
|
|
+ //过站点
|
|
|
|
+ StationInfo stationInfo = stationInfoService.get(passengerInfo.getTicketDownStationId());
|
|
|
|
+ ShiftInfo shiftInfo = shiftInfoService.get(passengerInfo.getVehicleShiftId());
|
|
|
|
+ //线路
|
|
|
|
+ RouteInfo routeInfo = routeInfoService.get(shiftInfo.getRouteId());
|
|
|
|
+
|
|
|
|
+ passengerMessageDTO.setId(passengerInfo.getId());
|
|
|
|
+ passengerMessageDTO.setVehicleId(shiftInfo.getVehicleId());
|
|
|
|
+ passengerMessageDTO.setStationId(stationInfo.getId());
|
|
|
|
+ passengerMessageDTO.setStationName(stationInfo.getName());
|
|
|
|
+ passengerMessageDTO.setRouteName(routeInfo.getName());
|
|
|
|
+ passengerMessageDTO.setSendTime(DateUtil.format(passengerMessage.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ passengerMessageDTO.setStatusName("已过站");
|
|
|
|
+ list.add(passengerMessageDTO);
|
|
|
|
+
|
|
|
|
+ passengerMessage.setReadStatus(true);
|
|
|
|
+ passengerMessageService.update(passengerMessage);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> pageMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ pageMap.put("recordsTotal",page.getTotal());
|
|
|
|
+ pageMap.put("recordsFiltered",page.getTotal());
|
|
|
|
+ pageMap.put("totalPage",page.getPages());
|
|
|
|
+ pageMap.put("pageNumber",page.getPageNum());
|
|
|
|
+ pageMap.put("pageSize",page.getPageSize());
|
|
|
|
+ pageMap.put("data", list);
|
|
|
|
+
|
|
|
|
+ messageResult.setData(pageMap);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("passengerMessageNoReadNum")
|
|
|
|
+ @ApiOperation(value = "乘客未读过站消息数量")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> passengerMessageNoReadNum(String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("openId",userInfo.getOpenId());
|
|
|
|
+ searchParams.put("readStatus",false);
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
+
|
|
|
|
+ Page<PassengerMessage> page = passengerMessageService.pageSearch(searchParams,1,100,true,sortList);
|
|
|
|
+ List<PassengerMessage> passengerMessageList = page.getResult();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("num",passengerMessageList.size());
|
|
|
|
+
|
|
|
|
+ messageResult.setData(map);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("passengerRecordList")
|
|
|
|
+ @ApiOperation(value = "乘车记录")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "token", value = "令牌", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> passengerRecordList(String token, @RequestAttribute String subject,@RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "5") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+ searchParams.put("openId",userInfo.getOpenId());
|
|
|
|
+ searchParams.put("payStatus",20);
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("a.create_time","desc"));
|
|
|
|
+
|
|
|
|
+ Page<OrderInfo> page = orderInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ List<OrderInfo> orderInfoList = page.getResult();
|
|
|
|
+
|
|
|
|
+ List<PassengerRecordDTO> list =new ArrayList<>();
|
|
|
|
+ if (orderInfoList.size()>0){
|
|
|
|
+ for (OrderInfo orderInfo : orderInfoList){
|
|
|
|
+ PassengerRecordDTO passengerRecordDTO = new PassengerRecordDTO();
|
|
|
|
+
|
|
|
|
+ //乘客记录
|
|
|
|
+ PassengerInfo passengerInfo = passengerInfoService.get(orderInfo.getPassengerId());
|
|
|
|
+ passengerRecordDTO.setId(orderInfo.getId());
|
|
|
|
+ passengerRecordDTO.setImageUrl(passengerInfo.getImageUrl());
|
|
|
|
+ //开始站点
|
|
|
|
+ StationInfo startStation = stationInfoService.get(orderInfo.getTicketUpStationId());
|
|
|
|
+ //终点站
|
|
|
|
+ StationInfo endStation = stationInfoService.get(orderInfo.getTicketDownStationId());
|
|
|
|
+ passengerRecordDTO.setStartStation(startStation.getName());
|
|
|
|
+ passengerRecordDTO.setEndStation(endStation.getName());
|
|
|
|
+ passengerRecordDTO.setTicketType(orderInfo.getTicketType());
|
|
|
|
+ passengerRecordDTO.setTicketTypeName(passengerRecordDTO.getTicketTypeName(passengerRecordDTO.getTicketType()));
|
|
|
|
+ passengerRecordDTO.setGoodTicket(orderInfo.getGoodsTicket());
|
|
|
|
+ passengerRecordDTO.setPayTime(DateUtil.format(orderInfo.getPayTime(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
|
+ passengerRecordDTO.setTotalFee(orderInfo.getTotalFee());
|
|
|
|
+ list.add(passengerRecordDTO);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> pageMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ pageMap.put("recordsTotal",page.getTotal());
|
|
|
|
+ pageMap.put("recordsFiltered",page.getTotal());
|
|
|
|
+ pageMap.put("totalPage",page.getPages());
|
|
|
|
+ pageMap.put("pageNumber",page.getPageNum());
|
|
|
|
+ pageMap.put("pageSize",page.getPageSize());
|
|
|
|
+ pageMap.put("data", list);
|
|
|
|
+
|
|
|
|
+ messageResult.setData(pageMap);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("problemFeedback")
|
|
|
|
+ @ApiOperation(value = "问题反馈")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "content", value = "问题内容", required = false, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "picUrl", value = "图片地址", required = false, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "telephone", value = "联系电话", required = false, paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> problemFeedback(String token, @RequestAttribute String subject, String content, String picUrl, String telephone) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isBlank(content)) {
|
|
|
|
+ throw new Exception("请输入反馈内容");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<String, Object>();
|
|
|
|
+ ProblemFeedback problemFeedback = new ProblemFeedback();
|
|
|
|
+ problemFeedback.setId(UUID.randomUUID().toString());
|
|
|
|
+ problemFeedback.setProblemContent(content);
|
|
|
|
+ problemFeedback.setProblemPic(picUrl);
|
|
|
|
+ problemFeedback.setContactTelephone(telephone);
|
|
|
|
+ problemFeedback.setCreateBy(userInfo.getId().toString());
|
|
|
|
+ problemFeedback.setCreateTime(new Date());
|
|
|
|
+ problemFeedbackService.insert(problemFeedback);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ messageResult.setData(dataMap);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("userInfo")
|
|
|
|
+ @ApiOperation(value = "用户信息")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> userPhone(String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("userInfo",userInfo);
|
|
|
|
+
|
|
|
|
+ messageResult.setData(map);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("userUpdatePhone")
|
|
|
|
+ @ApiOperation(value = "用户更新绑定手机号码")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "phone", value = "手机号码", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "code", value = "验证码", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> userUpdatePhone(String token, @RequestAttribute String subject,String code,String phone) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (phone.equals(userInfo.getPhone())){
|
|
|
|
+ throw new Exception("请更换手机号码");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String smsKey = "SMS_" + phone;
|
|
|
|
+
|
|
|
|
+ String beforeVerifyCode = (String) redisTemplate.opsForValue().get(smsKey);
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isEmpty(beforeVerifyCode)) {
|
|
|
|
+ throw new Exception("验证码已过期!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!beforeVerifyCode.equals(code)) {
|
|
|
|
+ throw new Exception("验证码错误!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ userInfo.setPhone(phone);
|
|
|
|
+ userInfoService.update(userInfo);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("updateUserInfo")
|
|
|
|
+ @ApiOperation(value = "更新用户的基本信息")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "name", value = "用户姓名", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "faceImage", value = "人脸照片", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "acceptMessage", value = "是否接受乘车信息(0:不接受,1:接受)", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "code", value = "验证码", paramType = "form"),
|
|
|
|
+ @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form")
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> updateUserInfo(String token, @RequestAttribute String subject,String name,String faceImage,String acceptMessage) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ UserInfo userInfo = userInfoService.get(Long.parseLong(subject));
|
|
|
|
+ if (userInfo == null){
|
|
|
|
+ throw new Exception("请先注册信息");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Boolean accept = false;
|
|
|
|
+ if ("1".equals(acceptMessage)){
|
|
|
|
+ accept = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ userInfo.setName(name);
|
|
|
|
+ userInfo.setFaceImage(faceImage);
|
|
|
|
+ userInfo.setAcceptMessage(accept);
|
|
|
|
+ userInfoService.update(userInfo);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|