Browse Source

添加操作日志

houweiyu 4 years ago
parent
commit
fba82ac846

+ 6 - 1
src/main/java/fcb/project/manager/core/controller/AuditController.java

@@ -240,6 +240,11 @@ public class AuditController extends BaseController{
                     if(null != rsp){
                         log.info("code = {} , msg = {}" , rsp.getCode() , rsp.getMsg());
                     }
+                    int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "审核管理/审核下线/" + tmHouse.getHouseTitle() + "-失败");
+                    if(ins != 1){
+                        log.info("插入操作记录失败");
+                        throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+                    }
                     throw new CommonBaseException(ResultCodeEnum.D101 , "更新看看场景状态失败");
                 }
 
@@ -247,7 +252,7 @@ public class AuditController extends BaseController{
             //通知720,告知房源下线(审核通过/上线:4, 下线:3)
             panoService.noticeVrAuditStatus(tmHouse.getId() , getToken() , 3);
 
-            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "审核管理/审核下线/" + tmHouse.getHouseTitle() );
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "审核管理/审核下线/" + tmHouse.getHouseTitle() + "-成功");
             if(ins != 1){
                 log.info("插入操作记录失败");
                 throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");

+ 48 - 2
src/main/java/fcb/project/manager/core/controller/HouseManagerController.java

@@ -266,11 +266,21 @@ public class HouseManagerController extends BaseController{
         String outPutImageResultPath = imageLocalPath + outPutImageName;
         try {
             if(!DataUtils.createQRCode(totalVrUrl ,  outPutImageResultPath , totalFile)){
+                int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "更新VR项目分享二维码/" + tmHouse.getHouseTitle() + "-失败");
+                if(ins != 1){
+                    log.info("插入操作记录失败");
+                    throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+                }
                 return Result.failure("生成分享二维码失败");
             }
         } catch (Exception e) {
             e.printStackTrace();
             log.info("生成分享二维码出现异常");
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "更新VR项目分享二维码/" + tmHouse.getHouseTitle() + "-异常");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("生成分享二维码出现异常");
         }
         String resultOssPath = ossPath + outPutImageName;
@@ -284,6 +294,12 @@ public class HouseManagerController extends BaseController{
         }
         tmHouseService.updateHouse(tmHouse);
 
+        int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "更新VR项目分享二维码/" + tmHouse.getHouseTitle() + "-成功");
+        if(ins != 1){
+            log.info("插入操作记录失败");
+            throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+        }
+
         Map<String , Object> resultMap = new HashMap<>();
         resultMap.put("QrCode" , totalOssQueryPath);
         resultMap.put("vrLink" , totalVrUrl);
@@ -420,8 +436,18 @@ public class HouseManagerController extends BaseController{
 
         int delete = tmHouseService.deleteHouseById(houseId);
         if(delete != 1){
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "删除VR项目/" + dbHouse.getHouseTitle() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("删除失败");
         }
+        int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "删除VR项目/" + dbHouse.getHouseTitle() + "-成功");
+        if(ins != 1){
+            log.info("插入操作记录失败");
+            throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+        }
         List<String> sceneNumList = panoService.getKanKanSceneNums(dbHouse.getId() , getToken());
         log.info("720返回的房源的[{}]对应的四维场景码列表为:{}" , dbHouse.getId() , JSON.toJSONString(sceneNumList));
         if(!CollectionUtils.isEmpty(sceneNumList)){
@@ -476,8 +502,18 @@ public class HouseManagerController extends BaseController{
             tmHouse.setInnerVrLink(innerHostVrLink);
         }
         if(tmHouseService.updateHouse(tmHouse)){
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "更新VR项目/" + dbHouse.getHouseTitle() + "-成功");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.success("修改成功");
         }else{
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "更新VR项目/" + dbHouse.getHouseTitle() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("修改失败");
         }
     }
@@ -526,7 +562,7 @@ public class HouseManagerController extends BaseController{
                 log.info("更新房源的审批id失败");
                 throw new CommonBaseException(ResultCodeEnum.D101 , "更新房源的审批记录失败");
             }
-            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "审核管理/提交审核/" + dbHouse.getHouseTitle() );
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "提交审核/" + dbHouse.getHouseTitle() + "-成功");
             if(ins != 1){
                 log.info("插入操作记录失败");
                 throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
@@ -536,6 +572,11 @@ public class HouseManagerController extends BaseController{
             map.put("auditId" , tmAudit.getId());
            return Result.success(map);
         }else{
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "提交审核/" + dbHouse.getHouseTitle() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("提交失败");
         }
     }
@@ -587,6 +628,11 @@ public class HouseManagerController extends BaseController{
         dbHouse.setAuditTime(null);
         dbHouse.setStatus(HouseStatus.DRAFT.getCode());
         if(!tmHouseService.updateHouse(dbHouse)){
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "撤销审核/" + dbHouse.getHouseTitle() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             throw new CommonBaseException(ResultCodeEnum.D101 , "撤销房源的审批记录失败");
         }
 
@@ -595,7 +641,7 @@ public class HouseManagerController extends BaseController{
             throw new CommonBaseException(ResultCodeEnum.D101 , "删除审批记录失败");
         }
 
-        int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "审核管理/撤销审核/" + dbHouse.getHouseTitle() );
+        int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "审核管理" , "撤销审核/" + dbHouse.getHouseTitle() + "-成功");
         if(ins != 1){
             log.info("插入操作记录失败");
             throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");

+ 39 - 0
src/main/java/fcb/project/manager/core/controller/ProjectController.java

@@ -8,6 +8,7 @@ import fcb.project.manager.base.entity.TmHouse;
 import fcb.project.manager.base.service.custom.PanoService;
 import fcb.project.manager.base.service.impl.TmEstateServiceImpl;
 import fcb.project.manager.base.service.impl.TmHouseServiceImpl;
+import fcb.project.manager.base.service.impl.TmOperationServiceImpl;
 import fcb.project.manager.base.utils.DataUtils;
 import fdage.back.sdk.base.entity.Result;
 import fdage.back.sdk.base.enums.ResultCodeEnum;
@@ -49,6 +50,10 @@ public class ProjectController extends BaseController {
     @Autowired
     private PanoService panoService;
 
+    @Autowired
+    private TmOperationServiceImpl tmOperationService;
+
+
     @GetMapping("/queryOrSearchList")
     @ApiOperation(value = "根据条件拉取所有楼盘")
     @ApiImplicitParams({
@@ -87,8 +92,18 @@ public class ProjectController extends BaseController {
             tmEstate.setCreateByName(tokenMap.getNickName());
         }
         if (tmEstateService.insertNew(tmEstate)) {
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "创建楼盘/" + dbEstate.getEstateName() + "-成功");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.success("新增成功");
         } else {
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "创建楼盘/" + dbEstate.getEstateName() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("新增失败");
         }
     }
@@ -100,6 +115,10 @@ public class ProjectController extends BaseController {
         if (StringUtils.isBlank(estateId)) {
             return Result.failure("楼盘ID不能为空");
         }
+        TmEstate dbEstate = tmEstateService.getById(estateId);
+        if(null == dbEstate){
+            return Result.failure("楼盘不存在");
+        }
 
         IPage<TmHouse> page = tmHouseService.checkEstateCanDelete(estateId);
         if (null != page && page.getTotal() > 0) {
@@ -119,8 +138,18 @@ public class ProjectController extends BaseController {
         }
         int delete = tmEstateService.deleteEstateById(estateId);
         if (delete != 1) {
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "删除楼盘/" + dbEstate.getEstateName() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("删除失败");
         }
+        int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "删除楼盘/" + dbEstate.getEstateName() + "-成功");
+        if(ins != 1){
+            log.info("插入操作记录失败");
+            throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+        }
 
         return Result.success("删除楼盘成功");
 
@@ -142,8 +171,18 @@ public class ProjectController extends BaseController {
 
         }
         if (tmEstateService.updateEstate(tmEstate)) {
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "修改楼盘/" + dbEstate.getEstateName() + "-成功");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.success("修改成功");
         } else {
+            int ins = tmOperationService.addNewWithTypeAndContent(getContextUserInfo() , "VR楼盘项目" , "修改楼盘/" + dbEstate.getEstateName() + "-失败");
+            if(ins != 1){
+                log.info("插入操作记录失败");
+                throw new CommonBaseException(ResultCodeEnum.D101 , "插入操作记录失败");
+            }
             return Result.failure("修改失败");
         }
     }