魏超 5 years ago
parent
commit
ca25ba8d09

+ 30
- 0
src/main/java/com/huiju/estateagents/eContract/controller/TaContractBusinessController.java View File

7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
 import com.huiju.estateagents.common.CommConstant;
8
 import com.huiju.estateagents.common.CommConstant;
9
 import com.huiju.estateagents.common.StringUtils;
9
 import com.huiju.estateagents.common.StringUtils;
10
+import com.huiju.estateagents.eContract.entity.TaCompany;
11
+import com.huiju.estateagents.eContract.entity.TaCompanySeal;
10
 import com.huiju.estateagents.eContract.entity.TaContractBusiness;
12
 import com.huiju.estateagents.eContract.entity.TaContractBusiness;
13
+import com.huiju.estateagents.eContract.entity.TaContractTemplate;
14
+import com.huiju.estateagents.eContract.service.ITaCompanySealService;
15
+import com.huiju.estateagents.eContract.service.ITaCompanyService;
11
 import com.huiju.estateagents.eContract.service.ITaContractBusinessService;
16
 import com.huiju.estateagents.eContract.service.ITaContractBusinessService;
17
+import com.huiju.estateagents.eContract.service.ITaContractTemplateService;
18
+import com.huiju.estateagents.entity.TaRaise;
19
+import com.huiju.estateagents.mapper.TaRaiseMapper;
20
+import com.huiju.estateagents.sample.entity.TaContact;
21
+import com.huiju.estateagents.service.ITaRaiseService;
12
 import org.slf4j.Logger;
22
 import org.slf4j.Logger;
13
 import org.slf4j.LoggerFactory;
23
 import org.slf4j.LoggerFactory;
14
 import org.springframework.beans.factory.annotation.Autowired;
24
 import org.springframework.beans.factory.annotation.Autowired;
35
     @Autowired
45
     @Autowired
36
     public ITaContractBusinessService iTaContractBusinessService;
46
     public ITaContractBusinessService iTaContractBusinessService;
37
 
47
 
48
+    @Autowired
49
+    private ITaContractTemplateService iTaContractTemplateService;
50
+
51
+    @Autowired
52
+    private TaRaiseMapper taRaiseMapper;
53
+
54
+    @Autowired
55
+    private ITaCompanyService iTaCompanyService;
56
+
57
+    @Autowired
58
+    private ITaCompanySealService iTaCompanySealService;
38
 
59
 
39
     /**
60
     /**
40
      * 分页查询列表
61
      * 分页查询列表
164
                                         @RequestBody TaContractBusiness taContractBusiness, HttpServletRequest request){
185
                                         @RequestBody TaContractBusiness taContractBusiness, HttpServletRequest request){
165
         ResponseBean responseBean = new ResponseBean();
186
         ResponseBean responseBean = new ResponseBean();
166
         try {
187
         try {
188
+            TaContractTemplate taContractTemplate = iTaContractTemplateService.getById(taContractBusiness.getContractTemplateId());
189
+            TaRaise taRaise = taRaiseMapper.getRaiseById(taContractBusiness.getTargetId(), getOrgId(request));
190
+            TaCompany taCompany = iTaCompanyService.getById(taContractBusiness.getCompanyId());
191
+
167
             Integer targetId = taContractBusiness.getTargetId();
192
             Integer targetId = taContractBusiness.getTargetId();
168
             QueryWrapper<TaContractBusiness> taContractBusinessQueryWrapper = new QueryWrapper<>();
193
             QueryWrapper<TaContractBusiness> taContractBusinessQueryWrapper = new QueryWrapper<>();
169
             taContractBusinessQueryWrapper.eq("org_id", getOrgId(request));
194
             taContractBusinessQueryWrapper.eq("org_id", getOrgId(request));
170
             taContractBusinessQueryWrapper.eq("status", CommConstant.STATUS_NORMAL);
195
             taContractBusinessQueryWrapper.eq("status", CommConstant.STATUS_NORMAL);
171
             taContractBusinessQueryWrapper.eq("target_id", targetId);
196
             taContractBusinessQueryWrapper.eq("target_id", targetId);
172
             taContractBusinessQueryWrapper.ne("contract_business_id", id);
197
             taContractBusinessQueryWrapper.ne("contract_business_id", id);
198
+
199
+
173
             Integer contractBusinessNum = iTaContractBusinessService.count(taContractBusinessQueryWrapper);
200
             Integer contractBusinessNum = iTaContractBusinessService.count(taContractBusinessQueryWrapper);
174
             if (contractBusinessNum > 0){
201
             if (contractBusinessNum > 0){
175
                 responseBean.addError("所选业务已有发布的业务配置,无法再新增已发布的业务配置");
202
                 responseBean.addError("所选业务已有发布的业务配置,无法再新增已发布的业务配置");
177
             }
204
             }
178
 
205
 
179
             taContractBusiness.setContractBusinessId(id);
206
             taContractBusiness.setContractBusinessId(id);
207
+            taContractBusiness.setContractTemplateName(taContractTemplate.getContractTemplateName());
208
+            taContractBusiness.setTargetName(taRaise.getSalesBatchName());
209
+            taContractBusiness.setCompanyName(taCompany.getCompanyName());
180
             if (iTaContractBusinessService.updateById(taContractBusiness)){
210
             if (iTaContractBusinessService.updateById(taContractBusiness)){
181
                 responseBean.addSuccess(taContractBusiness);
211
                 responseBean.addSuccess(taContractBusiness);
182
             }else {
212
             }else {

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

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.alibaba.fastjson.JSONObject;
4
 import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
 import com.fadada.sdk.client.FddClientBase;
6
 import com.fadada.sdk.client.FddClientBase;
6
 import com.fadada.sdk.client.authForfadada.FindCertInfo;
7
 import com.fadada.sdk.client.authForfadada.FindCertInfo;
7
 import com.fadada.sdk.client.authForfadada.GetCompanyVerifyUrl;
8
 import com.fadada.sdk.client.authForfadada.GetCompanyVerifyUrl;
210
 
211
 
211
     @Override
212
     @Override
212
     public String autoAuthCompanySeal(Integer companyId, Integer orgId) throws Exception {
213
     public String autoAuthCompanySeal(Integer companyId, Integer orgId) throws Exception {
214
+        QueryWrapper<TaContract> taContractQueryWrapper = new QueryWrapper<>();
215
+        taContractQueryWrapper.eq("target_type", CommConstant.AUTH);
216
+        taContractQueryWrapper.eq("company_id", companyId);
217
+        TaContract taContract = taContractMapper.selectOne(taContractQueryWrapper);
218
+
213
         TaCompany taCompany = taCompanyMapper.selectById(companyId);
219
         TaCompany taCompany = taCompanyMapper.selectById(companyId);
214
         String timeStamp = HttpsUtil.getTimeStamp();
220
         String timeStamp = HttpsUtil.getTimeStamp();
215
         String transactionId = "TRAN" + timeStamp;
221
         String transactionId = "TRAN" + timeStamp;
216
-        TaContract taContract = new TaContract();
217
-        taContract.setCompanyId(companyId);
218
-        taContract.setOrgId(orgId);
219
-        taContract.setCreateDate(LocalDateTime.now());
220
-        taContract.setTargetType(CommConstant.AUTH);
221
-        taContract.setSignatoryName(taCompany.getCompanyName());
222
-        taContract.setCustomerName("法大大公司平台");
223
-        taContract.setSignatoryTime(LocalDateTime.now());
224
-        taContract.setCustomerTime(LocalDateTime.now());
225
-        taContract.setStatus(CommConstant.STATUS_UNACCALIMED);
226
-        taContract.setOrgId(orgId);
227
-        taContractMapper.insert(taContract);
222
+        if (taContract == null){
223
+            taContract = new TaContract();
224
+            taContract.setCompanyId(companyId);
225
+            taContract.setOrgId(orgId);
226
+            taContract.setCreateDate(LocalDateTime.now());
227
+            taContract.setTargetType(CommConstant.AUTH);
228
+            taContract.setSignatoryName(taCompany.getCompanyName());
229
+            taContract.setCustomerName("法大大公司平台");
230
+            taContract.setSignatoryTime(LocalDateTime.now());
231
+            taContract.setCustomerTime(LocalDateTime.now());
232
+            taContract.setStatus(CommConstant.STATUS_UNACCALIMED);
233
+            taContract.setOrgId(orgId);
234
+            taContractMapper.insert(taContract);
235
+        }else{
236
+            taContract.setSignatoryTime(LocalDateTime.now());
237
+            taContract.setCustomerTime(LocalDateTime.now());
238
+            taContractMapper.updateById(taContract);
239
+        }
228
 
240
 
229
         Integer contractId = taContract.getContractId();
241
         Integer contractId = taContract.getContractId();
230
         String customerId = taCompany.getFadadaCode();
242
         String customerId = taCompany.getFadadaCode();