zhuhaiwen %!s(int64=3) %!d(string=hace) años
padre
commit
94cce05f09

+ 13 - 13
oa-app/src/main/java/com/css/oa/exam/admin/bean/Admin.java

@ -12,19 +12,19 @@ public class Admin {
12 12
        this.my_unit_id = my_unit_id;
13 13
    }
14 14
15
//    public static Admin getAdminByToken(@NotNull String token){
16
//        if(token.equals("1")){
17
//            return new Admin("中央水利局","0");
18
//        }else if(token.equals("2")){
19
//            return new Admin("华南水利局","1");
20
//        }else if(token.equals("3")){
21
//            return new Admin("湖南水利","2");
22
//        }else if(token.equals("4")){
23
//            return new Admin("长沙市水利","3");
24
//        }else {
25
//            return new Admin("长沙县水利","4");
26
//        }
27
//    }
15
    public static Admin getAdminByToken(@NotNull String token){
16
        if(token.equals("1")){
17
            return new Admin("中央水利局朱局长","1");
18
        }else if(token.equals("2")){
19
            return new Admin("华南局朱董事","2");
20
        }else if(token.equals("3")){
21
            return new Admin("湖南水利厅朱厅长","3");
22
        }else if(token.equals("4")){
23
            return new Admin("长沙市水利所朱所长","4");
24
        }else {
25
            return new Admin("长沙县水利站朱站长","5");
26
        }
27
    }
28 28
29 29
    public static String getAdminUnitId(@NotNull String token){
30 30
        if(token.equals("1")){

+ 7 - 4
oa-app/src/main/java/com/css/oa/exam/exam/service/ExamService.java

@ -76,11 +76,12 @@ public class ExamService extends BaseService implements IExamService {
76 76
        if (obj.getUpdate_time() == null) {
77 77
            obj.setUpdate_time(newDate);
78 78
        }
79
        if (TextUtils.isEmpty(obj.getCreate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
80
            obj.setCreate_user("系统");
79
        Admin admin = Admin.getAdminByToken(token);
80
        if (TextUtils.isEmpty(obj.getCreate_user())) {
81
            obj.setCreate_user(admin.name);
81 82
        }
82
        if (TextUtils.isEmpty(obj.getUpdate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
83
            obj.setUpdate_user("系统");
83
        if (TextUtils.isEmpty(obj.getUpdate_user())) {
84
            obj.setUpdate_user(admin.name);
84 85
        }
85 86
        return saveExam(obj);
86 87
    }
@ -90,6 +91,8 @@ public class ExamService extends BaseService implements IExamService {
90 91
        checkPermission("管理员所在的单位没有编辑考试的权限");
91 92
        Optional<Exam> byId = repository.findById(newObj.getUuid());
92 93
        Exam old = byId.get();
94
        Admin admin = Admin.getAdminByToken(token);
95
        newObj.setUpdate_user(admin.name);
93 96
        UpdateObjectTool.copyNullProperties(old, newObj);
94 97
        return saveExam(newObj);
95 98
    }

+ 9 - 0
oa-app/src/main/java/com/css/oa/exam/place/bean/VerifyOneReq.java

@ -0,0 +1,9 @@
1
package com.css.oa.exam.place.bean;
2
3
public class VerifyOneReq {
4
5
    public String uuid;
6
7
    public String suggest;
8
9
}

+ 4 - 3
oa-app/src/main/java/com/css/oa/exam/place/bean/VerifyReq.java

@ -1,9 +1,10 @@
1 1
package com.css.oa.exam.place.bean;
2 2
3
import java.util.ArrayList;
4
import java.util.List;
5
3 6
public class VerifyReq {
4 7
5
    public String uuid;
6
    public int state;
7
    public String suggest;
8
    public List<String> ids = new ArrayList<>();
8 9
9 10
}

+ 21 - 9
oa-app/src/main/java/com/css/oa/exam/place/controller/PlaceController.java

@ -11,8 +11,6 @@ import org.apache.http.util.TextUtils;
11 11
import org.springframework.beans.factory.annotation.Autowired;
12 12
import org.springframework.web.bind.annotation.*;
13 13
14
import java.util.ArrayList;
15
import java.util.HashMap;
16 14
import java.util.List;
17 15
import java.util.Map;
18 16
@ -68,6 +66,8 @@ public class PlaceController extends BaseController {
68 66
    public Result update(@RequestBody Place newPlace) {
69 67
        Result<Map> result;
70 68
        try {
69
            String token = getToken();
70
            mService.setToken(token);
71 71
            if (TextUtils.isEmpty(newPlace.getUuid())) {
72 72
                return setErr("uuid参数不能为空");
73 73
            }
@ -135,17 +135,16 @@ public class PlaceController extends BaseController {
135 135
    }
136 136
137 137
    @ApiOperation(value = "审核")
138
    @PostMapping("/verify")
139
    public Result verify(@RequestBody VerifyReq req) {
138
    @PostMapping("/verifyOne")
139
    public Result verifyOne(@RequestBody VerifyOneReq req) {
140 140
        Result<Map> result;
141 141
        try {
142
            if(TextUtils.isEmpty(req.uuid)){
142
            String token = getToken();
143
            mService.setToken(token);
144
            if (TextUtils.isEmpty(req.uuid)) {
143 145
                return setErr("uuid参数不能为空");
144 146
            }
145
            if(req.state == 0){
146
                return setErr("state参数不能为空或不能为0");
147
            }
148
            mService.verify(req.uuid, req.state, req.suggest);
147
            mService.verifyOne(req.uuid, req.suggest);
149 148
            result = setResult();
150 149
        } catch (Exception e) {
151 150
            result = setErr(e.getMessage());
@ -154,6 +153,19 @@ public class PlaceController extends BaseController {
154 153
        return result;
155 154
    }
156 155
156
    @ApiOperation(value = "批量审核")
157
    @PostMapping("/batchVerify")
158
    public Result batchVerify(@RequestBody List<String> ids) {
159
        Result<Map> result;
160
        try {
161
            mService.batchVerify(ids);
162
            result = setResult();
163
        } catch (Exception e) {
164
            result = setErr(e.getMessage());
165
            e.printStackTrace();
166
        }
167
        return result;
168
    }
157 169
158 170
    @ApiOperation(value = "年份-考试-考点")
159 171
    @GetMapping("/queryToYear")

+ 10 - 5
oa-app/src/main/java/com/css/oa/exam/place/repository/IPlaceRepository.java

@ -16,27 +16,32 @@ public interface IPlaceRepository extends JpaRepository<Place, String>, JpaSpeci
16 16
    //批量删除
17 17
    @Modifying
18 18
    @Transactional
19
    @Query(nativeQuery = true, value = "delete from ATT_EXAM_PLACE where UUID in :ids")
19
    @Query(nativeQuery = true, value = "delete from OP_EXAM_PLACE where UUID in :ids")
20 20
    void deleteRealByIds(@Param("ids") List<String> ids);
21 21
22 22
    @Modifying
23 23
    @Transactional
24
    @Query(nativeQuery = true , value = "select * from ATT_EXAM_PLACE where EXAM_ID = :exam_id")
24
    @Query(nativeQuery = true , value = "select * from OP_EXAM_PLACE where EXAM_ID = :exam_id")
25 25
    List<Place> queryById(@Param("exam_id")String exam_id);
26 26
27 27
    @Modifying
28 28
    @Transactional
29
    @Query(nativeQuery = true , value = "select UUID from ATT_EXAM_PLACE where EXAM_ID = :exam_id")
29
    @Query(nativeQuery = true, value = "select * from OP_EXAM_PLACE where UUID in :ids")
30
    List<Place> getAllByIds(@Param("ids") List<String> ids);
31
32
    @Modifying
33
    @Transactional
34
    @Query(nativeQuery = true , value = "select UUID from OP_EXAM_PLACE where EXAM_ID = :exam_id")
30 35
    List<String> queryMyIdByExamId(@Param("exam_id")String exam_id);
31 36
32 37
    @Modifying
33 38
    @Transactional
34
    @Query(nativeQuery = true, value = "select * from ATT_EXAM_PLACE where EXAM_ID in :ids")
39
    @Query(nativeQuery = true, value = "select * from OP_EXAM_PLACE where EXAM_ID in :ids")
35 40
    List<Place> queryByExamIds(@Param("ids") List<String> ids);
36 41
37 42
//    @Modifying
38 43
//    @Transactional
39
//    @Query(nativeQuery = true , value = "select * from ATT_EXAM_PLACE where EXAM_ID = :exam_id")
44
//    @Query(nativeQuery = true , value = "select * from OP_EXAM_PLACE where EXAM_ID = :exam_id")
40 45
//    List<ExamPlace> queryByName(@Param("name")String name);
41 46
42 47
}

+ 2 - 3
oa-app/src/main/java/com/css/oa/exam/place/repository/Place.java

@ -45,9 +45,8 @@ public class Place implements Serializable, Cloneable {
45 45
    @Column(name = "EXAM_TYPE")
46 46
    public int exam_type;
47 47
48
    //状态  11一级审核通过 10一级审核未通过 15一级待审核,  20二级未通过 25二级待审核 , 35三级待提交
49
    @Column(name = "STATE")
50
    public int state;
48
    @Column(name = "VERIFY_STATE")
49
    public String verify_state;
51 50
52 51
//    @Column(name = "SUGGEST") //审核意见
53 52
//    public int suggest;

+ 3 - 1
oa-app/src/main/java/com/css/oa/exam/place/service/IPlaceService.java

@ -20,7 +20,9 @@ public interface IPlaceService {
20 20
21 21
    boolean duplicate(PlaceDuplicateBean bean);
22 22
23
    void verify(String uuid, int state, String suggest);
23
    void verifyOne(String uuid, String suggest);
24
25
    void batchVerify(List<String> ids);
24 26
25 27
    PlaceResultWrap queryToYear();
26 28

+ 68 - 23
oa-app/src/main/java/com/css/oa/exam/place/service/PlaceService.java

@ -165,37 +165,47 @@ public class PlaceService extends BaseService implements IPlaceService {
165 165
    @Autowired
166 166
    IUnitRepository unitRepository;
167 167
168
    private Unit getUnit(String id) {
169
        List<Unit> unitList = unitRepository.getUnitBy(id);
170
        if (unitList.size() > 0) {
171
            Unit me = unitList.get(0);
172
            return me;
173
        }
174
        return null;
175
    }
176
168 177
    private ArrayList<String> getArr(Unit unit) {
169
        ArrayList list = new ArrayList();
170
        list.add(unit.uuid);
178
        ArrayList<String> ids = new ArrayList();
179
        ids.add(unit.uuid);
171 180
        String p_id = unit.getP_id();
172
        while (!TextUtils.isEmpty(p_id)) {
173
            List<Unit> unitList = unitRepository.getUnitBy(p_id);
174
            if (unitList.size() > 0) {
175
                Unit pUnit = unitList.get(0);
176
                list.add(pUnit.uuid);
177
                list.addAll(getArr(pUnit));
181
        boolean b = !TextUtils.isEmpty(p_id) && !p_id.equals("-1") && !p_id.equals(" ") && !p_id.contains(" ");
182
        if (b) {
183
            Unit pUnit = getUnit(p_id);
184
            if (pUnit != null) {
185
                ids.addAll(getArr(pUnit));
178 186
            }
179 187
        }
180
        return list;
188
        return ids;
181 189
    }
182 190
183 191
    private void setQue(Place place) {
184 192
        String adminUnitId = Admin.getAdminUnitId(token);
185
        List<Unit> unitList = unitRepository.getUnitBy(adminUnitId);
186
        if (unitList.size() > 0) {
187
            Unit unit = unitList.get(0);
188
            place.setCurr_id(unit.uuid);
189
            ArrayList<String> list = getArr(unit);
193
        Unit me = getUnit(adminUnitId);
194
        if (me != null) {
195
            place.setCurr_id(me.uuid);
196
            place.setVerify_state("待提交");
197
198
            ArrayList<String> list = getArr(me);
190 199
            String que = "";
191 200
            for (int i = 0; i < list.size(); i++) {
192
                String id  = list.get(i);
193
                if(i == 0){
201
                String id = list.get(i);
202
                if (i == 0) {
194 203
                    que = que + id;
195
                }else {
204
                } else {
196 205
                    que = que + "," + id;
197 206
                }
198 207
            }
208
            list.clear();
199 209
            place.setQueue(que);
200 210
        }
201 211
@ -216,11 +226,12 @@ public class PlaceService extends BaseService implements IPlaceService {
216 226
        if (place.getUpdate_time() == null) {
217 227
            place.setUpdate_time(newDate);
218 228
        }
219
        if (TextUtils.isEmpty(place.getCreate_user()) || place.getCreate_user().equalsIgnoreCase("null")) {
220
            place.setCreate_user("无管理员");
229
        Admin admin = Admin.getAdminByToken(token);
230
        if (TextUtils.isEmpty(place.getCreate_user())) {
231
            place.setCreate_user(admin.name);
221 232
        }
222
        if (TextUtils.isEmpty(place.getUpdate_user()) || place.getCreate_user().equalsIgnoreCase("null")) {
223
            place.setUpdate_user("无管理员");
233
        if (TextUtils.isEmpty(place.getUpdate_user())) {
234
            place.setUpdate_user(admin.name);
224 235
        }
225 236
        setQue(place);
226 237
        repository.save(place);
@ -240,6 +251,8 @@ public class PlaceService extends BaseService implements IPlaceService {
240 251
    public void update(Place newPlace) {
241 252
        Optional<Place> byId = repository.findById(newPlace.getUuid());
242 253
        Place oldPlace = byId.get();
254
        Admin admin = Admin.getAdminByToken(token);
255
        newPlace.setUpdate_user(admin.name);
243 256
        UpdateObjectTool.copyNullProperties(oldPlace, newPlace);
244 257
        repository.save(newPlace);
245 258
    }
@ -269,17 +282,49 @@ public class PlaceService extends BaseService implements IPlaceService {
269 282
    }
270 283
271 284
    @Override
272
    public void verify(String uuid, int state, String suggest) {
285
    public void verifyOne(String uuid, String suggest) {
273 286
        Optional<Place> byId = repository.findById(uuid);
274 287
        Place oldPlace = byId.get();
275 288
289
        Admin admin = Admin.getAdminByToken(token);
276 290
        Place newPlace = new Place();
277
        newPlace.setState(state);
291
        newPlace.setCurr_id(admin.my_unit_id);
278 292
279 293
        UpdateObjectTool.copyNullProperties(oldPlace, newPlace);
280 294
        repository.save(newPlace);
281 295
    }
282 296
297
    private boolean cannot(Place oldPlace, Admin admin) {
298
        String[] que = oldPlace.getQueue().split(",");
299
        ArrayList<String> ids = new ArrayList();
300
        for (String id : que) {
301
            ids.add(id);
302
        }
303
        int i = ids.indexOf(oldPlace.getCurr_id());
304
        int j = ids.indexOf(admin.my_unit_id);
305
        if (i < j) {
306
            return false;
307
        }
308
        return true;
309
    }
310
311
    @Override
312
    public void batchVerify(List<String> ids) {
313
        Admin admin = Admin.getAdminByToken(token);
314
        List<Place> oldAll = repository.getAllByIds(ids);
315
        List<Place> newAll = new ArrayList<>();
316
        for (Place oldPlace : oldAll) {
317
            if (cannot(oldPlace, admin)) {
318
                continue;
319
            }
320
            Place newPlace = new Place();
321
            newPlace.setCurr_id(admin.my_unit_id);
322
            UpdateObjectTool.copyNullProperties(oldPlace, newPlace);
323
            newAll.add(newPlace);
324
        }
325
        repository.saveAll(newAll);
326
    }
327
283 328
    @Autowired
284 329
    IExamRepository examRepository;
285 330

+ 2 - 2
oa-app/src/main/java/com/css/oa/exam/room/controller/RoomController.java

@ -1,7 +1,7 @@
1 1
package com.css.oa.exam.room.controller;
2 2
3 3
import com.css.oa.exam.base.BaseController;
4
import com.css.oa.exam.place.bean.VerifyReq;
4
import com.css.oa.exam.place.bean.VerifyOneReq;
5 5
import com.css.oa.exam.room.bean.RoomQueryReq;
6 6
import com.css.oa.exam.room.repository.Room;
7 7
import com.css.oa.exam.room.service.RoomService;
@ -59,7 +59,7 @@ public class RoomController extends BaseController {
59 59
60 60
    @ApiOperation(value = "审核")
61 61
    @PostMapping("/verify")
62
    public Result verify(@RequestBody VerifyReq req) {
62
    public Result verify(@RequestBody VerifyOneReq req) {
63 63
        Result<Map> result;
64 64
        try {
65 65
            if(TextUtils.isEmpty(req.uuid)){

+ 11 - 8
oa-app/src/main/java/com/css/oa/exam/subject/service/SubjectService.java

@ -61,11 +61,12 @@ public class SubjectService extends BaseService implements ISubjectService {
61 61
        if (obj.getUpdate_time() == null) {
62 62
            obj.setUpdate_time(newDate);
63 63
        }
64
        if (TextUtils.isEmpty(obj.getCreate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
65
            obj.setCreate_user("系统");
64
        Admin admin = Admin.getAdminByToken(token);
65
        if (TextUtils.isEmpty(obj.getCreate_user())) {
66
            obj.setCreate_user(admin.name);
66 67
        }
67
        if (TextUtils.isEmpty(obj.getUpdate_user()) || obj.getCreate_user().equalsIgnoreCase("null")) {
68
            obj.setUpdate_user("系统");
68
        if (TextUtils.isEmpty(obj.getUpdate_user())) {
69
            obj.setUpdate_user(admin.name);
69 70
        }
70 71
        repository.save(obj);
71 72
    }
@ -114,12 +115,14 @@ public class SubjectService extends BaseService implements ISubjectService {
114 115
    }
115 116
116 117
    @Override
117
    public void update(Subject newTest) throws Exception {
118
    public void update(Subject newObj) throws Exception {
118 119
        checkPermission("管理员所在的单位没有编辑科目的权限");
119
        Optional<Subject> byId = repository.findById(newTest.getUuid());
120
        Optional<Subject> byId = repository.findById(newObj.getUuid());
120 121
        Subject old = byId.get();
121
        UpdateObjectTool.copyNullProperties(old, newTest);
122
        repository.save(newTest);
122
        Admin admin = Admin.getAdminByToken(token);
123
        newObj.setUpdate_user(admin.name);
124
        UpdateObjectTool.copyNullProperties(old, newObj);
125
        repository.save(newObj);
123 126
    }
124 127
125 128
    @Override