Commit 2f585aab authored by 廖旭伟's avatar 廖旭伟

修改综窗事项列表接口

parent 831ea89f
package com.mortals.xhx.system;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.common.keys.QueueKey;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@Component
@Primary
@Slf4j
public class MessageProducer implements IMessageProduceService {
@Autowired
private RabbitTemplate rabbitTemplate;
public void syncAccessSend(AccessLogPdu accessLogPdu) {
//new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8))
//rabbitTemplate.send(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE,new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8)));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
//rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
}
@Override
public void syncBizSend(BizLogPdu bizLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.BIZ_LOG_QUEUE, JSON.toJSONString(bizLogPdu));
}
@Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
}
@Override
public void syncOperSend(OperateLogPdu operLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
}
}
//package com.mortals.xhx.system;
//
//import com.alibaba.fastjson.JSON;
//import com.mortals.framework.model.AccessLogPdu;
//import com.mortals.framework.model.BizLogPdu;
//import com.mortals.framework.model.ErrorLogPdu;
//import com.mortals.framework.model.OperateLogPdu;
//import com.mortals.framework.service.IMessageProduceService;
//import com.mortals.xhx.common.keys.QueueKey;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Primary;
//import org.springframework.stereotype.Component;
//
////@Component
//@Primary
//@Slf4j
//public class MessageProducer implements IMessageProduceService {
//
// @Autowired
// private RabbitTemplate rabbitTemplate;
//
// public void syncAccessSend(AccessLogPdu accessLogPdu) {
// //new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8))
// //rabbitTemplate.send(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE,new Message(JSON.toJSONString(accessLogPdu).getBytes(StandardCharsets.UTF_8)));
//
// rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, JSON.toJSONString(accessLogPdu));
// //rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ACCESS_LOG_QUEUE, accessLogPdu);
// }
//
// @Override
// public void syncBizSend(BizLogPdu bizLogPdu) {
// rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.BIZ_LOG_QUEUE, JSON.toJSONString(bizLogPdu));
// }
//
// @Override
// public void syncErrorSend(ErrorLogPdu errorLogPdu) {
// rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
// }
//
// @Override
// public void syncOperSend(OperateLogPdu operLogPdu) {
// rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu));
// }
//
//}
......@@ -9,6 +9,8 @@ import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.busiz.req.ComplexImplementationReq;
import com.mortals.xhx.busiz.req.FindHandlingPageReq;
......@@ -32,6 +34,7 @@ import com.mortals.xhx.protocol.complex.matter.model.rsp.HandlingRspInfoList;
import lombok.extern.slf4j.Slf4j;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -39,7 +42,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collector;
import java.util.stream.Collectors;
......@@ -65,6 +70,7 @@ public class ComplexApiController {
@Autowired
private ApplyMatterService applyMatterService;
/**
* 事项列表查询
*
......@@ -76,33 +82,46 @@ public class ComplexApiController {
public String eventImplementationList(@RequestBody ComplexImplementationReq req) {
log.info("【事项列表查询】【请求体】--> " + JSONObject.toJSONString(req));
req.setUrlPath("eventImplementation/list");
ApiResp<String> rsp = new ApiResp<>();
ApiResp<Object> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
try {
req.setNonce(RandomUtil.randomNumbers(6));
cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
if (ObjectUtil.isEmpty(rest)) {
throw new AppException("请求访问超时");
}
Rest<ImplementEventInfo> eventListRest = JSON.parseObject(rest, new TypeReference<Rest<ImplementEventInfo>>() {
});
if(eventListRest.getCode()==1){
Integer applyType = req.getApplyType()==null?1:req.getApplyType();
List<ApplyMatterEntity> entityList = applyMatterService.find(new ApplyMatterQuery().applyType(applyType));
if(CollectionUtils.isNotEmpty(entityList)) {
Set<String> matter = entityList.stream().map(t -> t.getEventId()).collect(Collectors.toSet());
for (RecordsItem item : eventListRest.getData().getRecords()) {
if(matter.contains(item.getEventId())){
item.setEnableFlag(1);
}else {
item.setEnableFlag(0);
}
}
}
}
return JSON.toJSONString(eventListRest);
PageInfo pageInfo = new PageInfo(req.getPageSize());
pageInfo.setCurrPage(req.getCurrentPage());
ApplyMatterEntity query = new ApplyMatterEntity();
BeanUtils.copyProperties(req, query);
Result<ApplyMatterEntity> result = applyMatterService.find(query,pageInfo,null);
Map<String, Object> model = new HashMap();
model.put("records",result.getList());
model.put("current",result.getPageInfo().getCurrPage());
model.put("pages",result.getPageInfo().getTotalPage());
model.put("size",result.getPageInfo().getPrePageResult());
model.put("total",result.getPageInfo().getTotalResult());
rsp.setData(model);
// req.setNonce(RandomUtil.randomNumbers(6));
// cacheService.lpush(KEY_COMPLEX_REQ, JSONObject.toJSONString(req));
// String rest = cacheService.blpop(KEY_EVENT_IMPLEMENTATION_RESP + req.getNonce(), HTTP_TIMEOUT, String.class);
// if (ObjectUtil.isEmpty(rest)) {
// throw new AppException("请求访问超时");
// }
// Rest<ImplementEventInfo> eventListRest = JSON.parseObject(rest, new TypeReference<Rest<ImplementEventInfo>>() {
// });
// if(eventListRest.getCode()==1){
// Integer applyType = req.getApplyType()==null?1:req.getApplyType();
// List<ApplyMatterEntity> entityList = applyMatterService.find(new ApplyMatterQuery().applyType(applyType));
// if(CollectionUtils.isNotEmpty(entityList)) {
// Set<String> matter = entityList.stream().map(t -> t.getEventId()).collect(Collectors.toSet());
// for (RecordsItem item : eventListRest.getData().getRecords()) {
// if(matter.contains(item.getEventId())){
// item.setEnableFlag(1);
// }else {
// item.setEnableFlag(0);
// }
// }
// }
// }
return JSON.toJSONString(rsp);
} catch (Exception e) {
log.error("接收数据失败", e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue());
......
......@@ -10,46 +10,58 @@ import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.matter.model.vo.ApplyMatterVo;
import lombok.Data;
/**
* 申报事项列表实体对象
*
* @author zxfei
* @date 2024-06-20
*/
* 申报事项列表实体对象
*
* @author zxfei
* @date 2024-07-01
*/
@Data
public class ApplyMatterEntity extends ApplyMatterVo {
private static final long serialVersionUID = 1L;
/**
* 可申报类型
*/
* 可申报类型
*/
private Integer applyType;
/**
* 实施清单事项ID
*/
* 实施清单事项ID
*/
private String eventId;
/**
* 事项类型
*/
* 事项类型
*/
private String eventType;
/**
* 实施编码
*/
* 实施编码
*/
private String implementCoding;
/**
* 业务办理项编码
*/
* 业务办理项编码
*/
private String handlingItemCode;
/**
* 实施清单名称
*/
* 实施清单名称
*/
private String implementName;
/**
* 事项面向对象分类
*/
* 事项面向对象分类
*/
private String eventObjectType;
/**
* 是否纳入通办
*/
private String crossFlag;
/**
* 委托部门
*/
private Integer deptId;
/**
* 委托部门
*/
private String deptName;
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -57,19 +69,22 @@ public class ApplyMatterEntity extends ApplyMatterVo {
if (obj instanceof ApplyMatterEntity) {
ApplyMatterEntity tmp = (ApplyMatterEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
}
public void initAttrValue(){
this.applyType = 0;
this.eventId = "";
this.eventType = "";
this.implementCoding = "";
this.handlingItemCode = "";
this.implementName = "";
this.eventObjectType = "";
this.applyType = 0;
this.eventId = "";
this.eventType = "";
this.implementCoding = "";
this.handlingItemCode = "";
this.implementName = "";
this.eventObjectType = "";
this.crossFlag = "";
this.deptId = null;
this.deptName = "";
}
}
\ No newline at end of file
......@@ -10,42 +10,54 @@ import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.matter.model.vo.EventImplementationVo;
import lombok.Data;
/**
* 综窗事项列表实体对象
*
* @author zxfei
* @date 2024-06-20
*/
* 综窗事项列表实体对象
*
* @author zxfei
* @date 2024-07-01
*/
@Data
public class EventImplementationEntity extends EventImplementationVo {
private static final long serialVersionUID = 1L;
/**
* 实施清单事项ID
*/
* 实施清单事项ID
*/
private String eventId;
/**
* 事项类型
*/
* 事项类型
*/
private String eventType;
/**
* 实施编码
*/
* 实施编码
*/
private String implementCoding;
/**
* 业务办理项编码
*/
* 业务办理项编码
*/
private String handlingItemCode;
/**
* 实施清单名称
*/
* 实施清单名称
*/
private String implementName;
/**
* 事项面向对象分类
*/
* 事项面向对象分类
*/
private String eventObjectType;
/**
* 是否纳入通办
*/
private String crossFlag;
/**
* 委托部门
*/
private Integer deptId;
/**
* 委托部门
*/
private String deptName;
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -53,18 +65,21 @@ public class EventImplementationEntity extends EventImplementationVo {
if (obj instanceof EventImplementationEntity) {
EventImplementationEntity tmp = (EventImplementationEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
}
public void initAttrValue(){
this.eventId = "";
this.eventType = "";
this.implementCoding = "";
this.handlingItemCode = "";
this.implementName = "";
this.eventObjectType = "";
this.eventId = "";
this.eventType = "";
this.implementCoding = "";
this.handlingItemCode = "";
this.implementName = "";
this.eventObjectType = "";
this.crossFlag = "";
this.deptId = null;
this.deptName = "";
}
}
\ No newline at end of file
......@@ -20,6 +20,7 @@ import com.mortals.xhx.module.matter.model.ApplyMatterEntity;
import com.mortals.xhx.module.matter.model.EventImplementationQuery;
import com.mortals.xhx.module.matter.service.ApplyMatterService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
......@@ -169,12 +170,16 @@ public class EventImplementationServiceImpl extends AbstractCRUDServiceImpl<Even
for (EventImplementationEntity item:list){
ApplyMatterEntity applyMatterEntity = new ApplyMatterEntity();
applyMatterEntity.initAttrValue();
applyMatterEntity.setEventId(item.getEventId());
applyMatterEntity.setEventObjectType(item.getEventObjectType());
applyMatterEntity.setEventType(item.getEventType());
applyMatterEntity.setHandlingItemCode(item.getHandlingItemCode());
applyMatterEntity.setImplementName(item.getImplementName());
applyMatterEntity.setImplementCoding(item.getImplementCoding());
BeanUtils.copyProperties(item, applyMatterEntity);
// applyMatterEntity.setEventId(item.getEventId());
// applyMatterEntity.setEventObjectType(item.getEventObjectType());
// applyMatterEntity.setEventType(item.getEventType());
// applyMatterEntity.setHandlingItemCode(item.getHandlingItemCode());
// applyMatterEntity.setImplementName(item.getImplementName());
// applyMatterEntity.setImplementCoding(item.getImplementCoding());
// applyMatterEntity.setCrossFlag(item.getCrossFlag());
// applyMatterEntity.setDeptId(item.getDeptId());
// applyMatterEntity.setDeptName(item.getDeptName());
applyMatterEntity.setApplyType(entity.getApplyType());
applyMatterEntity.setCreateTime(new Date());
applyMatterEntity.setCreateUserId(userId);
......@@ -194,12 +199,16 @@ public class EventImplementationServiceImpl extends AbstractCRUDServiceImpl<Even
for (RecordsItem item:records){
EventImplementationEntity entity = new EventImplementationEntity();
entity.initAttrValue();
entity.setEventId(item.getEventId());
entity.setEventObjectType(item.getEventObjectType());
entity.setEventType(item.getEventType());
entity.setHandlingItemCode(item.getHandlingItemCode());
entity.setImplementName(item.getImplementName());
entity.setImplementCoding(item.getImplementCoding());
BeanUtils.copyProperties(item, entity);
// entity.setEventId(item.getEventId());
// entity.setEventObjectType(item.getEventObjectType());
// entity.setEventType(item.getEventType());
// entity.setHandlingItemCode(item.getHandlingItemCode());
// entity.setImplementName(item.getImplementName());
// entity.setImplementCoding(item.getImplementCoding());
// entity.setCrossFlag(item.getCrossFlag());
// entity.setDeptId(item.getDeptId());
// entity.setDeptName(item.getDeptName());
list.add(entity);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment