licailing 4 лет назад
Родитель
Сommit
daa9875589

+ 42 - 7
src/main/java/com/izouma/wenlvju/service/RateService.java

@@ -9,6 +9,7 @@ import com.izouma.wenlvju.domain.*;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.dto.ReviewTime;
 import com.izouma.wenlvju.enums.AuthorityName;
+import com.izouma.wenlvju.enums.OrganizationGrade;
 import com.izouma.wenlvju.enums.RateStatus;
 import com.izouma.wenlvju.exception.BusinessException;
 import com.izouma.wenlvju.repo.*;
@@ -610,7 +611,7 @@ public class RateService {
     /**
      * 发短信
      *
-     * @param announcement
+     * @param announcement 是否公告短信
      */
     public void batchSendSms(boolean announcement) {
         List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_PAPER_MATERIALS, String.valueOf(LocalDate.now()
@@ -622,19 +623,53 @@ public class RateService {
         } else {
             njwlSmsService.sendSms(phones, "请你单位在5个工作日内将纸质申请材料(2份)送属地区文化和旅游局文化行政主管部门,逾期不送,作自动放弃处理。");
         }
-
     }
 
     /**
      * 等级
      */
-    public void grade(double excellent,double eligible) {
+    public void gradeRatio(double excellent, double eligible, Long userId) {
         List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_GRADE, String.valueOf(LocalDate.now()
                 .getYear()));
         rates.sort(Comparator.comparingInt(Rate::getSort));
-        int excellentSum = (int) Math.round(rates.size() * excellent);
-        List<Rate> excellentList = rates.subList(0, excellentSum);
-        int eligibleSum = (int) Math.round(rates.size() * eligible);
-//        List<Rate> eligibleList = rates.subList(total);
+        int size = rates.size();
+        int excellentSum = (int) Math.round(size * excellent / 100);
+        if (excellentSum >= size) {
+            rates.forEach(rate -> {
+                rate.setGrade(OrganizationGrade.EXCELLENT);
+                rate.setStatus(RateStatus.SUBMIT_PAPER_MATERIALS);
+                RateAudit rateAudit = RateAudit.builder()
+                        .userId(userId)
+                        .rateId(rate.getId())
+                        .remark("市政管理员已评审完成,请你单位在5个工作日内将纸质申请材料(2份)送属地区文化行政主管部门。")
+                        .status(RateStatus.SUBMIT_PAPER_MATERIALS.toString())
+                        .build();
+                rateAuditRepo.save(rateAudit);
+            });
+            rateRepo.saveAll(rates);
+            return;
+        }
+
+        int eligibleSum = (int) Math.round(size * eligible / 100);
+        int total = eligibleSum + excellentSum;
+        for (int i = 0; i < size; i++) {
+            Rate rate = rates.get(i);
+            if (i < excellentSum) {
+                rate.setGrade(OrganizationGrade.EXCELLENT);
+            } else if (i < total) {
+                rate.setGrade(OrganizationGrade.ELIGIBLE);
+            } else {
+                rate.setGrade(OrganizationGrade.NOT_ELIGIBLE);
+            }
+            rate.setStatus(RateStatus.SUBMIT_PAPER_MATERIALS);
+            RateAudit rateAudit = RateAudit.builder()
+                    .userId(userId)
+                    .rateId(rate.getId())
+                    .remark("市政管理员已评审完成,请你单位在5个工作日内将纸质申请材料(2份)送属地区文化行政主管部门。")
+                    .status(RateStatus.SUBMIT_PAPER_MATERIALS.toString())
+                    .build();
+            rateAuditRepo.save(rateAudit);
+        }
+        rateRepo.saveAll(rates);
     }
 }

+ 13 - 0
src/main/java/com/izouma/wenlvju/web/RateController.java

@@ -181,10 +181,23 @@ public class RateController extends BaseController {
         return rateRepo.countAllByOrganizationIdAndYear(id, year) == 0;
     }
 
+    @ApiOperation("提交纸质材料")
     @PostMapping("/paperMaterial")
     public void paperMaterial(@RequestParam Long id, @RequestParam RateStatus status, String remark) {
         rateService.paperMaterial(id, status, remark, SecurityUtils.getAuthenticatedUser().getId());
     }
 
+    @ApiOperation("批量发送短信")
+    @PostMapping("/batchSendSms")
+    public void batchSendSms(boolean announcement) {
+        rateService.batchSendSms(announcement);
+    }
+
+    @ApiOperation("设置等级比例")
+    @PostMapping("/gradeRatio")
+    public void gradeRatio(double excellent, double eligible) {
+        rateService.gradeRatio(excellent, eligible, SecurityUtils.getAuthenticatedUser().getId());
+    }
+
 }
 

+ 5 - 1
src/main/vue/src/components/OrganizationLog.vue

@@ -135,7 +135,11 @@
                             </el-form-item>
                             <el-form-item label="营业执照" prop="businessLicense" class="address">
                                 <!-- <single-upload v-model="formData.businessLicense"></single-upload> -->
-                                <img style="width:100px;height100px" :src="formData.businessLicense" alt="" />
+                                <el-image
+                                    style="width:100px;height100px"
+                                    :src="formData.businessLicense"
+                                    :preview-src-list="[formData.businessLicense]"
+                                ></el-image>
                             </el-form-item>
                         </div>
                     </el-collapse-transition>

+ 3 - 62
src/main/vue/src/views/rate/RateList.vue

@@ -1,68 +1,6 @@
 <template>
     <div class="list-view">
         <div class="filters-container">
-            <!-- <el-input placeholder="输入关键字" v-model="search" clearable class="filter-item"></el-input>
-             <el-button @click="addRow" type="primary" icon="el-icon-plus" class="filter-item">创建申请 </el-button> -->
-            <!-- <el-button
-                @click="download"
-                type="primary"
-                icon="el-icon-download"
-                :loading="downloading"
-                class="filter-item"
-                :disabled="totalElements <= 0"
-                >导出EXCEL
-            </el-button>
-            <el-select v-model="year" placeholder="请选择年度" class="filter-item" clearable>
-                <el-option v-for="item in years" :key="item" :value="item" :label="item + '年'"></el-option>
-            </el-select>
-            <el-select v-model="agency" placeholder="所属考级机构" multiple class="filter-item">
-                <el-option
-                    v-for="(item, index) in examination"
-                    :key="index"
-                    :value="item.value"
-                    :label="item.label"
-                ></el-option>
-            </el-select>
-            <el-input
-                placeholder="输入承办单位名称"
-                v-model="search"
-                clearable
-                class="filter-item"
-                @change="getData"
-            ></el-input>
-            <el-select
-                style="width: 220px"
-                v-model="status"
-                placeholder="请选择的状态"
-                class="filter-item"
-                multiple
-                clearable
-                @change="getData"
-            >
-                <el-option
-                    v-for="item in statusOptions"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                ></el-option>
-            </el-select>
-            <el-select
-                style="width: 220px"
-                v-model="grade"
-                placeholder="请选择的等级"
-                class="filter-item"
-                multiple
-                clearable
-                @change="getData"
-            >
-                <el-option
-                    v-for="item in gradeOptions"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                ></el-option>
-            </el-select> -->
-            <!-- <el-button @click="getData" type="primary" icon="el-icon-search" class="filter-item">搜索 </el-button> -->
             <div>
                 <el-col :span="7">
                     <span class="span-size">申请年度</span>
@@ -193,6 +131,9 @@
                     <span v-if="row.score">{{ row.score }}</span>
                     <span v-else>暂无</span>
                 </template>
+                <template slot="header" slot-scope="{ column }">
+                    <sortable-header :column="column" :current-sort="sort" @changeSort="changeSort"> </sortable-header>
+                </template>
             </el-table-column>
             <el-table-column prop="grade" label="等级">
                 <template slot-scope="{ row }">

+ 37 - 2
src/main/vue/src/views/rate/RateListDone.vue

@@ -122,8 +122,12 @@
                         :disabled="totalElements <= 0"
                         >导出EXCEL
                     </el-button>
-                    <el-button type="primary" :loading="downloading" class="filter-item">公告短信通知 </el-button>
-                    <el-button type="primary" :loading="downloading" class="filter-item">提交材料短信通知 </el-button>
+                    <el-button type="primary" :loading="downloading" class="filter-item" @click="batchSendSms(true)"
+                        >公告短信通知
+                    </el-button>
+                    <el-button type="primary" :loading="downloading" class="filter-item" @click="batchSendSms(false)"
+                        >提交材料短信通知
+                    </el-button>
                 </el-col>
             </div>
         </div>
@@ -152,6 +156,9 @@
                     <span v-if="row.score">{{ row.score }}</span>
                     <span v-else>暂无</span>
                 </template>
+                <template slot="header" slot-scope="{ column }">
+                    <sortable-header :column="column" :current-sort="sort" @changeSort="changeSort"> </sortable-header>
+                </template>
             </el-table-column>
             <el-table-column prop="grade" label="等级">
                 <template slot-scope="{ row }">
@@ -605,6 +612,34 @@ export default {
                     });
                     this.$set(row, 'loading', false);
                 });
+        },
+        batchSendSms(res) {
+            this.$confirm('发送短信后不可撤回,确认发送吗?', '提示', {
+                confirmButtonText: '确认',
+                cancelButtonText: '取消',
+                type: 'warning'
+            })
+                .then(() => {
+                    this.$http
+                        .post('/rate/batchSendSms', {
+                            announcement: res
+                        })
+                        .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);
+                });
         }
     }
 };

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

@@ -122,6 +122,7 @@
                         :disabled="totalElements <= 0"
                         >导出EXCEL
                     </el-button>
+                    <el-button @click="dialogRatio = true" type="primary">设置等级</el-button>
                 </el-col>
             </div>
         </div>
@@ -256,6 +257,35 @@
                 </div>
             </div>
         </el-dialog>
+        <el-dialog title="等级比例" :visible.sync="dialogRatio" width="500px" center>
+            <div style="height: 150px;width:400px;margin:0 0 2px 80px">
+                <el-form :form="ratioForm">
+                    <el-form-item label="优秀比例(%)">
+                        <el-input-number
+                            v-model="ratioForm.excellent"
+                            :min="0"
+                            :max="100"
+                            @change="changeEligible"
+                            style="width: 160px"
+                        ></el-input-number>
+                    </el-form-item>
+                    <el-form-item label="合格比例(%)">
+                        <el-input-number
+                            v-model="ratioForm.eligible"
+                            :min="0"
+                            :max="100"
+                            @change="changeExcellent"
+                            style="width: 160px"
+                        ></el-input-number>
+                    </el-form-item>
+                    <el-form-item>
+                        <el-button style="margin-left: 170px" type="primary" size="mini" @click="gradeRatio"
+                            >确定</el-button
+                        >
+                    </el-form-item>
+                </el-form>
+            </div>
+        </el-dialog>
     </div>
 </template>
 <script>
@@ -291,7 +321,9 @@ export default {
             year: '',
             districts: [],
             district: '',
-            dateRange: ''
+            dateRange: '',
+            dialogRatio: false,
+            ratioForm: {}
         };
     },
     created() {
@@ -612,6 +644,29 @@ export default {
                     });
                     this.$set(row, 'loading', false);
                 });
+        },
+        changeEligible(res) {
+            this.ratioForm.eligible = 100 - res;
+        },
+        changeExcellent(res) {
+            this.ratioForm.excellent = 100 - res;
+        },
+        gradeRatio() {
+            this.$http
+                .post('/rate/gradeRatio', {
+                    excellent: this.ratioForm.excellent,
+                    eligible: this.ratioForm.eligible
+                })
+                .then(res => {
+                    this.$message.success('等级设置成功');
+                    this.getData();
+                    this.dialogRatio = false;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.dialogRatio = false;
+                    this.$message.error(e.error);
+                });
         }
     }
 };

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

@@ -206,7 +206,11 @@ public class RepoTest extends ApplicationTests {
 
     @Test
     public void test6() {
-        String phone = "18205083565";
-        System.out.println(phone.replace(phone.substring(3, phone.length() - 4), "****"));
+//        String phone = "18205083565";
+//        System.out.println(phone.replace(phone.substring(3, phone.length() - 4), "****"));
+        int sum1 = Math.round(75 * 20 / 100);
+        System.out.println(sum1);
+        int sum2 = Math.round(75 * 80 / 100);
+        System.out.println(sum1 + sum2);
     }
 }