zoujiajian 3 anos atrás
pai
commit
a8b52eb6ec

+ 9 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/group/CmsGroupsRelationExpiryController.java

@@ -15,6 +15,7 @@ import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.util.MapBuilder;
 import com.ejlchina.searcher.util.MapUtils;
 import lombok.RequiredArgsConstructor;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -71,15 +72,22 @@ public class CmsGroupsRelationExpiryController {
 	 * 客服进行跟进
 	 */
 	@PostMapping("/reBuy")
+	@Transactional(rollbackFor = Throwable.class)
 	public Result<String> recordReBuy(@RequestBody GroupsRelationCustomerServiceFollowRecord record) {
 		Long ecId = record.getEcId();
-		if (ecId == null || groupsRelationExpiryRecordMapper.selectById(ecId) == null) {
+		if (ecId == null) {
+			throw BusinessRuntimeException.getInstance("请选择对应的跟进车票");
+		}
+		GroupsRelationExpiryRecord groupsRelationExpiryRecord = groupsRelationExpiryRecordMapper.selectById(ecId);
+		if (groupsRelationExpiryRecord == null) {
 			throw BusinessRuntimeException.getInstance("请选择对应的跟进车票");
 		}
 		if (StrUtil.isAllBlank(record.getContent(), record.getImgs())) {
 			throw BusinessRuntimeException.getInstance("请完善对应跟进信息");
 		}
 		relationCustomerServiceFollowRecordMapper.insert(record);
+		groupsRelationExpiryRecord.setIsFollow(true);
+		groupsRelationExpiryRecordMapper.updateById(groupsRelationExpiryRecord);
 		return GatewayResponse.SUCCESS.newBuilder().toResult();
 	}
 }