|
@@ -1,7 +1,10 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.gis.common.constant.ConfigConstant;
|
|
|
import com.gis.common.util.Result;
|
|
|
+import com.gis.domain.dto.DateDto;
|
|
|
+import com.gis.domain.dto.PageDateDto;
|
|
|
import com.gis.domain.entity.ProjectEntity;
|
|
|
import com.gis.domain.dto.PageDto;
|
|
|
import com.gis.mapper.ProjectMapper;
|
|
@@ -11,6 +14,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -33,9 +37,79 @@ public class ProjectServiceImpl extends ZtBaseServiceImpl<ProjectEntity, Long> i
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Result<ProjectEntity> search(PageDto param) {
|
|
|
- startPage(param);
|
|
|
- return Result.success(new PageInfo<>(this.findAll()));
|
|
|
+ public Result<ProjectEntity> search(PageDateDto param) {
|
|
|
+// startPage(param);
|
|
|
+// return Result.success(new PageInfo<>(this.findAll()));
|
|
|
+ Condition condition = new Condition(ProjectEntity.class);
|
|
|
+
|
|
|
+ String startTime = param.getStartTime();
|
|
|
+ String endTime = param.getEndTime();
|
|
|
+ if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)){
|
|
|
+ condition.and().andBetween("begin", startTime, endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ String searchKey = param.getSearchKey();
|
|
|
+ if (StrUtil.isNotBlank(searchKey)){
|
|
|
+ searchKey = "%"+searchKey +"%";
|
|
|
+ condition.and().andLike("name", searchKey);
|
|
|
+ }
|
|
|
+// condition.orderBy("")
|
|
|
+ return Result.success(this.pageAll(condition, param, "openedDate desc"));
|
|
|
+// return Result.success(this.findAll(condition, param.getPageNum(), param.getPageSize(), "openedDate desc"));
|
|
|
+// return Result.success(new PageInfo<>());
|
|
|
+ }
|
|
|
+
|
|
|
+// @Override
|
|
|
+// public Result totalByDept(DateDto param) {
|
|
|
+// StringBuilder builder = new StringBuilder();
|
|
|
+// builder.append("select ROUND(sum(d.consumed),0) as pcs, c.name as groupKey, c.id from zt_taskestimate d left join " +
|
|
|
+// "zt_task a on a.id=d.task left join zt_user b on a.assignedTo=b.account left join zt_dept c on c.id=b.dept");
|
|
|
+// builder.append(" where a.project=").append(param.getId());
|
|
|
+// builder.append(" and a.deleted='0'");
|
|
|
+// String startTime = param.getStartTime();
|
|
|
+// String endTime = param.getEndTime();
|
|
|
+// if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)){
|
|
|
+// builder.append(" and d.date between '").append(startTime).append("' and '").append(endTime).append("'");
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 查询小于结束时间的数据
|
|
|
+// if (StrUtil.isBlank(startTime) && StrUtil.isNotBlank(endTime)){
|
|
|
+// builder.append(StrUtil.format(" and d.date <= '{}'", endTime));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// builder.append(" GROUP BY c.id");
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// return Result.success(entityMapper.countSql(builder.toString()));
|
|
|
+// }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result totalByDept(DateDto param) {
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+ builder.append("select ROUND(sum(b.consumed),0) as pcs, d.name as groupKey from zt_task a left join zt_taskestimate b on a.id=b.task LEFT JOIN zt_user c on c.account=a.lastEditedBy left join zt_dept d on d.id=c.dept");
|
|
|
+ builder.append(" where a.project=").append(param.getId());
|
|
|
+ builder.append(" and a.deleted='0'");
|
|
|
+ String startTime = param.getStartTime();
|
|
|
+ String endTime = param.getEndTime();
|
|
|
+ if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)){
|
|
|
+ builder.append(" and b.date between '").append(startTime).append("' and '").append(endTime).append("'");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询小于结束时间的数据
|
|
|
+ if (StrUtil.isBlank(startTime) && StrUtil.isNotBlank(endTime)){
|
|
|
+ builder.append(StrUtil.format(" and b.date <= '{}'", endTime));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ builder.append(" GROUP BY d.id");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success(entityMapper.countSql(builder.toString()));
|
|
|
}
|
|
|
|
|
|
}
|