Merge pull request #173 from 17hao/issue-153

Tracking changes applied to app
This commit is contained in:
EricZeng
2021-02-07 16:10:01 +08:00
committed by GitHub
3 changed files with 18 additions and 5 deletions

View File

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

View File

@@ -60,10 +60,8 @@ public class AppServiceImpl implements AppService {
@Autowired @Autowired
private OperateRecordService operateRecordService; private OperateRecordService operateRecordService;
@Override @Override
public ResultStatus addApp(AppDO appDO) { public ResultStatus addApp(AppDO appDO, String operator) {
try { try {
if (appDao.insert(appDO) < 1) { if (appDao.insert(appDO) < 1) {
LOGGER.warn("class=AppServiceImpl||method=addApp||AppDO={}||msg=add fail,{}",appDO,ResultStatus.MYSQL_ERROR.getMessage()); 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.setOperation(OperationStatusEnum.CREATE.getCode());
kafkaUserDO.setUserType(0); kafkaUserDO.setUserType(0);
kafkaUserDao.insert(kafkaUserDO); 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) { } catch (DuplicateKeyException e) {
LOGGER.error("class=AppServiceImpl||method=addApp||errMsg={}||appDO={}|", e.getMessage(), appDO, e); LOGGER.error("class=AppServiceImpl||method=addApp||errMsg={}||appDO={}|", e.getMessage(), appDO, e);
return ResultStatus.RESOURCE_ALREADY_EXISTED; return ResultStatus.RESOURCE_ALREADY_EXISTED;
@@ -141,6 +148,12 @@ public class AppServiceImpl implements AppService {
appDO.setDescription(dto.getDescription()); appDO.setDescription(dto.getDescription());
if (appDao.updateById(appDO) > 0) { 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; return ResultStatus.SUCCESS;
} }
} catch (DuplicateKeyException e) { } catch (DuplicateKeyException e) {

View File

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