Commit a03f731d authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents af285cb1 a4551513
...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; ...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice("com.xxfc.platform") @RestControllerAdvice("com.xxfc.platform")
public class PlatformExceptionHandler { public class PlatformExceptionHandler {
@ExceptionHandler(value = {BaseException.class,Exception.class}) @ExceptionHandler(value = {BaseException.class})
public BaseResponse baseExceptionHandler(Exception e) { public BaseResponse baseExceptionHandler(Exception e) {
if (e instanceof BaseException){ if (e instanceof BaseException){
BaseException be = (BaseException) e; BaseException be = (BaseException) e;
......
...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* ${DESCRIPTION} * ${DESCRIPTION}
...@@ -38,6 +39,9 @@ public interface UserFeign { ...@@ -38,6 +39,9 @@ public interface UserFeign {
@RequestMapping(value = "/member/levels", method = RequestMethod.GET) @RequestMapping(value = "/member/levels", method = RequestMethod.GET)
public List<BaseUserMemberLevel> levels(); public List<BaseUserMemberLevel> levels();
@RequestMapping(value = "/public/app/userinfo-by-id")
public Map<Integer,Object> userDetailById(List<Integer> userids);
} }
...@@ -17,11 +17,15 @@ import com.github.wxiaoqi.security.common.msg.BaseResponse; ...@@ -17,11 +17,15 @@ import com.github.wxiaoqi.security.common.msg.BaseResponse;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* ${DESCRIPTION} * ${DESCRIPTION}
...@@ -69,4 +73,23 @@ public class PublicController { ...@@ -69,4 +73,23 @@ public class PublicController {
} }
return new ObjectRestResponse<AppUserDetail>().rel(true).data(user); return new ObjectRestResponse<AppUserDetail>().rel(true).data(user);
} }
//批量获取用户信息
@RequestMapping(value = "/app/userinfo-by-id", method = RequestMethod.GET)
public @ResponseBody
Map<Integer,Object> userDetailById(List<Integer> userids) throws Exception {
Map<Integer,Object> map=new HashMap<>();
for (Integer userid:userids) {
AppUserDetail user = detailBiz.getUserByUserid(userid);
if (user == null) {
user=new AppUserDetail();
user.setHeadimgurl(SystemConfig.USER_HEADER_URL_DEFAULT);
}
map.put(userid,user);
}
return map;
}
} }
...@@ -29,10 +29,10 @@ public class CampsiteShopCarousel implements Serializable { ...@@ -29,10 +29,10 @@ public class CampsiteShopCarousel implements Serializable {
private Integer id; private Integer id;
/** /**
* 商家id * 营地id
*/ */
@Column(name = "shop_id") @Column(name = "shop_id")
@ApiModelProperty(value = "商家id") @ApiModelProperty(value = "营地id")
private Integer shopId; private Integer shopId;
/** /**
......
...@@ -9,7 +9,7 @@ import lombok.Data; ...@@ -9,7 +9,7 @@ import lombok.Data;
/** /**
* 店铺类型表 * 店铺与类型
* *
* @author libin * @author libin
* @email 18178966185@163.com * @email 18178966185@163.com
......
...@@ -91,15 +91,18 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -91,15 +91,18 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
List<Integer> tagIds = tourTags.stream().map(TourTag::getId).collect(Collectors.toList()); List<Integer> tagIds = tourTags.stream().map(TourTag::getId).collect(Collectors.toList());
Map<Integer, List<TourTagBannerDTO>> tourTagBannerMap = tourTagBannerBiz.findTourTagBannersByTagIds(tagIds); Map<Integer, List<TourTagBannerDTO>> tourTagBannerMap = tourTagBannerBiz.findTourTagBannersByTagIds(tagIds);
tourTags.forEach(tourTag -> { tourTags.forEach(tourTag -> {
//vo转换
TourTagDTO tourTagDTO = new TourTagDTO();
BeanUtils.copyProperties(tourTag,tourTagDTO);
//根据旅游标签id查询出标签banner相关信息
List<TourTagBannerDTO> tagBannerDTOS = tourTagBannerMap.get(tourTag.getId());
//banner 数量
tourTagDTO.setBannerNums(tagBannerDTOS.size());
tourTagAndBannerDTOS.add(TourTagAndBannerDTO.builder().tourTagDTO(tourTagDTO).tourTagBannerDTOS(tagBannerDTOS).build());
}); });
for (TourTag tourTag:tourTags){
//vo转换
TourTagDTO tourTagDTO = new TourTagDTO();
BeanUtils.copyProperties(tourTag,tourTagDTO);
//根据旅游标签id查询出标签banner相关信息
List<TourTagBannerDTO> tagBannerDTOS = tourTagBannerMap.get(tourTag.getId());
//banner 数量
tourTagDTO.setBannerNums(tagBannerDTOS==null?0:tagBannerDTOS.size());
tourTagAndBannerDTOS.add(TourTagAndBannerDTO.builder().tourTagDTO(tourTagDTO).tourTagBannerDTOS(tagBannerDTOS).build());
}
//组装数据 //组装数据
tourTagAndBannerDTOPageDataVO.setData(tourTagAndBannerDTOS); tourTagAndBannerDTOPageDataVO.setData(tourTagAndBannerDTOS);
tourTagAndBannerDTOPageDataVO.setPageNum(pageDataVO.getPageNum()); tourTagAndBannerDTOPageDataVO.setPageNum(pageDataVO.getPageNum());
......
...@@ -47,7 +47,7 @@ public class TourGoodAdminController extends BaseController<TourGoodBiz, TourGoo ...@@ -47,7 +47,7 @@ public class TourGoodAdminController extends BaseController<TourGoodBiz, TourGoo
@ApiOperation("后台旅游上下架") @ApiOperation("后台旅游上下架")
@RequestMapping(value = "/admin/upStatus", method = RequestMethod.POST) @RequestMapping(value = "/admin/upStatus", method = RequestMethod.GET)
public ObjectRestResponse upStatus( public ObjectRestResponse upStatus(
@RequestParam(value = "id",defaultValue = "0")Integer id, @RequestParam(value = "id",defaultValue = "0")Integer id,
@RequestParam(value = "status",defaultValue = "1")Integer status) { @RequestParam(value = "status",defaultValue = "1")Integer status) {
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<!--查询旅游路线列表--> <!--查询旅游路线列表-->
<select id="getGoodList" parameterType="java.util.Map" resultMap="tourGoodMap"> <select id="getGoodList" parameterType="java.util.Map" resultMap="tourGoodMap">
SELECT * from tour_good t SELECT * from tour_good t
where 1=1 where t.is_del=1 AND t.g.status=1
<if test="params.query != null and params.query != ''"> <if test="params.query != null and params.query != ''">
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%')) and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if> </if>
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
LEFT JOIN tour_good_tag tag ON g.id=tag.good_id LEFT JOIN tour_good_tag tag ON g.id=tag.good_id
LEFT JOIN tour_tag t ON tag.tag_id=t.id LEFT JOIN tour_tag t ON tag.tag_id=t.id
<where> <where>
g.is_del=0
<if test="params.name != null and params.name != ''"> <if test="params.name != null and params.name != ''">
and (g.`name` like CONCAT('%',#{params.name},'%') or g.introduce like CONCAT('%',#{params.name},'%')) and (g.`name` like CONCAT('%',#{params.name},'%') or g.introduce like CONCAT('%',#{params.name},'%'))
</if> </if>
......
package com.xxfc.platform.vehicle.constant;
/**
* @author libin
* @version 1.0
* @description 车型评分类型
* @data 2019/6/18 15:39
*/
public enum VehicleScoreType {
/**
* 服务态度
*/
SERVICE,
/**
* 司机
*/
DRIVER,
/**
* 检验感受
*/
EXPERIENCE;
}
package com.xxfc.platform.vehicle.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 用户评分表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-18 15:03:58
*/
@Data
@Table(name = "vehicle_user_score")
public class VehicleUserScore implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Integer id;
/**
* 用户id
*/
@Column(name = "user_id")
@ApiModelProperty(value = "用户id")
private Integer userId;
/**
* 订单id
*/
@Column(name = "order_id")
@ApiModelProperty(value = "订单id")
private Integer orderId;
/**
* 车型id
*/
@Column(name = "model_id")
@ApiModelProperty(value = "车型id")
private Integer modelId;
/**
* 评分类型
*/
@Column(name = "type")
@ApiModelProperty(value = "评分类型")
private Integer type;
/**
* 评价分
*/
@Column(name = "ave_score")
@ApiModelProperty(value = "评价分")
private Integer aveScore;
/**
* 评分明细
*/
@Column(name = "scores")
@ApiModelProperty(value = "评分明细")
private String scores;
/**
* 是否匿名;0-否;1-是
*/
@Column(name = "is_anony")
@ApiModelProperty(value = "是否匿名;0-否;1-是")
private Integer isAnony;
/**
* 评价
*/
@Column(name = "comment")
@ApiModelProperty(value = "评价")
private String comment;
/**
* 图片
*/
@Column(name = "imgs")
@ApiModelProperty(value = "图片")
private String imgs;
/**
* 状态:0-未审核;1-已审核;2-审核不通过
*/
@Column(name = "status")
@ApiModelProperty(value = "状态:0-未审核;1-已审核;2-审核不通过")
private Integer status;
/**
* 创建时间
*/
@Column(name = "crt_time")
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
/**
* 更新时间
*/
@Column(name = "upd_time")
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
/**
* 是否删除;0-正常;1-删除
*/
@Column(name = "is_del")
@ApiModelProperty(value = "是否删除;0-正常;1-删除")
private Integer isDel;
}
package com.xxfc.platform.vehicle.pojo.dto;
import com.xxfc.platform.vehicle.constant.VehicleScoreType;
import lombok.Data;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
/**
* @author libin
* @version 1.0
* @description TODO
* @data 2019/6/18 15:45
*/
@Data
public class ScoreTypeDTO {
/**
* 评分类型
*/
@Enumerated(EnumType.STRING)
private VehicleScoreType vehicleScoreType;
/**
* 评分
*/
private int score;
}
package com.xxfc.platform.vehicle.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author libin
* @version 1.0
* @description 车型评分
* @data 2019/6/18 15:15
*/
@Data
public class VehicleUserScoreDTO {
@ApiModelProperty("主键id")
private Integer id;
/**
* 用户id
*/
@ApiModelProperty(value = "用户id")
private Integer userId;
/**
* 订单id
*/
@ApiModelProperty(value = "订单id")
private Integer orderId;
/**
* 车型id
*/
@ApiModelProperty(value = "车型id")
private Integer modelId;
/**
* 评分类型
*/
@ApiModelProperty(value = "评分类型")
private Integer type;
/**
* 评价分
*/
@ApiModelProperty(value = "评价分")
private Integer aveScore;
/**
* 评分明细
*/
@ApiModelProperty(value = "评分明细")
private String scores;
/**
* 是否匿名;0-否;1-是
*/
@ApiModelProperty(value = "是否匿名;0-否;1-是")
private Integer isAnony;
/**
* 评价
*/
@ApiModelProperty(value = "评价")
private String comment;
/**
* 图片
*/
@ApiModelProperty(value = "图片")
private String imgs;
/**
* 状态:0-未审核;1-已审核;2-审核不通过
*/
@ApiModelProperty(value = "状态:0-未审核;1-已审核;2-审核不通过")
private Integer status;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间", hidden = true )
private Long crtTime;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间", hidden = true )
private Long updTime;
/**
* 是否删除;0-正常;1-删除
*/
@ApiModelProperty(value = "是否删除;0-正常;1-删除")
private Integer isDel;
/**
* 服务类型评分
*/
@ApiModelProperty(value = "服务类型评分")
private List<ScoreTypeDTO> scoretype;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.pojo.vo;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description TODO
* @data 2019/6/18 15:26
*/
@Data
public class VehicleUserScoreVo {
}
package com.xxfc.platform.vehicle.biz;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.entity.VehicleUserScore;
import com.xxfc.platform.vehicle.mapper.VehicleUserScoreMapper;
import com.xxfc.platform.vehicle.pojo.dto.ScoreTypeDTO;
import com.xxfc.platform.vehicle.pojo.dto.VehicleUserScoreDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleUserScoreVo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.Instant;
import java.util.List;
/**
* 用户评分表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-18 15:03:58
*/
@Service
public class VehicleUserScoreBiz extends BaseBiz<VehicleUserScoreMapper, VehicleUserScore> {
/**
* 根据车型id查询
* @param modelId
* @return
*/
public PageDataVO<VehicleUserScoreVo> findVehicleUserScorePageByModelId(Integer modelId) {
return null;
}
/**
* 保存评分
* @param vehicleUserScoreDTO
* @return
*/
public int saveVehicleUserScore(VehicleUserScoreDTO vehicleUserScoreDTO) {
vehicleUserScoreDTO.setCrtTime(Instant.now().toEpochMilli());
List<ScoreTypeDTO> scoretype = vehicleUserScoreDTO.getScoretype();
vehicleUserScoreDTO.setComment(JSONObject.toJSONString(scoretype));
double avgScore = scoretype.stream().mapToInt(ScoreTypeDTO::getScore).average().getAsDouble();
VehicleUserScore vehicleUserScore = new VehicleUserScore();
BeanUtils.copyProperties(vehicleUserScoreDTO,vehicleUserScore);
//vehicleUserScore.setAveScore();
return mapper.insertSelective(vehicleUserScore);
}
}
\ No newline at end of file
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehicleUserScore;
import tk.mybatis.mapper.common.Mapper;
/**
* 用户评分表
*
* @author libin
* @email 18178966185@163.com
* @date 2019-06-18 15:03:58
*/
public interface VehicleUserScoreMapper extends Mapper<VehicleUserScore> {
}
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.VehicleUserScoreBiz;
import com.xxfc.platform.vehicle.entity.VehicleUserScore;
import com.xxfc.platform.vehicle.pojo.dto.VehicleUserScoreDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehicleUserScoreVo;
import org.springframework.web.bind.annotation.*;
/**
* @author libin
* @version 1.0
* @description 评分
* @data 2019/6/18 15:32
*/
@RestController
@RequestMapping("vehicleUserScore")
public class VehicleUserScoreController extends BaseController<VehicleUserScoreBiz, VehicleUserScore> {
/**
* 保存评分
* @param vehicleUserScoreDTO
* @return
*/
@PostMapping("/score")
public ObjectRestResponse<Void> saveVehicleUserScore(VehicleUserScoreDTO vehicleUserScoreDTO){
int effectRows = getBaseBiz().saveVehicleUserScore(vehicleUserScoreDTO);
if (effectRows>0){
return ObjectRestResponse.succ();
}
return ObjectRestResponse.createDefaultFail();
}
/**
* 根据车型查询评分列表
*
* @param modelId
* @return
*/
@GetMapping("/scores")
public ObjectRestResponse<PageDataVO<VehicleUserScoreVo>> findVehicleUserScorePageByModelId(@RequestParam("modelId") Integer modelId) {
PageDataVO<VehicleUserScoreVo> pageDataVO = getBaseBiz().findVehicleUserScorePageByModelId(modelId);
return ObjectRestResponse.succ(pageDataVO);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleUserScoreMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xxfc.platform.vehicle.entity.VehicleUserScore" id="vehicleUserScoreMap">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="orderId" column="order_id"/>
<result property="modelId" column="model_id"/>
<result property="type" column="type"/>
<result property="aveScore" column="ave_score"/>
<result property="scores" column="scores"/>
<result property="isAnony" column="is_anony"/>
<result property="comment" column="comment"/>
<result property="imgs" column="imgs"/>
<result property="status" column="status"/>
<result property="crtTime" column="crt_time"/>
<result property="updTime" column="upd_time"/>
<result property="isDel" column="is_del"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment