|
@@ -100,12 +100,29 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
|
100
|
100
|
public TaContract autoContract(TaRaiseRecord taRaiseRecord, TaPerson person) throws Exception {
|
101
|
101
|
taRaiseRecord = taRaiseRecordMapper.selectById(taRaiseRecord.getRaiseRecordId());
|
102
|
102
|
|
|
103
|
+
|
|
104
|
+
|
103
|
105
|
//根据raiseId获取合同的所有参数
|
104
|
106
|
TaContractBusiness taContractBusiness = taContractMapper.selectContractInfoByRaiseId(taRaiseRecord.getRaiseId());
|
105
|
107
|
if (null == taContractBusiness){
|
106
|
108
|
throw new Exception("无合同模板,请和置业顾问联系");
|
107
|
109
|
}
|
108
|
110
|
|
|
111
|
+ //检查是否签署过本合同
|
|
112
|
+ QueryWrapper<TaContract> queryWrapper = new QueryWrapper<>();
|
|
113
|
+ queryWrapper.eq("building_id",taRaiseRecord.getBuildingId());
|
|
114
|
+ queryWrapper.eq("org_id",taRaiseRecord.getOrgId());
|
|
115
|
+ queryWrapper.eq("target_type","raise");
|
|
116
|
+ queryWrapper.eq("target_id",Integer.valueOf(taRaiseRecord.getRaiseId()));
|
|
117
|
+ queryWrapper.eq("invoice_target_type","raise_record");
|
|
118
|
+ queryWrapper.eq("invoice_target_id",taRaiseRecord.getRaiseRecordId());
|
|
119
|
+ queryWrapper.eq("company_id",taContractBusiness.getCompanyId());
|
|
120
|
+ queryWrapper.eq("person_id",person.getPersonId());
|
|
121
|
+ TaContract oldContract = taContractMapper.selectOne(queryWrapper);
|
|
122
|
+ if (null != oldContract){
|
|
123
|
+ return oldContract;
|
|
124
|
+ }
|
|
125
|
+
|
109
|
126
|
//先入合同表
|
110
|
127
|
TaContract taContract = new TaContract();
|
111
|
128
|
taContract.setBuildingId(taRaiseRecord.getBuildingId());
|
|
@@ -118,6 +135,7 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
|
118
|
135
|
taContract.setCompanyId(taContractBusiness.getCompanyId());
|
119
|
136
|
taContract.setCreateDate(LocalDateTime.now());
|
120
|
137
|
taContract.setStatus(0);
|
|
138
|
+ taContract.setPersonId(person.getPersonId());
|
121
|
139
|
taContractMapper.insert(taContract);
|
122
|
140
|
|
123
|
141
|
//上传合同
|
|
@@ -148,7 +166,6 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
|
148
|
166
|
//反更新合同地址
|
149
|
167
|
taContract.setContractDownloadUrl(autoSignResultJson.getString("download_url"));
|
150
|
168
|
taContract.setContractViewUrl(autoSignResultJson.getString("viewpdf_url"));
|
151
|
|
- taContract.setStatus(1);
|
152
|
169
|
taContractMapper.updateById(taContract);
|
153
|
170
|
|
154
|
171
|
//企业名称
|
|
@@ -183,6 +200,9 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
|
183
|
200
|
queryWrapper.eq("mini_openid",person.getMiniOpenid());
|
184
|
201
|
TaContractUser taContractUser = taContractUserMapper.selectOne(queryWrapper);
|
185
|
202
|
|
|
203
|
+ if (taContract.getStatus() == 1){
|
|
204
|
+ throw new Exception("已经成功签署,无需再次签署");
|
|
205
|
+ }
|
186
|
206
|
//根据raiseId获取合同的所有参数
|
187
|
207
|
TaContractBusiness taContractBusiness = taContractMapper.selectContractInfoByRaiseId(taContract.getTargetId().toString());
|
188
|
208
|
if (null == taContractBusiness){
|
|
@@ -206,4 +226,35 @@ public class TaContractServiceImpl extends ServiceImpl<TaContractMapper, TaContr
|
206
|
226
|
String signUrl = base.invokeExtSign(req);
|
207
|
227
|
return signUrl;
|
208
|
228
|
}
|
|
229
|
+
|
|
230
|
+ /**
|
|
231
|
+ * 检查签署合同状态
|
|
232
|
+ *
|
|
233
|
+ * @param taRaiseRecord
|
|
234
|
+ * @param person
|
|
235
|
+ * @return
|
|
236
|
+ */
|
|
237
|
+ @Override
|
|
238
|
+ public TaContract checkContract(TaRaiseRecord taRaiseRecord, TaPerson person) throws Exception {
|
|
239
|
+ taRaiseRecord = taRaiseRecordMapper.selectById(taRaiseRecord.getRaiseRecordId());
|
|
240
|
+
|
|
241
|
+ //根据raiseId获取合同的所有参数
|
|
242
|
+ TaContractBusiness taContractBusiness = taContractMapper.selectContractInfoByRaiseId(taRaiseRecord.getRaiseId());
|
|
243
|
+ if (null == taContractBusiness){
|
|
244
|
+ throw new Exception("无合同模板,请和置业顾问联系");
|
|
245
|
+ }
|
|
246
|
+
|
|
247
|
+ //检查是否签署过本合同
|
|
248
|
+ QueryWrapper<TaContract> queryWrapper = new QueryWrapper<>();
|
|
249
|
+ queryWrapper.eq("building_id",taRaiseRecord.getBuildingId());
|
|
250
|
+ queryWrapper.eq("org_id",taRaiseRecord.getOrgId());
|
|
251
|
+ queryWrapper.eq("target_type","raise");
|
|
252
|
+ queryWrapper.eq("target_id",Integer.valueOf(taRaiseRecord.getRaiseId()));
|
|
253
|
+ queryWrapper.eq("invoice_target_type","raise_record");
|
|
254
|
+ queryWrapper.eq("invoice_target_id",taRaiseRecord.getRaiseRecordId());
|
|
255
|
+ queryWrapper.eq("company_id",taContractBusiness.getCompanyId());
|
|
256
|
+ queryWrapper.eq("person_id",person.getPersonId());
|
|
257
|
+ TaContract oldContract = taContractMapper.selectOne(queryWrapper);
|
|
258
|
+ return oldContract;
|
|
259
|
+ }
|
209
|
260
|
}
|