|
@@ -1,16 +1,14 @@
|
|
|
|
|
|
|
|
package org.sky.scientific.service.impl;
|
|
package org.sky.scientific.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import org.sky.core.excel.util.ExcelUtil;
|
|
import org.sky.core.excel.util.ExcelUtil;
|
|
|
import org.sky.core.log.exception.ServiceException;
|
|
import org.sky.core.log.exception.ServiceException;
|
|
|
import org.sky.core.mp.base.BaseServiceImpl;
|
|
import org.sky.core.mp.base.BaseServiceImpl;
|
|
|
-import org.sky.core.tool.utils.BeanUtil;
|
|
|
|
|
-import org.sky.core.tool.utils.CollectionUtil;
|
|
|
|
|
-import org.sky.core.tool.utils.DateUtil;
|
|
|
|
|
-import org.sky.core.tool.utils.StringUtil;
|
|
|
|
|
|
|
+import org.sky.core.tool.utils.*;
|
|
|
import org.sky.scientific.excel.XmLeaseExcel;
|
|
import org.sky.scientific.excel.XmLeaseExcel;
|
|
|
import org.sky.scientific.mapper.XmLeaseMapper;
|
|
import org.sky.scientific.mapper.XmLeaseMapper;
|
|
|
import org.sky.scientific.mapper.XmMapper;
|
|
import org.sky.scientific.mapper.XmMapper;
|
|
@@ -19,10 +17,8 @@ import org.sky.scientific.service.IXmLeaseService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 研发项目租赁清单 服务实现类
|
|
* 研发项目租赁清单 服务实现类
|
|
@@ -95,7 +91,49 @@ public class XmLeaseServiceImpl extends BaseServiceImpl<XmLeaseMapper, XmLeaseEn
|
|
|
return this.saveOrUpdate(xmLease);
|
|
return this.saveOrUpdate(xmLease);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void judgeLeaseDate(Date date, String yearAndMonth) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<JSONObject> yanfazulinzichanfeiyongfenpeibiao(XmLeaseEntity dto) {
|
|
|
|
|
+ if(Func.isBlank(dto.getYearAndMonth())){
|
|
|
|
|
+ throw new ServiceException("参数yearAndMonth不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ List<XmLeaseEntity> list = baseMapper.yanfazulinzichanfeiyongfenpeibiao(dto);
|
|
|
|
|
+
|
|
|
|
|
+ List<JSONObject> result = new ArrayList<>();
|
|
|
|
|
+ if(CollectionUtil.isEmpty(list)){
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<Long, List<XmLeaseEntity>> mapByXmId = list.stream().collect(Collectors.groupingBy(XmLeaseEntity::getXmId));
|
|
|
|
|
+ for (Long xmId : mapByXmId.keySet()) {
|
|
|
|
|
+ List<XmLeaseEntity> listByXmId = mapByXmId.get(xmId);
|
|
|
|
|
+
|
|
|
|
|
+ for (XmLeaseEntity vo : listByXmId) {
|
|
|
|
|
+ String key = xmId+":"+ DateUtil.format(vo.getLeaseDate(), DateUtil.PATTERN_DATE);
|
|
|
|
|
+
|
|
|
|
|
+ if(result.isEmpty()){
|
|
|
|
|
+ ArrayList<XmLeaseEntity> vos = new ArrayList<>();
|
|
|
|
|
+ vos.add(vo);
|
|
|
|
|
+ JSONObject o = new JSONObject();
|
|
|
|
|
+ o.put(key, vos);
|
|
|
|
|
+ result.add(o);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ for (JSONObject o : result) {
|
|
|
|
|
+ List<XmLeaseEntity> voList= null;
|
|
|
|
|
+ if(o.containsKey(key)){
|
|
|
|
|
+ voList= o.getJSONArray(key).toJavaList(XmLeaseEntity.class);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ voList = new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ voList.add(vo);
|
|
|
|
|
+ o.put(key, voList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void judgeLeaseDate(Date date, String yearAndMonth) {
|
|
|
//日期,必须时当月日期
|
|
//日期,必须时当月日期
|
|
|
if (date != null) {
|
|
if (date != null) {
|
|
|
String format = DateUtil.format(date, DateUtil.PATTERN_YYYYMM);
|
|
String format = DateUtil.format(date, DateUtil.PATTERN_YYYYMM);
|