change 3 gadi atpakaļ
vecāks
revīzija
04259002ef

+ 9 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -32,6 +32,7 @@ import com.zhongzheng.modules.base.domain.UserProfile;
 import com.zhongzheng.modules.base.mapper.UserProfileMapper;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
 import com.zhongzheng.modules.base.service.IUserProfileService;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 import sun.misc.BASE64Encoder;
 
@@ -110,22 +111,24 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(UserProfileEditBo bo) {
-        UserProfile update = new UserProfile();
-        update.setId(bo.getId());
-        update.setCurrentStatus(2L);
-        update.setUpdateTime(DateUtils.getNowTime());
-        this.updateById(update);
+        UserProfileVo userProfileVo = this.queryById(bo.getId());
 
         UserProfile addProfile = BeanUtil.toBean(bo,UserProfile.class);
         addProfile.setCreateTime(DateUtils.getNowTime());
         addProfile.setUpdateTime(DateUtils.getNowTime());
         addProfile.setStatus(3);
-        UserProfileVo userProfileVo = this.queryById(bo.getId());
         addProfile.setOneTime(userProfileVo.getOneTime());
         addProfile.setLastTime(DateUtils.getNowTime());
         addProfile.setCurrentStatus(1L);
         addProfile.setChangeStatus(0);
+
+        UserProfile update = new UserProfile();
+        update.setId(bo.getId());
+        update.setCurrentStatus(2L);
+        update.setUpdateTime(DateUtils.getNowTime());
+        this.updateById(update);
         return this.save(addProfile);
     }