魏超 5 years ago
parent
commit
e2e97a584b

+ 37
- 8
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanyController.java View File

@@ -18,6 +18,7 @@ import com.huiju.estateagents.eContract.entity.TaContractUser;
18 18
 import com.huiju.estateagents.eContract.service.ITaCompanySealService;
19 19
 import com.huiju.estateagents.config.FadadaProperties;
20 20
 import com.huiju.estateagents.eContract.service.ITaContractUserService;
21
+import com.huiju.estateagents.eContract.service.impl.TaCompanySealUtil;
21 22
 import com.huiju.estateagents.entity.TaMiniapp;
22 23
 import com.huiju.estateagents.sample.entity.TaH5Demand;
23 24
 import com.huiju.estateagents.service.impl.TaMiniappServiceImpl;
@@ -76,6 +77,9 @@ public class TaCompanyController extends BaseController {
76 77
     @Autowired
77 78
     private TaMiniappServiceImpl taMiniappService;
78 79
 
80
+    @Autowired
81
+    private TaCompanySealUtil taCompanySealUtil;
82
+
79 83
 
80 84
     /**
81 85
      * 条件查询企业列表
@@ -122,18 +126,12 @@ public class TaCompanyController extends BaseController {
122 126
     @RequestMapping(value = "/admin/taCompanyList", method = RequestMethod.GET)
123 127
     public ResponseBean companyList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
124 128
                                    @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
125
-                                   String companyName, String companyCode) {
129
+                                   String companyName, String companyCode, HttpServletRequest request) {
126 130
         ResponseBean responseBean = new ResponseBean();
127 131
         try {
128 132
             //使用分页插件
129 133
             IPage<TaCompany> pg = new Page<>(pageNum, pageSize);
130
-            QueryWrapper<TaCompany> queryWrapper = new QueryWrapper<>();
131
-            queryWrapper.like(StringUtils.isNotBlank(companyName), "company_name", companyName);
132
-            queryWrapper.like(StringUtils.isNotBlank(companyCode), "company_code", companyCode);
133
-            queryWrapper.eq("status", CommConstant.REAL_NAME_STATUS);
134
-            queryWrapper.orderByDesc("create_date");
135
-
136
-            IPage<TaCompany> result = iTaCompanyService.page(pg, queryWrapper);
134
+            IPage<TaCompany> result = iTaCompanyService.selectListByOrgId(pg, companyCode, companyName, getOrgId(request));
137 135
             List<TaCompany> taCompanyList = result.getRecords();
138 136
             for (TaCompany taCompany : taCompanyList){
139 137
                 QueryWrapper<TaCompanySeal> sealQueryWrapper = new QueryWrapper<>();
@@ -506,6 +504,37 @@ public class TaCompanyController extends BaseController {
506 504
         return responseBean;
507 505
     }
508 506
 
507
+    /**
508
+     * 设置默认章
509
+     */
510
+    @RequestMapping(value = "/channel/company/setDefaultSeal/{id}", method = RequestMethod.POST)
511
+    public ResponseBean setDefaultSeal(@PathVariable Integer id){
512
+        ResponseBean responseBean = new ResponseBean();
513
+        TaCompanySeal taCompanySeal = iTaCompanySealService.getById(id);
514
+        TaCompany taCompany = iTaCompanyService.getById(taCompanySeal.getCompanyId());
515
+        String res = taCompanySealUtil.setDefaultSeal(taCompanySeal.getSignatureId(), taCompany.getFadadaCode());
516
+        JSONObject result = JSONObject.parseObject(res);
517
+        if ((Integer) result.get("code") != 1){
518
+            responseBean.addError(result.getString("msg"));
519
+            return responseBean;
520
+        }
521
+        //更新旧的印章为否
522
+        QueryWrapper<TaCompanySeal> taCompanySealQueryWrapper = new QueryWrapper<>();
523
+        taCompanySealQueryWrapper.eq("company_id", taCompany.getCompanyId());
524
+        taCompanySealQueryWrapper.eq("default_seal", CommConstant.STATUS_NORMAL);
525
+        TaCompanySeal oldDefaultSeal = iTaCompanySealService.getOne(taCompanySealQueryWrapper);
526
+        oldDefaultSeal.setDefaultSeal(CommConstant.STATUS_UNACCALIMED);
527
+        iTaCompanySealService.updateById(oldDefaultSeal);
528
+
529
+        //更新默认章
530
+        taCompanySeal.setDefaultSeal(CommConstant.STATUS_NORMAL);
531
+        iTaCompanySealService.updateById(taCompanySeal);
532
+
533
+
534
+        responseBean.addSuccess(result.getString("msg"));
535
+        return responseBean;
536
+    }
537
+
509 538
 
510 539
     /**
511 540
      * 手动签署回调函数

+ 3
- 1
src/main/java/com/huiju/estateagents/eContract/controller/TaCompanySealController.java View File

@@ -58,7 +58,8 @@ public class TaCompanySealController extends BaseController {
58 58
     @RequestMapping(value="/admin/taCompanySeal",method= RequestMethod.GET)
59 59
     public ResponseBean taCompanySealList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
60 60
                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
61
-                                          @RequestParam(value ="sealName", required = false) String sealName){
61
+                                          @RequestParam(value ="sealName", required = false) String sealName,
62
+                                          @RequestParam(value ="companyId", required = false) String companyId){
62 63
         ResponseBean responseBean = new ResponseBean();
63 64
         try {
64 65
             //使用分页插件
@@ -66,6 +67,7 @@ public class TaCompanySealController extends BaseController {
66 67
             QueryWrapper<TaCompanySeal> queryWrapper = new QueryWrapper<>();
67 68
             queryWrapper.like(!StringUtils.isEmpty(sealName), "seal_name", sealName);
68 69
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
70
+            queryWrapper.eq(!StringUtils.isEmpty(companyId), "company_id", companyId);
69 71
             queryWrapper.orderByDesc("create_date");
70 72
 
71 73
             IPage<TaCompanySeal> result = iTaCompanySealService.page(pg, queryWrapper);

+ 4
- 2
src/main/java/com/huiju/estateagents/eContract/controller/TaContractBusinessController.java View File

@@ -23,6 +23,7 @@ import org.slf4j.Logger;
23 23
 import org.slf4j.LoggerFactory;
24 24
 import org.springframework.beans.factory.annotation.Autowired;
25 25
 import org.springframework.web.bind.annotation.*;
26
+import sun.util.locale.LocaleObjectCache;
26 27
 
27 28
 import javax.servlet.http.HttpServletRequest;
28 29
 import java.time.LocalDateTime;
@@ -110,7 +111,7 @@ public class TaContractBusinessController extends BaseController {
110 111
             taContractBusinessQueryWrapper.eq("status", CommConstant.STATUS_NORMAL);
111 112
             taContractBusinessQueryWrapper.eq("target_id", targetId);
112 113
             Integer contractBusinessNum = iTaContractBusinessService.count(taContractBusinessQueryWrapper);
113
-            if (contractBusinessNum > 0){
114
+            if (contractBusinessNum > 0 && CommConstant.STATUS_NORMAL.equals(taContractBusiness.getStatus())){
114 115
                 responseBean.addError("所选业务已有发布的业务配置,无法再新增已发布的业务配置");
115 116
                 return responseBean;
116 117
             }
@@ -198,7 +199,7 @@ public class TaContractBusinessController extends BaseController {
198 199
 
199 200
 
200 201
             Integer contractBusinessNum = iTaContractBusinessService.count(taContractBusinessQueryWrapper);
201
-            if (contractBusinessNum > 0){
202
+            if (contractBusinessNum > 0 && CommConstant.STATUS_NORMAL.equals(taContractBusiness.getStatus())){
202 203
                 responseBean.addError("所选业务已有发布的业务配置,无法再新增已发布的业务配置");
203 204
                 return responseBean;
204 205
             }
@@ -207,6 +208,7 @@ public class TaContractBusinessController extends BaseController {
207 208
             taContractBusiness.setContractTemplateName(taContractTemplate.getContractTemplateName());
208 209
             taContractBusiness.setTargetName(taRaise.getSalesBatchName());
209 210
             taContractBusiness.setCompanyName(taCompany.getCompanyName());
211
+            taContractBusiness.setUpdateDate(LocalDateTime.now());
210 212
             if (iTaContractBusinessService.updateById(taContractBusiness)){
211 213
                 responseBean.addSuccess(taContractBusiness);
212 214
             }else {

+ 5
- 0
src/main/java/com/huiju/estateagents/eContract/entity/TaCompanySeal.java View File

@@ -59,4 +59,9 @@ public class TaCompanySeal implements Serializable {
59 59
      * 签章id
60 60
      */
61 61
     private String signatureId;
62
+
63
+    /**
64
+     * 默认章
65
+     */
66
+    private Integer defaultSeal;
62 67
 }

+ 2
- 0
src/main/java/com/huiju/estateagents/eContract/mapper/TaCompanyMapper.java View File

@@ -19,4 +19,6 @@ import org.springframework.stereotype.Component;
19 19
 @Component
20 20
 public interface TaCompanyMapper extends BaseMapper<TaCompany> {
21 21
     TaCompany getCompanyAndContractInfo(@Param("companyId") Integer companyId);
22
+
23
+    IPage<TaCompany> selectListByOrgId(IPage<TaCompany> iPage, @Param("companyName") String companyName, @Param("companyCode")String companyCode, @Param("orgId")Integer orgId);
22 24
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/eContract/service/ITaCompanyService.java View File

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.eContract.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.huiju.estateagents.eContract.entity.TaCompany;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 import org.apache.poi.ss.formula.functions.T;
@@ -39,4 +40,6 @@ public interface ITaCompanyService extends IService<TaCompany> {
39 40
     TaCompany getCompanyAndContractInfo(Integer companyId);
40 41
 
41 42
     String getAuthStatus(Integer companyId);
43
+
44
+    IPage<TaCompany> selectListByOrgId(IPage<TaCompany> iPage, String companyName, String companyCode, Integer orgId);
42 45
 }

+ 20
- 0
src/main/java/com/huiju/estateagents/eContract/service/impl/TaCompanySealUtil.java View File

@@ -114,4 +114,24 @@ public class TaCompanySealUtil {
114 114
         return HttpsUtil.doPost(fadadaProperties.getAuthServeHost() + "get_auth_status.api", params);
115 115
     }
116 116
 
117
+    public String setDefaultSeal(String signatureId, String customerId){
118
+        ArrayList params = new ArrayList();
119
+
120
+        try {
121
+            String timeStamp = HttpsUtil.getTimeStamp();
122
+            String sha1 = FddEncryptTool.sha1(fadadaProperties.getAppId() + FddEncryptTool.md5Digest(timeStamp) + FddEncryptTool.sha1(fadadaProperties.getAppSecret() + customerId + signatureId));
123
+            String msgDigest = new String(FddEncryptTool.Base64Encode(sha1.getBytes()));
124
+            params.add(new BasicNameValuePair("customer_id", customerId));
125
+            params.add(new BasicNameValuePair("app_id", fadadaProperties.getAppId()));
126
+            params.add(new BasicNameValuePair("timestamp", timeStamp));
127
+            params.add(new BasicNameValuePair("v", fadadaProperties.getVersion()));
128
+            params.add(new BasicNameValuePair("msg_digest", msgDigest));
129
+            params.add(new BasicNameValuePair("signature_id", signatureId));
130
+        } catch (Exception var7) {
131
+            var7.printStackTrace();
132
+            throw new RuntimeException(var7);
133
+        }
134
+
135
+        return HttpsUtil.doPost(fadadaProperties.getAuthServeHost() + "default_signature.api", params);
136
+    }
117 137
 }

+ 6
- 0
src/main/java/com/huiju/estateagents/eContract/service/impl/TaCompanyServiceImpl.java View File

@@ -3,6 +3,7 @@ package com.huiju.estateagents.eContract.service.impl;
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
+import com.baomidou.mybatisplus.core.metadata.IPage;
6 7
 import com.fadada.sdk.client.FddClientBase;
7 8
 import com.fadada.sdk.client.authForfadada.FindCertInfo;
8 9
 import com.fadada.sdk.client.authForfadada.GetCompanyVerifyUrl;
@@ -255,6 +256,11 @@ public class TaCompanyServiceImpl extends ServiceImpl<TaCompanyMapper, TaCompany
255 256
         return taCompanySealUtil.getAuthStatus(taCompany.getFadadaCode());
256 257
     }
257 258
 
259
+    @Override
260
+    public IPage<TaCompany> selectListByOrgId(IPage<TaCompany> iPage, String companyName, String companyCode, Integer orgId) {
261
+        return taCompanyMapper.selectListByOrgId(iPage, companyName, companyCode, orgId);
262
+    }
263
+
258 264
     /**
259 265
      * url解码
260 266
      * @param bizContent

+ 1
- 1
src/main/resources/application-blue.yml View File

@@ -86,7 +86,7 @@ fadada:
86 86
   authServeHost: "http://test.api.fabigbig.com:8888/api/"
87 87
   serveHost: "https://testapi08.fadada.com/api/"
88 88
   companyNotify: "https://dev.pawoma.cn/api/fadd/company"
89
-  authReturnUrl: "http://localhost:8000/#/eContract/seal/detail?id="
89
+  authReturnUrl: "https://dev.pawoma.cn/channel/#/eContract/seal/detail?id="
90 90
   authNotifyUrl: "https://dev.pawoma.cn/api/fadd/autoAuthCompanySeal"
91 91
   signNotify: "https://dev.pawoma.cn/api/fadd/sign"
92 92
   redirectUrl: "https://dev.pawoma.cn/other/redirect.html"

+ 1
- 1
src/main/resources/application-green.yml View File

@@ -86,7 +86,7 @@ fadada:
86 86
   authServeHost: "http://test.api.fabigbig.com:8888/api/"
87 87
   serveHost: "https://testapi08.fadada.com/api/"
88 88
   companyNotify: "https://dev.pawoma.cn/api/fadd/company"
89
-  authReturnUrl: "http://localhost:8000/#/eContract/seal/detail?id="
89
+  authReturnUrl: "https://dev.pawoma.cn/channel/#/eContract/seal/detail?id="
90 90
   authNotifyUrl: "https://dev.pawoma.cn/api/fadd/autoAuthCompanySeal"
91 91
   signNotify: "https://dev.pawoma.cn/api/fadd/sign"
92 92
   redirectUrl: "https://dev.pawoma.cn/other/redirect.html"

+ 14
- 0
src/main/resources/mapper/eContract/TaCompanyMapper.xml View File

@@ -8,4 +8,18 @@
8 8
         where t.company_id = #{companyId}
9 9
     </select>
10 10
 
11
+    <select id="selectListByOrgId" resultType="com.huiju.estateagents.eContract.entity.TaCompany">
12
+        select t.* From ta_company t
13
+        left join ta_company_org a on t.company_id = a.company_id
14
+        where a.org_id = #{orgId}
15
+        <if test="companyCode != null and companyCode!=''">
16
+            and t.company_code = #{companyCode}
17
+        </if>
18
+        <if test="companyName != null and companyName!=''">
19
+            and t.company_name = #{companyName}
20
+        </if>
21
+        and t.status = 4
22
+        order by t.create_date desc
23
+    </select>
24
+
11 25
 </mapper>