Browse Source

Merge branch 'test' of licailing/wenlvju into master

licailing 4 years ago
parent
commit
5eb42d5539

+ 148 - 91
src/main/h5/src/views/TrainingInstitution.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="page">
-    <van-form @submit="submit" :submit-on-enter="false">
+    <van-form ref="form" @submit="submit" :submit-on-enter="false">
       <van-popover v-model="showPopover" trigger="click">
         <template #reference>
           <van-field
@@ -29,12 +29,41 @@
         v-model="form.uscc"
         :rules="[{ required: true, message: '请填写注册号' }]"
       />
+      <van-field
+        name="是否从事文化艺术类校外培训"
+        label="是否从事文化艺术类校外培训"
+        :rules="[
+          {
+            validator: val => {
+              return val || val === false;
+            },
+            message: '请选择'
+          }
+        ]"
+      >
+        <template #input>
+          <van-radio-group
+            v-model="form.engagedInTraining"
+            direction="horizontal"
+          >
+            <van-radio :name="true"> 是</van-radio>
+            <van-radio :name="false">否</van-radio>
+          </van-radio-group>
+        </template>
+      </van-field>
       <div style="margin:30px" v-if="!form.id">
-        <van-button class="submit" round block type="info" @click="byUscc">
+        <van-button
+          class="submit"
+          native-type="button"
+          round
+          block
+          type="info"
+          @click="byUscc"
+        >
           查询
         </van-button>
       </div>
-      <template v-else>
+      <template v-else-if="form.engagedInTraining">
         <van-field
           type="textarea"
           name="经营范围"
@@ -129,78 +158,88 @@
           v-model="form.classroomNum"
           :rules="[{ required: true, message: '请填写教室数量' }]"
         />
-        <van-field
-          type="digit"
-          name="教师总数"
-          label="教师总数"
-          placeholder="请输入教师总数"
-          v-model="form.teacherNum"
-          :rules="[{ required: true, message: '请填写教师总数' }]"
-        />
-        <van-field
-          type="digit"
-          name="专职数量"
-          label="专职数量"
-          placeholder="请输入专职数量"
-          v-model="form.fullTimeNum"
-          :rules="[{ required: true, message: '请填写专职数量' }]"
-        />
-        <van-field
-          type="digit"
-          name="兼职数量"
-          label="兼职数量"
-          placeholder="请输入兼职数量"
-          v-model="form.partTimeNum"
-          :rules="[{ required: true, message: '请填写兼职数量' }]"
-        />
-        <van-field
-          type="digit"
-          name="音乐类"
-          label="音乐类"
-          placeholder="请输入音乐类"
-          v-model="form.musicNum"
-          :rules="[{ required: true, message: '请填写音乐类' }]"
-        />
-        <van-field
-          type="digit"
-          name="舞蹈类"
-          label="舞蹈类"
-          placeholder="请输入舞蹈类"
-          v-model="form.danceNum"
-          :rules="[{ required: true, message: '请填写舞蹈类' }]"
-        />
-        <van-field
-          type="digit"
-          name="美术类"
-          label="美术类"
-          placeholder="请输入美术类"
-          v-model="form.artNum"
-          :rules="[{ required: true, message: '请填写美术类' }]"
-        />
-        <van-field
-          type="digit"
-          name="戏剧戏曲"
-          label="戏剧戏曲"
-          placeholder="请输入戏剧戏曲"
-          v-model="form.theatreOperaNum"
-          :rules="[{ required: true, message: '请填写戏剧戏曲' }]"
-        />
-        <van-field
-          type="digit"
-          name="曲艺类"
-          label="曲艺类"
-          placeholder="请输入曲艺类"
-          v-model="form.folkMusicNum"
-          :rules="[{ required: true, message: '请填写曲艺类' }]"
-        />
-        <van-field
-          type="digit"
-          name="有教师资格证"
-          label="有教师资格证"
-          placeholder="请输入有教师资格证"
-          v-model="form.qualificationNum"
-          :rules="[{ required: true, message: '请填写有教师资格证' }]"
-        />
+
+        <div class="panel">
+          <van-divider content-position="left">教师人数统计</van-divider>
+          <van-field
+            type="digit"
+            name="专职数量"
+            label="专职数量"
+            placeholder="请输入专职数量"
+            v-model="form.fullTimeNum"
+            @change="changeNum"
+            :rules="[{ required: true, message: '请填写专职数量' }]"
+          />
+          <van-field
+            type="digit"
+            name="兼职数量"
+            label="兼职数量"
+            placeholder="请输入兼职数量"
+            v-model="form.partTimeNum"
+            @change="changeNum"
+            :rules="[{ required: true, message: '请填写兼职数量' }]"
+          />
+          <van-field
+            type="digit"
+            name="教师总数"
+            label="教师总数"
+            placeholder="请输入教师总数"
+            v-model="form.teacherNum"
+            :rules="[{ required: true, message: '请填写教师总数' }]"
+          />
+        </div>
+        <div class="panel">
+          <van-divider content-position="left">教师专业人数统计</van-divider>
+
+          <van-field
+            type="digit"
+            name="音乐类"
+            :label="`音乐类(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入音乐类"
+            v-model="form.musicNum"
+            :rules="[{ required: true, message: '请填写音乐类' }]"
+          />
+          <van-field
+            type="digit"
+            name="舞蹈类"
+            :label="`舞蹈类(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入舞蹈类"
+            v-model="form.danceNum"
+            :rules="[{ required: true, message: '请填写舞蹈类' }]"
+          />
+          <van-field
+            type="digit"
+            name="美术类"
+            :label="`美术类(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入美术类"
+            v-model="form.artNum"
+            :rules="[{ required: true, message: '请填写美术类' }]"
+          />
+          <van-field
+            type="digit"
+            name="戏剧戏曲"
+            :label="`戏剧戏曲(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入戏剧戏曲"
+            v-model="form.theatreOperaNum"
+            :rules="[{ required: true, message: '请填写戏剧戏曲' }]"
+          />
+          <van-field
+            type="digit"
+            name="曲艺类"
+            :label="`曲艺类(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入曲艺类"
+            v-model="form.folkMusicNum"
+            :rules="[{ required: true, message: '请填写曲艺类' }]"
+          />
+          <van-field
+            type="digit"
+            name="有教师资格证"
+            :label="`有教师资格证(教师总数:${form.teacherNum}人)`"
+            placeholder="请输入有教师资格证"
+            v-model="form.qualificationNum"
+            :rules="[{ required: true, message: '请填写有教师资格证' }]"
+          />
+        </div>
         <van-field
           type="digit"
           name="年培训人数"
@@ -268,7 +307,8 @@ export default {
         examPoint: false
       },
       list: [],
-      showPopover: false
+      showPopover: false,
+      activeNames: "1"
     };
   },
 
@@ -303,22 +343,27 @@ export default {
         });
     },
     byUscc() {
-      this.$toast.loading({
-        message: "加载中...",
-        forbidClick: true,
-        duration: 0
-      });
-      this.$http
-        .post(
-          `/trainingInstitution/byUscc?name=${this.form.name}&uscc=${this.form.uscc}`
-        )
-        .then(res => {
-          this.$toast.clear();
-          this.form = { ...res };
-        })
-        .catch(e => {
-          this.$toast(e.error);
+      this.$refs.form.validate().then(() => {
+        this.$toast.loading({
+          message: "加载中...",
+          forbidClick: true,
+          duration: 0
         });
+        this.$http
+          .post(
+            `/trainingInstitution/byUscc?name=${this.form.name}&uscc=${this.form.uscc}`
+          )
+          .then(res => {
+            this.$toast.clear();
+            this.form = { ...res, ...this.form };
+            if (!this.form.engagedInTraining) {
+              this.submit();
+            }
+          })
+          .catch(e => {
+            this.$toast(e.error);
+          });
+      });
     },
     choose(info) {
       this.form.name = info;
@@ -354,6 +399,12 @@ export default {
       let data = JSON.stringify({ ...this.form });
       window.localStorage.setItem("trainingInstitution", data);
       this.$toast.success("暂存成功");
+    },
+    changeNum() {
+      this.$nextTick(() => {
+        this.form.teacherNum =
+          Number(this.form.partTimeNum) + Number(this.form.fullTimeNum);
+      });
     }
   }
 };
@@ -404,4 +455,10 @@ export default {
     // margin-left: 13px;
   }
 }
+.panel {
+  padding: 30px 0;
+}
+.panel + .panel {
+  padding-top: 0;
+}
 </style>

+ 3 - 0
src/main/java/com/izouma/wenlvju/domain/TrainingInstitution.java

@@ -31,6 +31,9 @@ public class TrainingInstitution extends BaseEntity {
     @ApiModelProperty("注册号")
     private String uscc;
 
+    @ApiModelProperty(value = "是否从事文化艺术类校外培训")
+    private boolean engagedInTraining;
+
     @ExcelProperty(value = "经营范围")
     @Column(columnDefinition = "TEXT")
     @ApiModelProperty("经营范围")

+ 1 - 1
src/main/java/com/izouma/wenlvju/repo/RateRepo.java

@@ -31,6 +31,6 @@ public interface RateRepo extends JpaRepository<Rate, Long>, JpaSpecificationExe
     @Query(nativeQuery = true, value = "select count(1) from rate where del=0 and (expert_user_id = ?1 or find_in_set(?1,expert_member_user_id))")
     Long countByExpertId(Long userId);
 
-    List<Rate> findAllByStatusAndYear(RateStatus status, String year);
+    List<Rate> findAllByStatusAndYearOrderByScoreDesc(RateStatus status, String year);
 
 }

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

@@ -614,7 +614,7 @@ public class RateService {
      * @param announcement 是否公告短信
      */
     public void batchSendSms(boolean announcement) {
-        List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_PAPER_MATERIALS, String.valueOf(LocalDate.now()
+        List<Rate> rates = rateRepo.findAllByStatusAndYearOrderByScoreDesc(RateStatus.SUBMIT_PAPER_MATERIALS, String.valueOf(LocalDate.now()
                 .getYear()));
         String phones = rates.stream().map(Rate::getOwnerPhone).collect(Collectors.joining(","));
 
@@ -629,9 +629,9 @@ public class RateService {
      * 等级
      */
     public void gradeRatio(double excellent, double eligible, Long userId) {
-        List<Rate> rates = rateRepo.findAllByStatusAndYear(RateStatus.SUBMIT_GRADE, String.valueOf(LocalDate.now()
+        List<Rate> rates = rateRepo.findAllByStatusAndYearOrderByScoreDesc(RateStatus.SUBMIT_GRADE, String.valueOf(LocalDate.now()
                 .getYear()));
-        rates.sort(Comparator.comparingInt(Rate::getSort));
+//        rates.sort((a, b) -> Integer.compare(b.getScore(), a.getSort()));
         int size = rates.size();
         int excellentSum = (int) Math.round(size * excellent / 100);
         if (excellentSum >= size) {

+ 15 - 4
src/main/java/com/izouma/wenlvju/service/performance/ProgrammeService.java

@@ -309,6 +309,8 @@ public class ProgrammeService {
                     // 专业
                     if (ObjectUtil.isNotNull(specialty)) {
                         programme.setSpecialtyId(specialty.getId());
+                    } else {
+                        throw new BusinessException("专业名称不正确,仔细核对专业表");
                     }
 
                     // 节目状态
@@ -355,11 +357,20 @@ public class ProgrammeService {
                 Participant participant = new Participant(dto);
                 if (ObjectUtil.isNotNull(dto.getParticipantBirthday())) {
                     if (dto.getParticipantBirthday().contains("/")) {
-                        LocalDate birthday = LocalDate.parse(dto.getParticipantBirthday(), DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_FORMAT1));
-                        participant.setBirthday(birthday);
+                        try {
+                            LocalDate birthday = LocalDate.parse(dto.getParticipantBirthday(), DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_FORMAT1));
+                            participant.setBirthday(birthday);
+                        } catch (Exception e) {
+                            throw new BusinessException("日期格式错误");
+                        }
+
                     } else if (dto.getParticipantBirthday().contains("-")) {
-                        LocalDate birthday = LocalDate.parse(dto.getParticipantBirthday(), DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_FORMAT));
-                        participant.setBirthday(birthday);
+                        try {
+                            LocalDate birthday = LocalDate.parse(dto.getParticipantBirthday(), DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_FORMAT));
+                            participant.setBirthday(birthday);
+                        } catch (Exception e) {
+                            throw new BusinessException("日期格式错误");
+                        }
                     } else {
                         throw new BusinessException("日期格式错误!");
                     }

+ 1 - 0
src/main/vue/src/views/TrainingInstitutionList.vue

@@ -50,6 +50,7 @@
             <el-table-column prop="contactPhone" label="企业联系方式"> </el-table-column>
             <el-table-column prop="district" label="所属管区"> </el-table-column>
             <el-table-column prop="registeredCapital" label="注册资本(万)"> </el-table-column>
+            <el-table-column prop="engagedInTraining" label="是否从事文化艺术类校外培训"> </el-table-column>
             <el-table-column prop="category" label="单位性质"> </el-table-column>
             <el-table-column prop="specialty" label="专业种类"> </el-table-column>
             <el-table-column prop="trainingSite" label="培训点数量三楼及以下"> </el-table-column>

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

@@ -156,9 +156,6 @@
                     <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 }">
@@ -354,7 +351,7 @@ export default {
         },
         beforeGetData() {
             let data = {
-                sort: 'sort,desc;createdAt,desc',
+                sort: 'sort,desc;score,desc;createdAt,desc',
                 query: {
                     submit: true,
                     status: ['REVIEW_PENDING', 'SUBMIT_PAPER_MATERIALS', 'COMPLETE']