|
@@ -16,11 +16,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.annotation.SysLogger;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
+import com.diagbot.dto.ResultModelDTO;
|
|
|
import com.diagbot.dto.UserInfoDTO;
|
|
|
import com.diagbot.entity.Organization;
|
|
|
+import com.diagbot.entity.User;
|
|
|
import com.diagbot.facade.OrganizationFacade;
|
|
|
import com.diagbot.facade.UserFacade;
|
|
|
-import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.vo.OrganizationVO;
|
|
|
+import com.diagbot.vo.UserAndOrganizationVO;
|
|
|
import com.diagbot.vo.UserInfoOrganizationsVO;
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -41,6 +45,9 @@ public class UserInfoController {
|
|
|
@Autowired
|
|
|
OrganizationFacade organizationFacade;
|
|
|
|
|
|
+ private final String MSG_SUCCESS = "操作成功!";
|
|
|
+ private final String MSG_ERROR = "操作失败!";
|
|
|
+
|
|
|
@ApiOperation(value = "分页查询获取用户信息", notes = "根据每页显示条数,默认 10,和当前页")
|
|
|
@PostMapping("/getUserInfoPag")
|
|
|
@SysLogger("getUserInfoPag")
|
|
@@ -68,10 +75,9 @@ public class UserInfoController {
|
|
|
public RespDTO updateDeleted(@RequestParam String userId){
|
|
|
Map<String,String> map = new HashMap<String, String>();
|
|
|
map.put("userId", userId);
|
|
|
- //map.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
|
+ //TODO map.put("modifier",UserUtils.getCurrentPrincipleID());
|
|
|
map.put("modifier","5");
|
|
|
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- map.put("gmtModified",df.format(new Date()));
|
|
|
+ map.put("gmtModified",DateUtil.DATE_TIME_FORMAT);
|
|
|
int res= userFacade.updateDeleted(map);
|
|
|
return RespDTO.onSuc("刪除成功"+res);
|
|
|
}
|
|
@@ -83,25 +89,56 @@ public class UserInfoController {
|
|
|
//TODO 返回机构Id和机构
|
|
|
List<Organization> organization = organizationFacade.findOrganization(organizationName);
|
|
|
|
|
|
- return RespDTO.onSuc("查询成功");
|
|
|
+ return RespDTO.onSuc(organization);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加构信息", notes = "机构信息")
|
|
|
@PostMapping("/addOrganization")
|
|
|
@SysLogger("addOrganization")
|
|
|
- public RespDTO addOrganization(Organization organization){
|
|
|
+ public RespDTO<OrganizationVO> addOrganization(OrganizationVO organizationVO){
|
|
|
//TODO
|
|
|
+ ResultModelDTO resultMode = new ResultModelDTO();
|
|
|
+ String organizationName = organizationVO.getOrganizationName();
|
|
|
+ List<Organization> organizationList = organizationFacade.findOrganization(organizationName);
|
|
|
+ if(organizationList.size()>0){
|
|
|
+ resultMode.setMessage("该机构存在");
|
|
|
+ return RespDTO.onSuc(resultMode);
|
|
|
+ }
|
|
|
+ Organization organization = new Organization();
|
|
|
+ organization.setName(organizationVO.getOrganizationName());
|
|
|
+ organization.setType(organizationVO.getType());
|
|
|
+ organization.setPrincipal(organizationVO.getPrincipal());
|
|
|
+ organization.setSubNum(organizationVO.getSubNum());
|
|
|
+ organization.setAddress(organizationVO.getAddress());
|
|
|
+ organization.setGmtCreate(DateUtil.now());
|
|
|
+ //TODO organization.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
+ organization.setCreator("5");
|
|
|
+
|
|
|
+ boolean op = organizationFacade.save(organization);
|
|
|
|
|
|
- return RespDTO.onSuc("成功");
|
|
|
+ resultMode.setMessage(op+"");
|
|
|
+ return RespDTO.onSuc(resultMode);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "添加用户信息和机构信息管理员", notes = "用户信息和机构信息的绑定")
|
|
|
@PostMapping("/addUserInfo")
|
|
|
@SysLogger("addUserInfo")
|
|
|
- public RespDTO addUserInfo(@RequestParam String userId){
|
|
|
+ public RespDTO<UserAndOrganizationVO> addUserInfo(UserAndOrganizationVO userAndOrganizationVO){
|
|
|
//TODO 先查找机构,获取机构id,再注册用户,返回用户id, 取到用户id和 机构id ,查询用户机构关联表,在进行绑定
|
|
|
-
|
|
|
- return RespDTO.onSuc("成功");
|
|
|
+ //User user = new User();
|
|
|
+ ResultModelDTO resultMode = new ResultModelDTO();
|
|
|
+ String username = userAndOrganizationVO.getUserName();
|
|
|
+ User user= userFacade.getUserInfo(username);
|
|
|
+ System.out.println(user);
|
|
|
+ if(user!=null){
|
|
|
+ resultMode.setMessage("该用户存在");
|
|
|
+ return RespDTO.onSuc(resultMode);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ resultMode.setMessage("用户不存在");
|
|
|
+ return RespDTO.onSuc(resultMode);
|
|
|
}
|
|
|
|
|
|
|