Commit cda527c8 authored by tianbo's avatar tianbo

三个规定排查统计

parent eae01586
package com.yeejoin.amos.boot.module.tcm.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.ThreeSystems;
import java.util.LinkedHashMap;
......@@ -16,8 +14,5 @@ import java.util.List;
*/
public interface IThreeSystemsService {
Page<ThreeSystemsDto> getThreeProvisionsList(String orgCode, ThreeSystemsDto threeSystemsDto,
Page<ThreeSystemsDto> page);
List<ThreeSystems> getStatisticsMessage(List<LinkedHashMap> list, String planType, String startDate, String endDate);
}
......@@ -25,31 +25,28 @@ import java.util.List;
@RestController
@Api(tags = "三个规定统计")
@RequestMapping(value = "/threeProvisions")
public class ThreeSystemsController extends BaseController {
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@Autowired
private IThreeSystemsService iThreeSystemsService;
@Autowired
private TzsUserInfoServiceImpl tzsUserInfoServiceImpl;
@Autowired
RedisUtils redisUtils;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getStatisticsMessage")
@ApiOperation(httpMethod = "GET", value = "监管单位三个规定统计信息", notes = "监管单位三个规定统计信息")
public ResponseModel<Object> getStatisticsMessage(@RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam("planType") String planType,
@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate) {
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>();
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
Page<ThreeSystems> threeSystemsPage = new Page<>();
threeSystemsPage.setRecords(iThreeSystemsService.getStatisticsMessage(list, planType, startDate, endDate));
return ResponseHelper.buildResponse(threeSystemsPage);
}
public class ThreeSystemsController<string> extends BaseController {
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@Autowired
RedisUtils redisUtils;
@Autowired
private IThreeSystemsService iThreeSystemsService;
@Autowired
private TzsUserInfoServiceImpl tzsUserInfoServiceImpl;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getStatisticsMessage")
@ApiOperation(httpMethod = "GET", value = "监管单位三个规定统计信息", notes = "监管单位三个规定统计信息")
public ResponseModel<Object> getStatisticsMessage(@RequestParam("sequenceNbr") String sequenceNbr,
@RequestParam(value = "planType", defaultValue = "1") String planType,
@RequestParam(value = "startDate",required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate) {
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
ArrayList<LinkedHashMap> result = new ArrayList<>();
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
Page<ThreeSystems> threeSystemsPage = new Page<>();
threeSystemsPage.setRecords(iThreeSystemsService.getStatisticsMessage(list, planType, startDate, endDate));
return ResponseHelper.buildResponse(threeSystemsPage);
}
}
package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto;
import com.yeejoin.amos.boot.module.tcm.api.entity.ThreeSystems;
import com.yeejoin.amos.boot.module.tcm.api.enums.SupervisoryEnum;
import com.yeejoin.amos.boot.module.tcm.api.mapper.ThreeSystemsMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.IThreeSystemsService;
import com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
/**
......@@ -17,17 +27,56 @@ import java.util.List;
*/
@Service
public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto,ThreeSystems,ThreeSystemsMapper> implements IThreeSystemsService {
/**
* 分页查询
*/
public Page<ThreeSystemsDto> queryForThreeSystemsPage(Page<ThreeSystemsDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
* 列表查询
*/
public List<ThreeSystemsDto> queryForThreeSystemsList() {
return this.queryForList("" , false);
@Override
public List<ThreeSystems> getStatisticsMessage(List<LinkedHashMap> list, String planType, String startDate, String endDate) {
String orgCode = null;
String nextLevel = null;
SupervisoryEnum enumByLevel = null;
if (!ObjectUtils.isEmpty(list) && !ObjectUtils.isEmpty(list.get(0))) {
orgCode = String.valueOf(list.get(0).get("orgCode"));
enumByLevel = SupervisoryEnum.getEnumByLevel(String.valueOf(list.get(0).get("level")));
nextLevel = !ObjectUtils.isEmpty(enumByLevel) ? enumByLevel.getNextLevel() : null;
}
DecimalFormat decimalFormat = new DecimalFormat("0.##");
if (!ObjectUtils.isEmpty(orgCode)) {
if ("50*56".equals(orgCode)) {
nextLevel = "organization";
}
LambdaQueryWrapper<ThreeSystems> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(ThreeSystems::getSupervisoryUnitOrgcode, orgCode);
queryWrapper.eq(ThreeSystems::getIsDelete, false);
queryWrapper.eq(ThreeSystems::getPlanType, planType);
queryWrapper.between(ThreeSystems::getCheckDate, ValidationUtil.isEmpty(startDate) ? new Date() :
startDate + " 00:00:00", ValidationUtil.isEmpty(endDate) ? new Date() : endDate + " 23:59:59");
queryWrapper.eq(ThreeSystems::getSupervisoryUnitLevel, nextLevel);
List<ThreeSystems> listByOrgCode = this.getBaseMapper().selectList(queryWrapper);
ThreeSystems summary = new ThreeSystems();
summary.setSupervisoryUnitName("汇总");
if (!ValidationUtil.isEmpty(listByOrgCode)) {
listByOrgCode.forEach(i -> {
summary.setCheckNum(ValidationUtil.isEmpty(summary.getCheckNum()) ? i.getCheckNum() :
summary.getCheckNum() + i.getCheckNum());
summary.setFinishCheckNum(ValidationUtil.isEmpty(summary.getFinishCheckNum()) ?
i.getFinishCheckNum() : summary.getFinishCheckNum() + i.getFinishCheckNum());
summary.setRegisteredNum(ValidationUtil.isEmpty(summary.getRegisteredNum()) ?
i.getRegisteredNum() : summary.getRegisteredNum() + i.getRegisteredNum());
});
if (ValidationUtil.isEmpty(summary.getCheckNum()) || ValidationUtil.isEmpty(summary.getRegisteredNum())) {
summary.setProportion("0%");
} else {
BigDecimal result = new BigDecimal(summary.getFinishCheckNum()).divide(new BigDecimal(summary.getCheckNum())
, 4,
RoundingMode.HALF_UP);
summary.setProportion(decimalFormat.format(result.multiply(new BigDecimal(100))) + "%");
}
listByOrgCode.add(summary);
return listByOrgCode;
}
}
return Lists.newArrayList();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment