|
|
@@ -1,6 +1,5 @@
|
|
|
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;
|
|
|
@@ -17,7 +16,6 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -36,18 +34,17 @@ public class PolicyLawController extends BaseController {
|
|
|
ObjUtils.merge(orig, record);
|
|
|
return policyLawRepo.save(orig);
|
|
|
}
|
|
|
+ PolicyLaw policyLaw = policyLawRepo.save(record);
|
|
|
+ LocalDate issuedAt = policyLaw.getIssuedAt();
|
|
|
+ int year = issuedAt.getYear();
|
|
|
+ policyLaw.setYear(year);
|
|
|
return policyLawRepo.save(record);
|
|
|
}
|
|
|
|
|
|
|
|
|
//@PreAuthorize("hasRole('ADMIN')")
|
|
|
@PostMapping("/all")
|
|
|
- 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);
|
|
|
+ public Page<PolicyLaw> all(@RequestBody PageQuery pageQuery) {
|
|
|
return policyLawService.all(pageQuery);
|
|
|
}
|
|
|
|
|
|
@@ -64,12 +61,8 @@ public class PolicyLawController extends BaseController {
|
|
|
@GetMapping("/excel")
|
|
|
@ResponseBody
|
|
|
public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
|
|
|
- List<PolicyLaw> data = alll(pageQuery).getContent();
|
|
|
+ List<PolicyLaw> data = all(pageQuery).getContent();
|
|
|
ExcelUtils.export(response, data);
|
|
|
}
|
|
|
-
|
|
|
- public Page<PolicyLaw> alll( @RequestBody PageQuery pageQuery) {
|
|
|
- return policyLawService.all(pageQuery);
|
|
|
- }
|
|
|
}
|
|
|
|