| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.jfpt.healthcode.entity.healthcode; |
| | | import org.springblade.jfpt.healthcode.entity.Healthcode; |
| | | import org.springblade.jfpt.healthcode.service.IhealthcodeService; |
| | | import org.springblade.jfpt.healthcode.vo.healthcodeVO; |
| | | import org.springblade.jfpt.healthcode.vo.HealthcodeVO; |
| | | import org.springblade.jfpt.healthcode.wrapper.healthcodeWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @CrossOrigin |
| | | @RequestMapping("healthcode/healthcode") |
| | | @Api(value = "", tags = "接口") |
| | | public class healthcodeController extends BladeController { |
| | |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入lx") |
| | | public R<healthcodeVO> detail(healthcode healthcode) { |
| | | healthcode detail = ihealthcodeService.getOne(Condition.getQueryWrapper(healthcode)); |
| | | public R<HealthcodeVO> detail(Healthcode healthcode) { |
| | | Healthcode detail = ihealthcodeService.getOne(Condition.getQueryWrapper(healthcode)); |
| | | return R.data(healthcodeWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入lx") |
| | | public R<IPage<healthcodeVO>> list(healthcode healthcode, Query query) { |
| | | IPage<healthcode> pages = ihealthcodeService.page(Condition.getPage(query), Condition.getQueryWrapper(healthcode)); |
| | | public R<IPage<HealthcodeVO>> list(Healthcode healthcode, Query query) { |
| | | IPage<Healthcode> pages = ihealthcodeService.page(Condition.getPage(query), Condition.getQueryWrapper(healthcode)); |
| | | return R.data(healthcodeWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 自定义健康码分页/健康码统计图表点击事件 |
| | | * @param healthcodeVO 健康码对象 |
| | | * @param query 分页对象(页码) |
| | | * @return |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "自定义分页", notes = "传入lx") |
| | | public R<IPage<Healthcode>> page(HealthcodeVO healthcodeVO, Query query) { |
| | | return R.data(ihealthcodeService.selectHealthcodeListPage(Condition.getPage(query),healthcodeVO)); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入lx") |
| | | public R save(@Valid @RequestBody healthcode healthcode) { |
| | | public R save(@Valid @RequestBody Healthcode healthcode) { |
| | | return R.status(ihealthcodeService.save(healthcode)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入lx") |
| | | public R update(@Valid @RequestBody healthcode healthcode) { |
| | | public R update(@Valid @RequestBody Healthcode healthcode) { |
| | | return R.status(ihealthcodeService.updateById(healthcode)); |
| | | } |
| | | |
| | |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入lx") |
| | | public R submit(@Valid @RequestBody healthcode healthcode) { |
| | | public R submit(@Valid @RequestBody Healthcode healthcode) { |
| | | return R.status(ihealthcodeService.saveOrUpdate(healthcode)); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 统计接口 |
| | | */ |
| | | @PostMapping("/selectCount") |
| | | public R selectCount(@RequestBody String type, HttpServletResponse response) { |
| | | @GetMapping("/selectCount") |
| | | public R selectCount(Integer type,HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | |
| | | if (1 == dayWeek) { |
| | | cal.add(Calendar.DAY_OF_MONTH, -1); |
| | | } |
| | | String type1 = type; |
| | | String substring = type1.substring(9, 10); |
| | | System.out.println(substring); |
| | | switch(substring){ |
| | | case "0" : |
| | | switch(type){ |
| | | case 0 : |
| | | //日 |
| | | String times = sdf.format(cal.getTime()); |
| | | System.out.println("times = " + times); |
| | | list=ihealthcodeService.selectCountr(times); |
| | | break; |
| | | case "1" : |
| | | case 1 : |
| | | System.out.println("要计算日期为:" + sdf.format(cal.getTime())); // 输出要计算日期 |
| | | // 设置一个星期的第一天,按中国的习惯一个星期的第一天是星期一 |
| | | cal.setFirstDayOfWeek(Calendar.MONDAY); |