瀏覽代碼

新增工单管理的查询接口

konghl 4 年之前
父節點
當前提交
90d166c419

+ 158 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/WorkOrderManagementController.java

@ -0,0 +1,158 @@
1
package com.ai.bss.security.protection.controller;
2
3
import java.util.HashMap;
4
import java.util.List;
5
import java.util.Map;
6
7
import org.apache.commons.lang.StringUtils;
8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10
import org.springframework.beans.factory.annotation.Autowired;
11
import org.springframework.stereotype.Controller;
12
import org.springframework.web.bind.annotation.RequestMapping;
13
import org.springframework.web.bind.annotation.RequestParam;
14
import org.springframework.web.bind.annotation.ResponseBody;
15
16
import com.ai.abc.api.model.CommonResponse;
17
import com.ai.bss.components.common.model.PageBean;
18
import com.ai.bss.security.protection.service.interfaces.WorkOrderManagementService;
19
import com.ai.bss.security.protection.util.EbcConstant;
20
21
/**
22
 * 工单管理
23
 */
24
@Controller
25
@RequestMapping("/workOrderManagement")
26
public class WorkOrderManagementController {
27
	Logger logger = LoggerFactory.getLogger(WorkOrderManagementController.class);
28
29
	@Autowired
30
	private WorkOrderManagementService workOrderManagementService;
31
32
	/**
33
	 * 分页查询工单信息
34
	 * @param pageNumber  当前页数
35
	 * @param pageSize 每页条数
36
	 * @param status 工作状态(默认END)  RUN:待审批, END:完成
37
	 * @param appovalSubType 工单类型  小类
38
	 * @param startTime 开始时间
39
	 * @param endTime 结束时间
40
	 * @return
41
	 * @throws Exception
42
	 */
43
	@ResponseBody
44
	@RequestMapping("/queryPageWorkOrder")
45
	public CommonResponse<PageBean<Map<String, Object>>> queryPageWorkOrder(
46
			@RequestParam(required = false) int pageNumber, @RequestParam(required = false) int pageSize,
47
			@RequestParam(defaultValue = "END") String status, @RequestParam(required = false) String appovalSubType,
48
			@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime)
49
			throws Exception {
50
51
		pageNumber = pageNumber < 1 ? 1 : pageNumber;
52
		pageSize = pageSize < 1 ? EbcConstant.DEFAULT_PAGE_SIZE : pageSize;
53
54
		Map<String, String> params = new HashMap<String, String>();
55
		params.put("status", status);
56
		params.put("appovalSubType", appovalSubType);
57
		params.put("startTime", startTime);
58
		params.put("endTime", endTime);
59
60
		return workOrderManagementService.queryPageWorkOrder(params, pageNumber, pageSize);
61
	}
62
63
	/**
64
	 * 获取所有工单类型
65
	 *
66
	 * @return
67
	 */
68
	@ResponseBody
69
	@RequestMapping("/queryWorkOrderTypeList")
70
	public  CommonResponse<Map<String, List<Map<String, String>>>> queryWorkOrderTypeList() {
71
		return workOrderManagementService.queryWorkOrderTypeList();
72
	}
73
74
	/**
75
	 * 查询单个工单信息
76
	 *
77
	 * @param workOrderId
78
	 * @return
79
	 * @throws Exception
80
	 */
81
	@ResponseBody
82
	@RequestMapping("/queryOneWorkOrder")
83
	public CommonResponse<Map<String, Object>> queryOneWorkOrder(@RequestParam String workOrderId)
84
			throws Exception {
85
		if (StringUtils.isEmpty(workOrderId)) {
86
			return CommonResponse.fail("500", "操作失败");
87
		}
88
89
		Map<String,String> params = new HashMap<String, String>();
90
		params.put("workOrderId", workOrderId);
91
		
92
		return workOrderManagementService.queryOneWorkOrder(params);
93
	}
94
95
	
96
	
97
	
98
	
99
	
100
	
101
	
102
	
103
	
104
	
105
	
106
	
107
	
108
	
109
	
110
	/**
111
	 * 工单申请
112
	 *
113
	 * @param mapTagInfoDto
114
	 * @return
115
	 * @throws Exception
116
	 */
117
	/*@ResponseBody
118
	@RequestMapping("/addAlppyVacationInfo")
119
	public CommonResponse<Void> addAlppyVacationInfo(@RequestBody WorkEvent mapTagInfoDto) throws Exception {
120
		Map<String, Object> result = new HashMap<String, Object>();
121
122
		*//*if (mapTagInfoDto == null || mapTagInfoDto.getMapAreaName() == null
123
				|| mapTagInfoDto.getMapAreaContent() == null) {
124
			return CommonResponse.fail("500", "添加失败");
125
		}
126
		
127
		mapTagInfoDto.setMapAreaSetId(0L); // TODO 固定值 所属地图工单集合标识
128
		mapTagInfoDto.setPriority("10"); // 优先级
129
		mapTagInfoDto.setMapType(MapArea.MAP_TYPE_GEOMETRY);*//* // 工单形状,GEO多边形, RAD 圆形
130
131
		return workOrderManagementService.addAlppyVacationInfo(mapTagInfoDto);
132
	}*/
133
134
	/**
135
	 * 工单审核
136
	 *
137
	 * @param mapTagInfoDto
138
	 * @return
139
	 * @throws Exception
140
	 */
141
	/*@ResponseBody
142
	@RequestMapping("/checkAlppyVacationInfo")
143
	public CommonResponse<Void> checkAlppyVacationInfo(@RequestBody MapTagInfoDto mapTagInfoDto) throws Exception {
144
		Map<String, Object> result = new HashMap<String, Object>();
145
146
		*//*if (mapTagInfoDto == null || mapTagInfoDto.getMapAreaName() == null || mapTagInfoDto.getMapAreaId() == null
147
				|| mapTagInfoDto.getMapAreaContent() == null) {
148
			return CommonResponse.fail("500", "修改失败");
149
		}
150
		
151
		mapTagInfoDto.setMapAreaSetId(0L); // TODO 固定值 所属地图工单集合标识
152
		mapTagInfoDto.setPriority("10"); // 优先级
153
		mapTagInfoDto.setMapType(MapArea.MAP_TYPE_GEOMETRY);*//* // 工单形状,GEO多边形, RAD 圆形
154
155
		return workOrderManagementService.checkAlppyVacationInfo(mapTagInfoDto);
156
	}*/
157
158
}

+ 80 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/CharSpecServiceImpl.java

@ -0,0 +1,80 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import java.util.ArrayList;
4
import java.util.HashMap;
5
import java.util.Iterator;
6
import java.util.List;
7
import java.util.Map;
8
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.stereotype.Service;
11
import org.springframework.util.CollectionUtils;
12
13
import com.ai.bss.characteristic.spec.model.CharacteristicSpec;
14
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
15
import com.ai.bss.characteristic.spec.service.api.CharacteristicSpecService;
16
import com.ai.bss.characteristic.spec.service.api.CharacteristicSpecValueService;
17
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
18
import com.ailk.org.apache.commons.lang3.StringUtils;
19
20
@Service
21
public class CharSpecServiceImpl implements CharSpecService {
22
23
	@Autowired
24
	private CharacteristicSpecService characteristicSpecService;
25
26
	@Autowired
27
	private CharacteristicSpecValueService characteristicSpecValueService;
28
29
	@Override
30
	public List<CharacteristicSpecValue> getCharSpecList(String charSpecCode) {
31
		if (StringUtils.isEmpty(charSpecCode)) {
32
			return new ArrayList<CharacteristicSpecValue>();
33
		}
34
35
		CharacteristicSpec characteristicSpec = characteristicSpecService.findBusinessSpecByCharSpecCode(charSpecCode);
36
		List<CharacteristicSpecValue> list = characteristicSpec.getCharacteristicSpecValues();
37
38
		if (CollectionUtils.isEmpty(list)) {
39
			return new ArrayList<CharacteristicSpecValue>();
40
		}
41
42
		return list;
43
	}
44
45
	@Override
46
	public Map<String, String> getCharSpecMap(String charSpecCode) {
47
		List<CharacteristicSpecValue> list = getCharSpecList(charSpecCode);
48
49
		Map<String, String> resultMap = new HashMap<String, String>();
50
		for (CharacteristicSpecValue characteristicSpecValue : list) {
51
			resultMap.put(characteristicSpecValue.getCode(), characteristicSpecValue.getValue());
52
		}
53
54
		return resultMap;
55
	}
56
57
	@Override
58
	public boolean saveCharSpecList(String charSpecCode, Map<String, String> dataMap) {
59
		List<CharacteristicSpecValue> characteristicSpecList = getCharSpecList(charSpecCode);
60
61
		if (CollectionUtils.isEmpty(dataMap) || CollectionUtils.isEmpty(characteristicSpecList)) {
62
			return false;
63
		}
64
65
		for (CharacteristicSpecValue characteristicSpecValue : characteristicSpecList) {
66
			Iterator<Map.Entry<String, String>> iter = dataMap.entrySet().iterator();
67
			while (iter.hasNext()) {
68
				Map.Entry<String, String> entry = iter.next();
69
				if (characteristicSpecValue.getCode().equals(entry.getKey())) {
70
					characteristicSpecValue.setValue(entry.getValue());
71
					break;
72
				}
73
			}
74
		}
75
76
		List<CharacteristicSpecValue> resultList = characteristicSpecValueService
77
				.saveCharacteristicSpecValue(characteristicSpecList);
78
		return resultList.size() > 0;
79
	}
80
}

+ 139 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/WorkOrderManagementServiceImpl.java

@ -0,0 +1,139 @@
1
package com.ai.bss.security.protection.service.impl;
2
3
import com.ai.abc.api.model.CommonRequest;
4
import com.ai.abc.api.model.CommonResponse;
5
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
6
import com.ai.bss.components.common.model.PageBean;
7
import com.ai.bss.security.protection.service.interfaces.CharSpecService;
8
import com.ai.bss.security.protection.service.interfaces.WorkOrderManagementService;
9
import com.ai.bss.security.protection.util.EbcConstant;
10
import com.ai.bss.work.attendance.service.api.ApprovalTaskQuery;
11
import com.alibaba.fastjson.JSONObject;
12
13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.stereotype.Service;
15
import org.springframework.util.CollectionUtils;
16
17
import java.util.ArrayList;
18
import java.util.HashMap;
19
import java.util.List;
20
import java.util.Map;
21
22
@Service
23
public class WorkOrderManagementServiceImpl implements WorkOrderManagementService {
24
25
    @Autowired
26
    private ApprovalTaskQuery approvalTaskQuery;
27
28
    @Autowired
29
    private CharSpecService charSpecService;
30
31
    @Override
32
    public CommonResponse<PageBean<Map<String, Object>>> queryPageWorkOrder(Map<String, String> params, int pageNumber,
33
                                                                            int pageSize) throws Exception {
34
        CommonRequest<Map<String, String>> request = new CommonRequest<Map<String, String>>(params, pageNumber,
35
                pageSize);
36
        CommonResponse<PageBean<Map<String, Object>>> response = approvalTaskQuery.queryApprovalTaskByConditions(request);
37
38
        List<Map<String, Object>> list = response.getData().getData();
39
        if (CollectionUtils.isEmpty(list)) {
40
            return response;
41
        }
42
43
        for (Map<String, Object> map : list) {
44
            JSONObject charValueJsonObj = JSONObject.parseObject(map.get("charValueSet").toString());
45
            map.put("applyBeginTime", charValueJsonObj.getString("beginTime"));
46
            map.put("applyEndTime", charValueJsonObj.getString("endTime"));
47
            map.put("applyDuration", charValueJsonObj.getString("duration"));
48
            map.put("charValueSet", null);
49
        }
50
51
        return response;
52
    }
53
54
    @Override
55
    public CommonResponse<Map<String, List<Map<String, String>>>> queryWorkOrderTypeList() {
56
        Map<String, List<Map<String, String>>> resultMap = new HashMap<String, List<Map<String, String>>>();
57
58
        List<CharacteristicSpecValue> allList = charSpecService
59
                .getCharSpecList(EbcConstant.BUSINESS_SPEC_WORK_ORDER_TYPE);
60
61
        List<Map<String, String>> allType = new ArrayList<Map<String, String>>(); // 所有工单小类
62
        List<Map<String, String>> askLeaveType = new ArrayList<Map<String, String>>(); // 请假
63
        List<Map<String, String>> fieldWorkType = new ArrayList<Map<String, String>>(); // 外勤
64
        List<Map<String, String>> recloType = new ArrayList<Map<String, String>>(); // 补卡
65
        List<Map<String, String>> overtimeType = new ArrayList<Map<String, String>>(); // 加班
66
67
        for (CharacteristicSpecValue charValue : allList) {
68
            Map<String, String> map = new HashMap<String, String>();
69
            String code = charValue.getCode();
70
            map.put("approvalType", code);
71
            map.put("approvalTypeName", charValue.getValue());
72
            allType.add(map);
73
74
            if (code.startsWith(EbcConstant.WORK_ORDER_TYPE_ASK_LEAVE)) {
75
                askLeaveType.add(map);
76
            } else if (code.startsWith(EbcConstant.WORK_ORDER_TYPE_FIELD_WORK)) {
77
                fieldWorkType.add(map);
78
            } else if (code.startsWith(EbcConstant.WORK_ORDER_TYPE_RECLOCK)) {
79
                recloType.add(map);
80
            } else if (code.startsWith(EbcConstant.WORK_ORDER_TYPE_OVERTIME)) {
81
                overtimeType.add(map);
82
            }
83
        }
84
85
        resultMap.put("allType", allType);
86
        resultMap.put("askLeaveType", askLeaveType);
87
        resultMap.put("fieldWorkType", fieldWorkType);
88
        resultMap.put("recloType", recloType);
89
        resultMap.put("overtimeType", overtimeType);
90
91
        return CommonResponse.ok(resultMap);
92
    }
93
94
    @Override
95
    public CommonResponse<Map<String, Object>> queryOneWorkOrder(Map<String, String> params) throws Exception {
96
        CommonRequest<Map<String, String>> conditionMapRequest = CommonRequest.<Map<String, String>>builder().data(params).build();
97
        CommonResponse<Map<String, Object>> response = approvalTaskQuery.queryApprovalTaskByWorkOrderId(conditionMapRequest);
98
99
100
        Map<String, Object> map = response.getData();
101
        if (CollectionUtils.isEmpty(map)) {
102
            return response;
103
        }
104
105
        JSONObject charValueJsonObj = JSONObject.parseObject(map.get("charValueSet").toString());
106
        map.put("applyBeginTime", charValueJsonObj.getString("beginTime"));
107
        map.put("applyEndTime", charValueJsonObj.getString("endTime"));
108
        map.put("applyDuration", charValueJsonObj.getString("duration"));
109
        map.put("charValueSet", null);
110
111
        return response;
112
    }
113
	
114
	
115
	
116
	
117
	
118
	
119
	
120
	
121
	
122
	
123
	
124
125
	/*@Override
126
	public CommonResponse<Void> addAlppyVacationInfo(WorkEvent workEvent) throws Throwable {
127
		CommonRequest<WorkEvent> eventRequest = new CommonRequest<WorkEvent>(workEvent);
128
		return eventHandleCommand.handleEvent(eventRequest);
129
	}
130
131
	@Override
132
	public CommonResponse<Void> checkAlppyVacationInfo(WorkEvent mapTagInfoDto) throws Exception {
133
		CommonResponse<WorkTask> resultProcessResult = workOrderCommand.reportWorkOrderResult(workOrderRequest);
134
135
		CommonRequest<MapTagInfoDto> param = new CommonRequest<MapTagInfoDto>(mapTagInfoDto);
136
		return mapAreaTagCommand.modifyMapAreaTag(param);
137
	}*/
138
139
}

+ 33 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/CharSpecService.java

@ -0,0 +1,33 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import java.util.List;
4
import java.util.Map;
5
6
import com.ai.bss.characteristic.spec.model.CharacteristicSpecValue;
7
8
public interface CharSpecService {
9
10
	/**
11
	 * 根据特征属性编码获取对应的属性值
12
	 * @param charSpecCode 特征属性编码
13
	 * @return
14
	 * @throws Exception
15
	 */
16
	List<CharacteristicSpecValue> getCharSpecList(String charSpecCode);
17
18
	/**
19
	 * 根据特征属性编码获取对应的属性值,并以code—>value的形式存放到Map中
20
	 * @param charSpecCode 特征属性编码
21
	 * @return
22
	 * @throws Exception
23
	 */
24
	Map<String, String> getCharSpecMap(String charSpecCode);
25
26
	/**
27
	 * 批量修改属性值
28
	 * @param charSpecCode 特征属性编码
29
	 * @param dataMap 需修改的数据(code—>value)
30
	 * @return
31
	 */
32
	boolean saveCharSpecList(String charSpecCode, Map<String, String> dataMap);
33
}

+ 67 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/WorkOrderManagementService.java

@ -0,0 +1,67 @@
1
package com.ai.bss.security.protection.service.interfaces;
2
3
import com.ai.abc.api.model.CommonResponse;
4
import com.ai.bss.components.common.model.PageBean;
5
6
import java.util.List;
7
import java.util.Map;
8
9
public interface WorkOrderManagementService {
10
11
	/**
12
	 * 分页查询工单信息
13
	 * @param params
14
	 * @param pageNumber 当前页数
15
	 * @param pageSize 每页条数
16
	 * @return
17
	 * @throws Exception
18
	 */
19
	CommonResponse<PageBean<Map<String, Object>>> queryPageWorkOrder(Map<String, String> params, int pageNumber, int pageSize) throws Exception;
20
21
	/**
22
	 * 获取所有工单类型
23
	 * 
24
	 * @return
25
	 */
26
	 CommonResponse<Map<String, List<Map<String, String>>>> queryWorkOrderTypeList();
27
	
28
	/**
29
	 * 获取单个工单信息
30
	 * @param params
31
	 * @return
32
	 * @throws Exception
33
	 */
34
	 CommonResponse<Map<String, Object>> queryOneWorkOrder(Map<String,String> params) throws Exception;
35
36
	
37
38
	
39
	
40
	
41
	
42
	
43
	
44
	
45
	
46
	
47
	
48
	
49
	
50
	
51
	/**
52
	 * 工单申请
53
	 * @param mapTagInfoDto
54
	 * @return
55
	 * @throws Exception
56
	 */
57
	//CommonResponse<Void> addAlppyVacationInfo(WorkEvent mapTagInfoDto) throws Throwable;
58
59
	/**
60
	 * 工单审核
61
	 * @param mapTagInfoDto
62
	 * @return
63
	 * @throws Exception
64
	 */
65
	//CommonResponse<Void> checkAlppyVacationInfo(WorkEvent mapTagInfoDto) throws Exception;
66
67
}

+ 15 - 1
security-protection-service/src/main/java/com/ai/bss/security/protection/util/EbcConstant.java

@ -22,7 +22,7 @@ public class EbcConstant {
22 22
	// 轨迹回放单次查询条数
23 23
	public static final int TRACK_PLAYBACK_SIZE = 100;
24 24
25
25
	
26 26
	// 考勤查询:日
27 27
	public static final String AREA_IN_OUT_RECORD_DAY = "day";
28 28
@ -33,5 +33,19 @@ public class EbcConstant {
33 33
	public static final String AREA_IN_OUT_RECORD_MONTH = "month";
34 34
35 35
	
36
	//静态常量: 工单类型
37
	public static final String BUSINESS_SPEC_WORK_ORDER_TYPE="WORK_ORDER_TYPE";
38
	
39
	//工单类型:请假
40
	public static final String WORK_ORDER_TYPE_ASK_LEAVE="ASK_LEAVE";
41
	
42
	//工单类型:外勤
43
	public static final String WORK_ORDER_TYPE_FIELD_WORK="FIELD_WORK";
44
	
45
	//工单类型:补卡
46
	public static final String WORK_ORDER_TYPE_RECLOCK="RECLO";
47
	
48
	//工单类型:加班
49
	public static final String WORK_ORDER_TYPE_OVERTIME="OVERTIME";
36 50
	
37 51
}