zhangtao
dongdingding 1 year ago
parent 4f881e7dce
commit 7c7695ae45

@ -97,7 +97,7 @@ public class BAdministrativeController extends BaseController {
for (BAdministrativeTreeRequest item1 : list) { for (BAdministrativeTreeRequest item1 : list) {
BAdministrativeTreeRequest parentDto = new BAdministrativeTreeRequest(item1.getCounty(), item1.getSubdistrict(), item1.getInstitutionName()); BAdministrativeTreeRequest parentDto = new BAdministrativeTreeRequest(item1.getCounty(), item1.getSubdistrict(), item1.getInstitutionName());
for (BAdministrativeTreeRequest item2 : listsub) { for (BAdministrativeTreeRequest item2 : listsub) {
if (item2.getSubdistrict()!=null){ if (item2.getSubdistrict()!=null && !item2.getSubdistrict().equals("")){
if (item2.getSubdistrict().substring(0, 10).equals(item1.getCounty().substring(0, 10))) { if (item2.getSubdistrict().substring(0, 10).equals(item1.getCounty().substring(0, 10))) {
BAdministrativeTreeRequest childDto = new BAdministrativeTreeRequest(item2.getCounty(), item2.getSubdistrict(), item2.getInstitutionName()); BAdministrativeTreeRequest childDto = new BAdministrativeTreeRequest(item2.getCounty(), item2.getSubdistrict(), item2.getInstitutionName());
parentDto.addChild(childDto); parentDto.addChild(childDto);

@ -67,18 +67,43 @@ public class BPlanEnterpriseController extends BaseController {
@ApiOperation(value = "查询计划企业列表") @ApiOperation(value = "查询计划企业列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(BPlanEnterprise bPlanEnterprise) { public AjaxResult list(BPlanEnterprise bPlanEnterprise) {
List<BPlanEnterprise> list = bPlanEnterpriseService.selectBPlanEnterpriseList(bPlanEnterprise); List<BPlanEnterprise> list = bPlanEnterpriseService.selectBPlanEnterpriseList(bPlanEnterprise);
for (BPlanEnterprise a :list){
String enterPriseId = String.valueOf(a.getEnterpriseId());
BKeyEnterprise count = bKeyEnterpriseService.getByentCode(enterPriseId);
if (count != null) {
a.setIsPoint(1);
}else{
a.setIsPoint(2);
}
bPlanEnterpriseService.updateById(a);
}
return AjaxResult.success(list); return AjaxResult.success(list);
} }
/** /**
* *
*/ */
@ApiOperation(value = "查询计划企业表树结构") @ApiOperation(value = "查询首页",response =BPlanEnterPriseTreeResponse.class )
@GetMapping("/tree") @GetMapping("/tree")
public AjaxResult tree(BPlanEnterprisePageRequest req) { public AjaxResult tree(BPlanEnterprisePageRequest req) {
List<BPlanEnterPriseTreeResponse> list = bAdministrativeService.selectBPlanEnterPriseTreeRequestRequestList(req); List<BPlanEnterPriseTreeResponse> list = bAdministrativeService.selectBPlanEnterPriseTreeRequestRequestList(req);
int plannedEnterpriseCountSum = list.stream()
.mapToInt(BPlanEnterPriseTreeResponse::getPlannedEnterpriseCount)
.sum();
int checkEnterpriseCountSum = list.stream()
.mapToInt(BPlanEnterPriseTreeResponse::getCheckEnterpriseCount)
.sum();
double ptSum = (double) checkEnterpriseCountSum /plannedEnterpriseCountSum;
BPlanEnterPriseTreeResponse resultObject = new BPlanEnterPriseTreeResponse();
resultObject.setInstitutionName("苏州");
resultObject.setPlannedEnterpriseCount(plannedEnterpriseCountSum);
resultObject.setCheckEnterpriseCount(checkEnterpriseCountSum);
resultObject.setPt(ptSum);
list.add(resultObject);
return success(list);
// List<List<BPlanEnterPriseTreeResponse>> groupedList = list.stream() // List<List<BPlanEnterPriseTreeResponse>> groupedList = list.stream()
// .collect(Collectors.groupingBy(BPlanEnterPriseTreeResponse::getCounty)) // .collect(Collectors.groupingBy(BPlanEnterPriseTreeResponse::getCounty))
// .values() // .values()
@ -99,7 +124,7 @@ public class BPlanEnterpriseController extends BaseController {
// cascadingSelectData.add(parentDto); // cascadingSelectData.add(parentDto);
// } // }
//} //}
return success(list);
} }
@ -111,8 +136,8 @@ public class BPlanEnterpriseController extends BaseController {
*/ */
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条计划企业表", response = BPlanEnterprise.class) @ApiOperation(value = "通过主键查询单条计划企业表", response = BPlanEnterprise.class)
public AjaxResult getById(@PathVariable Serializable id) { public AjaxResult getById(@PathVariable String id) {
return success(bPlanEnterpriseService.getById(id)); return success(bPlanEnterpriseService.selectById(id));
} }
/** /**

@ -1,6 +1,7 @@
package com.ruoyi.programManagement.entity; package com.ruoyi.programManagement.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@ -103,8 +104,6 @@ public class BPlanEnterprise implements Serializable {
private String district; private String district;
/** /**
* *
*/ */
@ -120,7 +119,6 @@ public class BPlanEnterprise implements Serializable {
private String planName; private String planName;
/** /**
* *
*/ */
@ -129,11 +127,18 @@ public class BPlanEnterprise implements Serializable {
private String planContent; private String planContent;
/** /**
* 12 * 12
*/ */
@ApiModelProperty(value = "是否重点企业1是2否") @ApiModelProperty(value = "是否重点企业1是2否")
private Integer isPoint; private Integer isPoint;
/**
*
*/
@TableField(exist = false)
@ApiModelProperty(value = "企业名称")
private String entprName;
} }

@ -11,58 +11,35 @@ import java.util.List;
* *
*/ */
@Data @Data
@ApiModel("行政区划书请求类") @ApiModel("首页请求类")
public class BPlanEnterPriseTreeResponse { public class BPlanEnterPriseTreeResponse {
/**
* id
*/
@ApiModelProperty("计划id")
private Long id;
/** /**
* *
*/ */
@ApiModelProperty("所在县(市,区)") @ApiModelProperty("所在县(市,区)")
private String county; private String institutionName;
/**
*
*
*/
@ApiModelProperty("所在乡镇")
private String subdistrict;
/**
*
*/
@ApiModelProperty("企业总数")
private Integer enterpriseCount;
/** /**
* *
*/ */
@ApiModelProperty("已计划数") @ApiModelProperty("执法计划数量")
private Integer plannedEnterpriseCount; private Integer plannedEnterpriseCount;
/** /**
* *
*/ */
@ApiModelProperty("已计划重点数") @ApiModelProperty("完成执法数量")
private Integer planneKeyEnterpriseCount; private Integer checkEnterpriseCount;
/** /**
* *
*/ */
@ApiModelProperty("剩余重点数") @ApiModelProperty("百分比")
private Integer remainingKeyEnterpriseCount; private double pt;
/**
*
*/
@ApiModelProperty("名称")
private String institutionName;
// private List<BPlanEnterPriseTreeResponse> children; // private List<BPlanEnterPriseTreeResponse> children;

@ -20,13 +20,14 @@ public class BPlanEnterpriseZhifaResponse {
*/ */
@ApiModelProperty(value = "编号") @ApiModelProperty(value = "编号")
@Excel(name = "编号")
private Long id; private Long id;
/** /**
* id * id
*/ */
@ApiModelProperty(value = "检查表id") @ApiModelProperty(value = "检查表id")
private String longId; private String longId;
/** /**
@ -106,6 +107,7 @@ public class BPlanEnterpriseZhifaResponse {
*/ */
@ApiModelProperty(value = "行政区划") @ApiModelProperty(value = "行政区划")
@Excel(name = "行政区划")
private String district; private String district;
@ -114,6 +116,7 @@ public class BPlanEnterpriseZhifaResponse {
*/ */
@ApiModelProperty(value = "企业名称") @ApiModelProperty(value = "企业名称")
@Excel(name = "企业名称")
private String entprName; private String entprName;
@ -122,6 +125,7 @@ public class BPlanEnterpriseZhifaResponse {
*/ */
@ApiModelProperty(value = "计划年份") @ApiModelProperty(value = "计划年份")
@Excel(name = "计划年份")
private String plannedYear; private String plannedYear;
/** /**
@ -129,6 +133,7 @@ public class BPlanEnterpriseZhifaResponse {
*/ */
@ApiModelProperty(value = "检查状态 1=已检查2=未检查") @ApiModelProperty(value = "检查状态 1=已检查2=未检查")
@Excel(name = "检查状态",readConverterExp = "1=已检查,2=未检查")
private String checkStatus; private String checkStatus;
} }

@ -85,5 +85,13 @@ public interface BPlanEnterpriseMapper extends BaseMapper<BPlanEnterprise> {
public List<BPlanEnterprise> selectBPlanEnterpriseList(BPlanEnterprise bPlanEnterprise); public List<BPlanEnterprise> selectBPlanEnterpriseList(BPlanEnterprise bPlanEnterprise);
/**
*
*
* @param id
* @return
*/
BPlanEnterprise selectById(String id);
} }

@ -79,5 +79,14 @@ public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
*/ */
Map<String, Object> getPlanMx(PlanMxRequest req); Map<String, Object> getPlanMx(PlanMxRequest req);
/**
*
*
* @param id
* @return
*/
BPlanEnterprise selectById(String id);
} }

@ -98,6 +98,11 @@ public class BPlanEnterpriseServiceImpl extends ServiceImpl<BPlanEnterpriseMappe
return result; return result;
} }
@Override
public BPlanEnterprise selectById(String id) {
return bPlanEnterpriseMapper.selectById(id);
}
} }

@ -103,7 +103,7 @@ public class SzEntBasicInfoServiceImpl implements ISzEntBasicInfoService
@Override @Override
public Map<String, Object> page(SzEntBasicInfoPageRequest req) { public Map<String, Object> page(SzEntBasicInfoPageRequest req) {
PageHelper.startPage(1,10); PageHelper.startPage(req.getPageNum(),req.getPageSize());
List<SzEntBasicInfo> szEntBasicInfos = szEntBasicInfoMapper.page(req); List<SzEntBasicInfo> szEntBasicInfos = szEntBasicInfoMapper.page(req);
PageInfo<SzEntBasicInfo> pageInfo = new PageInfo<>(szEntBasicInfos); PageInfo<SzEntBasicInfo> pageInfo = new PageInfo<>(szEntBasicInfos);
Map<String, Object> result =new HashMap<>(); Map<String, Object> result =new HashMap<>();

@ -52,22 +52,32 @@
<select id="selectBPlanEnterPriseTreeRequestRequestList" <select id="selectBPlanEnterPriseTreeRequestRequestList"
resultType="com.ruoyi.programManagement.entity.request.BPlanEnterPriseTreeResponse"> resultType="com.ruoyi.programManagement.entity.request.BPlanEnterPriseTreeResponse">
SELECT a.subdistrict AS subdistrict,a.county,c.id,a.institution_name as institutionName, -- SELECT a.subdistrict AS subdistrict,a.county,c.id,a.institution_name as institutionName,
COUNT(b.subdistrict) AS enterpriseCount, -- COUNT(b.subdistrict) AS enterpriseCount,
COUNT(DISTINCT k.ent_code) - COUNT(DISTINCT c.enterprise_id) AS remainingKeyEnterpriseCount, -- COUNT(DISTINCT k.ent_code) - COUNT(DISTINCT c.enterprise_id) AS remainingKeyEnterpriseCount,
COUNT(DISTINCT c.enterprise_id) AS plannedEnterpriseCount, -- COUNT(DISTINCT c.enterprise_id) AS plannedEnterpriseCount,
COUNT(DISTINCT CASE WHEN k.ent_code IS NOT NULL THEN c.enterprise_id END) AS planneKeyEnterpriseCount -- COUNT(DISTINCT CASE WHEN k.ent_code IS NOT NULL THEN c.enterprise_id END) AS planneKeyEnterpriseCount
FROM b_administrative a -- FROM b_administrative a
LEFT JOIN sz_ent_basic_info b ON a.subdistrict = LPAD(b.subdistrict, LENGTH(a.subdistrict), '0') -- LEFT JOIN sz_ent_basic_info b ON a.subdistrict = LPAD(b.subdistrict, LENGTH(a.subdistrict), '0')
LEFT JOIN b_key_enterprise k ON a.subdistrict = k.district -- LEFT JOIN b_key_enterprise k ON a.subdistrict = k.district
LEFT JOIN b_plan_enterprise c ON k.ent_code = c.enterprise_id -- LEFT JOIN b_plan_enterprise c ON k.ent_code = c.enterprise_id
WHERE a.SUBDISTRICT LIKE '%13205%' -- WHERE a.SUBDISTRICT LIKE '%13205%'
select s.institutionName ,s.plannedEnterpriseCount,s.checkEnterpriseCount,s.pt from (SELECT
a. institution_name AS institutionName,
COUNT(DISTINCT b.enterprise_id) AS plannedEnterpriseCount,
COUNT(DISTINCT c.USC_CODE) AS checkEnterpriseCount,
COUNT(DISTINCT c.USC_CODE) / COUNT(DISTINCT b.enterprise_id) AS pt
FROM
b_administrative a
LEFT JOIN b_plan_enterprise b ON SUBSTRING(a.county, 1, 8) = SUBSTRING(b.district, 1, 8)
LEFT JOIN sz_enfor_examine c ON b.enterprise_id = c.USC_CODE
<where> <where>
<if test="req.plannedYear!=null and req.plannedYear!=''"> <if test="req.plannedYear!=null and req.plannedYear!=''">
c.planned_year#{req.plannedYear} b.planned_year#{req.plannedYear}
</if> </if>
</where> </where>
GROUP BY a.subdistrict,a.county; GROUP BY SUBSTRING(a.county, 1, 8) )s
where s. institutionName!='苏州市'
</select> </select>

@ -175,6 +175,27 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectById" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">
select a.id,
a.enterprise_id,
a.create_id,
a.create_by,
a.create_time,
a.update_id,
a.update_by,
a. update_time,
a. remark,
a.user_id,
a. dept_id,
a.district,
a.planned_year,
a.plan_name,
a.plan_content,
a.is_point,
b.ENTPR_NAME as entprName
from b_plan_enterprise a left join sz_ent_basic_info b on a.enterprise_id=b.usc_code
where a.id=#{id}
</select>
</mapper> </mapper>

@ -316,7 +316,8 @@
) AS s ) AS s
WHERE s.is_point = 1 WHERE s.is_point = 1
</select> </select>
<select id="page" resultType="com.ruoyi.programManagement.entity.SzEntBasicInfo">select s.* from( <select id="page" resultType="com.ruoyi.programManagement.entity.SzEntBasicInfo">
select s.* from(
SELECT SELECT
a.*, a.*,
CASE WHEN b.ent_code IS NOT NULL THEN 1 ELSE 2 END AS is_point CASE WHEN b.ent_code IS NOT NULL THEN 1 ELSE 2 END AS is_point

Loading…
Cancel
Save