Sfoglia il codice sorgente

Merge branch 'dev' into Regulation

# Conflicts:
#	src/main/java/com/izouma/wenlvju/web/UserController.java
#	src/main/vue/src/views/rate/AssignExpert.vue
licailing 4 anni fa
parent
commit
367ff0d303

+ 10 - 1
src/main/h5/src/components/previewRate.vue

@@ -16,7 +16,12 @@
       </div>
 
       <div class="submit">
-        <van-button @click="submit" :color="$colors.prim" block round
+        <van-button
+          @click="submit"
+          :color="$colors.prim"
+          block
+          round
+          :loading="saving"
           >确认提交</van-button
         >
       </div>
@@ -39,6 +44,10 @@ export default {
       default: () => {
         return {};
       }
+    },
+    saving: {
+      type: Boolean,
+      default: false
     }
   },
   components: { rateInfo },

+ 2 - 2
src/main/h5/src/plugins/http.js

@@ -4,8 +4,8 @@ import qs from "qs";
 let baseUrl = "http://localhost:8080";
 switch (process.env.NODE_ENV) {
   case "development":
-    baseUrl = "http://wlj.izouma.com";
-    // baseUrl = 'http://localhost:8080';
+    // baseUrl = "http://wlj.izouma.com";
+    baseUrl = 'http://localhost:8080';
     break;
   case "test":
     baseUrl = "http://localhost:8080";

+ 4 - 1
src/main/h5/src/views/expert/expertAdd.vue

@@ -117,6 +117,7 @@
       @submit="submit"
       :info="subJson"
       :rate="form"
+      :loading="saving"
     ></preview-rate>
   </div>
 </template>
@@ -142,7 +143,8 @@ export default {
         imgs: []
       },
       img: [],
-      submitList: {}
+      submitList: {},
+      saving: false
     };
   },
   computed: {
@@ -280,6 +282,7 @@ export default {
         });
     },
     submit() {
+      this.saving = true;
       let form = { ...this.form };
       this.$toast.loading({
         message: "加载中...",

+ 6 - 2
src/main/h5/src/views/expert/expertDetail.vue

@@ -6,7 +6,10 @@
         <div class="info">
           <div class="title">{{ organization.name }}</div>
           <div class="address">
-            <div class="text">
+            <div class="text" v-if="rateInfo.change">
+              南京市{{ organization.district }} {{ rateInfo.changeAddress }}
+            </div>
+            <div class="text" v-else>
               南京市{{ organization.district }} {{ organization.address }}
             </div>
             <!-- <div class="img">
@@ -126,7 +129,8 @@ export default {
       rateInfo: {},
       organization: {},
       rateList: [],
-      userList: []
+      userList: [],
+      address: ""
     };
   },
   mounted() {

+ 8 - 2
src/main/h5/src/views/expert/expertList.vue

@@ -95,8 +95,14 @@ export default {
         {
           size: 20,
           query: {
-            expertUserId: this.$store.state.userInfo.id
-            // status: ["SUBMIT_GRADE", "REVIEW_PENDING"],
+            expertUserId: this.$store.state.userInfo.id,
+            status: [
+              "SUBMIT_GRADE",
+              "REVIEW_PENDING",
+              "SUBMIT_PAPER_MATERIALS",
+              "COLLECT_PAPER_MATERIALS",
+              "COMPLETE"
+            ]
           }
         },
         { body: "json" }

+ 32 - 0
src/main/java/com/izouma/wenlvju/domain/Alliance.java

@@ -0,0 +1,32 @@
+package com.izouma.wenlvju.domain;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+//@Entity
+@Where(clause = "del = 0")
+@ApiModel(value = "艺考联盟")
+public class Alliance {
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @ExcelIgnore
+    private Long id;
+
+    private String name;
+
+    private boolean del;
+}

+ 13 - 4
src/main/java/com/izouma/wenlvju/domain/Rate.java

@@ -114,10 +114,10 @@ public class Rate extends BaseEntity {
     private LocalDateTime applyTime;
 
     @ApiModelProperty(value = "审核开始时间")
-    private LocalDate reviewStartTime;
+    private LocalDateTime reviewStartTime;
 
     @ApiModelProperty(value = "审核结束时间")
-    private LocalDate reviewEndTime;
+    private LocalDateTime reviewEndTime;
 
     @ApiModelProperty(value = "审查时间")
     private LocalDateTime reviewTime;
@@ -155,9 +155,18 @@ public class Rate extends BaseEntity {
     @ApiModelProperty(value = "驳回时间")
     private LocalDateTime rejectedAt;
 
+    @ApiModelProperty(value = "是否变更地址")
+    private boolean isChange;
+
+    @ApiModelProperty(value = "变更地址")
+    private String changeAddress;
+
     public String getDetailAddress() {
-        String str = "江苏省南京市";
-        if (StrUtil.isNotBlank(this.address)) {
+        String str = "江苏省南京市" + this.district;
+
+        if (this.isChange && StrUtil.isNotBlank(this.changeAddress)) {
+            str += this.changeAddress;
+        } else if (StrUtil.isNotBlank(this.address)) {
             str += this.address;
         }
         return str;

+ 3 - 0
src/main/java/com/izouma/wenlvju/repo/UserRepo.java

@@ -27,4 +27,7 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
     User findByPhoneAndDelFalseAndIdIsNot(String phone, Long id);
 
     List<User> findAllByDistrictAndAuthoritiesContainsAndDelFalse(String district, Authority authorities);
+
+    User findByPhoneAndDelFalseAndIdIsNot(String phone, Long id);
+
 }

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

@@ -53,6 +53,7 @@ public class RateService {
     private final RateAuditRepo           rateAuditRepo;
     private final UserRepo                userRepo;
     private final NjwlSmsService          njwlSmsService;
+    private final OrganizationRepo        organizationRepo;
 
     public Page<Rate> all(PageQuery pageQuery) {
         return rateRepo.findAll(JpaUtils.toSpecification(pageQuery, Rate.class), JpaUtils.toPageRequest(pageQuery));
@@ -121,11 +122,18 @@ public class RateService {
     /*
     线下退回
      */
-    public void offline(Long id) {
+    public void offline(Long id, Long userId, RateStatus status) {
         Rate rate = rateRepo.findById(id).orElseThrow(new BusinessException("无记录"));
-        rate.setStatus(RateStatus.REVIEW_PENDING);
+        rate.setStatus(status);
         rate.setSort(rate.getStatus().getSort());
         rateRepo.save(rate);
+        RateAudit rateAudit = RateAudit.builder()
+                .userId(userId)
+                .rateId(id)
+                .remark(RateStatus.REVIEW_PENDING.equals(status) ? "线下考察材料提交不全,被退回!" : "已取消专家组分配!")
+                .status(status)
+                .build();
+        rateAuditRepo.save(rateAudit);
     }
 
     public void audit(Long id, RateStatus status, String remark, Long userId) {
@@ -169,15 +177,6 @@ public class RateService {
                 String message = "你区上报的承办单位等级评定申请被市文化和旅游局等级评定委员会退回,请根据反馈意见及时处理!";
                 njwlSmsService.sendSms(phone, message);
                 break;
-//            case REVIEW_PENDING:
-//                List<Long> ids = new ArrayList<>(rate.getExpertMemberUserId());
-//                ids.add(rate.getExpertUserId());
-//                String expertPhone = userRepo.findAllById(ids)
-//                        .stream()
-//                        .map(User::getPhone)
-//                        .collect(Collectors.joining(","));
-//                njwlSmsService.sendSms(expertPhone,"评分已被退回!");
-//                break;
             default:
                 break;
         }
@@ -338,13 +337,6 @@ public class RateService {
      * @return 压缩百分比
      */
     public int getPercent(float weight) {
-//        float percent;
-//        if (height > weight) {
-//            percent = PageSize.A4.getHeight() / height * 100;
-//        } else {
-//            percent = PageSize.A4.getWidth() / weight * 100;
-//        }
-//        return Math.round(percent);
         int p;
         float p2;
         p2 = 530 / weight * 100;
@@ -462,7 +454,6 @@ public class RateService {
         for (InputStream is : files) {
             is.close();
         }
-//        return outputStream.toString();
 
         response.setContentType("application/pdf");
         response.setHeader("Content-Disposition", "attachment; filename=" + "result.pdf");
@@ -480,6 +471,10 @@ public class RateService {
         Map<Long, User> userMap = userRepo.findAllById(ids)
                 .stream()
                 .collect(Collectors.toMap(User::getId, user -> user));
+        if (!rate.isChange()) {
+            Organization organization = organizationRepo.findById(rate.getId()).orElseThrow(new BusinessException("无记录"));
+            rate.setAddress(organization.getAddress());
+        }
 
         String message = "现场检查计划已分配:\n" +
                 "审核单位:%s\n" +
@@ -497,7 +492,7 @@ public class RateService {
                 "检查日期:%s\n" +
                 "组长:%s-%s";
 
-        DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_FORMAT);
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateConfig.DEFAULT_DATE_TIME_FORMAT);
 
         User user = userMap.get(rate.getExpertUserId());
         StringBuilder sb = new StringBuilder();

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

@@ -265,7 +265,6 @@ public class UserService {
             names.forEach(name -> and.add(criteriaBuilder.notLike(root.get("work"), "%" + name + "%")));
             return criteriaBuilder.and(and.toArray(new Predicate[0]));
         }), JpaUtils.toPageRequest(pageQuery)).map(user -> new ExpertDTO(user, artMap.get(user.getArtTypeId())));
-//        return this.all2(pageQuery, authorities).map(user -> new ExpertDTO(user, artMap.get(user.getArtTypeId())));
     }
 
 

+ 3 - 2
src/main/java/com/izouma/wenlvju/web/RateController.java

@@ -120,9 +120,10 @@ public class RateController extends BaseController {
         rateService.audit(id, status, remark, SecurityUtils.getAuthenticatedUser().getId());
     }
 
+    @OperLog(value = "等级评定", type = "退回", desc = "对等级评定申请进行操作")
     @PostMapping("/offline")
-    public void offline(@RequestParam Long id) {
-        rateService.offline(id);
+    public void offline(@RequestParam Long id, RateStatus status) {
+        rateService.offline(id, SecurityUtils.getAuthenticatedUser().getId(), status);
     }
 
 

+ 11 - 6
src/main/java/com/izouma/wenlvju/web/UserController.java

@@ -25,7 +25,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
-import javax.transaction.Transactional;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -53,6 +52,10 @@ public class UserController extends BaseController {
 
     @PostMapping("/regOrganization")
     public User regOrganization(@RequestBody OrganizationRegDTO dto) {
+//        LocalDate start = Convert.convert(LocalDate.class, "2021-6-3");
+//        if (LocalDate.now().isBefore(start)) {
+//            throw new AuthenticationException("系统暂未开放注册", null);
+//        }
         return userService.regOrganization(dto);
     }
 
@@ -64,7 +67,6 @@ public class UserController extends BaseController {
 
     @PreAuthorize("hasAnyRole('ADMIN,ORGANIZER')")
     @PostMapping("/save")
-//    @Transactional
     public User save(@RequestBody User user) {
         if (user.getId() != null) {
             User orig = userRepo.findById(user.getId()).orElseThrow(new BusinessException("无记录"));
@@ -109,17 +111,20 @@ public class UserController extends BaseController {
         authorities.add(Authority.get(AuthorityName.ROLE_SUPERVISOR));
         authorities.add(Authority.get(AuthorityName.ROLE_USER));
         authorities.add(Authority.get(AuthorityName.ROLE_DISTRICT_STAFF));
-        return userService.byAuthority(pageQuery, authorities);
+        return userService.all2(pageQuery, authorities);
     }
 
     @PostMapping("/all1")
     public Page<ExpertDTO> all1(@RequestBody PageQuery pageQuery) {
-        return userService.toArtType(pageQuery, Collections.singletonList(Authority.get(AuthorityName.ROLE_EXPERT)));
+        return userService.all1(pageQuery, Collections.singletonList(Authority.get(AuthorityName.ROLE_EXPERT)));
     }
 
     @PostMapping("/expert")
-    public Page<ExpertDTO> expert(@RequestParam Long rateId) {
-        return userService.rateExpert(rateId);
+    public Page<ExpertDTO> expert(@RequestBody PageQuery pageQuery) {
+        List<Authority> authorities = new ArrayList<>();
+        authorities.add(Authority.get(AuthorityName.ROLE_DISTRICT_STAFF));
+        authorities.add(Authority.get(AuthorityName.ROLE_EXPERT));
+        return userService.all1(pageQuery, authorities);
     }
 
     @PreAuthorize("hasRole('ADMIN')")

+ 12 - 2
src/main/vue/src/views/Login.vue

@@ -114,6 +114,15 @@
                             ></el-option>
                         </el-select>
                     </el-form-item>
+                    <el-form-item
+                        label="是否加入联盟"
+                        :rules="{ required: true, message: '请选择是否加入联盟', trigger: 'blur' }"
+                    >
+                        <el-select v-model="alliance" style="width: 350px" placeholder="请选择是否加入联盟">
+                            <el-option label="已加入" :value="true"></el-option>
+                            <el-option label="未加入" :value="false"></el-option>
+                        </el-select>
+                    </el-form-item>
                     <!-- <el-form-item
                         prop="businessLicense"
                         :rules="{ required: true, message: '请上传营业执照', trigger: 'blur' }"
@@ -255,7 +264,8 @@ export default {
                     },
                     { required: true, message: '请再次输入密码', trigger: 'blur' }
                 ]
-            }
+            },
+            alliance: ''
         };
         var validatePass = (rule, value, callback) => {
             if (value === '') {
@@ -495,7 +505,7 @@ export default {
         color: #313233;
         line-height: 33px;
         text-align: center;
-        padding: 50px 0 45px;
+        padding: 45px 0 40px;
     }
     .register-title {
         color: #20a0ff;

+ 71 - 20
src/main/vue/src/views/rate/AssignExpert.vue

@@ -17,12 +17,14 @@
                 <el-input
                     readonly
                     type="textarea"
-                    :autosize="{ minRows: 3, maxRows: 4 }"
+                    :autosize="{ minRows: 3, maxRows: 6 }"
                     placeholder="请输入单位概况"
                     v-model="formData.introduction"
                 ></el-input>
             </el-form-item>
-            <el-divider direction="horizontal" content-position="left">承办过的考级活动</el-divider>
+            <el-divider direction="horizontal" content-position="left" v-if="collaborates.length > 0"
+                >承办过的考级活动</el-divider
+            >
             <div class="add-con" v-for="(item, index) in collaborates" :key="index">
                 <div v-if="!item.del" style="padding: 3px 0 0 0">
                     <div class="parameters1">
@@ -60,8 +62,8 @@
             <el-form-item prop="reviewTime" label="审核时间">
                 <el-date-picker
                     v-model="dateRange"
-                    type="daterange"
-                    value-format="yyyy-MM-dd"
+                    type="datetimerange"
+                    value-format="yyyy-MM-dd HH:mm:ss"
                     start-placeholder="请选择开始时间"
                     end-placeholder="请选择结束时间"
                     range-separator="至"
@@ -118,20 +120,37 @@
                     </el-table>
                 </div>
             </el-form-item>
+            <el-form-item label="变更地址">
+                <el-switch v-model="formData.change" :disabled="formData.status !== 'ASSIGN_EXPERT'"></el-switch>
+                <el-input
+                    type="textarea"
+                    :rows="3"
+                    v-if="formData.change"
+                    placeholder="请输入新地址"
+                    v-model="formData.changeAddress"
+                    :readonly="formData.status != 'ASSIGN_EXPERT'"
+                ></el-input>
+            </el-form-item>
             <el-form-item class="fixed-btn">
                 <el-button @click="onSave" :loading="saving" type="primary" v-if="formData.status == 'ASSIGN_EXPERT'"
                     >保存</el-button
                 >
+                <el-button
+                    type="danger"
+                    v-if="formData.status == 'REVIEW_PENDING'"
+                    @click="saveDismiss"
+                    :loading="loading"
+                >
+                    退回
+                </el-button>
                 <el-button @click="$router.go(-1)">返回</el-button>
             </el-form-item>
         </el-form>
     </div>
 </template>
 <script>
-import delChild from '@/mixins/delChild';
 export default {
     name: 'AssignExpert',
-    mixins: [delChild],
     created() {
         if (this.$route.query.id) {
             this.$http
@@ -142,20 +161,22 @@ export default {
                         this.dateRange.push(res.reviewStartTime);
                         this.dateRange.push(res.reviewEndTime);
                     }
-                    this.$http.post('/user/expert', { rateId: this.$route.query.id }).then(data => {
-                        this.users = data.content;
-                        data.content.forEach(item => {
-                            let nickname = item.nickname;
-                            if (nickname.length < 3) {
-                                nickname = nickname.slice(0, 1) + ' ' + nickname.slice(1);
-                            }
-                            this.expert.push({
-                                label: nickname + '--' + item.phone + '--' + item.artType,
-                                value: item.id
+                    this.$http
+                        .post('/user/expert', { size: 1000, query: { del: false } }, { body: 'json' })
+                        .then(data => {
+                            this.users = data.content;
+                            data.content.forEach(item => {
+                                let nickname = item.nickname;
+                                if (nickname.length < 3) {
+                                    nickname = nickname.slice(0, 1) + ' ' + nickname.slice(1);
+                                }
+                                this.expert.push({
+                                    label: nickname + '--' + item.phone + '--' + item.artType,
+                                    value: item.id
+                                });
                             });
+                            this.getEmp(res);
                         });
-                        this.getEmp(res);
-                    });
                     this.$http
                         .post(
                             '/rateExpertAudit/all',
@@ -214,7 +235,6 @@ export default {
             emps: [],
             employeeId: '',
             employeeIds: [],
-            userPackage: [],
             dateRange: [],
             audits: [],
             grading: [],
@@ -230,7 +250,8 @@ export default {
             },
             readonly: true,
             collaborates: [],
-            expert: []
+            expert: [],
+            loading: false
         };
     },
     methods: {
@@ -308,6 +329,36 @@ export default {
         remove(row) {
             this.emps.pop(row);
             this.employeeIds.pop(this.employeeId);
+        },
+        delChild(list) {
+            return list.map(item => {
+                const info = {
+                    ...item,
+                    ['children']:
+                        item['children'] && item['children'].length > 0 ? this.delChild(item['children']) : null
+                };
+                return info;
+            });
+        },
+        saveDismiss() {
+            this.loading = true;
+            this.$alert('短信已发送,确认退回吗?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post('/rate/offline', {
+                        id: this.$route.query.id,
+                        status: 'ASSIGN_EXPERT'
+                    });
+                })
+                .then(res => {
+                    this.loading = false;
+                    this.$message.success('退回成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    this.loading = false;
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
         }
     }
 };

+ 2 - 1
src/main/vue/src/views/rate/GradeList.vue

@@ -363,7 +363,8 @@ export default {
             this.loading = true;
             this.$http
                 .post('/rate/offline', {
-                    id: this.$route.query.id
+                    id: this.$route.query.id,
+                    status: 'REVIEW_PENDING'
                 })
                 .then(res => {
                     this.loading = false;

+ 2 - 6
src/test/java/com/izouma/wenlvju/service/RateServiceTest.java

@@ -161,12 +161,8 @@ public class RateServiceTest extends ApplicationTests {
 
     @Test
     public void test9() {
-//        //加载Excel文档
-//        Workbook wb = new Workbook();
-//        wb.loadFromFile("C:\\Users\\Test1\\Desktop\\Test.xlsx");
-//
-//        //调用方法保存为PDF格式
-//        wb.saveToFile("output/ToPDF.pdf", FileFormat.PDF);
+        Rate rate = rateRepo.findById(366L).orElseThrow(new BusinessException("无消息"));
+        System.out.println(rateService.reviewTimesMessage(rate));
     }