cjl
2023-11-15 28776b56db3bbd2fbbfd64394e40aa11a6b7ea29
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.moral.api.controller;
 
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.moral.api.pojo.ext.allocation.AllocationPageExt;
import com.moral.api.pojo.query.app.AppAllocationFileCond;
import com.moral.api.pojo.query.app.AppAllocationPageCond;
import com.moral.api.pojo.vo.app.AppAllocationFindVo;
import com.moral.api.pojo.vo.app.AppAuthority;
import com.moral.constant.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
 
import javax.validation.Valid;
 
import com.moral.api.pojo.query.allocation.AllocationChangeCond;
import com.moral.api.pojo.query.allocation.AllocationCheckCond;
import com.moral.api.pojo.vo.allocation.AllocationFindVo;
import com.moral.api.service.AllocationService;
import com.moral.constant.ResultMessage;
 
@Api(tags = {"小程序立行立改"})
@RestController
@RequestMapping("allocationApp")
public class AppAllocationController {
 
 
 
    @Autowired
    private AllocationService allocationService;
 
 
 
    @GetMapping("select")
    @ApiOperation("小程序查询")
    public ResultMessage selectSmallRoutine(@RequestParam @ApiParam(value = "state",name = "状态") Integer state,
                                            @RequestParam @ApiParam(value = "startTime",name = "开始时间") String startTime,
                                            @RequestParam @ApiParam(value = "endTime",name = "结束时间") String endTime){
        List<AllocationFindVo> allocationFindVos = allocationService.selectSmallRoutine(state,startTime,endTime);
        return ResultMessage.ok(ObjectUtils.isEmpty(allocationFindVos)? "0":allocationFindVos);
    }
 
    @PostMapping("/page")
    @ApiOperation("小程序分页查询")
    public ResultMessage<PageResult<AppAllocationFindVo>> page(@Valid @RequestBody AppAllocationPageCond allocationPageCond){
        Page<AllocationPageExt> allocationFindVos = allocationService.pageApp(allocationPageCond);
        PageResult<AppAllocationFindVo> result = new PageResult<>(allocationFindVos);
        result.setList(AppAllocationFindVo.convert(allocationFindVos.getRecords()));
        return ResultMessage.ok(result);
    }
 
    public static void main(String[] args) {
        List<String> list = Arrays.asList("aaa", "bbb","aaa");
        System.out.println("num;" + Collections.frequency(list, "aaa"));
    }
 
    @PostMapping("appFile")
    @ApiOperation("用户头像新增or修改")
    public ResultMessage appFile(@Valid @RequestBody AppAllocationFileCond appAllocationFileCond){
        allocationService.saveFile(appAllocationFileCond);
        return ResultMessage.ok();
    }
 
    @PostMapping("changeRoutine")
    @ApiOperation("小程序整改")
    public ResultMessage changeSmallRoutine(@Valid @RequestBody AllocationChangeCond changeCond){
        allocationService.changeSmallRoutine(changeCond);
        return ResultMessage.ok();
    }
 
 
    @PostMapping("checkRoutine")
    @ApiOperation("小程序审批")
    public ResultMessage checkSmallRoutine(@Valid @RequestBody AllocationCheckCond checkCond){
        allocationService.checkSmallRoutine(checkCond);
        return ResultMessage.ok();
    }
 
 
    @GetMapping("authority")
    @ApiOperation(value = "分享权限")
    public  ResultMessage  authority(@RequestParam @ApiParam(value = "allocationNum",name = "单号") String allocationNum,
                                     @RequestParam @ApiParam(value = "userId",name = "用户Id") Integer userId){
        AppAuthority authority = allocationService.authority(allocationNum, userId);
        return ResultMessage.ok(authority);
    }
 
}