Browse Source

Merge branch 'dev' of http://git.izouma.com/licailing/zhirongip into dev

panhui 4 năm trước cách đây
mục cha
commit
2a589ef1a5

+ 5 - 0
src/main/java/com/izouma/zhirongip/repo/InstitutionRepo.java

@@ -15,6 +15,11 @@ public interface InstitutionRepo extends JpaRepository<Institution, Long>, JpaSp
     @Transactional
     void softDelete(Long id);
 
+    @Query("update Institution t set t.del = true where t.userId = ?1")
+    @Modifying
+    @Transactional
+    void softDeleteByUserId(Long userId);
+
     Institution findByUserId(Long userId);
 
     long countAllByStatus(ApplyStatus status);

+ 5 - 0
src/main/java/com/izouma/zhirongip/repo/PersonalRepo.java

@@ -15,6 +15,11 @@ public interface PersonalRepo extends JpaRepository<Personal, Long>, JpaSpecific
     @Transactional
     void softDelete(Long id);
 
+    @Query("update Personal t set t.del = true where t.userId = ?1")
+    @Modifying
+    @Transactional
+    void softDeleteByUserId(Long userId);
+
     Personal findByUserId(Long userId);
 
     long countAllByStatus(ApplyStatus status);

+ 18 - 7
src/main/java/com/izouma/zhirongip/service/UserService.java

@@ -10,6 +10,8 @@ import com.izouma.zhirongip.dto.PageQuery;
 import com.izouma.zhirongip.dto.UserRegister;
 import com.izouma.zhirongip.enums.AuthorityName;
 import com.izouma.zhirongip.exception.BusinessException;
+import com.izouma.zhirongip.repo.InstitutionRepo;
+import com.izouma.zhirongip.repo.PersonalRepo;
 import com.izouma.zhirongip.repo.UserRepo;
 import com.izouma.zhirongip.security.Authority;
 import com.izouma.zhirongip.security.JwtTokenUtil;
@@ -33,19 +35,22 @@ import org.springframework.stereotype.Service;
 import java.text.SimpleDateFormat;
 import java.util.Collections;
 import java.util.Date;
+import java.util.Set;
 import java.util.UUID;
 
 @Service
 @Slf4j
 @AllArgsConstructor
 public class UserService {
-    private final UserRepo       userRepo;
-    private final WxMaService    wxMaService;
-    private final WxMpService    wxMpService;
-    private final SmsService     smsService;
-    private final StorageService storageService;
-    private final JwtTokenUtil   jwtTokenUtil;
-    private final CaptchaService captchaService;
+    private final UserRepo        userRepo;
+    private final WxMaService     wxMaService;
+    private final WxMpService     wxMpService;
+    private final SmsService      smsService;
+    private final StorageService  storageService;
+    private final JwtTokenUtil    jwtTokenUtil;
+    private final CaptchaService  captchaService;
+    private final PersonalRepo    personalRepo;
+    private final InstitutionRepo institutionRepo;
 
     public Page<User> all(PageQuery pageQuery) {
         return userRepo.findAll(JpaUtils.toSpecification(pageQuery, User.class), JpaUtils.toPageRequest(pageQuery));
@@ -70,6 +75,12 @@ public class UserService {
             user.setPhone(user.getPhone() + "###" + RandomStringUtils.randomAlphabetic(8));
         }
         userRepo.save(user);
+        Set<Authority> authorities = user.getAuthorities();
+        if (authorities.contains(Authority.get(AuthorityName.ROLE_INSTITUTION))) {
+            institutionRepo.softDeleteByUserId(id);
+        } else if (authorities.contains(Authority.get(AuthorityName.ROLE_PERSONAL))) {
+            personalRepo.softDeleteByUserId(id);
+        }
     }
 
     public User loginByPhone(String phone) {

+ 1 - 1
src/main/java/com/izouma/zhirongip/service/demand/FundingService.java

@@ -33,7 +33,7 @@ public class FundingService {
                 .collect(Collectors.toMap(Setting::getId, Setting::getName));
 
         return fundingRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
-                    List<Predicate> and = JpaUtils.toPredicates(pageQuery, TechnicalManager.class, root, criteriaQuery, criteriaBuilder);
+                    List<Predicate> and = JpaUtils.toPredicates(pageQuery, Funding.class, root, criteriaQuery, criteriaBuilder);
                     if (ObjectUtil.isNotNull(field)) {
                         Expression<Long> function = criteriaBuilder.function("FIND_IN_SET", Long.class, criteriaBuilder.literal(field), root
                                 .get("purpose"));

+ 9 - 9
src/main/java/com/izouma/zhirongip/service/supply/PatentService.java

@@ -27,18 +27,18 @@ public class PatentService {
     private final InformationRepo informationRepo;
 
     public Page<Patent> all(PageQuery pageQuery) {
-        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 1, 13,24,25,26)).stream()
+        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 1, 13, 24, 25, 26)).stream()
                 .collect(Collectors.toMap(Setting::getId, Setting::getName));
         return patentRepo.findAll(JpaUtils.toSpecification(pageQuery, Patent.class), JpaUtils.toPageRequest(pageQuery))
                 .map(cd -> {
                     cd.setIndustryName(settingMap.get(cd.getIndustryClass()));
-                    if(cd.getPatentTypeId()!=null){
+                    if (cd.getPatentTypeId() != null) {
                         cd.setPatentType(settingMap.get(cd.getPatentTypeId()));
                     }
-                    if(cd.getLawStatusId()!=null){
+                    if (cd.getLawStatusId() != null) {
                         cd.setLawStatus(settingMap.get(cd.getLawStatusId()));
                     }
-                    if(cd.getTradingMethodId()!=null){
+                    if (cd.getTradingMethodId() != null) {
                         cd.setTradingMethod(settingMap.get(cd.getTradingMethodId()));
                     }
                     return cd;
@@ -51,17 +51,17 @@ public class PatentService {
                 .orElseThrow(new BusinessException("无记录"))
                 .getName());
 
-        if(patent.getPatentTypeId()!=null){
+        if (patent.getPatentTypeId() != null) {
             patent.setPatentType(settingRepo.findById(patent.getPatentTypeId())
                     .orElseThrow(new BusinessException("无记录"))
                     .getName());
         }
-        if(patent.getLawStatusId()!=null){
+        if (patent.getLawStatusId() != null) {
             patent.setLawStatus(settingRepo.findById(patent.getLawStatusId())
                     .orElseThrow(new BusinessException("无记录"))
                     .getName());
         }
-        if(patent.getTradingMethodId()!=null){
+        if (patent.getTradingMethodId() != null) {
             patent.setTradingMethod(settingRepo.findById(patent.getTradingMethodId())
                     .orElseThrow(new BusinessException("无记录"))
                     .getName());
@@ -81,14 +81,14 @@ public class PatentService {
             record.setStatus(ApplyStatus.PASS);
             patentRepo.save(record);
 
-            information.setContent("您发布的供给侧:"+record.getName()+"已通过审核!");
+            information.setContent("您发布的供给侧:" + record.getName() + "已通过审核!");
             informationRepo.save(information);
             return;
         }
         record.setStatus(ApplyStatus.DENY);
         patentRepo.save(record);
 
-        information.setContent("您发布的的供给侧:"+record.getName()+"未通过审核,原因为:" + remark);
+        information.setContent("您发布的的供给侧:" + record.getName() + "未通过审核,原因为:" + remark);
         informationRepo.save(information);
     }
 }

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

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

+ 24 - 24
src/main/vue/src/views/demand/CopyrightDemandEdit.vue

@@ -109,11 +109,11 @@ export default {
                 .then(res => {
                     this.formData = res;
                     if (res.type == 'COPY') {
-                        this.getSetting(3);
+                        this.getSetting(3, 'workTypeOptions');
                     } else if (res.type == 'SOFT') {
-                        this.getSetting(4);
+                        this.getSetting(4, 'workTypeOptions');
                     } else {
-                        this.getSetting(6);
+                        this.getSetting(6, 'workTypeOptions');
                     }
                 })
                 .catch(e => {
@@ -125,11 +125,11 @@ export default {
             let type = this.$route.query.type;
             this.formData.type = this.$route.query.type;
             if (type == 'COPY') {
-                this.getSetting(3);
+                this.getSetting(3, 'workTypeOptions');
             } else if (type == 'SOFT') {
-                this.getSetting(4);
+                this.getSetting(4, 'workTypeOptions');
             } else {
-                this.getSetting(6);
+                this.getSetting(6, 'workTypeOptions');
             }
         }
     },
@@ -231,25 +231,25 @@ export default {
                         this.$message.error((e || {}).error || '删除失败');
                     }
                 });
-        },
-        getSetting(flag) {
-            this.$http
-                .post('/setting/byFlag', { flag: flag })
-                .then(res => {
-                    if (res.length > 0) {
-                        res.forEach(item => {
-                            this.workTypeOptions.push({
-                                label: item.name,
-                                value: item.id
-                            });
-                        });
-                    }
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
         }
+        // getSetting(flag) {
+        //     this.$http
+        //         .post('/setting/byFlag', { flag: flag })
+        //         .then(res => {
+        //             if (res.length > 0) {
+        //                 res.forEach(item => {
+        //                     this.workTypeOptions.push({
+        //                         label: item.name,
+        //                         value: item.id
+        //                     });
+        //                 });
+        //             }
+        //         })
+        //         .catch(e => {
+        //             console.log(e);
+        //             this.$message.error(e.error);
+        //         });
+        // }
     }
 };
 </script>

+ 22 - 22
src/main/vue/src/views/demand/PatentDemandEdit.vue

@@ -126,9 +126,9 @@ export default {
                 .then(res => {
                     this.formData = res;
                     if (res.caseType == 'GENERAL') {
-                        this.getSetting(1);
+                        this.getSetting(1, 'industryClassOptions');
                     } else {
-                        this.getSetting(13);
+                        this.getSetting(13, 'industryClassOptions');
                     }
                 })
                 .catch(e => {
@@ -140,9 +140,9 @@ export default {
             let type = this.$route.query.type;
             this.formData.caseType = this.$route.query.type;
             if (type == 'GENERAL') {
-                this.getSetting(1);
+                this.getSetting(1, 'industryClassOptions');
             } else {
-                this.getSetting(13);
+                this.getSetting(13, 'industryClassOptions');
             }
         }
         this.getSetting(25, 'patentTypeOptions');
@@ -268,24 +268,24 @@ export default {
                     }
                 });
         },
-        getSetting(flag) {
-            this.$http
-                .post('/setting/byFlag', { flag: flag })
-                .then(res => {
-                    if (res.length > 0) {
-                        res.forEach(item => {
-                            this.industryClassOptions.push({
-                                label: item.name,
-                                value: item.id
-                            });
-                        });
-                    }
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
-        },
+        // getSetting(flag) {
+        //     this.$http
+        //         .post('/setting/byFlag', { flag: flag })
+        //         .then(res => {
+        //             if (res.length > 0) {
+        //                 res.forEach(item => {
+        //                     this.industryClassOptions.push({
+        //                         label: item.name,
+        //                         value: item.id
+        //                     });
+        //                 });
+        //             }
+        //         })
+        //         .catch(e => {
+        //             console.log(e);
+        //             this.$message.error(e.error);
+        //         });
+        // },
         clear() {
             if (this.formData.negotiateDirectly) {
                 this.formData.expectedPrice = '';

+ 22 - 22
src/main/vue/src/views/supply/CopyrightEdit.vue

@@ -168,9 +168,9 @@ export default {
                 .then(res => {
                     this.formData = res;
                     if (res.type == 'COPY') {
-                        this.getSetting(3);
+                        this.getSetting(3, 'workTypeOptions');
                     } else {
-                        this.getSetting(4);
+                        this.getSetting(4, 'workTypeOptions');
                     }
                 })
                 .catch(e => {
@@ -181,9 +181,9 @@ export default {
         if (this.$route.query.type) {
             this.formData.type = this.$route.query.type;
             if (this.formData.type == 'COPY') {
-                this.getSetting(3);
+                this.getSetting(3, 'workTypeOptions');
             } else {
-                this.getSetting(4);
+                this.getSetting(4, 'workTypeOptions');
             }
         }
     },
@@ -300,25 +300,25 @@ export default {
                         this.$message.error((e || {}).error || '删除失败');
                     }
                 });
-        },
-        getSetting(flag) {
-            this.$http
-                .post('/setting/byFlag', { flag: flag })
-                .then(res => {
-                    if (res.length > 0) {
-                        res.forEach(item => {
-                            this.workTypeOptions.push({
-                                label: item.name,
-                                value: item.id
-                            });
-                        });
-                    }
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
         }
+        // getSetting(flag) {
+        //     this.$http
+        //         .post('/setting/byFlag', { flag: flag })
+        //         .then(res => {
+        //             if (res.length > 0) {
+        //                 res.forEach(item => {
+        //                     this.workTypeOptions.push({
+        //                         label: item.name,
+        //                         value: item.id
+        //                     });
+        //                 });
+        //             }
+        //         })
+        //         .catch(e => {
+        //             console.log(e);
+        //             this.$message.error(e.error);
+        //         });
+        // }
     }
 };
 </script>

+ 2 - 2
src/main/vue/src/views/supply/PatentEdit.vue

@@ -240,11 +240,11 @@ export default {
                 .then(res => {
                     this.formData = res;
                     if (res.caseType == 'GENERAL') {
-                        this.getSetting(1);
+                        this.getSetting(1, 'industryOptions');
                         this.getSetting(25, 'patentTypeOptions');
                         this.getSetting(26, 'lawStatusOptions');
                     } else {
-                        this.getSetting(13);
+                        this.getSetting(13, 'industryOptions');
                     }
                 })
                 .catch(e => {

+ 6 - 4
src/main/zhi-rong-web/src/components/popup/TechProductDemandAdd.vue

@@ -62,7 +62,7 @@
             <el-form-item prop="patentType" label="专利类型" v-if="formData.isPatented">
                 <el-select v-model="formData.patentType" clearable filterable placeholder="请选择" style="width: 200px">
                     <el-option
-                        v-for="item in patentTypeOptions"
+                        v-for="item in patentTypeOptionss"
                         :key="item.value"
                         :label="item.label"
                         :value="item.value"
@@ -131,7 +131,6 @@ import {
 } from '../../utils/variables';
 import { mapState } from 'vuex';
 export default {
-    // components: { RichText },
     name: 'TechProductDemandEdit',
     data() {
         return {
@@ -141,10 +140,13 @@ export default {
             formData: {
                 isPatented: false
             },
-
             industryOptions: [],
             stageOptions,
-            patentTypeOptions,
+            patentTypeOptionss: [
+                { label: '发明', value: 'INVENTION' },
+                { label: '实用新型', value: 'UTILITY_MODEL' },
+                { label: '外观设计', value: 'APPEARANCE_DESIGN' }
+            ],
             tradingMethodOptionsDemands,
             tradingMethodOptionsDemand
         };

+ 7 - 3
src/main/zhi-rong-web/src/views/detail/TechnologyProductDemand.vue

@@ -17,7 +17,7 @@
                     <div class="info-item">
                         <span class="text1">{{ `是否专利${info.tpType === 'TECHNOLOGY' ? '技术' : '产品'}` }}:</span>
                         <span class="text2" v-if="info.isPatented">{{
-                            getLabelName(info.patentType, patentTypeOptions)
+                            getLabelName(info.patentType, patentTypeOptionss)
                         }}</span>
                         <span class="text2" v-else>否</span>
                     </div>
@@ -84,7 +84,7 @@
 import BreadPage from '../../components/page/BreadPage.vue';
 import comEvent from '../../mixins/comEvent';
 import {
-    patentTypeOptions,
+    // patentTypeOptions,
     tradingMethodOptionsDemand,
     tradingMethodOptionsDemands,
     stageOptions,
@@ -94,7 +94,11 @@ export default {
     data() {
         return {
             info: {},
-            patentTypeOptions,
+            patentTypeOptionss: [
+                { label: '发明', value: 'INVENTION' },
+                { label: '实用新型', value: 'UTILITY_MODEL' },
+                { label: '外观设计', value: 'APPEARANCE_DESIGN' }
+            ],
             stageOptions,
             tradingMethodOptionsDemand,
             tradingMethodOptionsDemands,

+ 6 - 4
src/main/zhi-rong-web/src/views/user/publish/TechProductDemandEdit.vue

@@ -71,7 +71,7 @@
                         style="width: 200px"
                     >
                         <el-option
-                            v-for="item in patentTypeOptions"
+                            v-for="item in patentTypeOptionss"
                             :key="item.value"
                             :label="item.label"
                             :value="item.value"
@@ -136,7 +136,6 @@
 <script>
 import {
     stageOptions,
-    patentTypeOptions,
     tradingMethodOptionsDemand,
     tradingMethodOptionsDemands,
     phonePattern
@@ -144,7 +143,6 @@ import {
 import { mapState } from 'vuex';
 export default {
     created() {
-        // console.log(this.userInfo);
         if (this.$route.query.id) {
             this.$http
                 .get('techProductDemand/get/' + this.$route.query.id)
@@ -190,7 +188,11 @@ export default {
             },
             industryOptions: [],
             stageOptions,
-            patentTypeOptions,
+            patentTypeOptionss: [
+                { label: '发明', value: 'INVENTION' },
+                { label: '实用新型', value: 'UTILITY_MODEL' },
+                { label: '外观设计', value: 'APPEARANCE_DESIGN' }
+            ],
             tradingMethodOptionsDemand,
             tradingMethodOptionsDemands
         };

+ 24 - 0
src/test/java/com/izouma/zhirongip/service/demand/FundingServiceTest.java

@@ -0,0 +1,24 @@
+package com.izouma.zhirongip.service.demand;
+
+import com.izouma.zhirongip.ApplicationTests;
+import com.izouma.zhirongip.dto.PageQuery;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Map;
+
+
+public class FundingServiceTest extends ApplicationTests {
+
+    @Autowired
+    private FundingService fundingService;
+
+    @Test
+    public void all() {
+        PageQuery pageQuery = new PageQuery();
+        Map<String, Object> query = pageQuery.getQuery();
+        query.put("loanTerm", "ONE_TWO_YEARS");
+
+        System.out.println(fundingService.all(pageQuery, null).getContent());
+    }
+}