|
|
@@ -0,0 +1,43 @@
|
|
|
+package com.uas.platform.b2c.logistics.service.impl;
|
|
|
+
|
|
|
+import com.uas.platform.b2c.common.account.model.User;
|
|
|
+import com.uas.platform.b2c.core.constant.ShortConstant;
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.b2c.logistics.constant.TipType;
|
|
|
+import com.uas.platform.b2c.logistics.dao.TipRecordDao;
|
|
|
+import com.uas.platform.b2c.logistics.model.TipRecord;
|
|
|
+import com.uas.platform.b2c.logistics.service.TipRecordService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author hulh
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class TipRecordServiceImpl implements TipRecordService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TipRecordDao tipRecordDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TipRecord findByUserUuOfRule() {
|
|
|
+ User user = SystemSession.getUser();
|
|
|
+ TipRecord record = tipRecordDao.findByUseruuAndType(user.getUserUU(),
|
|
|
+ TipType.TIP_LOGISTICS.getValue());
|
|
|
+ if (record == null){
|
|
|
+ return newOneRecord(user);
|
|
|
+ }
|
|
|
+ return record;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ private TipRecord newOneRecord(User user){
|
|
|
+ TipRecord record = new TipRecord();
|
|
|
+ record.setEnuu(user.getEnterprise().getUu());
|
|
|
+ record.setUseruu(user.getUserUU());
|
|
|
+ record.setType(TipType.TIP_LOGISTICS.getValue());
|
|
|
+ record.setTipAgain(ShortConstant.NO_SHORT);
|
|
|
+ return tipRecordDao.save(record);
|
|
|
+ }
|
|
|
+}
|