Browse Source

统一日志导出接口

wangli 4 years ago
parent
commit
2d85e729cb

+ 0 - 13
smart-city-platform/src/main/java/com/bz/smart_city/controller/system/OperationLogController.java

@@ -67,17 +67,4 @@ public class OperationLogController {
     ) {
         operationLogService.getExcel(username,content, startDate, endDate, mobilephone, httpServletResponse);
     }
-
-    @GetMapping("/getPayfeeExcel")
-    @ApiOperation(value = "缴费操作日志导出excel")
-    public void getPayfeeExcel(
-            @ApiParam(value = "用户名", required = false) @RequestParam(required = false) String username,
-            @ApiParam(value = "操作内容", required = false) @RequestParam(required = false) String content,
-            @ApiParam(value = "手机号码", required = false) @RequestParam(required = false) String mobilephone,
-            @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime startDate,
-            @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate,
-            HttpServletResponse httpServletResponse
-    ) {
-        operationLogService.getPayfeeExcel(username,content, startDate, endDate, mobilephone, httpServletResponse);
-    }
 }

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dto/pay/payfee/PayfeeInvoicePrintDto.java

@@ -37,7 +37,7 @@ public class PayfeeInvoicePrintDto {
     private LocalDateTime printDate;
     @ApiModelProperty(value = "价税合计")
     private Double totalPrintAmount;
-    @ApiModelProperty(value = "发票状态 0:待生成 1:正常 2: 开票中(待生成) 3:已冲红 4:开票失败  5:已作废")
+    @ApiModelProperty(value = "发票状态: 0待生成  1 正常  3 已冲红  4 失败")
     private Integer state;
     @ApiModelProperty(value="发票状态")
     private String stateLabel;

+ 0 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/OperationLogService.java

@@ -21,8 +21,5 @@ public interface OperationLogService {
     void getExcel(String username,  String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
 
     void addMobileOperationLog(OperationLog operationLog);
-
-    void getPayfeeExcel(String username, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse);
-
 }
 

+ 9 - 28
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/OperationLogServiceImpl.java

@@ -98,35 +98,12 @@ public class OperationLogServiceImpl implements OperationLogService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, content, startDate, endDate,mobilephone);
         String title = "操作日志";
-        String[] rowsName = new String[]{"序号", "时间", "用户名","手机号", "操作", "操作前", "操作后"};
-        List<Object[]> dataList = newArrayList();
-        Object[] objs = null;
-        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        for (int i = 0; i < list.size(); i++) {
-            OperationLog operationLog = list.get(i);
-            objs = new Object[rowsName.length];
-            objs[0] = (i + 1);
-            objs[1] = operationLog.getCreateDate().format(df);
-            objs[2] = operationLog.getUsername();
-            objs[3] = operationLog.getMobilePhone();
-            objs[4] = operationLog.getOperationName();
-            objs[5] = operationLog.getOldData().replaceAll("&", ",\r\n");
-            objs[6] = operationLog.getNewData().replaceAll("&", ",\r\n");
-            dataList.add(objs);
+        String[] rowsName;
+        if(loginUser.getSiteType() != null && loginUser.getSiteType() == 2){
+            rowsName = new String[]{"序号", "操作时间", "用户名","手机号", "操作内容"};
+        }else{
+            rowsName= new String[]{"序号", "时间", "用户名","手机号", "操作", "操作前", "操作后"};
         }
-        ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);
-        try {
-            excelUtil.export(httpServletResponse);
-        } catch (Exception e) {
-            throw new ServiceException(-900, "导出异常");
-        }
-    }
-
-    public void getPayfeeExcel(String username, String content, LocalDateTime startDate, LocalDateTime endDate,String mobilephone, HttpServletResponse httpServletResponse) {
-        LoginUser loginUser = UserUtil.getCurrentUser();
-        List<OperationLog> list = operationLogMapper.getList(loginUser.getSiteId(), UserUtil.getCurrentSiteProgramItems(loginUser), username, content, startDate, endDate,mobilephone);
-        String title = "操作日志";
-        String[] rowsName = new String[]{"序号", "操作时间", "用户名","手机号", "操作内容"};
         List<Object[]> dataList = newArrayList();
         Object[] objs = null;
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -138,6 +115,10 @@ public class OperationLogServiceImpl implements OperationLogService {
             objs[2] = operationLog.getUsername();
             objs[3] = operationLog.getMobilePhone();
             objs[4] = operationLog.getOperationName();
+            if(loginUser.getSiteType() == null || loginUser.getSiteType() != 2) {
+                objs[5] = operationLog.getOldData().replaceAll("&", ",\r\n");
+                objs[6] = operationLog.getNewData().replaceAll("&", ",\r\n");
+            }
             dataList.add(objs);
         }
         ExcelUtil excelUtil = new ExcelUtil(title, rowsName, dataList);