Tracking changes applied to app

This commit is contained in:
17hao
2021-02-07 15:16:26 +08:00
parent 832320abc6
commit c1afc07955
3 changed files with 18 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ public interface AppService {
* @param appDO appDO
* @return int
*/
ResultStatus addApp(AppDO appDO);
ResultStatus addApp(AppDO appDO, String operator);
/**
* 删除数据

View File

@@ -60,10 +60,8 @@ public class AppServiceImpl implements AppService {
@Autowired
private OperateRecordService operateRecordService;
@Override
public ResultStatus addApp(AppDO appDO) {
public ResultStatus addApp(AppDO appDO, String operator) {
try {
if (appDao.insert(appDO) < 1) {
LOGGER.warn("class=AppServiceImpl||method=addApp||AppDO={}||msg=add fail,{}",appDO,ResultStatus.MYSQL_ERROR.getMessage());
@@ -75,6 +73,15 @@ public class AppServiceImpl implements AppService {
kafkaUserDO.setOperation(OperationStatusEnum.CREATE.getCode());
kafkaUserDO.setUserType(0);
kafkaUserDao.insert(kafkaUserDO);
Map<String, String> content = new HashMap<>();
content.put("appId", appDO.getAppId());
content.put("name", appDO.getName());
content.put("applicant", appDO.getApplicant());
content.put("password", appDO.getPassword());
content.put("principals", appDO.getPrincipals());
content.put("description", appDO.getDescription());
operateRecordService.insert(operator, ModuleEnum.APP, appDO.getName(), OperateEnum.ADD, content);
} catch (DuplicateKeyException e) {
LOGGER.error("class=AppServiceImpl||method=addApp||errMsg={}||appDO={}|", e.getMessage(), appDO, e);
return ResultStatus.RESOURCE_ALREADY_EXISTED;
@@ -141,6 +148,12 @@ public class AppServiceImpl implements AppService {
appDO.setDescription(dto.getDescription());
if (appDao.updateById(appDO) > 0) {
Map<String, String> content = new HashMap<>();
content.put("appId", appDO.getAppId());
content.put("name", appDO.getName());
content.put("principals", appDO.getPrincipals());
content.put("description", appDO.getDescription());
operateRecordService.insert(operator, ModuleEnum.APP, appDO.getName(), OperateEnum.EDIT, content);
return ResultStatus.SUCCESS;
}
} catch (DuplicateKeyException e) {

View File

@@ -87,6 +87,6 @@ public class ApplyAppOrder extends AbstractAppOrder {
appDO.setDescription(orderDO.getDescription());
appDO.generateAppIdAndPassword(orderDO.getId(), configUtils.getIdc());
appDO.setType(0);
return appService.addApp(appDO);
return appService.addApp(appDO, userName);
}
}