Commit 6f43125e authored by hezhen's avatar hezhen

添加评论和短信

parent daa0401f
......@@ -98,7 +98,7 @@ public class AppUserRest {
@RequestParam(value="nickname",defaultValue="")String nickname,
@RequestParam(value="headimgurl",defaultValue="")String headimgurl,
@RequestParam(value="openid",defaultValue="")String openid,
@RequestParam(value="password",defaultValue="")String unionid,
@RequestParam(value="unionid",defaultValue="")String unionid,
@RequestParam(value="type",defaultValue="0")Integer type,
@RequestParam(value="isQQ",defaultValue="0")Integer isQQ
){
......
......@@ -113,6 +113,21 @@ public class OrderRentVehicleDetail implements Serializable, OrderDetail {
@Column(name = "model_id")
@ApiModelProperty(value = "车型id")
private Integer modelId;
//评分
@Column(name = "score")
@ApiModelProperty(value = "评分")
private Integer score;
//评分人
@Column(name = "s_userid")
@ApiModelProperty(value = "评分人")
private Integer sUserid;
//评分时间
@Column(name = "s_time")
@ApiModelProperty(value = "评分时间")
private Long sTime;
}
......@@ -25,6 +25,11 @@
<version>2.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.xxfc.platform</groupId>
<artifactId>xx-vehicle-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
......
......@@ -14,7 +14,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableDiscoveryClient
@EnableScheduling
@EnableAceAuthClient
@EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.xxfc.platform.order.feign"})
@EnableFeignClients({"com.github.wxiaoqi.security.auth.client.feign", "com.xxfc.platform.order.feign", "com.xxfc.platform.vehicle.feign"})
@EnableAceCache
@tk.mybatis.spring.annotation.MapperScan(basePackages = "com.xxfc.platform.order.mapper")
public class OrderApplication {
......
package com.xxfc.platform.order.biz;
import com.alibaba.fastjson.JSONObject;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
......@@ -20,8 +23,40 @@ public class OrderRentVehicleBiz extends BaseBiz<OrderRentVehicleDetailMapper, O
@Autowired
BaseOrderBiz baseOrderBiz;
@Autowired
VehicleFeign vehicleFeign;
public List<OrderRentVehicleDetail> listByOrderId(Integer orderId) {
return mapper.listByOrderId(orderId);
}
//评分
public void addScore(Integer userid,Integer score,Integer orderId) {
List<OrderRentVehicleDetail> list=mapper.listByOrderId(orderId);
int num=0;
if(list.size()>0){
Example example = new Example(OrderRentVehicleDetail.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("order_id",orderId);
OrderRentVehicleDetail detail=list.get(0);
Integer modelId=detail.getModelId();
detail=new OrderRentVehicleDetail();
detail.setScore(score);
detail.setSUserid(userid);
detail.setSTime(System.currentTimeMillis());
num=mapper.updateByExampleSelective(detail,example);
if(num>0){
score=mapper.getPScore(modelId);
vehicleFeign.addScore(modelId,score);
}
}
}
//获取用户评分列表
public List<JSONObject> getScoreAll(Integer userid) {
return null;
}
}
\ No newline at end of file
......@@ -15,5 +15,6 @@ import java.util.List;
*/
public interface OrderRentVehicleDetailMapper extends Mapper<OrderRentVehicleDetail> {
public List<OrderRentVehicleDetail> listByOrderId(@Param("orderId") Integer orderId);
public Integer getPScore(@Param("modelId") Integer modelId);
}
......@@ -5,7 +5,11 @@
<select id="listByOrderId" parameterType="Integer" resultType="com.xxfc.platform.order.entity.OrderRentVehicleDetail">
select *
from order_rent_vehicle_item
from order_rent_vehicle_detail
where order_id = #{orderId}
</select>
<select id="getPScore" resultType="Integer" >
SELECT round(IFNULL (AVG(score),0)) score FROM order_rent_vehicle_detail WHERE model_id=#{modelId}
</select>
</mapper>
\ No newline at end of file
......@@ -5,6 +5,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
......@@ -17,5 +18,6 @@ import org.springframework.web.bind.annotation.RequestParam;
public interface ThirdFeign {
@RequestMapping(value = "/sms/app/unauth/send", method = RequestMethod.GET)
public JSONObject send(@RequestParam(value = "phone") String phone);
@RequestMapping(value = "/file/app/unauth/uploadFiles", method = RequestMethod.POST)
public JSONObject uploadFiles(@RequestParam("files") MultipartFile[] files);
}
......@@ -18,11 +18,13 @@ import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.service.UploadService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.commons.fileupload.ProgressListener;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -38,6 +40,7 @@ import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("file")
@IgnoreUserToken
@Slf4j
public class UploadController{
@Autowired
......@@ -214,7 +217,7 @@ public class UploadController{
}
@RequestMapping(value = "/app/unauth/upload", method = RequestMethod.POST)
public JSONObject uploadDrivingLicense(@RequestParam("file") MultipartFile file)
public JSONObject upload(@RequestParam("file") MultipartFile file)
throws Exception {
String contentType = file.getContentType(); //图片文件类型
// String fileName = file.getOriginalFilename(); //图片名字
......@@ -229,8 +232,36 @@ public class UploadController{
@IgnoreUserToken
@RequestMapping(value = "/app/unauth/download", method = RequestMethod.GET) //匹配的是href中的download请求
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
public ResponseEntity<byte[]> download(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return uploadService.downloadFile(realFileRelPath);
}
@RequestMapping(value = "/app/unauth/uploadFiles", method = RequestMethod.POST)
public JSONObject uploadFiles(@RequestParam("files") MultipartFile[] files)
throws Exception {
if(files!=null&&files.length>0){
String urls="";
for(int i = 0;i<files.length;i++){
MultipartFile file = files[i];
//保存文件
String contentType = file.getContentType();
if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
log.error("大小超过限制!!!");
continue;
}
String path=uploadService.uploadFile(file);
if(StringUtils.isBlank(urls)){
urls+=path;
}else {
urls+=","+path;
}
}
return JsonResultUtil.createSuccessResultWithObj(urls);
}
return JsonResultUtil.createDefaultFail();
}
}
......@@ -200,6 +200,11 @@ public class VehicleModel implements Serializable {
@Column(name = "upd_host")
@ApiModelProperty(value = "修改者host")
private String updHost;
//评分
@Column(name = "score")
@ApiModelProperty(value = "评分")
private Integer score;
}
package com.xxfc.platform.vehicle.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.dto.AppUserDTO;
import com.xxfc.platform.vehicle.feign.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by ace on 2017/9/15.
*/
//@FeignClient(value = "${auth.serviceId}",configuration = {})
@FeignClient("xx-vehicle")
public interface VehicleFeign{
//修改评分
@RequestMapping(value = "/vehicleModel/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(@RequestParam(value="id")Integer id, @RequestParam(value="score")Integer score);
}
......@@ -10,7 +10,7 @@ public class VehicleUserLicenseVo {
private Integer id;
//用户id
//用户id
private Integer userid;
//名称
......
......@@ -15,4 +15,13 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class VehicleModelBiz extends BaseBiz<VehicleModelMapper,VehicleModel> {
//添加评分
public void addScore(Integer id,Integer score){
VehicleModel model=new VehicleModel();
model.setId(id);
model.setScore(score);
updateSelectiveById(model);
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
public class VehicleLicenseController extends VehicleBaseController<VehicleLicenseBiz> {
@RequestMapping(value = "/license/update", method = RequestMethod.POST)
@RequestMapping(value = "/license/update", method = RequestMethod.POST)
public RestResponse update(@RequestBody VehicleUserLicenseVo licenseVo) throws Exception {
AppUserDTO userDTO =getUserInfo();
if(userDTO==null){
......@@ -62,4 +62,5 @@ public class VehicleLicenseController extends VehicleBaseController<VehicleLicen
}
package com.xxfc.platform.vehicle.rest;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.VehicleModelBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.constant.ResCode.ResCode;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.entity.VehicleUserLicense;
import com.xxfc.platform.vehicle.feign.dto.AppUserDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("vehicleModel")
public class VehicleModelController extends BaseController<VehicleModelBiz,VehicleModel> {
//修改评分
@RequestMapping(value = "/app/addScore", method = RequestMethod.GET)
public RestResponse addScore(
@RequestParam(value="id",defaultValue="0")Integer id,
@RequestParam(value="score",defaultValue="0")Integer score){
baseBiz.addScore(id,score);
return RestResponse.suc();
}
}
\ 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