|
|
@ -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.validator.group.UpdateGroup; |
|
|
import com.thing.common.core.web.response.PageData; |
|
|
import com.thing.common.core.web.response.PageData; |
|
|
import com.thing.common.core.web.response.Result; |
|
|
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.dto.CqcCarbonReportDTO; |
|
|
import com.thing.cqc.cqcCarbonReport.service.CqcCarbonReportService; |
|
|
import com.thing.cqc.cqcCarbonReport.service.CqcCarbonReportService; |
|
|
import com.thing.cqc.rpcService.service.CqcRpcService; |
|
|
import com.thing.cqc.rpcService.service.CqcRpcService; |
|
|
@ -37,21 +39,33 @@ public class CqcCarbonReportController { |
|
|
|
|
|
|
|
|
private final CqcCarbonReportService cqcCarbonReportService; |
|
|
private final CqcCarbonReportService cqcCarbonReportService; |
|
|
|
|
|
|
|
|
private final CqcRpcService cqcRpcService; |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("page") |
|
|
@GetMapping("page") |
|
|
@Operation(summary="分页") |
|
|
@Operation(summary="分页") |
|
|
@Parameters({ |
|
|
@Parameters({ |
|
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
|
|
@Parameter(name = Constant.PAGE, description = "当前页码,从1开始", required = true) , |
|
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
|
|
@Parameter(name = Constant.LIMIT, description = "每页显示记录数", required = true) , |
|
|
@Parameter(name = Constant.ORDER_FIELD, description = "排序字段") , |
|
|
@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<PageData<CqcCarbonReportDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){ |
|
|
public Result<PageData<CqcCarbonReportDTO>> page(@Parameter(hidden = true) @RequestParam Map<String, Object> params){ |
|
|
PageData<CqcCarbonReportDTO> page = cqcCarbonReportService.getPageData(params, CqcCarbonReportDTO.class); |
|
|
PageData<CqcCarbonReportDTO> page = cqcCarbonReportService.getPageData(params, CqcCarbonReportDTO.class); |
|
|
return new Result<PageData<CqcCarbonReportDTO>>().ok(page); |
|
|
return new Result<PageData<CqcCarbonReportDTO>>().ok(page); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("count") |
|
|
|
|
|
public Result<CqcCarbonReportCountInfo> count(){ |
|
|
|
|
|
CqcCarbonReportCountInfo data = cqcCarbonReportService.countByStatus(); |
|
|
|
|
|
return new Result<CqcCarbonReportCountInfo>().ok(data); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("{id}") |
|
|
@GetMapping("{id}") |
|
|
public Result<CqcCarbonReportDTO> get(@PathVariable("id") Long id){ |
|
|
public Result<CqcCarbonReportDTO> get(@PathVariable("id") Long id){ |
|
|
CqcCarbonReportDTO data = cqcCarbonReportService.getByIdAs(id, CqcCarbonReportDTO.class); |
|
|
CqcCarbonReportDTO data = cqcCarbonReportService.getByIdAs(id, CqcCarbonReportDTO.class); |
|
|
@ -63,12 +77,13 @@ public class CqcCarbonReportController { |
|
|
public Result<Object> save(@RequestBody CqcCarbonReportDTO dto){ |
|
|
public Result<Object> save(@RequestBody CqcCarbonReportDTO dto){ |
|
|
//效验数据 |
|
|
//效验数据 |
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|
|
|
|
|
dto.setId(IdGenerator.nextId()); |
|
|
dto.setApplyNo(String.valueOf(UUID.randomUUID())); |
|
|
dto.setApplyNo(String.valueOf(UUID.randomUUID())); |
|
|
dto.setCreateDate(System.currentTimeMillis()); |
|
|
dto.setCreateDate(System.currentTimeMillis()); |
|
|
dto.setCompanyId(UserContext.getCompanyId()); |
|
|
dto.setCompanyId(UserContext.getCompanyId()); |
|
|
dto.setTenantCode(UserContext.getTenantCode()); |
|
|
dto.setTenantCode(UserContext.getTenantCode()); |
|
|
cqcCarbonReportService.saveDto(dto); |
|
|
cqcCarbonReportService.saveDto(dto); |
|
|
return new Result<Object>().ok(dto.getApplyNo()); |
|
|
|
|
|
|
|
|
return new Result<Object>().ok(dto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@PutMapping |
|
|
@PutMapping |
|
|
@ -77,7 +92,7 @@ public class CqcCarbonReportController { |
|
|
//效验数据 |
|
|
//效验数据 |
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|
|
cqcCarbonReportService.updateDto(dto); |
|
|
cqcCarbonReportService.updateDto(dto); |
|
|
return new Result<Object>().ok(dto.getApplyNo()); |
|
|
|
|
|
|
|
|
return new Result<Object>().ok(dto); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@DeleteMapping |
|
|
@DeleteMapping |
|
|
|