Commit cda527c8 authored by tianbo's avatar tianbo

三个规定排查统计

parent eae01586
package com.yeejoin.amos.boot.module.tcm.api.service; 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 com.yeejoin.amos.boot.module.tcm.api.entity.ThreeSystems;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -16,8 +14,5 @@ import java.util.List; ...@@ -16,8 +14,5 @@ import java.util.List;
*/ */
public interface IThreeSystemsService { 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); List<ThreeSystems> getStatisticsMessage(List<LinkedHashMap> list, String planType, String startDate, String endDate);
} }
...@@ -25,31 +25,28 @@ import java.util.List; ...@@ -25,31 +25,28 @@ import java.util.List;
@RestController @RestController
@Api(tags = "三个规定统计") @Api(tags = "三个规定统计")
@RequestMapping(value = "/threeProvisions") @RequestMapping(value = "/threeProvisions")
public class ThreeSystemsController extends BaseController { public class ThreeSystemsController<string> extends BaseController {
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE"; private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
@Autowired
@Autowired RedisUtils redisUtils;
private IThreeSystemsService iThreeSystemsService; @Autowired
private IThreeSystemsService iThreeSystemsService;
@Autowired @Autowired
private TzsUserInfoServiceImpl tzsUserInfoServiceImpl; private TzsUserInfoServiceImpl tzsUserInfoServiceImpl;
@Autowired @TycloudOperation(ApiLevel = UserType.AGENCY)
RedisUtils redisUtils; @GetMapping(value = "/getStatisticsMessage")
@ApiOperation(httpMethod = "GET", value = "监管单位三个规定统计信息", notes = "监管单位三个规定统计信息")
@TycloudOperation(ApiLevel = UserType.AGENCY) public ResponseModel<Object> getStatisticsMessage(@RequestParam("sequenceNbr") String sequenceNbr,
@GetMapping(value = "/getStatisticsMessage") @RequestParam(value = "planType", defaultValue = "1") String planType,
@ApiOperation(httpMethod = "GET", value = "监管单位三个规定统计信息", notes = "监管单位三个规定统计信息") @RequestParam(value = "startDate",required = false) String startDate,
public ResponseModel<Object> getStatisticsMessage(@RequestParam("sequenceNbr") String sequenceNbr, @RequestParam(value = "endDate", required = false) String endDate) {
@RequestParam("planType") String planType, List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
@RequestParam("startDate") String startDate, ArrayList<LinkedHashMap> result = new ArrayList<>();
@RequestParam("endDate") String endDate) { List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr);
List<LinkedHashMap> data = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE); Page<ThreeSystems> threeSystemsPage = new Page<>();
ArrayList<LinkedHashMap> result = new ArrayList<>(); threeSystemsPage.setRecords(iThreeSystemsService.getStatisticsMessage(list, planType, startDate, endDate));
List<LinkedHashMap> list = tzsUserInfoServiceImpl.screenData(result, data, sequenceNbr); return ResponseHelper.buildResponse(threeSystemsPage);
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; 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.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.mapper.ThreeSystemsMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.IThreeSystemsService; import com.yeejoin.amos.boot.module.tcm.api.service.IThreeSystemsService;
import com.yeejoin.amos.boot.module.tcm.api.dto.ThreeSystemsDto; import org.apache.commons.compress.utils.Lists;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; 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; import java.util.List;
/** /**
...@@ -17,17 +27,56 @@ import java.util.List; ...@@ -17,17 +27,56 @@ import java.util.List;
*/ */
@Service @Service
public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto,ThreeSystems,ThreeSystemsMapper> implements IThreeSystemsService { 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() { @Override
return this.queryForList("" , false); 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