anderx 1 год назад
Родитель
Сommit
a419223cf8

+ 17 - 10
src/main/java/com/goafanti/user/controller/UserServiceApiController.java

@@ -1,15 +1,5 @@
 package com.goafanti.user.controller;
 
-import java.util.List;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
@@ -18,6 +8,13 @@ import com.goafanti.user.bo.InputListOrderUserService;
 import com.goafanti.user.bo.InputUserServiceFollow;
 import com.goafanti.user.bo.OutOrderUserService;
 import com.goafanti.user.service.UserServiceService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
 
 @RestController
 @RequestMapping(value = "/api/admin")
@@ -41,6 +38,16 @@ public class UserServiceApiController extends BaseApiController {
 		return res;
 	}
 
+	@RequestMapping(value = "/updateUseService",method = RequestMethod.POST)
+	public Result updateUseService(InputUserServiceFollow us) {
+		Result res =new Result();
+		if(us.getUid()==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "用户编号"));
+		}
+		res.data(userServiceService.updateUseService(us));
+		return res;
+	}
+
 
 	@RequestMapping(value = "/listUseServiceFollow",method = RequestMethod.GET)
 	public Result listUseServiceFollow(String uid) {

+ 3 - 3
src/main/java/com/goafanti/user/service/UserServiceService.java

@@ -1,13 +1,13 @@
 package com.goafanti.user.service;
 
-import java.util.List;
-
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.user.bo.InputListOrderUserService;
 import com.goafanti.user.bo.InputUserServiceFollow;
 import com.goafanti.user.bo.OutOrderUserService;
 import com.goafanti.user.bo.OutUserServiceFollow;
 
+import java.util.List;
+
 public interface UserServiceService {
 
 	int addUseService(InputUserServiceFollow us);
@@ -22,5 +22,5 @@ public interface UserServiceService {
 	List<OutOrderUserService> listOrderUseServiceGetList(InputListOrderUserService i);
 
 
-
+	int updateUseService(InputUserServiceFollow us);
 }

+ 16 - 0
src/main/java/com/goafanti/user/service/impl/UserServiceServiceImpl.java

@@ -94,6 +94,22 @@ public class  UserServiceServiceImpl extends BaseMybatisDao<UserServiceMapper> i
 		return list;
 	}
 
+	@Override
+	public int updateUseService(InputUserServiceFollow us) {
+		UserService update =new UserService();
+		Integer id=userServiceMapper.selectByUid(us.getUid());
+		update.setUid(us.getUid());
+		update.setAddGroupChat(us.getAddWechat());
+		if (id==null) {
+			update.setCreateTime(new Date());
+			userServiceMapper.insertSelective(update);
+		}else {
+			update.setId(id);
+			userServiceMapper.update(update);
+		}
+		return 1;
+	}
+
 	private void setOrderUserService(List<OutOrderUserService> list) {
 		for (OutOrderUserService ou: list) {
 			StringBuffer projects=new StringBuffer();