| | |
| | | import org.json.JSONObject; |
| | | import org.json.XML; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void handleWechatSendHistoryBySpNo(String spNo) { |
| | | if (StringUtils.isNotBlank(spNo)) { |
| | | WechatSendHistoryQueryCriteria criteria = new WechatSendHistoryQueryCriteria(); |
| | | criteria.setContentInnerLike(spNo); |
| | | List<WechatSendHistory> historyList = wechatSendHistoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (historyList.size() > 0) { |
| | | WechatSendHistory filterData = historyList.stream().filter(h -> h.getContent().startsWith("{\"ApprovalInfo\"")).findFirst().orElseGet(WechatSendHistory::new); |
| | | if (StringUtils.isNotBlank(filterData.getContent())) { |
| | | ChangeApprovalStatusEvent event = new ChangeApprovalStatusEvent(new Object(), filterData.getId()); |
| | | applicationEventPublisher.publishEvent(event); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断字符串是不是Json格式 |
| | | * |
| | |
| | | */ |
| | | private static void fixJsonStructure(JSONObject jsonObject) { |
| | | // 定义需要确保为列表的字段名 |
| | | String[] listFields = {"ProcessList", "NodeList", "Details", "Notifyer", "SubNodeList", "SpRecord" }; |
| | | String[] listFields = {"ProcessList", "NodeList", "Details", "Notifyer", "SubNodeList", "SpRecord", "Comments" }; |
| | | |
| | | for (String fieldName : listFields) { |
| | | if (jsonObject.has(fieldName)) { |