|
|
@@ -1,5 +1,6 @@
|
|
|
package com.izouma.zhirongip.web.resource;
|
|
|
|
|
|
+import com.izouma.zhirongip.domain.resource.NumOfIp;
|
|
|
import com.izouma.zhirongip.web.BaseController;
|
|
|
import com.izouma.zhirongip.domain.resource.PolicyLaw;
|
|
|
import com.izouma.zhirongip.service.resource.PolicyLawService;
|
|
|
@@ -16,6 +17,8 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RestController
|
|
|
@@ -39,7 +42,12 @@ public class PolicyLawController extends BaseController {
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
|
- public Page<PolicyLaw> all(@RequestBody PageQuery pageQuery) {
|
|
|
+ public Page<PolicyLaw> all(@RequestParam(name = "year", required = false) Integer year, @RequestBody PageQuery pageQuery) {
|
|
|
+ LocalDate starDate = LocalDate.of(year, 1, 1);
|
|
|
+ LocalDate endDate = starDate.plusYears(1).minusDays(1);
|
|
|
+ pageQuery.getCriteria()
|
|
|
+ .andGreaterThanOrEqualTo("issuedAt", starDate)
|
|
|
+ .andLessThanOrEqualTo("issuedAt", endDate);
|
|
|
return policyLawService.all(pageQuery);
|
|
|
}
|
|
|
|
|
|
@@ -56,8 +64,12 @@ public class PolicyLawController extends BaseController {
|
|
|
@GetMapping("/excel")
|
|
|
@ResponseBody
|
|
|
public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|
|
|
- List<PolicyLaw> data = all(pageQuery).getContent();
|
|
|
+ List<PolicyLaw> data = alll(pageQuery).getContent();
|
|
|
ExcelUtils.export(response, data);
|
|
|
}
|
|
|
+
|
|
|
+ public Page<PolicyLaw> alll( @RequestBody PageQuery pageQuery) {
|
|
|
+ return policyLawService.all(pageQuery);
|
|
|
+ }
|
|
|
}
|
|
|
|