lfj 3 years ago
parent
commit
560e3a524c

+ 27 - 0
fjs-scenic-entity/src/main/java/com/fjs/scenic/dto/InputInfoPageParam.java

@@ -0,0 +1,27 @@
+package com.fjs.scenic.dto;
+
+import com.fjs.scenic.BasePage;
+import lombok.Data;
+import org.springframework.data.domain.Page;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+ * @program: fjs-parent
+ * @description: 日报统计基础信息查询条件
+ * @author: lfj
+ * @since: 2021-09-30 16:31
+ **/
+
+@Data
+public class InputInfoPageParam {
+    private String startCreateTime;
+    private String endtCreateTime;
+    private String startStaticDate;
+    private String endStaticDate;
+    private List<String> scenics;
+    private String manager;
+    private Integer pageSize = 10;
+    private Integer currentPage = 1;
+}

+ 4 - 0
fjs-scenic-entity/src/main/java/com/fjs/scenic/entity/system/InputInfo.java

@@ -44,5 +44,9 @@ public class InputInfo implements Serializable {
      * 创建时间
      */
     private LocalDate createTime;
+    /**
+     * 上传人
+     */
+    private String manager;
 
 }

+ 5 - 0
fjs-scenic-manager/pom.xml

@@ -91,6 +91,11 @@
 			<artifactId>log4j</artifactId>
 			<version>1.2.17</version>
 		</dependency>
+		<dependency>
+			<groupId>cn.hutool</groupId>
+			<artifactId>hutool-all</artifactId>
+			<version>5.7.13</version>
+		</dependency>
 	</dependencies>
 	<build>
 		<finalName>manager</finalName>

+ 26 - 2
fjs-scenic-manager/src/main/java/com/fjs/scenic/controller/system/InputInfoController.java

@@ -1,8 +1,12 @@
 package com.fjs.scenic.controller.system;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjs.scenic.controller.common.BaseController;
 import com.fjs.scenic.dto.InputInfoDto;
+import com.fjs.scenic.dto.InputInfoPageParam;
 import com.fjs.scenic.entity.system.InpIncome;
 import com.fjs.scenic.entity.system.InputInfo;
 import com.fjs.scenic.entity.system.Manage;
@@ -23,6 +27,7 @@ import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
+import javax.validation.Valid;
 import java.security.Principal;
 import java.time.LocalDate;
 import java.util.Date;
@@ -42,6 +47,8 @@ public class InputInfoController {
     private InputInfoService inputInfoService;
     @Autowired
     private InpIncomeService inpIncomeService;
+    @Autowired
+    private ManageServiceImpl manageService;
 
     @GetMapping("/index")
     public ModelAndView sceniclist() {
@@ -50,15 +57,18 @@ public class InputInfoController {
 
     @PostMapping("/add")
     @Transactional(rollbackFor = Exception.class)
-    public ReturnResult add(@RequestBody List<InputInfoDto> inputInfoDtos) {
+    public ReturnResult add(@Valid @RequestBody List<InputInfoDto> inputInfoDtos, Principal principal) {
+        String account = principal.getName();
+        Manage manage = manageService.getMangerByAccount(account);
         for (InputInfoDto inputInfoDto : inputInfoDtos) {
             inputInfoDto.setCreateTime(LocalDate.now());
+            inputInfoDto.setManager(manage.getName());
             int sum = inputInfoService.count(new LambdaQueryWrapper<InputInfo>()
                     .eq(InputInfo::getStaticDate, inputInfoDto.getStaticDate())
                     .eq(InputInfo::getScenic, inputInfoDto.getScenic()));
             Assert.isTrue(sum == 0, "请勿重复添加");
             inputInfoService.save(inputInfoDto);
-            if (inputInfoDto.getIncome()!=null){
+            if (inputInfoDto.getIncome() != null) {
                 for (InpIncome inpIncome : inputInfoDto.getIncome()) {
                     inpIncome.setInputInfoId(inputInfoDto.getId());
                     inpIncomeService.save(inpIncome);
@@ -68,4 +78,18 @@ public class InputInfoController {
         return ReturnResult.ok();
     }
 
+    @PostMapping("/page")
+    public ReturnResult page(@RequestBody InputInfoPageParam param) {
+        return ReturnResult.ok(inputInfoService
+                .page(new Page<>(param.getCurrentPage(), param.getPageSize()), new LambdaQueryWrapper<InputInfo>()
+                        .gt(ObjectUtil.isNotEmpty(param.getStartCreateTime()), InputInfo::getCreateTime, param.getStartCreateTime())
+                        .le(ObjectUtil.isNotEmpty(param.getEndtCreateTime()), InputInfo::getCreateTime, param.getEndtCreateTime())
+                        .gt(ObjectUtil.isNotEmpty(param.getStartStaticDate()), InputInfo::getStaticDate, param.getStartStaticDate())
+                        .le(ObjectUtil.isNotEmpty(param.getEndStaticDate()), InputInfo::getStaticDate, param.getEndStaticDate())
+                        .in(ObjectUtil.isNotEmpty(param.getScenics()), InputInfo::getScenic, param.getScenics())
+                        .eq(ObjectUtil.isNotEmpty(param.getManager()), InputInfo::getManager, param.getManager())
+                )
+        );
+    }
+
 }

+ 13 - 15
fjs-scenic-manager/src/main/resources/templates/system/inputInfo.html

@@ -14,7 +14,7 @@
             <!-- Content Header (Page header) -->
             <section class="content-header">
                 <h1>
-                    统计信息录入
+                    统计信息录入1
                     <small>Optional description</small>
                 </h1>
                 <ol class="breadcrumb">
@@ -456,6 +456,7 @@
                 }
             },
             mounted: function () {
+                console.log(1);
                 this.loadTable1();
             },
             methods: {
@@ -474,7 +475,7 @@
                         cancelButtonText: '取消',
                         type: 'warning'
                     }).then(() => {
-                        $.dyAjax('/manage/freezeUnfreeza', { id: id, status: stutes }, function (data) {
+                        $.dyAjax('/inputInfo/freezeUnfreeza', { id: id, status: stutes }, function (data) {
                             _this.$message({ message: '操作成功', type: 'success' });
                             _this.loadTable1();
                         });
@@ -484,7 +485,7 @@
                 //编辑
                 table1Edit(index, row) {
                     let _this = this;
-                    $.dyAjax('/manage/get/' + row.id, {}, function (data) {
+                    $.dyAjax('/inputInfo/get/' + row.id, {}, function (data) {
                         _this.editData = data;
                         _this.dialog2Visible = true;
                         console.log(data);
@@ -526,12 +527,9 @@
                                         _this.dialog1Visible = false;
                                     });
                                 } else {
-                                    _this.loadTable1(function () {
-                                        _this.$message({
-                                            message: data.msg,
-                                            type: 'error'
-                                        });
-                                        _this.dialog1Visible = false;
+                                    _this.$message({
+                                        message: data.msg,
+                                        type: 'error'
                                     });
                                 }
                             });
@@ -543,13 +541,13 @@
                 //加载表数据
                 loadTable1: function (callback) {
                     var _this = this;
-                    $.dyAjax('/manage/page1', this.con, function (data) {
+                    $.dyjAjax('/inputInfo/page', this.con, function (data) {
                         callback && callback(data);
                         console.log(data)
-                        _this.tableData = data.list;
+                        _this.tableData = data.records;
                         _this.con.total = data.total;
-                        _this.con.currentPage = data.pageNum;
-                        _this.con.pageSize = data.pageSize;
+                        _this.con.currentPage = data.current;
+                        _this.con.pageSize = data.size;
                     });
                 },
                 //删除
@@ -561,7 +559,7 @@
                         cancelButtonText: '取消',
                         type: 'warning'
                     }).then(() => {
-                        $.dyAjax('/manage/del', { id: row.id }, function (data) {
+                        $.dyAjax('/inputInfo/del', { id: row.id }, function (data) {
                             _this.loadTable1(function () {
                                 _this.$message({
                                     type: 'success',
@@ -575,7 +573,7 @@
                 //分配权限
                 authorityClick: function (index, row) {
                     var _this = this;
-                    $.dyAjax('/manage/getTypeAuthority/' + row.id, undefined, function (data) {
+                    $.dyAjax('/inputInfo/getTypeAuthority/' + row.id, undefined, function (data) {
                         if (data.length > 0) {
                             let companyScenic = data.reduce((acc, cur) => {
                                 acc.push([cur.company, cur.scenic])