魏超 il y a 5 ans
Parent
révision
8c12689e82

+ 43
- 0
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanyController.java Voir le fichier

123
         return responseBean;
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 Voir le fichier

1
 package com.huiju.estateagents.eContract.controller;
1
 package com.huiju.estateagents.eContract.controller;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.base.ResponseBean;
9
+import com.huiju.estateagents.common.CommConstant;
8
 import com.huiju.estateagents.common.StringUtils;
10
 import com.huiju.estateagents.common.StringUtils;
11
+import com.huiju.estateagents.eContract.entity.TaCompany;
9
 import com.huiju.estateagents.eContract.entity.TaCompanySeal;
12
 import com.huiju.estateagents.eContract.entity.TaCompanySeal;
10
 import com.huiju.estateagents.eContract.service.ITaCompanySealService;
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
 import org.slf4j.Logger;
16
 import org.slf4j.Logger;
12
 import org.slf4j.LoggerFactory;
17
 import org.slf4j.LoggerFactory;
13
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.web.bind.annotation.*;
19
 import org.springframework.web.bind.annotation.*;
15
 
20
 
21
+import java.time.LocalDateTime;
22
+
16
 /**
23
 /**
17
  * <p>
24
  * <p>
18
     * 公司印章  前端控制器
25
     * 公司印章  前端控制器
30
     @Autowired
37
     @Autowired
31
     public ITaCompanySealService iTaCompanySealService;
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
         return responseBean;
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
      * @param taCompanySeal 实体对象
107
      * @param taCompanySeal 实体对象
65
      * @return
108
      * @return
66
      */
109
      */
67
-    @RequestMapping(value="/taCompanySeal",method= RequestMethod.POST)
110
+    @RequestMapping(value="/channel/taCompanySeal",method= RequestMethod.POST)
68
     public ResponseBean taCompanySealAdd(@RequestBody TaCompanySeal taCompanySeal){
111
     public ResponseBean taCompanySealAdd(@RequestBody TaCompanySeal taCompanySeal){
69
         ResponseBean responseBean = new ResponseBean();
112
         ResponseBean responseBean = new ResponseBean();
70
         try {
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
             if (iTaCompanySealService.save(taCompanySeal)){
125
             if (iTaCompanySealService.save(taCompanySeal)){
72
                 responseBean.addSuccess(taCompanySeal);
126
                 responseBean.addSuccess(taCompanySeal);
73
             }else {
127
             }else {

+ 24
- 1
src/main/java/com/huiju/estateagents/eContract/controller/TaContractBusinessController.java Voir le fichier

16
 
16
 
17
 import javax.servlet.http.HttpServletRequest;
17
 import javax.servlet.http.HttpServletRequest;
18
 import java.time.LocalDateTime;
18
 import java.time.LocalDateTime;
19
+import java.util.List;
19
 
20
 
20
 /**
21
 /**
21
  * <p>
22
  * <p>
61
             queryWrapper.like(!StringUtils.isEmpty(targetName), "target_name", targetName);
62
             queryWrapper.like(!StringUtils.isEmpty(targetName), "target_name", targetName);
62
             queryWrapper.like(!StringUtils.isEmpty(companyName), "company_name", companyName);
63
             queryWrapper.like(!StringUtils.isEmpty(companyName), "company_name", companyName);
63
             queryWrapper.eq(status != null, "status", status);
64
             queryWrapper.eq(status != null, "status", status);
65
+            queryWrapper.ne("status", CommConstant.STATUS_DELETE);
64
             queryWrapper.orderByDesc("create_date");
66
             queryWrapper.orderByDesc("create_date");
65
             IPage<TaContractBusiness> result = iTaContractBusinessService.page(pg, queryWrapper);
67
             IPage<TaContractBusiness> result = iTaContractBusinessService.page(pg, queryWrapper);
66
             responseBean.addSuccess(result);
68
             responseBean.addSuccess(result);
113
      * @param id  实体ID
115
      * @param id  实体ID
114
      */
116
      */
115
     @ResponseBody
117
     @ResponseBody
116
-    @RequestMapping(value="/taContractBusiness/{id}", method= RequestMethod.DELETE)
118
+    @RequestMapping(value="/taContractBusiness/{id}", method= RequestMethod.PUT)
117
     public ResponseBean taContractBusinessDelete(@PathVariable Integer id){
119
     public ResponseBean taContractBusinessDelete(@PathVariable Integer id){
118
         ResponseBean responseBean = new ResponseBean();
120
         ResponseBean responseBean = new ResponseBean();
119
         try {
121
         try {
130
         return responseBean;
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
      * @param id  实体ID
158
      * @param id  实体ID

+ 4
- 0
src/main/java/com/huiju/estateagents/eContract/entity/TaContractBusiness.java Voir le fichier

5
 import com.baomidou.mybatisplus.annotation.TableId;
5
 import com.baomidou.mybatisplus.annotation.TableId;
6
 import java.time.LocalDateTime;
6
 import java.time.LocalDateTime;
7
 import java.io.Serializable;
7
 import java.io.Serializable;
8
+import java.util.List;
9
+
8
 import lombok.Data;
10
 import lombok.Data;
9
 import lombok.EqualsAndHashCode;
11
 import lombok.EqualsAndHashCode;
10
 import lombok.experimental.Accessors;
12
 import lombok.experimental.Accessors;
110
      */
112
      */
111
     private Integer status;
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 Voir le fichier

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
+}