Merge remote-tracking branch 'origin/develop_master_new' into develop_master_new

This commit is contained in:
gaojiabao
2022-12-01 14:19:33 +08:00
8 changed files with 115 additions and 48 deletions
@@ -56,7 +56,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
startdate = formater.parse(start);
}
if (end!=null){
enddate=formater.parse(DateUtil.addOneDay(end));
enddate=formater.parse(end);
}
} catch (ParseException e) {
e.printStackTrace();
@@ -83,7 +83,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
//
Calendar c2 = Calendar.getInstance();
c2.setTime(sarPublicIdea.getEndTime());
c2.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
c2.add(Calendar.DAY_OF_MONTH, 0);// 今天+1天
sarPublicIdea.setEndTime(c2.getTime());
sarPublicIdeaService.save(sarPublicIdea);
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
@@ -50,6 +51,21 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
if (start!=null && end !=null){
String date1 = (new SimpleDateFormat("yyyy-MM-dd")).format(start);
String date2 = (new SimpleDateFormat("yyyy-MM-dd")).format(end);
// Date classDate = null;
// try {
// classDate = new SimpleDateFormat("yyyy-MM-dd").parse(date3);
// Calendar calendar = Calendar.getInstance(); //使用Calendar日历类对日期进行加减
// calendar.setTime(classDate);
// calendar.add(Calendar.DAY_OF_MONTH, - 1);
// classDate = calendar.getTime();//获取加减以后的Date类型日期
//
// } catch (ParseException e) {
// e.printStackTrace();
// }
// ;//把字符串转化成指定格式的日期
// String date2 =(new SimpleDateFormat("yyyy-MM-dd")).format(classDate);
list.like(StringUtils.isNotEmpty(category), "category", category)
.like(StringUtils.isNotEmpty(cname), "cid", cname)
.ge(start != null, "start_time", date1)
@@ -59,15 +75,23 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
String date1 = (new SimpleDateFormat("yyyy-MM-dd")).format(start);
list.like(StringUtils.isNotEmpty(category), "category", category)
.like(StringUtils.isNotEmpty(cname), "cid", cname)
.le(start != null, "start_time", date1)
.ge(start != null, "end_time", date1)
// .le(start != null, "start_time", date1)
// .ge(start != null, "end_time", date1)
.ge(start != null, "start_time", date1)
// .le(start != null, "end_time", date1)
.orderByDesc("start_time");
}else if (end!=null){
String date2 = (new SimpleDateFormat("yyyy-MM-dd")).format(end);
list.like(StringUtils.isNotEmpty(category), "category", category)
.like(StringUtils.isNotEmpty(cname), "cid", cname)
.le(end != null, "start_time", date2)
.ge(end != null, "end_time", date2)
// .le(end != null, "start_time", date2)
// .ge(end != null, "end_time", date2)
.le(end != null, "end_time", date2)
// .ge(end != null, "end_time", date2)
.orderByDesc("start_time");
}else {
list.like(StringUtils.isNotEmpty(category), "category", category)
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -89,5 +90,12 @@ public class ZlTreeController extends BaseController<ZlTree> {
}
@GetMapping("/queryTree")
@ApiOperation("根据树id判断树层级并查询对应的节点")
public ResponseMessage<ZlTree> queryTree(@Param("treeId") String treeId){
ZlTree zlTree = iZlTreeService.queryTree(treeId);
return Result.success(zlTree);
}
}
@@ -45,5 +45,10 @@ public interface IZlTreeService extends IService<ZlTree> {
*/
int topping(String id);
/**
* 根据树id判断树层级并查询对应的节点
* @param treeId
* @return
*/
ZlTree queryTree(String treeId);
}
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -130,4 +131,27 @@ public class ZlTreeServiceImpl extends ServiceImpl<ZlTreeDao, ZlTree> implements
public int topping(String id) {
return zlTreeDao.topping(id);
}
/**
* 根据树id判断树层级并查询对应的节点
* @param treeId
* @return
*/
@Override
public ZlTree queryTree(String treeId) {
ZlTree zlTree = zlTreeDao.selectById(treeId);
if (ObjectUtils.isNotEmpty(zlTree)) {
if (ObjectUtils.isNotEmpty(zlTree.getParentId())) {
ZlTree zlTreeParents = zlTreeDao.selectById(zlTree.getParentId());
if (ObjectUtils.isEmpty(zlTreeParents.getParentId())) {
return zlTree;
} else {
return zlTreeParents;
}
} else {
return zlTree;
}
}
return null;
}
}