Commit 7b9ee0d5 authored by libin's avatar libin

Merge branch 'base-modify' of http://113.105.137.151:22280/youjj/cloud-platform into base-modify

parents 2921f662 0dec6e30
......@@ -4,6 +4,7 @@ package com.xxfc.platform.tour.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
......@@ -23,12 +24,14 @@ public class GoodSpePriceDTO {
//出行时间
@ApiModelProperty(value = "出行时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",locale="zh", timezone = "GMT+8")
private Date startTime;
//结束时间
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd",locale="zh", timezone = "GMT+8")
private Date endTime;
@ApiModelProperty("商品id")
......
......@@ -78,5 +78,8 @@ public class TourDepartVo {
@ApiModelProperty(value = "类型")
private Integer type;
//排序
@ApiModelProperty(value = "排序")
private Integer rank;
}
......@@ -120,13 +120,14 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
goodBanner.setGoodId(goodId);
if(bannerId==null||bannerId==0){
bannerBiz.insertSelective(goodBanner);
bannerId=goodBanner.getId();
}else {
bannerBiz.updateSelectiveById(goodBanner);
bannerIds.add(bannerId);
}
bannerIds.add(bannerId);
}
if(bannerIds.size()>0){
bannerBiz.delGoodBanner(null,bannerIds);
bannerBiz.delGoodBanner(goodId,bannerIds);
}
}else{
......@@ -146,33 +147,37 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
siteId=site.getId();
}else {
siteBiz.updateSelectiveById(site);
siteIds.add(siteId);
}
siteIds.add(siteId);
if(site.getType()==0){
sites.add(siteId);
}
}
if(siteIds.size()>0){
siteBiz.delGoodSite(null,siteIds);
siteBiz.delGoodSite(goodId,siteIds);
}
}
List<GoodTagDTO> tagList=dto.getTagDTOS();
if(siteDTOList.size()>0){
if(tagList.size()>0){
List<Integer> tagIds=new ArrayList<>();
for (GoodTagDTO tagDTO:tagList){
Integer tagId=tagDTO.getId();
Integer tagId=tagDTO.getTagId();
TourGoodTag tag=new TourGoodTag();
BeanUtils.copyProperties(tag,tagDTO);
tag.setGoodId(goodId);
if(tagId==null||tagId==0){
TourGoodTag tag1=tagBiz.selectOne(tag);
if(tag1==null){
tagBiz.insertSelective(tag);
tagId=tag.getId();
}else {
tagBiz.updateSelectiveById(tag);
tagIds.add(tagId);
/* tag.setId(tag.getId());
tagBiz.updateSelectiveById(tag);*/
tagId=tag1.getId();
}
tagIds.add(tagId);
}
if(tagIds.size()>0){
tagBiz.delGoodTag(null,tagIds);
tagBiz.delGoodTag(goodId,tagIds);
}
}else{
tagBiz.delGoodTag(goodId,null);
......@@ -221,7 +226,7 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
prices.add(priceId);
}
if(priceIds.size()>0){
speBiz.delGoodSpe(null,priceIds);
speBiz.delGoodSpe(goodId,priceIds);
}
}
if(sites.size()>0){
......@@ -251,14 +256,14 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
}
if(vids.size()>0){
verificationBiz.delGoodVerification(vids);
verificationBiz.delGoodVerification(goodId,vids);
}
if(verifications.size()>0){
verificationBiz.addBathTourGoodVerification(verifications);
for (TourGoodVerification verif:verifications)
verificationBiz.insertSelective(verif);
}
}
List<TourGoodVerification> verifications=new ArrayList<>();
}
} catch (IllegalAccessException e) {
e.printStackTrace();
......@@ -269,6 +274,41 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
return ObjectRestResponse.succ();
}
//删除商品
public ObjectRestResponse delGoodById(Integer id) {
if (id == null || id == 0) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
try {
TourGood TourGood=new TourGood();
TourGood.setId(id);
TourGood.setIsDel(1);
updateSelectiveById(TourGood);
return ObjectRestResponse.succ();
} catch (Exception e) {
e.printStackTrace();
log.error("---商品详情---id=====" + id + "----异常---msg===" + e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
//上下架商品
public ObjectRestResponse upStatusById(Integer id,Integer status) {
if (id == null || id == 0||status == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
try {
TourGood TourGood=new TourGood();
TourGood.setId(id);
TourGood.setStatus(status);
updateSelectiveById(TourGood);
return ObjectRestResponse.succ();
} catch (Exception e) {
e.printStackTrace();
log.error("---商品详情---id=====" + id + "----异常---msg===" + e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
}
......
......@@ -47,26 +47,27 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
TourGoodBannerMapper bannerMapper;
//获取商品详情
public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id){
if(id==null||id==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
public ObjectRestResponse<TourGoodDetailVo> getGoodDetaileById(Integer id) {
if (id == null || id == 0) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
try {
TourGood TourGood = mapper.getOne(id);
if (TourGood != null) {
TourGoodDetailVo detailVo = new TourGoodDetailVo();
BeanUtils.copyProperties(detailVo, TourGood);
BigDecimal price=detailVo.getPrice();
if(price!=null&&detailVo.getIsMember()>0){
List<TourMemberVo> memberList=new ArrayList<>();
List<BaseUserMemberLevel> levelsList=userFeign.levels();
if(levelsList.size()>0){
for(BaseUserMemberLevel memberLevel :levelsList){
TourMemberVo memberVo=new TourMemberVo();
BigDecimal price = detailVo.getPrice();
if (price != null && detailVo.getIsMember() > 0) {
List<TourMemberVo> memberList = new ArrayList<>();
List<BaseUserMemberLevel> levelsList = userFeign.levels();
if (levelsList.size() > 0) {
for (BaseUserMemberLevel memberLevel : levelsList) {
TourMemberVo memberVo = new TourMemberVo();
memberVo.setLevel(memberLevel.getLevel());
memberVo.setName(memberLevel.getName());
BigDecimal member_price=price.multiply(new BigDecimal(memberLevel.getDiscount()+"")).divide(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP); ;
BigDecimal member_price = price.multiply(new BigDecimal(memberLevel.getDiscount() + "")).divide(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP);
;
memberVo.setPrice(member_price);
memberList.add(memberVo);
}
......@@ -75,56 +76,54 @@ public class TourGoodDetailBiz extends BaseBiz<TourGoodMapper, TourGood> {
}
//获取出行时间
List<TourDepartTimeVo> timelist=priceMapper.getAllByGoodId(id);
List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id);
detailVo.setTourDepartTimeVo(timelist);
//获取出发地点
List<TourDepartVo> departList=siteMapper.getlistByGoodId(id);
List<TourDepartVo> departList = siteMapper.getlistByGoodId(id);
detailVo.setTourDepartVo(departList);
return ObjectRestResponse.succ(detailVo);
return ObjectRestResponse.succ(detailVo);
}
return ObjectRestResponse.createDefaultFail();
}catch (Exception e) {
return ObjectRestResponse.createDefaultFail();
} catch (Exception e) {
e.printStackTrace();
log.error("---商品详情---id====="+id+"----异常---msg==="+ e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
log.error("---商品详情---id=====" + id + "----异常---msg===" + e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
//获取商品详情
public ObjectRestResponse<TourGoodDetailVo> findDetaileById(Integer id){
if(id==null||id==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
public ObjectRestResponse<TourGoodDetailVo> findDetaileById(Integer id) {
if (id == null || id == 0) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
try {
TourGood TourGood = mapper.getOne(id);
if (TourGood != null) {
TourGoodDetailVo detailVo = new TourGoodDetailVo();
BeanUtils.copyProperties(detailVo, TourGood);
BigDecimal price=detailVo.getPrice();
BigDecimal price = detailVo.getPrice();
//获取出行时间
List<TourDepartTimeVo> timelist=priceMapper.getAllByGoodId(id);
List<TourDepartTimeVo> timelist = priceMapper.getAllByGoodId(id);
detailVo.setTourDepartTimeVo(timelist);
//获取出发地点
List<TourDepartVo> departList=siteMapper.getlistByGoodId(id);
List<TourDepartVo> departList = siteMapper.getlistByGoodId(id);
detailVo.setTourDepartVo(departList);
//获取标签
List<GoodTagDTO> tagList=tagMapper.getGoodTagList(id);
List<GoodTagDTO> tagList = tagMapper.getGoodTagList(id);
detailVo.setTagDTOS(tagList);
//获取banner
List<GoodBannerDTO> bannerList=bannerMapper.getBannerList(id);
List<GoodBannerDTO> bannerList = bannerMapper.getBannerList(id);
detailVo.setBannerDTOS(bannerList);
return ObjectRestResponse.succ(detailVo);
return ObjectRestResponse.succ(detailVo);
}
return ObjectRestResponse.createDefaultFail();
}catch (Exception e) {
return ObjectRestResponse.createDefaultFail();
} catch (Exception e) {
e.printStackTrace();
log.error("---商品详情---id====="+id+"----异常---msg==="+ e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
log.error("---商品详情---id=====" + id + "----异常---msg===" + e.getMessage());
return ObjectRestResponse.createFailedResult(ResultCode.EXCEPTION_CODE, "出现异常");
}
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ import java.util.*;
public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,TourGoodVerification> {
//删除线路核销
public void delGoodVerification(List<Integer> ids){ mapper.delVerification(ids);}
public void delGoodVerification(Integer goodId,List<Integer> ids){ mapper.delVerification(goodId,ids);}
/**
* 批量插入核销
......
......@@ -21,7 +21,7 @@ import java.util.List;
public interface TourGoodVerificationMapper extends Mapper<TourGoodVerification> {
//删除线路核销
public int delVerification( @Param("list") List<Integer> ids);
public int delVerification(@Param("goodId")Integer goodId, @Param("list") List<Integer> ids);
/**
......
......@@ -39,5 +39,20 @@ public class TourGoodAdminController extends BaseController<TourGoodBiz, TourGoo
return detailBiz.findDetaileById(id);
}
@ApiOperation("后台旅游删除")
@RequestMapping(value = "/admin/goodDel/{id}", method = RequestMethod.GET)
public ObjectRestResponse goodDel(@PathVariable Integer id) {
return baseBiz.delGoodById(id);
}
@ApiOperation("后台旅游上下架")
@RequestMapping(value = "/admin/upStatus", method = RequestMethod.POST)
public ObjectRestResponse upStatus(
@RequestParam(value = "id",defaultValue = "0")Integer id,
@RequestParam(value = "status",defaultValue = "1")Integer status) {
return baseBiz.upStatusById(id,status);
}
}
\ No newline at end of file
......@@ -35,6 +35,7 @@
<result property="latitude" column="latitude"/>
<result property="type" column="type"/>
<result property="intro" column="intro"/>
<result property="rank" column="rank"/>
</resultMap>
<!-- 获取出行时间 -->
......
......@@ -18,6 +18,7 @@
<update id="delVerification">
update tour_good_verification set is_del=1
where total_person=0 and verification_person=0
and good_id=#{goodId}
<if test="list!=null ">
and id not in (
<trim suffixOverrides=",">
......
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