|
|
@ -13,18 +13,20 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.PidUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.dao.LingshanOfficeHallServiceRecordDao; |
|
|
|
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO; |
|
|
|
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO; |
|
|
|
import com.epmet.dto.form.lingshan.ScreenOfficeHallResultDTO; |
|
|
|
import com.epmet.dto.form.lingshan.ScreenOfficeHallResultDetailDTO; |
|
|
|
import com.epmet.dto.result.SubOrgResDTO; |
|
|
|
import com.epmet.entity.LingshanOfficeHallServiceRecordEntity; |
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.service.LingshanOfficeHallServiceRecordService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -32,8 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.time.Year; |
|
|
|
import java.time.YearMonth; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 灵山_办事大厅服务记录 |
|
|
@ -41,10 +44,13 @@ import java.util.Map; |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2023-05-15 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
public class LingshanOfficeHallServiceRecordServiceImpl extends BaseServiceImpl<LingshanOfficeHallServiceRecordDao, LingshanOfficeHallServiceRecordEntity> implements LingshanOfficeHallServiceRecordService { |
|
|
|
@Autowired |
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -204,4 +210,118 @@ public class LingshanOfficeHallServiceRecordServiceImpl extends BaseServiceImpl< |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 办事大厅柱状图 |
|
|
|
* |
|
|
|
* @param orgId 组织id |
|
|
|
* @param orgType 组织:agency |
|
|
|
* @param type 上月:last_month;本年:current_year |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ScreenOfficeHallResultDTO> queryScreenServiceTotal(String orgId, String orgType, String type) { |
|
|
|
if (OrgTypeEnum.GRID.getCode().equals(orgType)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
// 查询下级组织
|
|
|
|
Result<List<SubOrgResDTO>> subOrgListRes = govOrgOpenFeignClient.subOrgList(orgId); |
|
|
|
if (!subOrgListRes.success() || CollectionUtils.isEmpty(subOrgListRes.getData())) { |
|
|
|
log.error("调用gov-org查询下级组织异常,orgId:" + orgId); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
//查询业务类型字典
|
|
|
|
Map<String, String> categoryMap=new HashMap<>(); |
|
|
|
Result<Map<String, String>> categoryRes = adminOpenFeignClient.dictMap(DictTypeEnum.LINGSHAN_OFFICE_HALL_SERVICE_RECORD.getCode()); |
|
|
|
if (categoryRes.success() && MapUtils.isNotEmpty(categoryRes.getData())) { |
|
|
|
categoryMap = categoryRes.getData(); |
|
|
|
} |
|
|
|
// 计算申请日期范围
|
|
|
|
String applicantStartDate = ""; |
|
|
|
String applicantEndDate = ""; |
|
|
|
if ("last_month".equals(type)) { |
|
|
|
Calendar lastMonthFirstDateCal = Calendar.getInstance(); |
|
|
|
lastMonthFirstDateCal.add(Calendar.MONTH, -1); |
|
|
|
lastMonthFirstDateCal.set(Calendar.DAY_OF_MONTH, 1); |
|
|
|
applicantStartDate = DateUtils.format(lastMonthFirstDateCal.getTime(),"yyyy-MM-dd"); |
|
|
|
|
|
|
|
Calendar lastMonthEndDateCal = Calendar.getInstance(); |
|
|
|
lastMonthEndDateCal.add(Calendar.MONTH, -1); |
|
|
|
lastMonthEndDateCal.set( |
|
|
|
Calendar.DAY_OF_MONTH, lastMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); |
|
|
|
applicantEndDate=DateUtils.format(lastMonthEndDateCal.getTime(),"yyyy-MM-dd"); |
|
|
|
} else if ("current_year".equals(type)) { |
|
|
|
Calendar currCal=Calendar.getInstance(); |
|
|
|
int currentYear = currCal.get(Calendar.YEAR); |
|
|
|
// 1月1日
|
|
|
|
applicantStartDate=String.valueOf(currentYear).concat("-01-01"); |
|
|
|
// 当前事件
|
|
|
|
applicantEndDate=DateUtils.format(new Date(),"yyyy-MM-dd"); |
|
|
|
} |
|
|
|
List<ScreenOfficeHallResultDTO> resultDTOList = new ArrayList<>(); |
|
|
|
for (SubOrgResDTO orgResDTO : subOrgListRes.getData()) { |
|
|
|
ScreenOfficeHallResultDTO resultDTO = new ScreenOfficeHallResultDTO(); |
|
|
|
resultDTO.setOrgId(orgResDTO.getOrgId()); |
|
|
|
resultDTO.setOrgType(orgResDTO.getOrgType()); |
|
|
|
resultDTO.setOrgName(orgResDTO.getOrgName()); |
|
|
|
List<ScreenOfficeHallResultDetailDTO> dataList=new ArrayList<>(); |
|
|
|
//第一种方式
|
|
|
|
for(Map.Entry entry : categoryMap.entrySet()){ |
|
|
|
String mapKey = (String) entry.getKey(); |
|
|
|
String mapValue = (String)entry.getValue(); |
|
|
|
ScreenOfficeHallResultDetailDTO detailDTO=new ScreenOfficeHallResultDetailDTO(); |
|
|
|
detailDTO.setCategoryCode(mapKey); |
|
|
|
detailDTO.setCategoryName(mapValue); |
|
|
|
//未办结:0;已办结:1
|
|
|
|
detailDTO.setTotalService(baseDao.selectCountForScreen(orgResDTO.getOrgId(),mapKey,applicantStartDate,applicantEndDate,null)); |
|
|
|
dataList.add(detailDTO); |
|
|
|
} |
|
|
|
resultDTO.setDataList(dataList); |
|
|
|
resultDTOList.add(resultDTO); |
|
|
|
} |
|
|
|
return resultDTOList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ScreenOfficeHallResultDTO> queryScreenServiceTotalV1() { |
|
|
|
//获取所有的月份
|
|
|
|
Calendar calendar=Calendar.getInstance(); |
|
|
|
int currentYear = calendar.get(Calendar.YEAR); |
|
|
|
int currentMonth = calendar.get(Calendar.MONTH) + 1; |
|
|
|
Year year= Year.of(currentYear); |
|
|
|
List<YearMonth> months = new ArrayList<>(); |
|
|
|
for (int i = 1; i <= currentMonth; i++) { |
|
|
|
months.add(year.atMonth(i)); |
|
|
|
} |
|
|
|
|
|
|
|
//查询业务类型字典
|
|
|
|
Map<String, String> categoryMap=new HashMap<>(); |
|
|
|
Result<Map<String, String>> categoryRes = adminOpenFeignClient.dictMap(DictTypeEnum.LINGSHAN_OFFICE_HALL_SERVICE_RECORD.getCode()); |
|
|
|
if (categoryRes.success() && MapUtils.isNotEmpty(categoryRes.getData())) { |
|
|
|
categoryMap = categoryRes.getData(); |
|
|
|
} |
|
|
|
List<ScreenOfficeHallResultDTO> resultDTOList = new ArrayList<>(); |
|
|
|
for (YearMonth month:months) { |
|
|
|
ScreenOfficeHallResultDTO resultDTO = new ScreenOfficeHallResultDTO(); |
|
|
|
resultDTO.setYear(currentYear); |
|
|
|
resultDTO.setMonth(String.valueOf(month.getMonthValue())); |
|
|
|
resultDTO.setMonthName(month.getMonthValue()+"月"); |
|
|
|
|
|
|
|
List<ScreenOfficeHallResultDetailDTO> dataList=new ArrayList<>(); |
|
|
|
//第一种方式
|
|
|
|
for(Map.Entry entry : categoryMap.entrySet()){ |
|
|
|
String mapKey = (String) entry.getKey(); |
|
|
|
String mapValue = (String)entry.getValue(); |
|
|
|
ScreenOfficeHallResultDetailDTO detailDTO=new ScreenOfficeHallResultDetailDTO(); |
|
|
|
detailDTO.setCategoryCode(mapKey); |
|
|
|
detailDTO.setCategoryName(mapValue); |
|
|
|
//未办结:0;已办结:1
|
|
|
|
detailDTO.setTotalService(baseDao.selectMonthCountForScreen(mapKey, month.getYear(), resultDTO.getMonth())); |
|
|
|
dataList.add(detailDTO); |
|
|
|
} |
|
|
|
resultDTO.setDataList(dataList); |
|
|
|
resultDTOList.add(resultDTO); |
|
|
|
} |
|
|
|
return resultDTOList; |
|
|
|
} |
|
|
|
|
|
|
|
} |