Browse Source

Merge remote-tracking branch 'origin/lingshan_master' into lingshan_master

master
luyan 2 years ago
parent
commit
9127653770
  1. 33
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallFormDTO.java
  2. 23
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallResultDTO.java
  3. 16
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallResultDetailDTO.java
  4. 22
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingshanOfficeHallServiceRecordController.java
  5. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LingshanOfficeHallServiceRecordDao.java
  6. 11
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingshanOfficeHallServiceRecordService.java
  7. 132
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java
  8. 68
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LingshanOfficeHallServiceRecordDao.xml

33
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.form.lingshan;
import com.epmet.commons.tools.validator.group.QueryGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description 灵山大屏办事大厅柱状图接口地址http://yapi.elinkservice.cn/project/385/interface/api/10896
* @Author yzm
* @Date 2023/5/30 15:28
*/
@Data
public class ScreenOfficeHallFormDTO {
/**
* 组织id
* 或者网格id
*/
@NotBlank(message = "orgId不能为空", groups = QueryGroup.class)
private String orgId;
/**
* 组织agency
* 网格grid
*/
@NotBlank(message = "orgType不能为空", groups = QueryGroup.class)
private String orgType;
/**
* 上月last_month本年current_year
*/
@NotBlank(message = "type不能为空", groups = QueryGroup.class)
private String type;
}

23
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.form.lingshan;
import lombok.Data;
import java.util.List;
/**
* @Description 灵山大屏办事大厅柱状图接口地址http://yapi.elinkservice.cn/project/385/interface/api/10896
* @Author yzm
* @Date 2023/5/30 15:31
*/
@Data
public class ScreenOfficeHallResultDTO {
private String orgId;
private String orgType;
private String orgName;
private Integer year;
private String month;
private String monthName;
private List<ScreenOfficeHallResultDetailDTO> dataList;
}

16
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/lingshan/ScreenOfficeHallResultDetailDTO.java

@ -0,0 +1,16 @@
package com.epmet.dto.form.lingshan;
import lombok.Data;
/**
* @Description 灵山大屏办事大厅柱状图接口地址http://yapi.elinkservice.cn/project/385/interface/api/10896
* @Author yzm
* @Date 2023/5/30 15:32
*/
@Data
public class ScreenOfficeHallResultDetailDTO {
private String categoryCode;
private String categoryName;
private Integer totalService;
}

22
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/LingshanOfficeHallServiceRecordController.java

@ -20,8 +20,11 @@ import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.QueryGroup;
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO;
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO;
import com.epmet.dto.form.lingshan.ScreenOfficeHallFormDTO;
import com.epmet.dto.form.lingshan.ScreenOfficeHallResultDTO;
import com.epmet.excel.LingshanOfficeHallServiceRecordExportExcel;
import com.epmet.service.LingshanOfficeHallServiceRecordService;
import lombok.extern.slf4j.Slf4j;
@ -171,6 +174,21 @@ public class LingshanOfficeHallServiceRecordController {
}
}
/**
* 办事大厅柱状图
* 横坐标是组织或者网格
* 该接口已废弃需求变更了调用下面的接口
*
* @param formDTO
* @return
*/
@PostMapping("screen/org-service-total-feiqi")
public Result<List<ScreenOfficeHallResultDTO>> queryScreenServiceTotal(@RequestBody ScreenOfficeHallFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, QueryGroup.class);
return new Result<List<ScreenOfficeHallResultDTO>>().ok(lingshanOfficeHallServiceRecordService.queryScreenServiceTotal(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getType()));
}
@PostMapping("screen/org-service-total")
public Result<List<ScreenOfficeHallResultDTO>> queryScreenServiceTotalV1() {
return new Result<List<ScreenOfficeHallResultDTO>>().ok(lingshanOfficeHallServiceRecordService.queryScreenServiceTotalV1());
}
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LingshanOfficeHallServiceRecordDao.java

@ -27,4 +27,23 @@ public interface LingshanOfficeHallServiceRecordDao extends BaseDao<LingshanOffi
@Param("closeStartDate") String closeStartDate,
@Param("closeEndDate") String closeEndDate,
@Param("status") String status);
/**
* 分类服务次数统计
* @param orgId
* @param categoryCode
* @param applicantStartDate
* @param applicantEndDate
* @param status 未办结0已办结1
* @return
*/
Integer selectCountForScreen(@Param("orgId")String orgId,
@Param("categoryCode")String categoryCode,
@Param("applicantStartDate") String applicantStartDate,
@Param("applicantEndDate")String applicantEndDate,
@Param("status")String status);
Integer selectMonthCountForScreen(@Param("categoryCode") String categoryCode,
@Param("year") Integer year,
@Param("monthValue") String monthValue);
}

11
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/LingshanOfficeHallServiceRecordService.java

@ -4,6 +4,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.LingshanOfficeHallServiceRecordDTO;
import com.epmet.dto.form.lingshan.LingshanOfficeHallServiceRecordPageFormDTO;
import com.epmet.dto.form.lingshan.ScreenOfficeHallResultDTO;
import com.epmet.entity.LingshanOfficeHallServiceRecordEntity;
import java.util.List;
@ -66,5 +67,13 @@ public interface LingshanOfficeHallServiceRecordService extends BaseService<Ling
*/
void delete(List<String> ids);
/**
* 办事大厅柱状图
* @param orgId
* @param orgType
* @param type
* @return
*/
List<ScreenOfficeHallResultDTO> queryScreenServiceTotal(String orgId, String orgType, String type);
List<ScreenOfficeHallResultDTO> queryScreenServiceTotalV1();
}

132
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LingshanOfficeHallServiceRecordServiceImpl.java

@ -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;
}
}

68
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LingshanOfficeHallServiceRecordDao.xml

@ -45,4 +45,72 @@
</if>
ORDER BY R.CREATED_TIME DESC
</select>
<select id="selectCountForScreen" parameterType="map" resultType="java.lang.Integer">
SELECT
count(r.ID)
FROM lingshan_office_hall_service_record r
where r.DEL_FLAG='0'
<if test="categoryCode != null and categoryCode != ''">
and r.CATEGORY_CODE = #{categoryCode}
</if>
<if test="status != null and status != ''">
and r.`STATUS`= #{status}
</if>
<if test="orgId != null and orgId != ''">
and r.APPLICANT_ORG_ID_PATH like concat('%',#{orgId},'%')
</if>
<if test='applicantStartDate != null and applicantStartDate != "" '>
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m-%d') >= #{applicantStartDate}
</if>
<if test='applicantEndDate != null and applicantEndDate != "" '>
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{applicantEndDate}
</if>
</select>
<select id="selectMonthCountForScreen" parameterType="map" resultType="java.lang.Integer">
SELECT
count(r.ID)
FROM lingshan_office_hall_service_record r
where r.DEL_FLAG='0'
<if test="categoryCode != null and categoryCode != ''">
and r.CATEGORY_CODE = #{categoryCode}
</if>
<if test=" 1 ==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-01')
</if>
<if test=" 2 ==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-02')
</if>
<if test=" 3 ==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-03')
</if>
<if test=" 4 ==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-04')
</if>
<if test=" 5==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-05')
</if>
<if test=" 6==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-06')
</if>
<if test=" 7==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-07')
</if>
<if test=" 8==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-08')
</if>
<if test=" 9==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-09')
</if>
<if test=" 10==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-10')
</if>
<if test=" 11==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-11')
</if>
<if test=" 12==monthValue">
AND DATE_FORMAT(r.APPLICANT_TIME,'%Y-%m') = concat(#{year},'-12')
</if>
</select>
</mapper>
Loading…
Cancel
Save