|
@@ -11,6 +11,7 @@ import com.github.pagehelper.Page;
|
11
|
11
|
import com.github.pagehelper.PageHelper;
|
12
|
12
|
import com.google.common.collect.Maps;
|
13
|
13
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
|
14
|
+import org.springframework.beans.BeanUtils;
|
14
|
15
|
import org.springframework.beans.factory.annotation.Autowired;
|
15
|
16
|
import org.springframework.stereotype.Service;
|
16
|
17
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -386,20 +387,23 @@ public class SocialServiceImpl implements SocialServiceI {
|
386
|
387
|
public ResponseBean updateTransaction(String paramets,Integer userId,Integer id) {
|
387
|
388
|
ResponseBean response = new ResponseBean();
|
388
|
389
|
JSONObject jsonObject = JSONObject.parseObject(paramets);
|
389
|
|
- String transactionTitle = (String) jsonObject.get("transactionTitle");
|
390
|
|
- String transactionContent = (String) jsonObject.get("transactionContent");
|
391
|
390
|
String imageUrl = (String) jsonObject.get("imageUrl");
|
|
391
|
+
|
392
|
392
|
TpTransaction tpTransaction = JSONObject.parseObject(paramets, TpTransaction.class);
|
393
|
|
- TpTransaction taUser = tpTransactionMapper.getById(id);
|
394
|
|
- if (null != taUser && userId.equals(taUser.getTaUserId())) {
|
|
393
|
+ TpTransaction transaction = tpTransactionMapper.getById(id);
|
|
394
|
+ transaction.setTransactionTitle(tpTransaction.getTransactionTitle());
|
|
395
|
+ transaction.setTransactionContent(tpTransaction.getTransactionContent());
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+ if (null != transaction && userId.equals(transaction.getTaUserId())) {
|
395
|
399
|
tdImagesMapper.deleteTdImages(Integer.valueOf(id), Constant.TRANSACTION);
|
396
|
400
|
try {
|
397
|
|
- insertTdImage(tpTransaction, imageUrl, userId, Constant.TRANSACTION);
|
|
401
|
+ insertTdImage(transaction, imageUrl, userId, Constant.TRANSACTION);
|
398
|
402
|
} catch (IOException e) {
|
399
|
403
|
e.printStackTrace();
|
400
|
404
|
throw new RuntimeException("图片修改异常");
|
401
|
405
|
}
|
402
|
|
- tpTransactionMapper.updateTransaction(Integer.valueOf(id), transactionTitle, transactionContent, userId);
|
|
406
|
+ tpTransactionMapper.updateTransaction(Integer.valueOf(id), transaction.getTransactionTitle(), transaction.getTransactionContent(), userId);
|
403
|
407
|
response.addSuccess("修改成功");
|
404
|
408
|
return response;
|
405
|
409
|
|