Bladeren bron

驳回时间

licailing 4 jaren geleden
bovenliggende
commit
90b68a0239

+ 3 - 16
src/main/java/com/izouma/wenlvju/domain/Rate.java

@@ -32,32 +32,21 @@ public class Rate extends BaseEntity {
     @ApiModelProperty(value = "承办单位名称")
     private String name;
 
-    @NonNull
     @ApiModelProperty(value = "负责人")
     private String owner;
 
-    @NonNull
     private String ownerPhone;
 
-    @NonNull
     private String ownerEmail;
 
     private String district;
 
-//    @Convert(converter = StringArrayConverter.class)
-//    private List<String> district1;
-
     @Enumerated(EnumType.STRING)
     private RateStatus status;
 
     @ApiModelProperty(value = "是否承办考级活动")
     private boolean undertakeExamination;
 
-//    @Convert(converter = StringArrayConverter.class)
-//    @ApiModelProperty(value = "承办过的考级活动名称")
-//    private List<String> examination;
-
-    @NonNull
     @Column(columnDefinition = "TEXT")
     @ApiModelProperty(value = "单位概况")
     private String introduction;
@@ -70,7 +59,6 @@ public class Rate extends BaseEntity {
     @ApiModelProperty(value = "是否提交")
     private boolean submit;
 
-    @NonNull
     @ApiModelProperty(value = "承办单位")
     private Long organizationId;
 
@@ -158,14 +146,13 @@ public class Rate extends BaseEntity {
     @Convert(converter = ReviewTimeListConverter.class)
     private List<ReviewTime> reviewTimes = new ArrayList<>();
 
-//    @Column(columnDefinition = "TEXT")
-//    @Convert(converter = StringArrayConverter.class)
-//    private List<String> img;
-
     private String remark;
 
     private boolean isRejected;
 
+    @ApiModelProperty(value = "驳回时间")
+    private LocalDateTime rejectedAt;
+
     public String getDetailAddress() {
         String str = "江苏省南京市";
         if (StrUtil.isNotBlank(this.address)) {

+ 5 - 2
src/main/java/com/izouma/wenlvju/dto/RateDTO.java

@@ -83,6 +83,10 @@ public class RateDTO {
     @ApiModelProperty(value = "等级")
     private String grade;
 
+    @ExcelIgnore
+    @ApiModelProperty(value = "驳回时间")
+    private LocalDateTime rejectedAt;
+
     public RateDTO(Rate rate, Organization organization, String gradingOrganization) {
         BeanUtil.copyProperties(rate, this);
         if (ObjectUtil.isNotEmpty(organization)) {
@@ -92,13 +96,12 @@ public class RateDTO {
             if (StrUtil.isNotBlank(organization.getAddress())) {
                 address += organization.getAddress();
             }
-//            rate.setAddress(address);
             this.address = address;
         }
         if (ObjectUtil.isNotNull(rate.getGrade())) {
             this.grade = rate.getGrade().getDesc();
         }
-        if (ObjectUtil.isNotNull(rate.getStatus())){
+        if (ObjectUtil.isNotNull(rate.getStatus())) {
             this.status1 = rate.getStatus().getDesc();
         }
     }

+ 2 - 0
src/main/java/com/izouma/wenlvju/repo/RateAuditRepo.java

@@ -22,4 +22,6 @@ public interface RateAuditRepo extends JpaRepository<RateAudit, Long>, JpaSpecif
     void softDeleteByRateIdIn(Iterable<Long> rateIds);
 
     List<RateAudit> findAllByStatus(RateStatus status);
+
+    List<RateAudit> findAllByStatusAndRateIdIn(RateStatus status, Iterable<Long> rateIds);
 }

+ 1 - 0
src/main/java/com/izouma/wenlvju/service/RateService.java

@@ -112,6 +112,7 @@ public class RateService {
         if (RateStatus.REVIEW_DENY.equals(status)) {
             // 市里退回
             rate.setRejected(true);
+            rate.setRejectedAt(LocalDateTime.now());
         }
 
         RateAudit rateAudit = RateAudit.builder()

+ 4 - 9
src/main/java/com/izouma/wenlvju/web/RateController.java

@@ -3,18 +3,12 @@ package com.izouma.wenlvju.web;
 import cn.hutool.core.collection.CollUtil;
 import com.github.kevinsawicki.http.HttpRequest;
 import com.izouma.wenlvju.annotations.OperLog;
-import com.izouma.wenlvju.domain.GradingOrganization;
-import com.izouma.wenlvju.domain.Organization;
-import com.izouma.wenlvju.domain.Rate;
-import com.izouma.wenlvju.domain.User;
+import com.izouma.wenlvju.domain.*;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.dto.RateDTO;
 import com.izouma.wenlvju.enums.RateStatus;
 import com.izouma.wenlvju.exception.BusinessException;
-import com.izouma.wenlvju.repo.GradingOrganizationRepo;
-import com.izouma.wenlvju.repo.OrganizationRepo;
-import com.izouma.wenlvju.repo.RateRepo;
-import com.izouma.wenlvju.repo.UserRepo;
+import com.izouma.wenlvju.repo.*;
 import com.izouma.wenlvju.service.RateService;
 import com.izouma.wenlvju.utils.SecurityUtils;
 import com.izouma.wenlvju.utils.excel.ExcelUtils;
@@ -44,6 +38,7 @@ public class RateController extends BaseController {
     private final OrganizationRepo        organizationRepo;
     private final UserRepo                userRepo;
     private final GradingOrganizationRepo gradingOrganizationRepo;
+    private final RateAuditRepo           rateAuditRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -62,7 +57,7 @@ public class RateController extends BaseController {
     @PreAuthorize("hasAnyRole('ADMIN','DISTRICT','DISTRICT_STAFF','EXPERT')")
     @PostMapping("/all2")
     public Page<RateDTO> all2(@RequestBody PageQuery pageQuery) {
-        pageQuery.setSort("createdAt,desc");
+//        pageQuery.setSort("createdAt,desc");
         Map<Long, Organization> organizationMap = organizationRepo.findAll()
                 .stream()
                 .collect(Collectors.toMap(Organization::getId, organization -> organization));

+ 1 - 8
src/main/vue/src/views/rate/RateDistrictList.vue

@@ -394,14 +394,7 @@ export default {
             return '';
         },
         beforeGetData() {
-            // return {
-            //     search: this.search,
-            //     sort: 'createdAt,desc',
-            //     query: {
-            //         submit: true
-            //     }
-            // };
-            let data = { query: { submit: true, district: this.userInfo.district } };
+            let data = { sort: 'createdAt,desc', query: { submit: true, district: this.userInfo.district } };
             if (this.search) {
                 data.search = this.search;
             }

+ 1 - 0
src/main/vue/src/views/rate/RateDistrictListDone.vue

@@ -410,6 +410,7 @@ export default {
             //     }
             // };
             let data = {
+                sort: 'createdAt,desc',
                 query: {
                     submit: true,
                     district: this.userInfo.district,

+ 1 - 7
src/main/vue/src/views/rate/RateDistrictListPending.vue

@@ -394,14 +394,8 @@ export default {
             return '';
         },
         beforeGetData() {
-            // return {
-            //     search: this.search,
-            //     sort: 'createdAt,desc',
-            //     query: {
-            //         submit: true
-            //     }
-            // };
             let data = {
+                sort: 'createdAt,desc',
                 query: {
                     submit: true,
                     district: this.userInfo.district,

+ 0 - 1
src/main/vue/src/views/rate/RateGrade.vue

@@ -109,7 +109,6 @@ export default {
         return {
             multipleMode: false,
             search: '',
-            // url: '/rate/all2',
             downloading: false,
             statusOptions: [
                 { label: '等待初审', value: 'FIRST_REVIEW_PENDING' },

+ 1 - 0
src/main/vue/src/views/rate/RateList.vue

@@ -407,6 +407,7 @@ export default {
         },
         beforeGetData() {
             let data = {
+                sort: 'createdAt,desc',
                 query: {
                     submit: true,
                     status: [

+ 1 - 0
src/main/vue/src/views/rate/RateListDone.vue

@@ -345,6 +345,7 @@ export default {
         },
         beforeGetData() {
             let data = {
+                sort: 'createdAt,desc',
                 query: {
                     submit: true,
                     status: ['REVIEW_PENDING', 'SUBMIT_PAPER_MATERIALS', 'COMPLETE']

+ 1 - 0
src/main/vue/src/views/rate/RateListPending.vue

@@ -345,6 +345,7 @@ export default {
         },
         beforeGetData() {
             let data = {
+                sort: 'createdAt,desc',
                 query: {
                     submit: true,
                     status: ['ASSIGN_EXPERT', 'SUBMIT_GRADE', 'COLLECT_PAPER_MATERIALS']

+ 2 - 162
src/main/vue/src/views/rate/RateListRejected.vue

@@ -144,6 +144,7 @@
                     <span v-else><el-link :underline="false" type="info">暂无</el-link></span>
                 </template>
             </el-table-column>
+            <el-table-column label="驳回时间" prop="rejectedAt" min-width="110"></el-table-column>
             <el-table-column label="操作" align="right" fixed="right" min-width="110">
                 <template slot-scope="{ row }">
                     <el-button @click="editRow(row)" type="primary" size="mini" plain>
@@ -257,6 +258,7 @@ export default {
         },
         beforeGetData() {
             let data = {
+                sort: 'rejectedAt,desc',
                 query: {
                     // submit: true,
                     isRejected: true
@@ -350,168 +352,6 @@ export default {
         },
         operation2() {
             this.$message('操作2');
-        },
-        deleteRow(row) {
-            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
-                .then(() => {
-                    return this.$http.post(`/rate/del/${row.id}`);
-                })
-                .then(() => {
-                    this.$message.success('删除成功');
-                    this.getData();
-                })
-                .catch(e => {
-                    if (e !== 'cancel') {
-                        this.$message.error(e.error);
-                    }
-                });
-        },
-        audit(row, status, remark) {
-            this.$set(row, 'loading', true);
-
-            this.$confirm('确认此承办单位同意上报?', '提示', {
-                confirmButtonText: '同意上报',
-                cancelButtonText: '取消',
-                type: 'warning'
-            })
-                .then(() => {
-                    this.$http
-                        .post('/rate/audit', {
-                            id: row.id,
-                            status: status,
-                            score: 0,
-                            remark: remark
-                        })
-                        .then(res => {
-                            this.$set(row, 'loading', false);
-                            this.$message.success('上报成功');
-                            this.getData();
-                        })
-                        .catch(e => {
-                            console.log(e);
-                            this.$set(row, 'loading', false);
-                            this.$message.error(e.error);
-                        });
-                })
-                .catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消'
-                    });
-                    this.$set(row, 'loading', false);
-                });
-        },
-        dismiss(row) {
-            this.dialogDismiss = true;
-            this.form = row;
-        },
-        saveDismiss() {
-            let row = this.form;
-            this.$set(row, 'loading', true);
-            this.$http
-                .post('/rate/audit', {
-                    id: this.form.id,
-                    status: 'REVIEW_DENY',
-                    score: 0,
-                    remark: this.reason
-                })
-                .then(res => {
-                    this.$set(row, 'loading', false);
-                    this.$message.success('退回成功');
-                    this.getData();
-                })
-                .catch(e => {
-                    this.$set(row, 'loading', false);
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
-            this.form = '';
-            this.reason = '';
-            this.dialogDismiss = false;
-        },
-        supervision(id) {
-            this.$router.push({
-                path: '/organizationExpert',
-                query: {
-                    id: id
-                }
-            });
-            // this.dialogVisible = true;
-            // this.rateId = id;
-        },
-        addRegulatory(id) {
-            this.$http
-                .post('/rate/addExpert', {
-                    id: this.rateId,
-                    userId: id
-                })
-                .then(res => {
-                    this.saving = false;
-                    this.$message.success('成功');
-                    this.dialogVisible = false;
-                    this.recordId = '';
-                    this.getData();
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.saving = false;
-                    this.$message.error(e.error);
-                });
-        },
-        openScore(row) {
-            this.dialogScore = true;
-            this.scoreInfo = row;
-        },
-        saveScore() {
-            this.scoreInfo.status = 'SUBMIT_PAPER_MATERIALS';
-            this.$http
-                .post(
-                    '/rate/save',
-                    {
-                        ...this.scoreInfo
-                    },
-                    { body: 'json' }
-                )
-                .then(res => {
-                    this.$message.success('OK');
-                    this.dialogScore = false;
-                    // this.scoreInfo = '';
-                    this.getData();
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
-        },
-        saveComplete(row) {
-            this.$confirm('确认已收到区文旅局提交的材料?', '提示', {
-                confirmButtonText: '已收到',
-                cancelButtonText: '暂未收到',
-                type: 'warning'
-            })
-                .then(() => {
-                    this.$http
-                        .post('/rate/paperMaterial', {
-                            id: row.id,
-                            status: 'COMPLETE',
-                            remark: '市文旅局已确认收到区文旅局提交的材料'
-                        })
-                        .then(res => {
-                            this.$message.success('确认成功');
-                            this.getData();
-                        })
-                        .catch(e => {
-                            console.log(e);
-                            this.$message.error(e.error);
-                        });
-                })
-                .catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消'
-                    });
-                    this.$set(row, 'loading', false);
-                });
         }
     }
 };

+ 16 - 0
src/test/java/com/izouma/wenlvju/repo/RateExpertAuditRepoTest.java

@@ -3,13 +3,21 @@ package com.izouma.wenlvju.repo;
 
 import cn.hutool.core.collection.CollUtil;
 import com.izouma.wenlvju.ApplicationTests;
+import com.izouma.wenlvju.domain.RateAudit;
 import com.izouma.wenlvju.domain.RateExpertAudit;
+import com.izouma.wenlvju.enums.RateStatus;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.time.LocalDateTime;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 public class RateExpertAuditRepoTest extends ApplicationTests {
     @Autowired
     private RateExpertAuditRepo rateExpertAuditRepo;
+    @Autowired
+    private RateAuditRepo       rateAuditRepo;
 
     @Test
     public void test() {
@@ -21,4 +29,12 @@ public class RateExpertAuditRepoTest extends ApplicationTests {
                         "https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-04-08-14-45-42CvVMClla.jpg"))
                 .build());
     }
+
+    @Test
+    public void test1() {
+        Map<Long, LocalDateTime> collect = rateAuditRepo.findAllByStatusAndRateIdIn(RateStatus.REVIEW_DENY, CollUtil.newArrayList(10803L, 10503L, 10437L, 10403L))
+                .stream()
+                .collect(Collectors.toMap(RateAudit::getRateId, RateAudit::getCreatedAt, (old, newV) -> old.compareTo(newV) > 0 ? old : newV));
+        System.out.println(collect);
+    }
 }

+ 6 - 1
src/test/java/com/izouma/wenlvju/repo/RepoTest.java

@@ -12,8 +12,10 @@ import com.izouma.wenlvju.service.storage.StorageService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -134,10 +136,13 @@ public class RepoTest extends ApplicationTests {
     @Test
     public void test1() {
         List<RateAudit> rateAudits = rateAuditRepo.findAllByStatus(RateStatus.REVIEW_DENY);
+        Map<Long, LocalDateTime> collect = rateAudits.stream()
+                .collect(Collectors.toMap(RateAudit::getRateId, RateAudit::getCreatedAt, (old, newV) -> old.compareTo(newV) > 0 ? old : newV));
         Set<Long> ids = rateAudits.stream().map(RateAudit::getRateId).collect(Collectors.toSet());
         List<Rate> rates = rateRepo.findAllById(ids);
         rates.forEach(rate -> {
-            rate.setRejected(true);
+//            rate.setRejected(true);
+            rate.setRejectedAt(collect.get(rate.getId()));
             rateRepo.save(rate);
         });