Commit af356211 authored by 赵啸非's avatar 赵啸非

修改接口访问异步消息保存

parent 9a1ba74b
...@@ -76,6 +76,7 @@ public class AccessLogController extends BaseCRUDJsonBodyMappingController<Acces ...@@ -76,6 +76,7 @@ public class AccessLogController extends BaseCRUDJsonBodyMappingController<Acces
AccessLogPdu accessLogPdu = new AccessLogPdu(); AccessLogPdu accessLogPdu = new AccessLogPdu();
accessLogPdu.initAttrValue(); accessLogPdu.initAttrValue();
BeanUtils.copyProperties(entity, accessLogPdu, BeanUtil.getNullPropertyNames(entity)); BeanUtils.copyProperties(entity, accessLogPdu, BeanUtil.getNullPropertyNames(entity));
messageProducer.syncAccessSend(accessLogPdu);
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put("code", VALUE_RESULT_SUCCESS); ret.put("code", VALUE_RESULT_SUCCESS);
return ret.toJSONString(); return ret.toJSONString();
......
...@@ -3,9 +3,14 @@ import cn.hutool.core.codec.Base64; ...@@ -3,9 +3,14 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.system.MessageProducer;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -38,6 +43,9 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe ...@@ -38,6 +43,9 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private MessageProducer messageProducer;
public BizLogController(){ public BizLogController(){
super.setModuleDesc( "业务日志"); super.setModuleDesc( "业务日志");
} }
...@@ -66,7 +74,15 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe ...@@ -66,7 +74,15 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody BizLogEntity entity) { public String save(@RequestBody BizLogEntity entity) {
return super.save(entity); BizLogPdu bizLogPdu = new BizLogPdu();
bizLogPdu.initAttrValue();
BeanUtils.copyProperties(entity, bizLogPdu, BeanUtil.getNullPropertyNames(entity));
messageProducer.syncBizSend(bizLogPdu);
JSONObject ret = new JSONObject();
ret.put("code", VALUE_RESULT_SUCCESS);
return ret.toJSONString();
// return super.save(entity);
} }
......
...@@ -4,10 +4,14 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -4,10 +4,14 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.OperTypeEnum; import com.mortals.xhx.common.code.OperTypeEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.system.MessageProducer;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -47,6 +51,9 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -47,6 +51,9 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private MessageProducer messageProducer;
public OperateLogController() { public OperateLogController() {
super.setModuleDesc("平台用户操作日志业务"); super.setModuleDesc("平台用户操作日志业务");
} }
...@@ -70,7 +77,15 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -70,7 +77,15 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody OperateLogEntity entity) { public String save(@RequestBody OperateLogEntity entity) {
return super.save(entity); OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue();
BeanUtils.copyProperties(entity, operateLogPdu, BeanUtil.getNullPropertyNames(entity));
messageProducer.syncOperSend(operateLogPdu);
JSONObject ret = new JSONObject();
ret.put("code", VALUE_RESULT_SUCCESS);
return ret.toJSONString();
//return super.save(entity);
} }
public static void main(String[] args) throws JsonProcessingException { public static void main(String[] args) throws JsonProcessingException {
......
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