浏览代码

新需求

魏超 5 年前
父节点
当前提交
8c12689e82

+ 43
- 0
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanyController.java 查看文件

@@ -123,6 +123,49 @@ public class TaCompanyController extends BaseController {
123 123
         return responseBean;
124 124
     }
125 125
 
126
+    /**
127
+     * 条件查询企业列表
128
+     *
129
+     * @param pageNum
130
+     * @param pageSize
131
+     * @param companyName
132
+     * @return
133
+     */
134
+    @RequestMapping(value = "/channel/taCompanyList", method = RequestMethod.GET)
135
+    public ResponseBean channelCompanyList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
136
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
137
+                                           @RequestParam(value = "companyName") String companyName,
138
+                                           @RequestParam(value = "companyCode")String companyCode,
139
+                                           @RequestParam(value = "certifiedStatus")String certifiedStatus,
140
+                                           @RequestParam(value = "authorizeStatus")String authorizeStatus) {
141
+        ResponseBean responseBean = new ResponseBean();
142
+        try {
143
+            //使用分页插件
144
+            IPage<TaCompany> pg = new Page<>(pageNum, pageSize);
145
+            QueryWrapper<TaCompany> queryWrapper = new QueryWrapper<>();
146
+            queryWrapper.like(StringUtils.isNotBlank(companyName), "company_name", companyName);
147
+            queryWrapper.like(StringUtils.isNotBlank(companyCode), "company_code", companyCode);
148
+            queryWrapper.eq(StringUtils.isNotBlank(certifiedStatus), "certified_status", certifiedStatus);
149
+            queryWrapper.eq(StringUtils.isNotBlank(authorizeStatus), "authorize_status", authorizeStatus);
150
+            queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
151
+            queryWrapper.orderByDesc("create_date");
152
+
153
+            IPage<TaCompany> result = iTaCompanyService.page(pg, queryWrapper);
154
+            List<TaCompany> taCompanyList = result.getRecords();
155
+            for (TaCompany taCompany : taCompanyList){
156
+                QueryWrapper<TaCompanySeal> sealQueryWrapper = new QueryWrapper<>();
157
+                sealQueryWrapper.eq("company_id", taCompany.getCompanyId());
158
+                taCompany.setSealNum(iTaCompanySealService.count(sealQueryWrapper));
159
+            }
160
+            responseBean.addSuccess(result);
161
+        } catch (Exception e) {
162
+            e.printStackTrace();
163
+            logger.error("taCompanyList -=- {}", e.toString());
164
+            responseBean.addError(e.getMessage());
165
+        }
166
+        return responseBean;
167
+    }
168
+
126 169
     /**
127 170
      * 保存对象
128 171
      *

+ 55
- 1
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanySealController.java 查看文件

@@ -1,18 +1,25 @@
1 1
 package com.huiju.estateagents.eContract.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 7
 import com.huiju.estateagents.base.BaseController;
7 8
 import com.huiju.estateagents.base.ResponseBean;
9
+import com.huiju.estateagents.common.CommConstant;
8 10
 import com.huiju.estateagents.common.StringUtils;
11
+import com.huiju.estateagents.eContract.entity.TaCompany;
9 12
 import com.huiju.estateagents.eContract.entity.TaCompanySeal;
10 13
 import com.huiju.estateagents.eContract.service.ITaCompanySealService;
14
+import com.huiju.estateagents.eContract.service.ITaCompanyService;
15
+import com.huiju.estateagents.eContract.service.impl.TaCompanySealUtil;
11 16
 import org.slf4j.Logger;
12 17
 import org.slf4j.LoggerFactory;
13 18
 import org.springframework.beans.factory.annotation.Autowired;
14 19
 import org.springframework.web.bind.annotation.*;
15 20
 
21
+import java.time.LocalDateTime;
22
+
16 23
 /**
17 24
  * <p>
18 25
     * 公司印章  前端控制器
@@ -30,6 +37,11 @@ public class TaCompanySealController extends BaseController {
30 37
     @Autowired
31 38
     public ITaCompanySealService iTaCompanySealService;
32 39
 
40
+    @Autowired
41
+    private ITaCompanyService iTaCompanyService;
42
+
43
+    @Autowired
44
+    private TaCompanySealUtil taCompanySealUtil;
33 45
 
34 46
     /**
35 47
      * 分页查询列表
@@ -59,15 +71,57 @@ public class TaCompanySealController extends BaseController {
59 71
         return responseBean;
60 72
     }
61 73
 
74
+    /**
75
+     * 分页查询列表
76
+     * @param pageNum
77
+     * @param pageSize
78
+     * @return
79
+     */
80
+    @RequestMapping(value="/channel/taCompanySeal",method= RequestMethod.GET)
81
+    public ResponseBean channelCompanySealList(
82
+                                          @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
83
+                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
84
+                                          @RequestParam(value ="companyId", required = false) String companyId,
85
+                                          @RequestParam(value ="sealName", required = false) String sealName){
86
+        ResponseBean responseBean = new ResponseBean();
87
+        try {
88
+            //使用分页插件
89
+            IPage<TaCompanySeal> pg = new Page<>(pageNum, pageSize);
90
+            QueryWrapper<TaCompanySeal> queryWrapper = new QueryWrapper<>();
91
+            queryWrapper.eq("company_id", companyId);
92
+            queryWrapper.like(!StringUtils.isEmpty(sealName), "seal_name", sealName);
93
+            queryWrapper.orderByDesc("create_date");
94
+
95
+            IPage<TaCompanySeal> result = iTaCompanySealService.page(pg, queryWrapper);
96
+            responseBean.addSuccess(result);
97
+        }catch (Exception e){
98
+            e.printStackTrace();
99
+            logger.error("taCompanySealList -=- {}",e.toString());
100
+            responseBean.addError(e.getMessage());
101
+        }
102
+        return responseBean;
103
+    }
104
+
62 105
     /**
63 106
      * 保存对象
64 107
      * @param taCompanySeal 实体对象
65 108
      * @return
66 109
      */
67
-    @RequestMapping(value="/taCompanySeal",method= RequestMethod.POST)
110
+    @RequestMapping(value="/channel/taCompanySeal",method= RequestMethod.POST)
68 111
     public ResponseBean taCompanySealAdd(@RequestBody TaCompanySeal taCompanySeal){
69 112
         ResponseBean responseBean = new ResponseBean();
70 113
         try {
114
+            TaCompany taCompany = iTaCompanyService.getById(taCompanySeal.getCompanyId());
115
+            String result = taCompanySealUtil.addSignaTrue(taCompany.getFadadaCode(), taCompanySeal.getSealImg());
116
+            JSONObject params = JSONObject.parseObject(result);
117
+            if (!String.valueOf(CommConstant.STATUS_NORMAL).equals(params.get("code"))){
118
+                responseBean.addError(params.get("msg").toString());
119
+                return responseBean;
120
+            }
121
+
122
+            String data = params.getString("data");
123
+            taCompanySeal.setCreateDate(LocalDateTime.now());
124
+            taCompanySeal.setStatus(CommConstant.STATUS_NORMAL);
71 125
             if (iTaCompanySealService.save(taCompanySeal)){
72 126
                 responseBean.addSuccess(taCompanySeal);
73 127
             }else {

+ 24
- 1
src/main/java/com/huiju/estateagents/eContract/controller/TaContractBusinessController.java 查看文件

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
16 16
 
17 17
 import javax.servlet.http.HttpServletRequest;
18 18
 import java.time.LocalDateTime;
19
+import java.util.List;
19 20
 
20 21
 /**
21 22
  * <p>
@@ -61,6 +62,7 @@ public class TaContractBusinessController extends BaseController {
61 62
             queryWrapper.like(!StringUtils.isEmpty(targetName), "target_name", targetName);
62 63
             queryWrapper.like(!StringUtils.isEmpty(companyName), "company_name", companyName);
63 64
             queryWrapper.eq(status != null, "status", status);
65
+            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
64 66
             queryWrapper.orderByDesc("create_date");
65 67
             IPage<TaContractBusiness> result = iTaContractBusinessService.page(pg, queryWrapper);
66 68
             responseBean.addSuccess(result);
@@ -113,7 +115,7 @@ public class TaContractBusinessController extends BaseController {
113 115
      * @param id  实体ID
114 116
      */
115 117
     @ResponseBody
116
-    @RequestMapping(value="/taContractBusiness/{id}", method= RequestMethod.DELETE)
118
+    @RequestMapping(value="/taContractBusiness/{id}", method= RequestMethod.PUT)
117 119
     public ResponseBean taContractBusinessDelete(@PathVariable Integer id){
118 120
         ResponseBean responseBean = new ResponseBean();
119 121
         try {
@@ -130,6 +132,27 @@ public class TaContractBusinessController extends BaseController {
130 132
         return responseBean;
131 133
     }
132 134
 
135
+    /**
136
+     * 根据id批量删除对象
137
+     */
138
+    @ResponseBody
139
+    @RequestMapping(value="/admin/batchDelBusinessConfig", method= RequestMethod.PUT)
140
+    public ResponseBean batchDelBusinessConfig(@RequestBody TaContractBusiness contractBusinesses, HttpServletRequest request){
141
+        ResponseBean responseBean = new ResponseBean();
142
+        for (TaContractBusiness taContractBusiness : contractBusinesses.getContractBusinessList()){
143
+            taContractBusiness.setStatus(CommConstant.STATUS_DELETE);
144
+        }
145
+        try{
146
+            iTaContractBusinessService.updateBatchById(contractBusinesses.getContractBusinessList());
147
+            responseBean.addSuccess("success");
148
+        }catch (Exception e){
149
+            e.printStackTrace();
150
+            responseBean.addError("fail");
151
+        }
152
+
153
+        return responseBean;
154
+    }
155
+
133 156
     /**
134 157
      * 修改对象
135 158
      * @param id  实体ID

+ 4
- 0
src/main/java/com/huiju/estateagents/eContract/entity/TaContractBusiness.java 查看文件

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
5 5
 import com.baomidou.mybatisplus.annotation.TableId;
6 6
 import java.time.LocalDateTime;
7 7
 import java.io.Serializable;
8
+import java.util.List;
9
+
8 10
 import lombok.Data;
9 11
 import lombok.EqualsAndHashCode;
10 12
 import lombok.experimental.Accessors;
@@ -110,4 +112,6 @@ public class TaContractBusiness implements Serializable {
110 112
      */
111 113
     private Integer status;
112 114
 
115
+    @TableField(exist = false)
116
+    private List<TaContractBusiness> contractBusinessList;
113 117
 }

+ 21
- 0
src/main/java/com/huiju/estateagents/eContract/service/impl/TaCompanySealUtil.java 查看文件

@@ -0,0 +1,21 @@
1
+package com.huiju.estateagents.eContract.service.impl;
2
+
3
+import com.fadada.sdk.client.FddClientBase;
4
+import com.fadada.sdk.util.crypt.FddEncryptTool;
5
+import com.huiju.estateagents.base.ResponseBean;
6
+import com.huiju.estateagents.config.FadadaProperties;
7
+import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.stereotype.Component;
9
+
10
+@Component
11
+public class TaCompanySealUtil {
12
+
13
+    @Autowired
14
+    private FadadaProperties fadadaProperties;
15
+
16
+    public String addSignaTrue(String customerId, String imgUrl) throws Exception {
17
+        FddClientBase base = new FddClientBase(fadadaProperties.getAppId(), fadadaProperties.getAppSecret(), fadadaProperties.getVersion(), fadadaProperties.getServeHost());
18
+        String base64Url = FddEncryptTool.ImageToBase64ByOnline(imgUrl);
19
+        return base.invokeaddSignature(customerId, base64Url);
20
+    }
21
+}