|
@@ -7,15 +7,20 @@ 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.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.BaseCompany;
|
|
|
import com.usky.fire.domain.BaseCompanyAttach1;
|
|
|
import com.usky.fire.domain.DemReportInfo;
|
|
|
+import com.usky.fire.mapper.BaseCompanyMapper;
|
|
|
import com.usky.fire.mapper.DemReportInfoMapper;
|
|
|
+import com.usky.fire.mapper.SysUserMapper;
|
|
|
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 com.usky.system.domain.SysUser;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -32,17 +37,39 @@ import java.util.*;
|
|
|
*/
|
|
|
@Service
|
|
|
public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoMapper, DemReportInfo> implements DemReportInfoService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysUserMapper sysUserMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private BaseCompanyMapper baseCompanyMapper;
|
|
|
+
|
|
|
@Override
|
|
|
- public CommonPage<DemReportInfo> reportInfoList(String companyId,String sourceType,Integer pageNum, Integer pageSize) {
|
|
|
+ public CommonPage<DemReportInfo> reportInfoList(String companyId, String sourceType, Integer pageNum, Integer pageSize) {
|
|
|
IPage<DemReportInfo> page = new Page<>(pageNum, pageSize);
|
|
|
+
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ LambdaQueryWrapper<SysUser> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper1.select(SysUser::getRemark)
|
|
|
+ .eq(SysUser::getUserId, userId);
|
|
|
+ String organization = sysUserMapper.selectOne(queryWrapper1).getRemark();
|
|
|
+
|
|
|
+ LambdaQueryWrapper<BaseCompany> queryWrapper3 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper3.select(BaseCompany::getCompanyId)
|
|
|
+ .eq(BaseCompany::getOrganization, organization);
|
|
|
+ String companyId1 = baseCompanyMapper.selectOne(queryWrapper3).getCompanyId();
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(companyId)) {
|
|
|
+ companyId = companyId1;
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<DemReportInfo> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- 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)
|
|
|
+ queryWrapper.eq(DemReportInfo::getCompanyId, companyId);
|
|
|
+ if ("2".equals(sourceType)) {
|
|
|
+ queryWrapper.eq(DemReportInfo::getReportStatus, 1)
|
|
|
.orderByDesc(DemReportInfo::getId);
|
|
|
+ } else {
|
|
|
+ queryWrapper.orderByDesc(DemReportInfo::getId);
|
|
|
}
|
|
|
page = this.page(page, queryWrapper);
|
|
|
return ToCommonPage(page);
|
|
@@ -62,7 +89,7 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
|
|
|
LambdaQueryWrapper<DemReportInfo> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
queryWrapper1.select(DemReportInfo::getId, DemReportInfo::getCompanyId)
|
|
|
.in(DemReportInfo::getCompanyId, companyIdList)
|
|
|
- .eq(DemReportInfo::getStatisticsTime, now.get(Calendar.YEAR)+"-"+now.get(Calendar.MONTH)).groupBy(DemReportInfo::getCompanyId);
|
|
|
+ .eq(DemReportInfo::getStatisticsTime, now.get(Calendar.YEAR) + "-" + now.get(Calendar.MONTH)).groupBy(DemReportInfo::getCompanyId);
|
|
|
list2 = this.list(queryWrapper1);
|
|
|
for (int i = 0; i < companyList.size(); i++) {
|
|
|
for (int j = 0; j < list2.size(); j++) {
|