Browse Source

供给侧

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

+ 5 - 6
src/main/java/com/izouma/zhirongip/domain/supply/Copyright.java

@@ -61,13 +61,12 @@ public class Copyright extends BaseEntity {
     @ApiModelProperty(value = "著作权人")
     private String owner;
 
-    @EnumFormat(value = TradingMethod.class,
-            fromExcel = {"转让", "普通许可", "独占许可", "排他许可", "入股", "其他"},
-            toJavaEnum = {"TRANSFER", "GENERAL_PERMIT", "EXCLUSIVE_PERMIT", "EXCLUSIVITY_PERMIT", "INVEST", "OTHER"})
-    @ExcelProperty(value = "交易方式", converter = EnumExcelConverter.class)
-    @Enumerated(EnumType.STRING)
+
+    @ApiModelProperty(value = "交易方式")
+    private String tradingMethod;
+
     @ApiModelProperty(value = "交易方式")
-    private TradingMethod tradingMethod;
+    private Long tradingMethodId;
 
     @ExcelIgnore
     @Convert(converter = StringArrayConverter.class)

+ 5 - 6
src/main/java/com/izouma/zhirongip/domain/supply/Logo.java

@@ -71,13 +71,12 @@ public class Logo extends BaseEntity {
     @ApiModelProperty(value = "商标图样")
     private List<String> img;
 
-    @EnumFormat(value = TradingMethod.class,
-            fromExcel = {"转让", "普通许可", "独占许可", "排他许可", "入股", "其他"},
-            toJavaEnum = {"TRANSFER", "GENERAL_PERMIT", "EXCLUSIVE_PERMIT", "EXCLUSIVITY_PERMIT", "INVEST", "OTHER"})
-    @ExcelProperty(value = "交易方式", converter = EnumExcelConverter.class)
-    @Enumerated(EnumType.STRING)
+
+    @ApiModelProperty(value = "交易方式")
+    private String tradingMethod;
+
     @ApiModelProperty(value = "交易方式")
-    private TradingMethod tradingMethod;
+    private Long tradingMethodId;
 
     /*
     (万元)

+ 3 - 3
src/main/java/com/izouma/zhirongip/domain/supply/Patent.java

@@ -55,14 +55,14 @@ public class Patent extends BaseEntity {
     /**
      * setting
      */
-    @ExcelIgnore
+
     @ApiModelProperty(value = "行业分类")
     private Long industryClass;
 
     @ApiModelProperty(value = "IPC分类号")
     private String ipc;
 
-    @ExcelIgnore
+
     @ApiModelProperty(value = "法律状态")
     private String lawStatus;
     @ApiModelProperty(value = "法律状态")
@@ -104,7 +104,7 @@ public class Patent extends BaseEntity {
     private List<String> img;
 
 
-    @ExcelIgnore
+
     @ApiModelProperty(value = "交易方式")
     private String tradingMethod;
 

+ 4 - 2
src/main/java/com/izouma/zhirongip/domain/supply/TechnologyProduct.java

@@ -83,9 +83,11 @@ public class TechnologyProduct extends BaseEntity {
     @ApiModelProperty(value = "附图")
     private List<String> img;
 
-    @Enumerated(EnumType.STRING)
+
+    @ApiModelProperty(value = "交易方式")
+    private String tradingMethod;
     @ApiModelProperty(value = "交易方式")
-    private TechTradingMethod tradingMethod;
+    private Long tradingMethodId;
 
     /*
     (万元)

+ 12 - 6
src/main/java/com/izouma/zhirongip/enums/TechTradingMethod.java

@@ -1,18 +1,24 @@
 package com.izouma.zhirongip.enums;
 
 public enum TechTradingMethod {
-    TRANSFER("转让"),
-    PERMIT("许可"),
-    INVEST("入股"),
-    CO_PRODUCTION("合作生产"),
-    OTHER("其他");
+    TRANSFER("转让", 7255L),
+    PERMIT("许可", 7256L),
+    INVEST("入股", 7257L),
+    CO_PRODUCTION("合作生产", 7258L),
+    OTHER("其他", 7259L);
     private final String desc;
+    private final Long id;
 
-    TechTradingMethod(String desc) {
+    TechTradingMethod(String desc, Long id) {
         this.desc = desc;
+        this.id = id;
     }
 
     public String getDesc() {
         return desc;
     }
+
+    public Long getId() {
+        return  this.id;
+    }
 }

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

@@ -27,12 +27,15 @@ public class CopyrightService {
     private final InformationRepo informationRepo;
 
     public Page<Copyright> all(PageQuery pageQuery) {
-        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 3, 4, 6))
+        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 3, 4, 6,24))
                 .stream()
                 .collect(Collectors.toMap(Setting::getId, Setting::getName));
         return copyrightRepo.findAll(JpaUtils.toSpecification(pageQuery, Copyright.class), JpaUtils.toPageRequest(pageQuery))
                 .map(cd -> {
                     cd.setWorkName(settingMap.get(cd.getWorkType()));
+                    if(cd.getTradingMethodId()!=null){
+                        cd.setTradingMethod(settingMap.get(cd.getTradingMethodId()));
+                    }
                     return cd;
                 });
     }
@@ -42,6 +45,11 @@ public class CopyrightService {
         copyright.setWorkName(settingRepo.findById(copyright.getWorkType())
                 .orElseThrow(new BusinessException("无记录"))
                 .getName());
+        if(copyright.getTradingMethodId()!=null){
+            copyright.setTradingMethod(settingRepo.findById(copyright.getTradingMethodId())
+                    .orElseThrow(new BusinessException("无记录"))
+                    .getName());
+        }
         return copyright;
     }
 

+ 11 - 1
src/main/java/com/izouma/zhirongip/service/supply/LogoService.java

@@ -1,5 +1,6 @@
 package com.izouma.zhirongip.service.supply;
 
+import cn.hutool.core.collection.CollUtil;
 import com.izouma.zhirongip.domain.Information;
 import com.izouma.zhirongip.domain.Setting;
 import com.izouma.zhirongip.domain.supply.Logo;
@@ -26,11 +27,14 @@ public class LogoService {
     private final InformationRepo informationRepo;
 
     public Page<Logo> all(PageQuery pageQuery) {
-        Map<Long, String> settingMap = settingRepo.findAllByFlag(2).stream()
+        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 2,24)).stream()
                 .collect(Collectors.toMap(Setting::getId, Setting::getName));
         return logoRepo.findAll(JpaUtils.toSpecification(pageQuery, Logo.class), JpaUtils.toPageRequest(pageQuery))
                 .map(cd -> {
                     cd.setCategoryName(settingMap.get(cd.getCategory()));
+                    if(cd.getTradingMethodId()!=null){
+                        cd.setTradingMethod(settingMap.get(cd.getTradingMethodId()));
+                    }
                     return cd;
                 });
     }
@@ -40,6 +44,12 @@ public class LogoService {
         logo.setCategoryName(settingRepo.findById(logo.getCategory())
                 .orElseThrow(new BusinessException("无记录"))
                 .getName());
+
+        if(logo.getTradingMethodId()!=null){
+            logo.setTradingMethod(settingRepo.findById(logo.getTradingMethodId())
+                    .orElseThrow(new BusinessException("无记录"))
+                    .getName());
+        }
         return logo;
     }
 

+ 5 - 2
src/main/java/com/izouma/zhirongip/service/supply/TechnologyProductService.java

@@ -1,5 +1,6 @@
 package com.izouma.zhirongip.service.supply;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.izouma.zhirongip.converter.LongArrayConverter;
 import com.izouma.zhirongip.domain.Information;
@@ -34,10 +35,9 @@ public class TechnologyProductService {
     }
 
     public Page<TechnologyProduct> all(PageQuery pageQuery, String money) {
-        Map<Long, String> settingMap = settingRepo.findAllByFlag(1)
+        Map<Long, String> settingMap = settingRepo.findAllByFlagIn(CollUtil.list(false, 1,29))
                 .stream()
                 .collect(Collectors.toMap(Setting::getId, Setting::getName));
-
         return technologyProductRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
                     List<Predicate> and = JpaUtils.toPredicates(pageQuery, TechnologyProduct.class, root, criteriaQuery, criteriaBuilder);
                     if (StrUtil.isNotBlank(money)) {
@@ -53,6 +53,9 @@ public class TechnologyProductService {
                 }), JpaUtils.toPageRequest(pageQuery))
                 .map(tp -> {
                     tp.setFieldName(settingMap.get(tp.getField()));
+                    if(tp.getTradingMethodId()!=null){
+                        tp.setTradingMethod(settingMap.get(tp.getTradingMethodId()));
+                    }
                     return tp;
                 });
     }

+ 4 - 0
src/main/java/com/izouma/zhirongip/web/supply/TechnologyProductController.java

@@ -60,6 +60,10 @@ public class TechnologyProductController extends BaseController {
         TechnologyProduct record = technologyProductRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         settingRepo.findById(record.getField())
                 .ifPresent(setting -> record.setFieldName(setting.getName()));
+        if(record.getTradingMethodId()!=null){
+            settingRepo.findById(record.getTradingMethodId())
+                    .ifPresent(setting -> record.setTradingMethod(setting.getName()));
+        }
         return record;
     }
 

+ 4 - 4
src/main/vue/src/components/ExcelUpload.vue

@@ -44,11 +44,11 @@ export default {
         onfail(e) {
             console.log(e);
             this.$message.error('失败');
-            this.changeSelect;
+            this.changeSelect();
         },
         onSuccess() {
             this.$message.success('上传成功');
-            this.changeSelect;
+            this.changeSelect();
         },
         beforeUpload() {
             return this.$confirm('确认要导入文件数据吗?', '提示', {
@@ -57,8 +57,8 @@ export default {
                 type: 'warning'
             });
         },
-        changeSelect(val) {
-            this.$emit('input', val);
+        changeSelect() {
+            this.$emit('change');
         }
     }
 };

+ 18 - 1
src/main/vue/src/mixins/tradingMethod.js

@@ -1,6 +1,9 @@
 import { add } from 'date-fns';
 
 export default {
+    created() {
+        this.getSetting(24, 'tradingMethodOptions');
+    },
     data() {
         return {
             tradingMethodOptions: [
@@ -22,7 +25,21 @@ export default {
                 { label: '通过', value: 'PASS' },
                 { label: '申请中', value: 'PENDING' },
                 { label: '拒绝', value: 'DENY' }
-            ]
+            ],
+            getSetting(flag = 1, keyName) {
+                return this.$http.post('/setting/byFlag', { flag: flag }).then(res => {
+                    let list = res.map(item => {
+                        return {
+                            label: item.name,
+                            value: item.id
+                        };
+                    });
+                    if (keyName) {
+                        this[keyName] = list;
+                    }
+                    return Promise.resolve(list);
+                });
+            }
         };
     },
     methods: {

+ 1 - 1
src/main/vue/src/views/resource/DigitalList.vue

@@ -19,7 +19,7 @@
             >
                 导出
             </el-button>
-            <excel-upload uri="digital/upload" @input="getData"></excel-upload>
+            <excel-upload uri="digital/upload" @change="getData"></excel-upload>
         </page-title>
         <div class="filters-container">
             <el-input

+ 1 - 1
src/main/vue/src/views/resource/DigitalProductList.vue

@@ -19,7 +19,7 @@
             >
                 导出
             </el-button>
-            <excel-upload uri="digital/uploadProduct" @input="getData"></excel-upload>
+            <excel-upload uri="digital/uploadProduct" @change="getData"></excel-upload>
         </page-title>
         <div class="filters-container">
             <el-input

+ 1 - 1
src/main/vue/src/views/resource/IntellectualPropertyList.vue

@@ -19,7 +19,7 @@
             >
                 导出
             </el-button>
-            <excel-upload uri="intellectualProperty/upload" @input="getData"></excel-upload>
+            <excel-upload uri="intellectualProperty/upload" @change="getData"></excel-upload>
         </page-title>
         <div class="filters-container">
             <el-input

+ 6 - 20
src/main/vue/src/views/supply/PatentEdit.vue

@@ -241,6 +241,8 @@ export default {
                     this.formData = res;
                     if (res.caseType == 'GENERAL') {
                         this.getSetting(1);
+                        this.getSetting(25, 'patentTypeOptions');
+                        this.getSetting(26, 'lawStatusOptions');
                     } else {
                         this.getSetting(13);
                     }
@@ -254,9 +256,11 @@ export default {
             let type = this.$route.query.type;
             this.formData.caseType = this.$route.query.type;
             if (type == 'GENERAL') {
-                this.getSetting(1);
+                this.getSetting(1, 'industryOptions');
+                this.getSetting(25, 'patentTypeOptions');
+                this.getSetting(26, 'lawStatusOptions');
             } else {
-                this.getSetting(13);
+                this.getSetting(13, 'industryOptions');
             }
         }
     },
@@ -391,24 +395,6 @@ export default {
             }
             this.inputVisible = false;
             this.inputValue = '';
-        },
-        getSetting(flag) {
-            this.$http
-                .post('/setting/byFlag', { flag: flag })
-                .then(res => {
-                    if (res.length > 0) {
-                        res.forEach(item => {
-                            this.industryOptions.push({
-                                label: item.name,
-                                value: item.id
-                            });
-                        });
-                    }
-                })
-                .catch(e => {
-                    console.log(e);
-                    this.$message.error(e.error);
-                });
         }
     }
 };

+ 3 - 1
src/main/zhi-rong-web/src/utils/getVariables.js

@@ -3,7 +3,9 @@ import http from "../plugins/http";
 const flags = new Map([
     ['tradingMethodOption', 24],
     ['patentTypeOptions', 25],
-    ['patentStatusOptions', 26]
+    ['patentStatusOptions', 26],
+    ['tradingMethodOptionsDemands',29],
+    ['tradingMethodOptionsDemand',29]
 ])
 
 var checkList = [];

+ 1 - 1
src/main/zhi-rong-web/src/views/market/TechnologyProduct.vue

@@ -75,7 +75,7 @@ export default {
                 },
                 {
                     name: '交易方式',
-                    key: 'tradingMethod',
+                    key: 'tradingMethodId',
                     list: [...this.tradingMethodOptionsDemand]
                 },
                 {

+ 43 - 0
src/test/java/com/izouma/zhirongip/service/AllServiceTest.java

@@ -1,8 +1,15 @@
 package com.izouma.zhirongip.service;
 
 import com.izouma.zhirongip.ApplicationTests;
+import com.izouma.zhirongip.domain.supply.Copyright;
+import com.izouma.zhirongip.domain.supply.Logo;
+import com.izouma.zhirongip.domain.supply.Patent;
+import com.izouma.zhirongip.domain.supply.TechnologyProduct;
 import com.izouma.zhirongip.dto.SearchDTO;
+import com.izouma.zhirongip.repo.supply.CopyrightRepo;
+import com.izouma.zhirongip.repo.supply.LogoRepo;
 import com.izouma.zhirongip.repo.supply.PatentRepo;
+import com.izouma.zhirongip.repo.supply.TechnologyProductRepo;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
@@ -17,6 +24,15 @@ public class AllServiceTest extends ApplicationTests {
     @Autowired
     private ApplicationContext applicationContext;
 
+    @Autowired
+    private  PatentRepo patentRepo;
+    @Autowired
+    private LogoRepo logoRepo;
+    @Autowired
+    private CopyrightRepo copyrightRepo;
+    @Autowired
+    private TechnologyProductRepo technologyProductRepo;
+
     @Test
     public void search() {
         List<SearchDTO> search = allService.search("1");
@@ -29,4 +45,31 @@ public class AllServiceTest extends ApplicationTests {
         PatentRepo patentRepo = applicationContext.getBean(PatentRepo.class);
         patentRepo.addView(237L);
     }
+
+//    @Test
+//    public void test2() {
+//       List<Logo> logos= logoRepo.findAll();
+//        logos.forEach(item ->{
+//           if(item.getTradingMethod()!=null){
+//               item.setTradingMethodId(item.getTradingMethod().getId());
+//               logoRepo.save(item);
+//           }
+//       });
+//        List<Copyright> copys= copyrightRepo.findAll();
+//        copys.forEach(item ->{
+//            if(item.getTradingMethod()!=null){
+//                item.setTradingMethodId(item.getTradingMethod().getId());
+//                copyrightRepo.save(item);
+//            }
+//        });
+//        List<TechnologyProduct> tecs= technologyProductRepo.findAll();
+//        tecs.forEach(item ->{
+//            if(item.getTradingMethod()!=null){
+//                item.setTradingMethodId(item.getTradingMethod().getId());
+//                technologyProductRepo.save(item);
+//            }
+//        });
+//    }
+
+
 }