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

添加服务检测拉起脚本

parent 24e332fa
...@@ -9,6 +9,7 @@ import com.mortals.framework.model.Context; ...@@ -9,6 +9,7 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.access.dao.AccessLogDao; import com.mortals.xhx.module.access.dao.AccessLogDao;
import com.mortals.xhx.module.access.model.AccessLogEntity; import com.mortals.xhx.module.access.model.AccessLogEntity;
import com.mortals.xhx.module.access.service.AccessLogService; import com.mortals.xhx.module.access.service.AccessLogService;
import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -27,6 +28,11 @@ public class AccessLogServiceImpl extends AbstractCRUDServiceImpl<AccessLogDao, ...@@ -27,6 +28,11 @@ public class AccessLogServiceImpl extends AbstractCRUDServiceImpl<AccessLogDao,
@Override @Override
public AccessLogEntity save(AccessLogEntity entity, Context context) throws AppException { public AccessLogEntity save(AccessLogEntity entity, Context context) throws AppException {
entity.setId(IdUtil.getSnowflake(0, 1).nextId()); entity.setId(IdUtil.getSnowflake(0, 1).nextId());
if(ObjectUtils.isEmpty(entity.getCreateUserId())){
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
}
return super.save(entity, context); return super.save(entity, context);
} }
......
...@@ -9,6 +9,7 @@ import com.mortals.framework.model.Context; ...@@ -9,6 +9,7 @@ import com.mortals.framework.model.Context;
import com.mortals.xhx.module.biz.dao.BizLogDao; import com.mortals.xhx.module.biz.dao.BizLogDao;
import com.mortals.xhx.module.biz.model.BizLogEntity; import com.mortals.xhx.module.biz.model.BizLogEntity;
import com.mortals.xhx.module.biz.service.BizLogService; import com.mortals.xhx.module.biz.service.BizLogService;
import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -24,7 +25,22 @@ import java.util.List; ...@@ -24,7 +25,22 @@ import java.util.List;
public class BizLogServiceImpl extends AbstractCRUDServiceImpl<BizLogDao, BizLogEntity, Long> implements BizLogService { public class BizLogServiceImpl extends AbstractCRUDServiceImpl<BizLogDao, BizLogEntity, Long> implements BizLogService {
@Override
public BizLogEntity save(BizLogEntity entity, Context context) throws AppException {
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
if(ObjectUtils.isEmpty(entity.getCreateUserId())){
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
}
return super.save(entity, context);
}
// @Override
// public int save(List<BizLogEntity> list, Context context) throws AppException {
// list.forEach(item->item.setId(IdUtil.getSnowflake(0, 1).nextId()));
// return super.save(list, context);
// }
@Override @Override
public BizLogEntity get(Long key, Context context) throws AppException { public BizLogEntity get(Long key, Context context) throws AppException {
......
...@@ -57,10 +57,6 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe ...@@ -57,10 +57,6 @@ public class BizLogController extends BaseCRUDJsonBodyMappingController<BizLogSe
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody BizLogEntity entity) { public String save(@RequestBody BizLogEntity entity) {
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
...@@ -25,6 +25,18 @@ import java.util.List; ...@@ -25,6 +25,18 @@ import java.util.List;
*/ */
@Service("errorLogService") @Service("errorLogService")
public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService { public class ErrorLogServiceImpl extends AbstractCRUDServiceImpl<ErrorLogDao, ErrorLogEntity, Long> implements ErrorLogService {
@Override
protected void saveBefore(ErrorLogEntity entity, Context context) throws AppException {
//判断当前是否有重复的
//非系统自增,需这里设置主键
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
if(ObjectUtils.isEmpty(entity.getCreateUserId())){
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
}
super.saveBefore(entity, context);
}
@Override @Override
public int save(List<ErrorLogEntity> list, Context context) throws AppException { public int save(List<ErrorLogEntity> list, Context context) throws AppException {
......
...@@ -60,10 +60,6 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL ...@@ -60,10 +60,6 @@ public class ErrorLogController extends BaseCRUDJsonBodyMappingController<ErrorL
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody ErrorLogEntity entity) { public String save(@RequestBody ErrorLogEntity entity) {
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
...@@ -25,6 +25,18 @@ import java.util.List; ...@@ -25,6 +25,18 @@ import java.util.List;
@Service("operateLogService") @Service("operateLogService")
public class OperateLogServiceImpl extends AbstractCRUDServiceImpl<OperateLogDao, OperateLogEntity, Long> implements OperateLogService { public class OperateLogServiceImpl extends AbstractCRUDServiceImpl<OperateLogDao, OperateLogEntity, Long> implements OperateLogService {
@Override
public OperateLogEntity save(OperateLogEntity entity, Context context) throws AppException {
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
if(ObjectUtils.isEmpty(entity.getCreateUserId())){
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
}
return super.save(entity, context);
}
@Override @Override
public int save(List<OperateLogEntity> list, Context context) throws AppException { public int save(List<OperateLogEntity> list, Context context) throws AppException {
list.forEach(item -> item.setId(IdUtil.getSnowflake(0, 1).nextId())); list.forEach(item -> item.setId(IdUtil.getSnowflake(0, 1).nextId()));
......
package com.mortals.xhx.module.operate.web; package com.mortals.xhx.module.operate.web;
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.OrderCol; import com.mortals.framework.model.OrderCol;
...@@ -60,10 +59,6 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper ...@@ -60,10 +59,6 @@ public class OperateLogController extends BaseCRUDJsonBodyMappingController<Oper
@Override @Override
@UnAuth @UnAuth
public String save(@RequestBody OperateLogEntity entity) { public String save(@RequestBody OperateLogEntity entity) {
entity.setId(IdUtil.getSnowflake(0, 1).nextId());
entity.setCreateUserId(1L);
entity.setCreateUserName("system");
entity.setCreateTime(new Date());
return super.save(entity); return super.save(entity);
} }
} }
\ No newline at end of file
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