|
@@ -7,15 +7,17 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
-import com.usky.fire.domain.BaseCompany;
|
|
|
-import com.usky.fire.domain.BaseCompanyAttach1;
|
|
|
-import com.usky.fire.domain.BaseCompanyPerson;
|
|
|
import com.usky.fire.domain.DemReportInfo;
|
|
|
import com.usky.fire.mapper.DemReportInfoMapper;
|
|
|
import com.usky.fire.service.DemReportInfoService;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
+import com.usky.fire.service.vo.CompanyDataVo;
|
|
|
+import com.usky.fire.service.vo.DemReportInfoIdVo;
|
|
|
+import com.usky.fire.service.vo.DemReportInfoVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -32,14 +34,58 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoMapper, DemReportInfo> implements DemReportInfoService {
|
|
|
@Override
|
|
|
- public CommonPage<Object> reportInfoList(String companyId,Integer pageNum, Integer pageSize) {
|
|
|
- List<Object> list = new ArrayList<>();
|
|
|
+ public CommonPage<DemReportInfo> reportInfoList(String companyId,String sourceType,Integer pageNum, Integer pageSize) {
|
|
|
IPage<DemReportInfo> page = new Page<>(pageNum, pageSize);
|
|
|
LambdaQueryWrapper<DemReportInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(StringUtils.isNotBlank(companyId), DemReportInfo::getCompanyId, companyId)
|
|
|
- .orderByDesc(DemReportInfo::getId);
|
|
|
+ if ("2".equals(sourceType)){
|
|
|
+ queryWrapper.eq(StringUtils.isNotBlank(companyId), DemReportInfo::getCompanyId, companyId)
|
|
|
+ .eq(DemReportInfo::getReportStatus, 1)
|
|
|
+ .orderByDesc(DemReportInfo::getId);
|
|
|
+ }else {
|
|
|
+ queryWrapper.eq(StringUtils.isNotBlank(companyId), DemReportInfo::getCompanyId, companyId)
|
|
|
+ .orderByDesc(DemReportInfo::getId);
|
|
|
+ }
|
|
|
page = this.page(page, queryWrapper);
|
|
|
- list.add(page.getRecords());
|
|
|
- return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
|
|
|
+ return ToCommonPage(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<DemReportInfoVo> reportInfoAdd(DemReportInfoVo demReportInfoVo) {
|
|
|
+ List<DemReportInfoVo> list = new ArrayList<>();
|
|
|
+ List<CompanyDataVo> companyList = demReportInfoVo.getCompanyList();
|
|
|
+ if (CollectionUtils.isNotEmpty(companyList)) {
|
|
|
+ for (int i = 0; i < companyList.size(); i++) {
|
|
|
+ DemReportInfo demReportInfo = new DemReportInfo();
|
|
|
+ demReportInfo.setCompanyId(companyList.get(i).getCompanyId());
|
|
|
+ demReportInfo.setReportName(demReportInfoVo.getReportName());
|
|
|
+ demReportInfo.setCreateTime(LocalDateTime.now());
|
|
|
+ demReportInfo.setStartTime(demReportInfoVo.getStartTime());
|
|
|
+ demReportInfo.setEndTime(demReportInfoVo.getEndTime());
|
|
|
+ demReportInfo.setReportStatus(0);
|
|
|
+ this.save(demReportInfo);
|
|
|
+ int ID = demReportInfo.getId();
|
|
|
+ DemReportInfoVo demReportInfoVo1 = new DemReportInfoVo();
|
|
|
+ demReportInfoVo1.setId(ID);
|
|
|
+ demReportInfoVo1.setCompanyName(companyList.get(i).getCompanyName());
|
|
|
+ demReportInfoVo1.setCompanyId(companyList.get(i).getCompanyId());
|
|
|
+ list.add(demReportInfoVo1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void propelsReport(DemReportInfoIdVo demReportInfoIdVo) {
|
|
|
+ List<Integer> reportInfoIdList = demReportInfoIdVo.getReportIdList();
|
|
|
+ if (CollectionUtils.isNotEmpty(reportInfoIdList)) {
|
|
|
+ for (int i = 0; i < reportInfoIdList.size(); i++) {
|
|
|
+ DemReportInfo demReportInfo = new DemReportInfo();
|
|
|
+ demReportInfo.setId(reportInfoIdList.get(i));
|
|
|
+ demReportInfo.setReportStatus(1);
|
|
|
+ demReportInfo.setSendTime(LocalDateTime.now());
|
|
|
+ this.updateById(demReportInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|