diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/controller/CqcCarbonReportController.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/controller/CqcCarbonReportController.java index 3f4de37..2cd5167 100644 --- a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/controller/CqcCarbonReportController.java +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/controller/CqcCarbonReportController.java @@ -9,6 +9,8 @@ import com.thing.common.core.validator.group.DefaultGroup; import com.thing.common.core.validator.group.UpdateGroup; import com.thing.common.core.web.response.PageData; import com.thing.common.core.web.response.Result; +import com.thing.common.orm.utils.IdGenerator; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountInfo; import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportDTO; import com.thing.cqc.cqcCarbonReport.service.CqcCarbonReportService; import com.thing.cqc.rpcService.service.CqcRpcService; @@ -37,21 +39,33 @@ public class CqcCarbonReportController { private final CqcCarbonReportService cqcCarbonReportService; - private final CqcRpcService cqcRpcService; - @GetMapping("page") @Operation(summary="分页") @Parameters({ @Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , @Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , @Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , - @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)") + @Parameter(name = Constant.ORDER, description = "排序方式,可选值(asc、desc)"), + @Parameter(name = "status", description = "审核状态"), + @Parameter(name = "enterpriseNameCn", description = "企业名称"), + @Parameter(name = "productNameCn", description = "产品名称"), + @Parameter(name = "deptId", description = "认证机构") }) public Result> page(@Parameter(hidden = true) @RequestParam Map params){ PageData page = cqcCarbonReportService.getPageData(params, CqcCarbonReportDTO.class); return new Result>().ok(page); } + + @GetMapping("count") + public Result count(){ + CqcCarbonReportCountInfo data = cqcCarbonReportService.countByStatus(); + return new Result().ok(data); + } + + + + @GetMapping("{id}") public Result get(@PathVariable("id") Long id){ CqcCarbonReportDTO data = cqcCarbonReportService.getByIdAs(id, CqcCarbonReportDTO.class); @@ -63,12 +77,13 @@ public class CqcCarbonReportController { public Result save(@RequestBody CqcCarbonReportDTO dto){ //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + dto.setId(IdGenerator.nextId()); dto.setApplyNo(String.valueOf(UUID.randomUUID())); dto.setCreateDate(System.currentTimeMillis()); dto.setCompanyId(UserContext.getCompanyId()); dto.setTenantCode(UserContext.getTenantCode()); cqcCarbonReportService.saveDto(dto); - return new Result().ok(dto.getApplyNo()); + return new Result().ok(dto); } @PutMapping @@ -77,7 +92,7 @@ public class CqcCarbonReportController { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); cqcCarbonReportService.updateDto(dto); - return new Result().ok(dto.getApplyNo()); + return new Result().ok(dto); } @DeleteMapping diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountInfo.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountInfo.java new file mode 100644 index 0000000..ec3c756 --- /dev/null +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountInfo.java @@ -0,0 +1,20 @@ +package com.thing.cqc.cqcCarbonReport.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "状态统计") +public class CqcCarbonReportCountInfo { + + + @Schema(description = "待提交") + private Long pendingSubmitted; + @Schema(description = "待发证") + private Long pendingCertification; + @Schema(description = "已发证") + private Long issued; + + + +} diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountParam.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountParam.java new file mode 100644 index 0000000..59dd060 --- /dev/null +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/dto/CqcCarbonReportCountParam.java @@ -0,0 +1,14 @@ +package com.thing.cqc.cqcCarbonReport.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "状态统计") +public class CqcCarbonReportCountParam { + + + private String status; + private Long count; + +} diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/mapper/CqcCarbonReportMapper.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/mapper/CqcCarbonReportMapper.java index d8b8011..84e819d 100644 --- a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/mapper/CqcCarbonReportMapper.java +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/mapper/CqcCarbonReportMapper.java @@ -1,9 +1,14 @@ package com.thing.cqc.cqcCarbonReport.mapper; import com.thing.common.orm.mapper.PowerBaseMapper; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountInfo; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountParam; import com.thing.cqc.cqcCarbonReport.entity.CqcCarbonReportEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; +import java.util.Map; + /** * 申请表基础数据 * @@ -12,5 +17,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface CqcCarbonReportMapper extends PowerBaseMapper { - + + List countByStatus(); } \ No newline at end of file diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/CqcCarbonReportService.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/CqcCarbonReportService.java index 0ab8952..4af26b3 100644 --- a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/CqcCarbonReportService.java +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/CqcCarbonReportService.java @@ -2,6 +2,7 @@ package com.thing.cqc.cqcCarbonReport.service; import com.thing.common.core.web.response.Result; import com.thing.common.orm.service.IBaseService; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountInfo; import com.thing.cqc.cqcCarbonReport.entity.CqcCarbonReportEntity; /** @@ -13,4 +14,6 @@ import com.thing.cqc.cqcCarbonReport.entity.CqcCarbonReportEntity; public interface CqcCarbonReportService extends IBaseService { Result uploadReport(Long id); + + CqcCarbonReportCountInfo countByStatus(); } \ No newline at end of file diff --git a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/impl/CqcCarbonReportServiceImpl.java b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/impl/CqcCarbonReportServiceImpl.java index 9b3b121..bb57b2b 100644 --- a/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/impl/CqcCarbonReportServiceImpl.java +++ b/modules/cqc-service/src/main/java/com/thing/cqc/cqcCarbonReport/service/impl/CqcCarbonReportServiceImpl.java @@ -1,6 +1,7 @@ package com.thing.cqc.cqcCarbonReport.service.impl; import com.alibaba.fastjson.JSONObject; +import com.mybatisflex.core.query.QueryColumn; import com.mybatisflex.core.query.QueryWrapper; import com.thing.common.core.web.response.Result; import com.thing.common.orm.service.impl.BaseServiceImpl; @@ -21,16 +22,20 @@ import com.thing.cqc.cqcCarbonMake.entity.CqcCarbonMakeEntity; import com.thing.cqc.cqcCarbonMake.service.CqcCarbonMakeService; import com.thing.cqc.cqcCarbonRaw.dto.CqcCarbonRawDTO; import com.thing.cqc.cqcCarbonRaw.service.CqcCarbonRawService; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountInfo; +import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportCountParam; import com.thing.cqc.cqcCarbonReport.dto.CqcCarbonReportDTO; import com.thing.cqc.cqcCarbonReport.mapper.CqcCarbonReportMapper; import com.thing.cqc.cqcCarbonReport.entity.CqcCarbonReportEntity; import com.thing.cqc.cqcCarbonReport.service.CqcCarbonReportService; import com.thing.cqc.rpcService.service.CqcRpcService; import com.thing.sys.security.context.UserContext; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; import java.util.Map; /** @@ -65,6 +70,16 @@ public class CqcCarbonReportServiceImpl extends BaseServiceImpl uploadReport(Long id) { Result result = new Result<>(); - - - CqcCarbonReportDTO reportDTO = this.getByIdAs(id,CqcCarbonReportDTO.class); String applyNo = reportDTO.getApplyNo(); if(ObjectUtils.isNotEmpty(reportDTO.getApplyNo())){ @@ -106,4 +118,25 @@ public class CqcCarbonReportServiceImpl extends BaseServiceImpl list = mapper.countByStatus(); + + list.forEach(temp->{ + if(temp.getStatus().equals("1")){ + cqcCarbonReportCountInfo.setPendingSubmitted(temp.getCount()==null?0:temp.getCount()); + } + if(temp.getStatus().equals("2")){ + cqcCarbonReportCountInfo.setPendingCertification(temp.getCount()==null?0:temp.getCount()); + } + if(temp.getStatus().equals("3")){ + cqcCarbonReportCountInfo.setIssued(temp.getCount()==null?0:temp.getCount()); + } + }); + return cqcCarbonReportCountInfo; + } } \ No newline at end of file diff --git a/modules/cqc-service/src/main/resources/mapper/CqcCarbonReportMapper.xml b/modules/cqc-service/src/main/resources/mapper/CqcCarbonReportMapper.xml index 6692d43..6ab0cca 100644 --- a/modules/cqc-service/src/main/resources/mapper/CqcCarbonReportMapper.xml +++ b/modules/cqc-service/src/main/resources/mapper/CqcCarbonReportMapper.xml @@ -3,4 +3,14 @@ + + + + \ No newline at end of file