批量申请处理
This commit is contained in:
parent
5b88c15aca
commit
0f9b368e53
|
@ -29,9 +29,11 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门动态审批人 v2
|
* 部门动态审批人 v2
|
||||||
|
@ -61,6 +63,8 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
||||||
@Autowired
|
@Autowired
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
@Autowired
|
||||||
private TAbilityApplicationService tAbilityApplicationService;
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,31 +131,16 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
||||||
if (kv.containsKey("tAbilityApplicationDTOList")) {
|
if (kv.containsKey("tAbilityApplicationDTOList")) {
|
||||||
dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
|
dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
|
||||||
}
|
}
|
||||||
|
String[] sqls;
|
||||||
if (auditingBaseDTO.getReject() != null && auditingBaseDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
|
if (auditingBaseDTO.getReject() != null && auditingBaseDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
|
||||||
|
sqls = dtoList.stream().map(i -> String.format("UPDATE t_ability_application SET del_flag = 0,approve_status = '不通过' WHERE id = %s", i.getId()))
|
||||||
|
.collect(Collectors.toList()).toArray(new String[dtoList.size()]);
|
||||||
} else {
|
} else {
|
||||||
|
sqls = dtoList.stream().map(i -> String.format("UPDATE t_ability_application SET del_flag = 0,approve_status = '通过' WHERE id = %s", i.getId()))
|
||||||
|
.collect(Collectors.toList()).toArray(new String[dtoList.size()]);
|
||||||
}
|
}
|
||||||
|
jdbcTemplate.batchUpdate(sqls);
|
||||||
}
|
}
|
||||||
|
|
||||||
// builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
|
||||||
//
|
|
||||||
// Gson gson = builder.create();
|
|
||||||
// JsonElement jsonElement = gson.toJsonTree(kv);
|
|
||||||
// TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
|
||||||
// if (abilityApplicationDTO != null) {
|
|
||||||
// if (abilityApplicationDTO.getReject() != null && abilityApplicationDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
|
|
||||||
// abilityApplicationDTO.setDelFlag(0);
|
|
||||||
// abilityApplicationDTO.setApproveStatus("不通过");
|
|
||||||
// tAbilityApplicationService.update(abilityApplicationDTO);
|
|
||||||
// logger.error("审批不通过!申请id:" + abilityApplicationDTO.getId());
|
|
||||||
// } else {
|
|
||||||
// abilityApplicationDTO.setDelFlag(0);
|
|
||||||
// abilityApplicationDTO.setApproveStatus("通过");
|
|
||||||
// tAbilityApplicationService.update(abilityApplicationDTO);
|
|
||||||
// logger.error("审批通过!申请id:" + abilityApplicationDTO.getId());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +188,7 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
||||||
try {
|
try {
|
||||||
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
logger.error("流程参数异常" + JSON.toJSONString(kv));
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
logger.error("", exception);
|
logger.error("流程参数异常", exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -222,13 +211,13 @@ public class CorrectionListenerV2 implements TaskListener, ExecutionListener, Ac
|
||||||
if (kv.get("gatewayCode") != null ||
|
if (kv.get("gatewayCode") != null ||
|
||||||
!ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) return;
|
!ActTaskService.Task_HANDLE_STATE_AGREE.equals(kv.get(ActTaskService.Task_HANDLE_STATE))) return;
|
||||||
try {
|
try {
|
||||||
GsonBuilder builder = new GsonBuilder();
|
List<TAbilityApplicationDTO> dtoList = new ArrayList<>();
|
||||||
builder.registerTypeAdapter(Date.class, (JsonDeserializer<Date>) (json, typeOfT, context) -> new Date(json.getAsJsonPrimitive().getAsLong()));
|
if (kv.containsKey("tAbilityApplicationDTOList")) {
|
||||||
|
dtoList = (List<TAbilityApplicationDTO>) kv.get("tAbilityApplicationDTOList");
|
||||||
Gson gson = builder.create();
|
}
|
||||||
JsonElement jsonElement = gson.toJsonTree(kv);
|
dtoList.stream().forEach(index -> {
|
||||||
TAbilityApplicationDTO abilityApplicationDTO = gson.fromJson(jsonElement, TAbilityApplicationDTO.class);
|
applyCode(delegateTask, index); // 列表内都执行
|
||||||
applyCode(delegateTask, abilityApplicationDTO);
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getLocalizedMessage(), e);
|
logger.error(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue