|
@@ -1,5 +1,8 @@
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.date.DatePattern;
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionDetailService;
|
|
import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionDetailService;
|
|
import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDetailDo;
|
|
import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDetailDo;
|
|
@@ -7,6 +10,10 @@ import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDo;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxPmqManagementDistributionDao;
|
|
import com.rongwei.bscommon.sys.dao.ZhcxPmqManagementDistributionDao;
|
|
import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionService;
|
|
import com.rongwei.bscommon.sys.service.ZhcxPmqManagementDistributionService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.rongwei.bsentity.domain.ZhcxPmqManagementDo;
|
|
|
|
+import com.rongwei.bsentity.vo.report.MachineState;
|
|
|
|
+import com.rongwei.bsentity.vo.report.ZhcxPmqManageChildVo;
|
|
|
|
+import com.rongwei.bsentity.vo.report.ZhcxPmqManagementVo;
|
|
import com.rongwei.rwcommon.base.R;
|
|
import com.rongwei.rwcommon.base.R;
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
@@ -15,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -30,6 +38,8 @@ public class ZhcxPmqManagementDistributionServiceImpl extends ServiceImpl<ZhcxPm
|
|
@Autowired
|
|
@Autowired
|
|
private ZhcxPmqManagementDistributionDetailService detailService;
|
|
private ZhcxPmqManagementDistributionDetailService detailService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ZhcxPmqManagementServiceImpl managementService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public R generateDistributionDetail(String pid) {
|
|
public R generateDistributionDetail(String pid) {
|
|
@@ -94,4 +104,49 @@ public class ZhcxPmqManagementDistributionServiceImpl extends ServiceImpl<ZhcxPm
|
|
baseMapper.updateDispatchStatus(pid);
|
|
baseMapper.updateDispatchStatus(pid);
|
|
return R.ok("生成派单成功");
|
|
return R.ok("生成派单成功");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public R selectManifestList(String projectId) {
|
|
|
|
+ // 找到第一层符合要求的数据
|
|
|
|
+ LambdaQueryWrapper<ZhcxPmqManagementDo> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(ZhcxPmqManagementDo::getDeleted,"0").eq(ZhcxPmqManagementDo::getProjectid,projectId);
|
|
|
|
+ List<ZhcxPmqManagementDo> list = managementService.list(wrapper);
|
|
|
|
+ if(list.isEmpty()){
|
|
|
|
+ return R.ok("暂无数据");
|
|
|
|
+ }
|
|
|
|
+ // 构造最终数组
|
|
|
|
+ List<ZhcxPmqManagementVo> resultList = new ArrayList<>();
|
|
|
|
+ List<String> machinseNoList = baseMapper.getAllMachinseNoByProjectId(projectId);
|
|
|
|
+ // 构造数据
|
|
|
|
+ for (ZhcxPmqManagementDo zhcxPmqManagementDo : list) {
|
|
|
|
+ ZhcxPmqManagementVo zhcxPmqManagementVo = new ZhcxPmqManagementVo();
|
|
|
|
+ BeanUtil.copyProperties(zhcxPmqManagementDo,zhcxPmqManagementVo);
|
|
|
|
+ if(StringUtils.isEmpty(zhcxPmqManagementVo.getClosestatus())){
|
|
|
|
+ // 关闭状态为null,给默认值
|
|
|
|
+ zhcxPmqManagementVo.setClosestatus("未关闭");
|
|
|
|
+ }
|
|
|
|
+ if(Objects.nonNull(zhcxPmqManagementVo.getDistributetime())){
|
|
|
|
+ //格式化下发时间
|
|
|
|
+ zhcxPmqManagementVo.setDistributetimes(DateUtil.format(zhcxPmqManagementVo.getDistributetime(), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
|
|
|
|
+ }
|
|
|
|
+ // 动态表头
|
|
|
|
+ List<String> titleList = new ArrayList<>();
|
|
|
|
+ titleList.add("流水号");
|
|
|
|
+ titleList.add("部门名称");
|
|
|
|
+ titleList.addAll(machinseNoList);
|
|
|
|
+ zhcxPmqManagementVo.setTitleList(titleList);
|
|
|
|
+ // 构建第二层数据
|
|
|
|
+ List<ZhcxPmqManageChildVo> childList = baseMapper.getAllDeptByPid(zhcxPmqManagementDo.getId());
|
|
|
|
+ for (ZhcxPmqManageChildVo zhcxPmqManageChildVo : childList) {
|
|
|
|
+ // 构造第三层数据
|
|
|
|
+ List<MachineState> machines = baseMapper.getMachinesStatus(projectId,zhcxPmqManageChildVo.getId());
|
|
|
|
+ zhcxPmqManageChildVo.setMachines(machines);
|
|
|
|
+ }
|
|
|
|
+ // 子表数据
|
|
|
|
+ zhcxPmqManagementVo.setChildList(childList);
|
|
|
|
+ resultList.add(zhcxPmqManagementVo);
|
|
|
|
+ }
|
|
|
|
+ // 返回结果集
|
|
|
|
+ return R.ok(resultList);
|
|
|
|
+ }
|
|
}
|
|
}
|