|
@@ -1,14 +1,19 @@
|
|
package com.zswl.dataservicestarter.service;
|
|
package com.zswl.dataservicestarter.service;
|
|
|
|
|
|
|
|
+import com.zswl.dataservicestarter.dao.DataServiceOrderInfoDao;
|
|
import com.zswl.dataservicestarter.dao.UserDao;
|
|
import com.zswl.dataservicestarter.dao.UserDao;
|
|
|
|
+import com.zswl.dataservicestarter.domain.DataServiceOrderInfo;
|
|
import com.zswl.dataservicestarter.domain.User;
|
|
import com.zswl.dataservicestarter.domain.User;
|
|
|
|
+import com.zswl.dataservicestarter.service.baeService.RedisService;
|
|
import com.zswl.dataservicestarter.utils.AppInfoUtil;
|
|
import com.zswl.dataservicestarter.utils.AppInfoUtil;
|
|
|
|
+import com.zswl.dataservicestarter.utils.exception.BusinessException;
|
|
import com.zswl.dataservicestarter.utils.result.ResultContent;
|
|
import com.zswl.dataservicestarter.utils.result.ResultContent;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
|
|
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author TRX
|
|
* @author TRX
|
|
@@ -27,6 +32,10 @@ public class UserService {
|
|
@Autowired
|
|
@Autowired
|
|
GridFsTemplate gridFsTemplate;
|
|
GridFsTemplate gridFsTemplate;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ DataServiceOrderInfoDao orderInfoDao;
|
|
|
|
+
|
|
|
|
+ @Transactional
|
|
public ResultContent addUser(String name) {
|
|
public ResultContent addUser(String name) {
|
|
User user = new User();
|
|
User user = new User();
|
|
if (StringUtils.isEmpty(name)) {
|
|
if (StringUtils.isEmpty(name)) {
|
|
@@ -38,6 +47,11 @@ public class UserService {
|
|
user.setAddress("重庆市渝北区");
|
|
user.setAddress("重庆市渝北区");
|
|
userDao.save(user);
|
|
userDao.save(user);
|
|
int code = user.hashCode();
|
|
int code = user.hashCode();
|
|
|
|
+
|
|
|
|
+ DataServiceOrderInfo orderInfo = new DataServiceOrderInfo();
|
|
|
|
+ orderInfo.setCode(code + "");
|
|
|
|
+ orderInfoDao.save(orderInfo);
|
|
|
|
+
|
|
log.info("名称: {} code {} redis: {}", name, code, AppInfoUtil.generateRandomString());
|
|
log.info("名称: {} code {} redis: {}", name, code, AppInfoUtil.generateRandomString());
|
|
return ResultContent.buildSuccess(name + ": " + code);
|
|
return ResultContent.buildSuccess(name + ": " + code);
|
|
}
|
|
}
|