Commit 44244347 authored by hezhen's avatar hezhen

修改旅游

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