12bfaa8485c7078038a832d4eddfecf3bb4f0e7a.svn-base
7.81 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.act.web;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.activiti.engine.ActivitiTaskAlreadyClaimedException;
import org.activiti.engine.task.Task;
import org.activiti.tracelog.ActivitiLog;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.act.entity.Act;
import com.thinkgem.jeesite.modules.act.service.ActTaskService;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseHbhqk;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSlsq;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHbhqkService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusSlsqService;
import com.thinkgem.jeesite.modules.reg.web.bus.RegBusFzController;
import com.thinkgem.jeesite.modules.reg.web.bus.RegBusSlsqController;
import com.thinkgem.jeesite.modules.reg.web.httprest.utils.DatatypeUtil;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
import com.thinkgem.jeesite.modules.ycsl.entity.ywzt.YcslYwzt;
import com.thinkgem.jeesite.modules.ycsl.service.ywzt.YcslYwztService;
/**
* 流程批量处理Controller
*
* @author winner pan
* @version 2018-5-09
*/
@Controller
@RequestMapping(value = "${adminPath}/act/batchProcess")
public class ActBatchProcesssController extends BaseController {
@Autowired
private ActTaskService actTaskService;
@Autowired
private RegBusSlsqService regBusSlsqService;
@Autowired
private RegBusFzController RegBusFz;
@Autowired
private RegBusSlsqController regBusSlsqController;
@Autowired
private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
@Autowired
private RegBaseHbhqkService regBaseHbhqkService;
@Autowired
private RegBaseHService regBaseHService;
@Autowired
private YcslYwztService ycslYwztService;
/**
* 签收任务
*
* @param taskId
* 任务ID
*/
@RequestMapping(value = "exec")
@ResponseBody
public String exec(String taskIds, Model model, HttpServletRequest request) {
if(StringUtils.isEmpty(taskIds)){
return "请至少选择一条要审核的数据.";
}
//获取县区代码
String areaCode = Global.getAreaCode();
String ids[] = taskIds.split(",");
StringBuffer errorInfo = new StringBuffer();
//add point for trace the claim operation issue.
ActivitiLog.batchProcessThread.set(true);
for (String id : ids) {
// 读取regBusSlsq.act.taskDefKey
Task task = actTaskService.getTask(id);
if(task==null){
continue;
}
try {
String userId = UserUtils.getUser().getLoginName();// ObjectUtils.toString(UserUtils.getUser().getId());
// 如果被其他用户签收则报异常
// 第一步先签收
try{
actTaskService.claim(task.getId(), userId);
}catch(ActivitiTaskAlreadyClaimedException e){
errorInfo.append(task.getName()).append(":").append("已被他人签收.").append("\n");
continue;
}
task = actTaskService.getTask(id);
// reg_bus_sqsl:id
RegBusSlsq regBusSlsq = regBusSlsqService.getByProcInsId(task.getProcessInstanceId());
String audits = regBusSlsq.getTaskdefkey();
String YWH = regBusSlsq.getYwh();
ModelMap modelMap = RegBusFz.taskSubmit(YWH, audits);
if (!modelMap.get("success").toString().equals("1")) {
// 中断处理
errorInfo.append(task.getName()).append(":").append("流程提交失败.").append("\n");
continue;
}
Act act = regBusSlsq.getAct();
if (act == null) {
act = new Act();
regBusSlsq.setAct(act);
}
act.setFlag("yes");
act.setTaskId(task.getId());
act.setTaskName(task.getName());
act.setTaskDefKey(task.getTaskDefinitionKey());
act.setProcInsId(task.getProcessInstanceId());
act.setProcDefId(task.getProcessDefinitionId());
String commentText = "";
String reg_audits = task.getTaskDefinitionKey();
if ("reg_audit".equalsIgnoreCase(reg_audits)) {
if("610702".equals(areaCode) || "610725".equals(areaCode) || "610721".equals(areaCode) || "610727".equals(areaCode) || "610728".equals(areaCode)){
if(!regBusSlsq.getYwh().contains("X")){
commentText = "审核合格";
}else{
commentText = "初审合格";
}
}else{
commentText = "初审合格";
}
} else if ("reg_audit2".equals(reg_audits)) {
commentText = "复审合格";
} else if ("reg_audit3".equals(reg_audits)) {
commentText = "核定通过";
if("429".equals(regBusSlsq.getDjxl())){
qzx_429(regBusSlsq);
}
} else if ("reg_audit5".equals(reg_audits)) {
commentText = "缮证到收费";
} else if ("reg_audit56".equals(reg_audits)) {
commentText = "已收费";
} else if ("reg_audit6".equals(reg_audits)) {
commentText = "已发证";
} else if ("reg_end".equals(reg_audits)) {
commentText = "已归档";
}
act.setComment(commentText);
String returnStr = regBusSlsqController.saveAudit(regBusSlsq, model, request, regBusSlsq.getDjxl());
if(returnStr.indexOf("/act/task/todo/")<0){
errorInfo.append(task.getName()).append(":").append("保存审核失败").append("\n");
}
} catch (Exception e) {
if (super.logger.isDebugEnabled()) {
e.printStackTrace();
} else {
super.logger.error(e.getMessage());
}
errorInfo.append(task.getName()).append(":").append(e.getMessage())
.append("\n");
}
}
//add point for trace the claim operation issue.
ActivitiLog.batchProcessThread.set(false);
// 返回列表界面
return errorInfo.toString();
}
/**
* 期转现楼盘变更,批量审核提交才处理业务
* @param regBusSlsq
*/
public void qzx_429(RegBusSlsq regBusSlsq) {
String currentywh = regBusSlsq.getYwh();
RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
regBusBdcqzsdjxx.setYwh(currentywh);
List<RegBusBdcqzsdjxx> regBusBdcqzsdjxxList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
int count = regBusBdcqzsdjxxList.size();
if (count > 0) {
for (int j = 0; j < count; j++) {
RegBusBdcqzsdjxx regBusBdcqzsdjxxTemp = regBusBdcqzsdjxxList.get(j);
RegBaseHbhqk regBaseHbhqkT = new RegBaseHbhqk();
regBaseHbhqkT.setYwh(currentywh);
regBaseHbhqkT.setBdcdyh(regBusBdcqzsdjxxTemp.getBdcdyh());
List<RegBaseHbhqk> findHbhqkList = regBaseHbhqkService.findList(regBaseHbhqkT);
if (findHbhqkList.size() > 0) {
regBaseHbhqkT = findHbhqkList.get(0);
RegBaseH regBaseOldT = regBaseHService.get(regBaseHbhqkT.getOldhid());
String oldRights = regBaseOldT.getRights();
RegBaseH regBaseNewT = regBaseHService.get(regBaseHbhqkT.getHid());
regBaseNewT.setRights(oldRights);
regBaseNewT.setIsaudit(regBaseOldT.getIsaudit());
regBaseNewT.setIsdiya(regBaseOldT.getIsdiya());
regBaseNewT.setIschafeng(regBaseOldT.getIschafeng());
regBaseNewT.setIsyiyi(regBaseOldT.getIsyiyi());
regBaseHService.save(regBaseNewT);
regBaseOldT.setRights("3");
regBaseHService.save(regBaseOldT);
}
regBusBdcqzsdjxxTemp.setFzsj(DateUtils.getDate("yyyy-MM-dd"));
regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxTemp);// 更新发证时间是为了核定状态后解除业务占用
}
}
}
}