mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.panzhihua.service_equipment.api;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.panzhihua.common.model.dtos.equipment.UnionReportDto;
import com.panzhihua.common.model.dtos.equipment.UnionUserDto;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_equipment.annotation.CurrentUser;
import com.panzhihua.service_equipment.model.dos.UnionReport;
import com.panzhihua.service_equipment.service.UnionReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
 
@Slf4j
@RestController
@RequestMapping("/unionReport")
public class UnionReportApi {
 
    @Resource
    private UnionReportService unionReportService;
 
    /**
     * 户外劳工站上报表
     *
     * @param unionReportDto
     * @return 新增结果
     */
    @PostMapping("/add")
    public R add(@RequestBody UnionReportDto unionReportDto, @CurrentUser UnionUserDto unionUserDto) {
        if (unionReportDto.getIsApplets().equals(1)) {
            log.info("小程序进入无需验证");
            return unionReportService.add(unionReportDto);
        } else {
            log.info("h5或者后台进入");
            if (unionUserDto != null) {
                unionReportDto.setCreateUnionUserId(unionUserDto.getId());
                return unionReportService.add(unionReportDto);
            } else {
                return R.fail("请重新登录");
            }
        }
    }
 
 
    /**
     * 分页户外劳工站上报表
     *
     * @param unionReportDto
     * @return 动态结果
     */
    @PostMapping("/query")
    public R<IPage<UnionReport>> query(@RequestBody UnionReportDto unionReportDto, @CurrentUser UnionUserDto
            unionUserDto) {
        if (unionReportDto.getIsApplets().equals(1)) {
            log.info("小程序进入无需验证");
            return unionReportService.query(unionReportDto);
        } else {
            log.info("h5或者后台进入");
            if (unionUserDto != null) {
                unionReportDto.setCreateUnionUserId(unionUserDto.getId());
                return unionReportService.query(unionReportDto);
            } else {
                return R.fail("请重新登录");
            }
        }
    }
}