Browse Source

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

master
yinzuomei 3 years ago
parent
commit
f0adbd50cd
  1. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  2. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java
  3. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  5. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  6. 43
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  7. 23
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

4
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -292,7 +292,8 @@
<select id="houseChart" resultType="com.epmet.dto.result.HouseChartResultDTO">
SELECT
COUNT(id) num, rent_flag rentFlag
COUNT(id) num,
rent_flag rentFlag
FROM
ic_house
WHERE del_flag = '0'
@ -319,7 +320,6 @@
)
</otherwise>
</choose>
GROUP BY rent_flag
</select>

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -39,4 +40,10 @@ public class UserChartResultDTO implements Serializable {
*/
private String ldUserRatio;
@JsonIgnore
private Integer num;
//是否是流动人口【是:1 否:0】
@JsonIgnore
private String isFloating;
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -61,7 +61,6 @@ import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcResiUserImportService;
import com.epmet.service.IcResiUserService;
import feign.RequestInterceptor;
import jodd.io.FileUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
@ -71,9 +70,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -900,10 +896,10 @@ public class IcResiUserController implements ResultDataResolver {
**/
@NoRepeatSubmit
@PostMapping("userchart")
public Result<HouseChartResultDTO> userChart(@LoginUser TokenDto tokenDto, @RequestBody UserChartFormDTO formDTO) {
public Result<UserChartResultDTO> userChart(@LoginUser TokenDto tokenDto, @RequestBody UserChartFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<HouseChartResultDTO>().ok(icResiUserService.userChart(formDTO));
return new Result<UserChartResultDTO>().ok(icResiUserService.userChart(formDTO));
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -288,4 +288,6 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
List<EpidemicPreventionResultDTO> vaccineList(EpidemicPreventionFormDTO formDTO);
IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId);
List<UserChartResultDTO> userChart(@Param("orgId") String orgId, @Param("orgType") String orgType);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -249,5 +249,5 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Author sun
* @Description 人房居民总数饼图
**/
HouseChartResultDTO userChart(UserChartFormDTO formDTO);
UserChartResultDTO userChart(UserChartFormDTO formDTO);
}

43
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -67,22 +67,17 @@ import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.NumberFormat;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
@ -1606,8 +1601,40 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @Description 人房居民总数饼图
**/
@Override
public HouseChartResultDTO userChart(UserChartFormDTO formDTO) {
return null;
public UserChartResultDTO userChart(UserChartFormDTO formDTO) {
UserChartResultDTO resultDTO = new UserChartResultDTO();
//计算百分比使用,保留小数点后两位
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(NumConstant.TWO);
//1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息
if (StringUtils.isEmpty(formDTO.getOrgId())) {
//2.获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType("agency");
}
//2.根据入参值查询对应的房屋统计数据
List<UserChartResultDTO> list = baseDao.userChart(formDTO.getOrgId(), formDTO.getOrgType());
//3.汇总数据
AtomicInteger userTotal = new AtomicInteger();
list.forEach(l -> {
userTotal.addAndGet(l.getNum());
if ("0".equals(l.getIsFloating())) {
resultDTO.setCzUserTotal(l.getNum());
} else {
resultDTO.setLdUserTotal(l.getNum());
}
});
resultDTO.setUserTotal(userTotal.get());
resultDTO.setCzUserRatio((resultDTO.getUserTotal() == 0 || resultDTO.getCzUserTotal() > resultDTO.getUserTotal()) ? "0%" : numberFormat.format(((float) resultDTO.getCzUserTotal() / (float) resultDTO.getUserTotal()) * 100) + "%");
resultDTO.setLdUserRatio((resultDTO.getUserTotal() == 0 || resultDTO.getLdUserTotal() > resultDTO.getUserTotal()) ? "0%" : numberFormat.format(((float) resultDTO.getLdUserTotal() / (float) resultDTO.getUserTotal()) * 100) + "%");
resultDTO.setOrgId(formDTO.getOrgId());
resultDTO.setOrgType(formDTO.getOrgType());
return resultDTO;
}
}

23
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -820,4 +820,27 @@
<select id="selectResiNoDelFlag" resultType="com.epmet.entity.IcResiUserEntity">
SELECT ID,NAME,ID_CARD,DEL_FLAG FROM ic_resi_user WHERE ID = #{icResiUserId}
</select>
<select id="userChart" resultType="com.epmet.dto.result.UserChartResultDTO">
SELECT
COUNT(id) num,
is_floating isFloating
FROM
ic_resi_user
WHERE
del_flag = '0'
<choose>
<when test='orgType == "agency"'>
AND (agency_id = #{orgId} OR pids LIKE CONCAT('%', #{orgId}, '%'))
</when>
<when test='orgType == "grid"'>
AND grid_id = #{orgId}
</when>
<otherwise>
AND village_id = #{orgId}
</otherwise>
</choose>
GROUP BY is_floating
</select>
</mapper>

Loading…
Cancel
Save