From 5c066735f78bbafc5f03a5a869d8ffbcabaf70d8 Mon Sep 17 00:00:00 2001 From: wangwei <1610949092@qq.com> Date: Sun, 12 Mar 2023 15:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/auth/AuthAdminController.java | 407 +++++++++++++++ .../auth/InvWarehouseController.java | 2 +- .../api/controller/auth/LoginController.java | 8 +- .../controller/auth/RegisterController.java | 490 ++++++++++++++++++ .../controller/sup/CustomerController.java | 181 +++++++ .../controller/system/CompanyController.java | 5 +- .../system/ConnectTestController.java | 2 +- .../com/glxp/api/dao/auth/AuthAdminDao.java | 11 +- .../glxp/api/dao/auth/AuthRoleAdminDao.java | 58 +++ .../com/glxp/api/dao/auth/AuthRoleDao.java | 52 ++ .../glxp/api/dao/auth/CustomerInfoDao.java | 33 ++ .../glxp/api/dao/auth/UserRegisterDao.java | 31 ++ .../dao/basic/BasicBussinessTypeRoleDao.java | 27 + .../api/dao/basic/BasicUnitMaintainDao.java | 36 ++ .../com/glxp/api/dao/system/CompanyDao.java | 16 + .../com/glxp/api/dao/system/SetupDao.java | 10 +- .../glxp/api/entity/auth/AliKeyEntity.java | 13 + .../com/glxp/api/entity/auth/AuthAdmin.java | 2 +- .../com/glxp/api/entity/auth/AuthRole.java | 30 ++ .../glxp/api/entity/auth/AuthRoleAdmin.java | 14 + .../api/entity/auth/CustomerDetailEntity.java | 31 ++ .../api/entity/auth/CustomerInfoEntity.java | 22 + .../api/entity/auth/UpdateUserflagBean.java | 9 + .../api/entity/auth/UserRegisterEntity.java | 32 ++ .../basic/BasicBussinessTypeRoleEntity.java | 19 + .../entity/basic/BasicUnitMaintainEntity.java | 43 ++ .../com/glxp/api/entity/info/SetupEntity.java | 16 + .../glxp/api/entity/system/CompanyEntity.java | 1 + .../api/req/auth/AuthRoleQueryRequest.java | 17 + .../req/auth/CustomerInfoFilterRequest.java | 14 + .../api/req/auth/FilterAuthUserRequest.java | 4 + .../api/req/auth/FilterCompanyRequest.java | 18 + .../api/req/auth/RegisterCheckRequest.java | 14 + .../glxp/api/req/auth/ResetPasswdRequest.java | 13 + .../req/auth/UserResisterFilterRequest.java | 12 + .../api/req/info/FilterAliCertRequest.java | 8 + .../api/res/auth/AuthAdminRoleResponse.java | 4 +- .../glxp/api/res/auth/CheckCodeRequest.java | 9 + .../api/service/auth/AuthAdminService.java | 4 + .../service/auth/AuthRoleAdminService.java | 25 + .../api/service/auth/AuthRoleService.java | 43 ++ .../api/service/auth/CustomerInfoService.java | 28 + .../api/service/auth/UserRegisterService.java | 29 ++ .../auth/impl/AuthAdminServiceImpl.java | 13 +- .../auth/impl/AuthRoleAdminServiceImpl.java | 120 +++++ .../auth/impl/AuthRoleServiceImpl.java | 144 +++++ .../auth/impl/CustomerInfoServiceImpl.java | 99 ++++ .../auth/impl/UserRegisterServiceImpl.java | 80 +++ .../basic/BasicUnitMaintainService.java | 38 ++ .../impl/BasicUnitMaintainServiceImpl.java | 123 +++++ .../service/info/impl/SetupServiceImpl.java | 27 + .../api/service/system/CompanyService.java | 22 + .../system/impl/CompanyServiceImpl.java | 66 ++- src/main/java/com/glxp/api/util/Constant.java | 100 ++++ .../mybatis/mapper/auth/AuthAdminDao.xml | 5 +- .../mybatis/mapper/auth/AuthRoleAdminDao.xml | 57 ++ .../mybatis/mapper/auth/AuthRoleDao.xml | 110 ++++ .../mybatis/mapper/auth/CustomerInfoDao.xml | 129 +++++ .../mybatis/mapper/auth/UserRegisterDao.xml | 108 ++++ .../mapper/basic/BasicUnitMaintainDao.xml | 268 ++++++++++ .../mapper/basic/BussinessTypeRoleDao.xml | 26 + .../mybatis/mapper/info/SetupDao.xml | 39 ++ .../mybatis/mapper/system/CompanyDao.xml | 280 +++++++++- 63 files changed, 3656 insertions(+), 41 deletions(-) create mode 100644 src/main/java/com/glxp/api/controller/auth/AuthAdminController.java create mode 100644 src/main/java/com/glxp/api/controller/auth/RegisterController.java create mode 100644 src/main/java/com/glxp/api/controller/sup/CustomerController.java create mode 100644 src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java create mode 100644 src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java create mode 100644 src/main/java/com/glxp/api/dao/auth/CustomerInfoDao.java create mode 100644 src/main/java/com/glxp/api/dao/auth/UserRegisterDao.java create mode 100644 src/main/java/com/glxp/api/dao/basic/BasicBussinessTypeRoleDao.java create mode 100644 src/main/java/com/glxp/api/dao/basic/BasicUnitMaintainDao.java create mode 100644 src/main/java/com/glxp/api/entity/auth/AliKeyEntity.java create mode 100644 src/main/java/com/glxp/api/entity/auth/AuthRole.java create mode 100644 src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java create mode 100644 src/main/java/com/glxp/api/entity/auth/CustomerDetailEntity.java create mode 100644 src/main/java/com/glxp/api/entity/auth/CustomerInfoEntity.java create mode 100644 src/main/java/com/glxp/api/entity/auth/UpdateUserflagBean.java create mode 100644 src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java create mode 100644 src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeRoleEntity.java create mode 100644 src/main/java/com/glxp/api/entity/basic/BasicUnitMaintainEntity.java create mode 100644 src/main/java/com/glxp/api/entity/info/SetupEntity.java create mode 100644 src/main/java/com/glxp/api/req/auth/AuthRoleQueryRequest.java create mode 100644 src/main/java/com/glxp/api/req/auth/CustomerInfoFilterRequest.java create mode 100644 src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java create mode 100644 src/main/java/com/glxp/api/req/auth/RegisterCheckRequest.java create mode 100644 src/main/java/com/glxp/api/req/auth/ResetPasswdRequest.java create mode 100644 src/main/java/com/glxp/api/req/auth/UserResisterFilterRequest.java create mode 100644 src/main/java/com/glxp/api/req/info/FilterAliCertRequest.java create mode 100644 src/main/java/com/glxp/api/res/auth/CheckCodeRequest.java create mode 100644 src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java create mode 100644 src/main/java/com/glxp/api/service/auth/AuthRoleService.java create mode 100644 src/main/java/com/glxp/api/service/auth/CustomerInfoService.java create mode 100644 src/main/java/com/glxp/api/service/auth/UserRegisterService.java create mode 100644 src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java create mode 100644 src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java create mode 100644 src/main/java/com/glxp/api/service/auth/impl/CustomerInfoServiceImpl.java create mode 100644 src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java create mode 100644 src/main/java/com/glxp/api/service/basic/BasicUnitMaintainService.java create mode 100644 src/main/java/com/glxp/api/service/basic/impl/BasicUnitMaintainServiceImpl.java create mode 100644 src/main/java/com/glxp/api/service/info/impl/SetupServiceImpl.java create mode 100644 src/main/java/com/glxp/api/util/Constant.java create mode 100644 src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml create mode 100644 src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml create mode 100644 src/main/resources/mybatis/mapper/auth/CustomerInfoDao.xml create mode 100644 src/main/resources/mybatis/mapper/auth/UserRegisterDao.xml create mode 100644 src/main/resources/mybatis/mapper/basic/BasicUnitMaintainDao.xml create mode 100644 src/main/resources/mybatis/mapper/basic/BussinessTypeRoleDao.xml create mode 100644 src/main/resources/mybatis/mapper/info/SetupDao.xml diff --git a/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java b/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java new file mode 100644 index 00000000..05e8769d --- /dev/null +++ b/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java @@ -0,0 +1,407 @@ +package com.glxp.api.controller.auth; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.auth.AuthAdminRoleResponse; +import com.glxp.api.service.auth.AuthAdminService; +import com.glxp.api.service.auth.AuthRoleAdminService; +import com.glxp.api.service.auth.AuthRoleService; +import org.springframework.beans.BeanUtils; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 管理员相关 + */ +@RestController +public class AuthAdminController { + + @Resource + private AuthAdminService authAdminService; + + @Resource + private AuthRoleService authRoleService; + + @Resource + private AuthRoleAdminService authRoleAdminService; + +// @Resource +// private CustomerInfoService customerInfoService; +// +// @Resource +// private WarehouseUserService warehouseUserService; +// +// @Resource +// private InvBusUserService invBusUserService; +// +// @Resource +// private InvSubWarehouseService invSubWarehouseService; + + +// @Resource +// private AuthPermissionRuleService authPermissionRuleService; +// @Resource +// private AuthPermissionService authPermissionService; + + /** + * 获取管理员列表 + */ +// @AuthRuleAnnotation("admin/auth/admin/index") +// @GetMapping("/admin/auth/admin/index") +// public BaseResponse index(@Valid FilterAuthUserRequest authAdminQueryRequest, +// BindingResult bindingResult) { +// +// if (bindingResult.hasErrors()) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); +// } +// +// if (authAdminQueryRequest.getRoleId() != null) { +// List authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId()); +// List ids = new ArrayList<>(); +// if (authRoleAdmins != null && !authRoleAdmins.isEmpty()) { +// ids = authRoleAdmins.stream().map(AuthRoleAdmin::getAdmin_id).collect(Collectors.toList()); +// } +// authAdminQueryRequest.setIds(ids); +// } +// List authAdminList = authAdminService.listAdminPage(authAdminQueryRequest); +// // 查询所有的权限 +// List adminIds = authAdminList.stream().map(AuthAdmin::getId).collect(Collectors.toList()); +// List authRoleAdminList = authRoleAdminService.listByAdminIdIn(adminIds); +// +// // 视图列表 +// List authAdminResponseList = authAdminList.stream().map(item -> { +// AuthAdminResponse authAdminResponse = new AuthAdminResponse(); +// BeanUtils.copyProperties(item, authAdminResponse); +// List roles = authRoleAdminList.stream() +// .filter(authRoleAdmin -> authAdminResponse.getId().equals(authRoleAdmin.getAdmin_id())) +// .map(AuthRoleAdmin::getRole_id) +// .collect(Collectors.toList()); +// authAdminResponse.setRoles(roles); +// return authAdminResponse; +// }).collect(Collectors.toList()); +// +// PageInfo authAdminPageInfo = new PageInfo<>(authAdminList); +// PageSimpleResponse authAdminPageSimpleResponse = new PageSimpleResponse<>(); +// authAdminPageSimpleResponse.setTotal(authAdminPageInfo.getTotal()); +// authAdminPageSimpleResponse.setList(authAdminResponseList); +// +// return ResultVOUtils.success(authAdminPageSimpleResponse); +// } + + + /** + * 获取角色列表 + */ +// @AuthRuleAnnotation("admin/auth/admin/roleList") +// @GetMapping("/admin/auth/admin/roleList") +// public BaseResponse roleList(@RequestParam(value = "page", defaultValue = "1") Integer page, +// @RequestParam(value = "limit", defaultValue = "100") Integer limit) { +// +// List authRoleList = authRoleService.listAuthAdminRolePage(page, limit, null); +// PageInfo pageInfo = new PageInfo<>(authRoleList); +// PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); +// pageSimpleResponse.setTotal(pageInfo.getTotal()); +// List authAdminRoleResponses = authRoleList.stream().map(e -> { +// AuthAdminRoleResponse authAdminRoleResponse = new AuthAdminRoleResponse(); +// BeanUtils.copyProperties(e, authAdminRoleResponse); +// return authAdminRoleResponse; +// }).collect(Collectors.toList()); +// pageSimpleResponse.setList(authAdminRoleResponses); +// +// return ResultVOUtils.success(pageSimpleResponse); +// } +// +// @AuthRuleAnnotation("admin/auth/admin/roleCustomers") +// @GetMapping("/admin/auth/admin/roleCustomers") +// public BaseResponse roleCustomers(@RequestParam(value = "page", defaultValue = "1") Integer page, +// @RequestParam(value = "limit", defaultValue = "100") Integer limit) { +// AuthAdmin authAdmin = getCustomerId(); +// List authRoles = authRoleAdminService.listAdminRole(authAdmin.getId()); +// List authRoleList = null; +// if (authRoles != null && authRoles.size() > 0) { +// int status = authRoles.get(0).getIsCustomer(); +// authRoleList = authRoleService.listCustomerRoles(page, limit, status); +// } else { +// authRoleList = authRoleService.listAuthAdminRolePage(page, limit, null); +// } +// +// PageInfo pageInfo = new PageInfo<>(authRoleList); +// PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); +// pageSimpleResponse.setTotal(pageInfo.getTotal()); +// List authAdminRoleResponses = authRoleList.stream().map(e -> { +// AuthAdminRoleResponse authAdminRoleResponse = new AuthAdminRoleResponse(); +// BeanUtils.copyProperties(e, authAdminRoleResponse); +// return authAdminRoleResponse; +// }).collect(Collectors.toList()); +// pageSimpleResponse.setList(authAdminRoleResponses); +// +// return ResultVOUtils.success(pageSimpleResponse); +// } + + + @AuthRuleAnnotation("admin/auth/admin/customerRoles") + @GetMapping("/admin/auth/admin/customerRoles") + public BaseResponse customerRoles(@RequestParam(value = "page", defaultValue = "1") Integer page, + @RequestParam(value = "limit", defaultValue = "100") Integer limit) { + + List authRoleList = authRoleService.listCustomerRoles(page, limit, 1); +// List authRoleList = authRoleService.listAuthRoles2(page, limit); + PageInfo pageInfo = new PageInfo<>(authRoleList); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + List authAdminRoleResponses = authRoleList.stream().map(e -> { + AuthAdminRoleResponse authAdminRoleResponse = new AuthAdminRoleResponse(); + BeanUtils.copyProperties(e, authAdminRoleResponse); + return authAdminRoleResponse; + }).collect(Collectors.toList()); + pageSimpleResponse.setList(authAdminRoleResponses); + + return ResultVOUtils.success(pageSimpleResponse); + } + + + /** + * 新增 + * + * @return + */ +// @AuthRuleAnnotation("admin/auth/admin/save") +// @PostMapping("/admin/auth/admin/save") +// public BaseResponse save(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, +// BindingResult bindingResult) { +// +// if (bindingResult.hasErrors()) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); +// } +// AuthAdmin curUser = getCustomerId(); +// if (!curUser.getCustomerId().equals("110")) { +// CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(curUser.getCustomerId()); +// int max = customerInfoEntity.getUserMax(); +// int count = authAdminService.findCountByCustomerId(authAdminSaveRequest.getCustomerId()); +// if (count >= max) { +// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "已超过最大用户数"); +// } +// } +// +// // 检查是否存在相同名称的管理员 +// AuthAdmin byUserName = authAdminService.findByUserName(authAdminSaveRequest.getUserName()); +// if (byUserName != null) { +// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "当前管理员已存在"); +// } +// +// AuthAdmin authAdmin = new AuthAdmin(); +// BeanUtils.copyProperties(authAdminSaveRequest, authAdmin); +// +// if (authAdmin.getPassWord() != null) { +// authAdmin.setPassWord(PasswordUtils.authAdminPwd(authAdmin.getPassWord())); +// } +// authAdmin.setCustomerId(curUser.getCustomerId()); +// authAdmin.setLastModifyTime(new Date()); +// boolean b = authAdminService.insertAuthAdmin(authAdmin); +// authAdmin = authAdminService.findByUserName(authAdmin.getUserName()); +// if (!b) { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } +// +// // 插入角色 +// if (authAdminSaveRequest.getRoles() != null) { +// authRoleAdminService.insertRolesAdminIdAll(authAdminSaveRequest.getRoles(), authAdmin.getId()); +// } else { +// List authRoleAdmins = authRoleAdminService.listByAdminId(curUser.getId()); +// List roles = new ArrayList<>(); +// if (!authRoleAdmins.isEmpty()) { +// for (AuthRoleAdmin authRoleAdmin : authRoleAdmins) { +// roles.add(authRoleAdmin.getRole_id()); +// } +// authRoleAdminService.insertRolesAdminIdAll(roles, authAdmin.getId()); +// } +// } +// +// Map res = new HashMap<>(); +// res.put("id", authAdmin.getId()); +// return ResultVOUtils.success(res); +// } +// +// /** +// * 修改 +// * +// * @return +// */ +// @AuthRuleAnnotation("admin/auth/admin/edit") +// @PostMapping("/admin/auth/admin/edit") +// public BaseResponse edit(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, +// BindingResult bindingResult) { +// +// if (bindingResult.hasErrors()) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); +// } +// +// if (authAdminSaveRequest.getId() == null) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数错误!"); +// } +// +// // 检查是否存在除了当前管理员的其它名称的管理员 +// AuthAdmin byUserName = authAdminService.findByUserName(authAdminSaveRequest.getUserName()); +// if (byUserName != null && !authAdminSaveRequest.getId().equals(byUserName.getId())) { +// return ResultVOUtils.error(ResultEnum.DATA_REPEAT, "当前管理员已存在"); +// } +// +// AuthAdmin authAdmin = new AuthAdmin(); +// BeanUtils.copyProperties(authAdminSaveRequest, authAdmin); +// if (authAdmin.getPassWord() != null) { +// authAdmin.setPassWord(PasswordUtils.authAdminPwd(authAdmin.getPassWord())); +// } +// authAdmin.setLastModifyTime(new Date()); +// boolean b = authAdminService.updateAuthAdmin(authAdmin); +// +// if (!b) { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } +// +// // 修改角色 +// if (authAdminSaveRequest.getRoles() != null && authAdminSaveRequest.getRoles().size() > 0) { +// // 先删除之前的 +// authRoleAdminService.deleteByAdminId(authAdmin.getId()); +// authRoleAdminService.insertRolesAdminIdAll(authAdminSaveRequest.getRoles(), authAdmin.getId()); +// } +// +// return ResultVOUtils.success(); +// } +// +// +// @AuthRuleAnnotation("admin/auth/admin/updateInv") +// @PostMapping("/admin/auth/admin/updateInv") +// public BaseResponse updateInv(@RequestBody @Valid AuthAdminSaveRequest authAdminSaveRequest, +// BindingResult bindingResult) { +// +// if (bindingResult.hasErrors()) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); +// } +// +// if (authAdminSaveRequest.getId() == null) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数错误!"); +// } +// InvSubWarehouseEntity invSubWarehouseEntity = invSubWarehouseService.filterGroupInvSubAndcode(authAdminSaveRequest.getLocSubInvCode()); +// if (invSubWarehouseEntity != null) { +// authAdminSaveRequest.setLocInvCode(invSubWarehouseEntity.getParentId()); +// } +// AuthAdmin authAdmin = new AuthAdmin(); +// BeanUtils.copyProperties(authAdminSaveRequest, authAdmin); +// authAdmin.setLastModifyTime(new Date()); +// boolean b = authAdminService.updateAuthAdmin(authAdmin); +// if (!b) { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } +// return ResultVOUtils.success(); +// } +// +// /** +// * 删除 +// * +// * @return +// */ +// @AuthRuleAnnotation("admin/auth/admin/delete") +// @PostMapping("/admin/auth/admin/delete") +// public BaseResponse delete(@RequestBody AuthAdminSaveRequest authAdminSaveRequest) { +// +// +// FilterInvUserRequest warehouseUser = new FilterInvUserRequest(); +// warehouseUser.setUserid(authAdminSaveRequest.getId()); +// List warehouseUserEntityList = warehouseUserService.filterWarehouseUsers(warehouseUser); +// if (warehouseUserEntityList.size() == 0) { +// FilterInvBusUserRequest invBusUserEntity = new FilterInvBusUserRequest(); +// invBusUserEntity.setUserId(authAdminSaveRequest.getId() + ""); +// List invBusUserList = invBusUserService.filterInvBusUser(invBusUserEntity); +// if (invBusUserList.size() > 0) { +// return ResultVOUtils.error(999, "该用户存在关联单据信息,请先解除再删除"); +// } +// } else { +// return ResultVOUtils.error(999, "该用户存在关联仓库信息,请先解除再删除"); +// } +// +// +// if (authAdminSaveRequest.getId() == null) { +// return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "参数错误!"); +// } +// +// boolean b = authAdminService.deleteById(authAdminSaveRequest.getId()); +// if (!b) { +// return ResultVOUtils.error(ResultEnum.NOT_NETWORK); +// } +// // 先删除之前的角色 +// authRoleAdminService.deleteByAdminId(authAdminSaveRequest.getId()); +// +// return ResultVOUtils.success(); +// } +// +// +// @GetMapping("/spms/getRouters") +// public BaseResponse getRouters() { +// +// List roleIds; +// AuthAdmin authAdmin = getCustomerId(); +// if (!authAdmin.getCustomerId().equals("110")) { +// CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(authAdmin.getCustomerId()); +// roleIds = new ArrayList<>(); +// roleIds.add(Long.parseLong(customerInfoEntity.getRoleId())); +// } else { +// List authRoleAdmins = authRoleAdminService.listByAdminId(authAdmin.getId()); +// roleIds = authRoleAdmins.stream().map(AuthRoleAdmin::getRole_id).collect(Collectors.toList()); +// } +// +// +// // 角色授权列表 +// List authPermissions = authPermissionService.listByRoleIdIn(roleIds); +// List permissionRuleIds = authPermissions.stream().map(AuthPermission::getPermissionRuleId).collect(Collectors.toList()); +// +// // 获取授权的规则 +// List authPermissionRules = authPermissionRuleService.listByIdIn(permissionRuleIds); +// +// +// if (authAdmin.getId() == 1) {//admin 用户获取所有菜单项 +// authPermissionRules = authPermissionRuleService.listAll(); +// } else { +// +// } +// +// +// List menus = authPermissionRuleService.selectMenuTreeByUserId(authPermissionRules); +// List routerEntities = authPermissionRuleService.buildMenus(menus); +// +// return ResultVOUtils.success(routerEntities); +// } +// +// +// public AuthAdmin getCustomerId() { +// ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); +// +// if (attributes == null) { +// throw new JsonException(ResultEnum.NOT_NETWORK); +// } +// HttpServletRequest request = attributes.getRequest(); +// String userId = request.getHeader("ADMIN_ID"); +// AuthAdmin authAdmin = authAdminService.findById(Long.parseLong(userId)); +// return authAdmin; +// } +// +// /** +// * 获取医院用户列表 +// * +// * @return +// */ +// @AuthRuleAnnotation("") +// @PostMapping("/admin/auth/admin/hospitalUserList") +// public BaseResponse getHospitalUserList() { +// List hospitalUserList = authAdminService.getHospitalUserList(); +// return ResultVOUtils.success(hospitalUserList); +// } +} diff --git a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java index ff62952d..1a589088 100644 --- a/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java +++ b/src/main/java/com/glxp/api/controller/auth/InvWarehouseController.java @@ -156,7 +156,7 @@ public class InvWarehouseController extends BaseController { AuthAdmin authAdmin = customerService.getUserBean(); if (StrUtil.isNotEmpty(filterInvWarehouseRequest.getPcode())) { if (filterInvWarehouseRequest.getFilter() == null || filterInvWarehouseRequest.getFilter() == 1 || filterInvWarehouseRequest.getFilter() == 2) { - if (authAdmin.getCustomerId() == 110) { + if (authAdmin.getCustomerId() == "110") { filterInvWarehouseRequest.setUserId(authAdmin.getId()); } else { filterInvWarehouseRequest.setSpUse(true); diff --git a/src/main/java/com/glxp/api/controller/auth/LoginController.java b/src/main/java/com/glxp/api/controller/auth/LoginController.java index 9367112d..1030c194 100644 --- a/src/main/java/com/glxp/api/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/api/controller/auth/LoginController.java @@ -219,8 +219,12 @@ public class LoginController extends BaseController { AuthAdmin authAdmin = authAdminService.findById(id); LoginUserInfoResponse loginUserInfoResponse = new LoginUserInfoResponse(); BeanUtils.copyProperties(authAdmin, loginUserInfoResponse); - CompanyEntity companyEntity = companyService.findCompany(); - loginUserInfoResponse.setCompanyName(companyEntity.getName()); + CompanyEntity companyEntity = companyService.findCompany(authAdmin.getCustomerId()); + if("110".equals(authAdmin.getCustomerId())){ + loginUserInfoResponse.setCompanyName(authAdmin.getEmployeeName()); + }else{ + loginUserInfoResponse.setCompanyName(companyEntity.getCompanyName()); + } loginUserInfoResponse.setLocDeptName(deptService.getInvName(loginUserInfoResponse.getLocDeptCode())); loginUserInfoResponse.setLocInvName(invWarehouseService.getSubInvName(loginUserInfoResponse.getLocInvCode())); // 角色集合 diff --git a/src/main/java/com/glxp/api/controller/auth/RegisterController.java b/src/main/java/com/glxp/api/controller/auth/RegisterController.java new file mode 100644 index 00000000..dbcbb738 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/auth/RegisterController.java @@ -0,0 +1,490 @@ +package com.glxp.api.controller.auth; + +import cn.hutool.core.util.ReUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.enums.ResultEnum; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.auth.CustomerInfoEntity; +import com.glxp.api.entity.auth.UserRegisterEntity; +import com.glxp.api.entity.basic.BasicUnitMaintainEntity; +import com.glxp.api.entity.purchase.CustomerContactEntity; +import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.entity.system.SystemParamConfigEntity; +import com.glxp.api.req.auth.CustomerInfoFilterRequest; +import com.glxp.api.req.auth.RegisterCheckRequest; +import com.glxp.api.req.auth.ResetPasswdRequest; +import com.glxp.api.req.auth.UserResisterFilterRequest; +import com.glxp.api.req.info.FilterAliCertRequest; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.res.auth.CheckCodeRequest; +import com.glxp.api.service.auth.AuthAdminService; +import com.glxp.api.service.auth.AuthRoleAdminService; +import com.glxp.api.service.auth.CustomerInfoService; +import com.glxp.api.service.auth.UserRegisterService; +import com.glxp.api.service.basic.BasicUnitMaintainService; +import com.glxp.api.service.purchase.CustomerContactService; +import com.glxp.api.service.system.CompanyService; +import com.glxp.api.service.system.SystemParamConfigService; +import com.glxp.api.util.Constant; +import com.glxp.api.util.DateUtil; +import com.glxp.api.util.RedisUtil; +import com.glxp.api.util.UuidUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.client.RestTemplate; + +import javax.annotation.Resource; +import javax.servlet.http.HttpSession; +import javax.validation.Valid; +import java.util.*; + +@RestController +@Slf4j +public class RegisterController { + + private static String Url = "http://106.ihuyi.com/webservice/sms.php?method=Submit"; + + @Resource + UserRegisterService userRegisterService; + @Resource + private AuthRoleAdminService authRoleAdminService; + @Resource + private AuthAdminService authAdminService; + @Resource + private CustomerInfoService customerInfoService; + @Resource + private CustomerContactService customerContactService; + + @Resource + private CompanyService companyService; + @Resource + private BasicUnitMaintainService basicUnitMaintainService; + @Resource + private SystemParamConfigService systemParamConfigService; + @Resource + RedisUtil redisUtil; + + + @AuthRuleAnnotation("") + @GetMapping("salewarehouse/register/list") + public BaseResponse filterList(UserResisterFilterRequest userResisterFilterRequest) { + + List userRegisterEntities = userRegisterService.filterUserRegisters(userResisterFilterRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(userRegisterEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(userRegisterEntities); + return ResultVOUtils.success(pageSimpleResponse); + } + + @PostMapping("salewarehouse/register/getCheckcode") + public BaseResponse getCheckcode(@RequestBody CheckCodeRequest checkCodeRequest, HttpSession httpSession) { + + if (checkCodeRequest.getUserName() != null) { + AuthAdmin authAdmin = authAdminService.findByUserName(checkCodeRequest.getUserName()); + if (authAdmin == null) { + return ResultVOUtils.error(500, "未找到该用户"); + } + UserRegisterEntity userRegisterEntity = userRegisterService.selectByCustomerId(String.valueOf(authAdmin.getCustomerId())); + if (!userRegisterEntity.getMobile().equals(checkCodeRequest.getPhoneNum())) { + CustomerContactEntity customerContactEntity = customerContactService.selectById(Long.valueOf(String.valueOf(authAdmin.getCustomerId()))); + if (customerContactEntity != null) { + if (!customerContactEntity.getMobile().equals(checkCodeRequest.getPhoneNum())) { + return ResultVOUtils.error(500, "手机号与注册时不一致"); + } + } else { + return ResultVOUtils.error(500, "手机号与注册时不一致"); + } + } + } + + RestTemplate restTemplate = new RestTemplate(); + int mobile_code = (int) ((Math.random() * 9 + 1) * 100000); + MultiValueMap postParameters = new LinkedMultiValueMap<>(); + int time = 5; + String content = new String("您正在进行手机验证,验证码是" + mobile_code + "," + time + "分钟内有效。"); + postParameters.add("account", "C07086222"); + postParameters.add("password", "2dddbbf73636c193c5903324bdb47c5c"); + postParameters.add("mobile", checkCodeRequest.getPhoneNum()); + postParameters.add("content", content); + HttpHeaders headers = new HttpHeaders(); + headers.add("Content-Type", "application/x-www-form-urlencoded;charset=GBK"); + HttpEntity> httpEntity = new HttpEntity<>(postParameters, headers); + String response = restTemplate.postForObject(Url, httpEntity, String.class); + if (response.contains("提交成功")) { + JSONObject json = new JSONObject(); + json.put("memPhone", checkCodeRequest.getPhoneNum()); + json.put("code", mobile_code); + json.put("createTime", System.currentTimeMillis()); + //验证码存入redis中 + redisUtil.set(Constant.CAPTCHAS + checkCodeRequest.getPhoneNum(), json, 300L); + return ResultVOUtils.success("发送成功" + " " + mobile_code); + } else { + return ResultVOUtils.error(500, "验证码发送失败"); + } + + } + + @GetMapping("salewarehouse/register/checkCompany") + public BaseResponse checkCompany(@RequestParam("companyName") String companyName) { + if (StringUtils.isBlank(companyName)) return ResultVOUtils.error(ResultEnum.DATA_ERROR, "企业名称不能为空"); + + if (basicUnitMaintainService.selectByName(companyName) != null) { + return ResultVOUtils.success("校验成功"); + } else { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, "校验失败"); + } + + } + + @GetMapping("salewarehouse/register/getRegisterConfig") + public BaseResponse getRegisterConfig() { + + Map rMap = new HashMap<>(); + SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("register_company_check"); + if (systemParamConfigEntity == null + || StringUtils.isBlank(systemParamConfigEntity.getParamValue()) + || systemParamConfigEntity.getParamValue().equals("0")) { + rMap.put("companyCheckStatus", false); + } else { + rMap.put("companyCheckStatus", true); + } + + SystemParamConfigEntity systemParamConfigEntity1 = systemParamConfigService.selectByParamKey("register_udplat_check"); + if (systemParamConfigEntity1 == null + || StringUtils.isBlank(systemParamConfigEntity1.getParamValue()) + || systemParamConfigEntity1.getParamValue().equals("0")) { + rMap.put("udplatCheckStatus", false); + } else { + rMap.put("udplatCheckStatus", true); + } + + + return ResultVOUtils.success(rMap); + } + + @AuthRuleAnnotation("") + @PostMapping("salewarehouse/register/deleteResiter") + public BaseResponse deleteResiter(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + + String id = deleteRequest.getId(); + userRegisterService.deleteById(Long.parseLong(id)); + return ResultVOUtils.success("删除成功"); + } + + @PostMapping("salewarehouse/register/update") + public BaseResponse updateRegister(@RequestBody @Valid UserRegisterEntity userRegisterEntity, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + boolean b = userRegisterService.updateUserRegister(userRegisterEntity); + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + return ResultVOUtils.success("添加成功"); + } + + @PostMapping("salewarehouse/register/save") + public BaseResponse saveRegister(@RequestBody @Valid UserRegisterEntity userRegisterEntity, HttpSession httpSession, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + String codeStr = String.valueOf(redisUtil.get(Constant.CAPTCHAS + userRegisterEntity.getMobile())); + if (StrUtil.isBlank(codeStr) || "null".equals(codeStr)) { + return ResultVOUtils.error(500, "验证码已过期,请重新获取"); + } + JSONObject userCode = JSONObject.parseObject(codeStr); + if (userCode == null) { + return ResultVOUtils.error(500, "验证码已失效,请重新获取"); + } + long lastTime = userCode.getLong("createTime"); + int checkCode = (Integer) userCode.get("code"); + String phoneNum = userCode.getString("memPhone"); + if ((System.currentTimeMillis() - lastTime) > 1000 * 60 * 5) { + return ResultVOUtils.error(500, "验证码已过期,请重新获取"); + } + if (checkCode != userRegisterEntity.getCheckCode()) { + return ResultVOUtils.error(500, "验证码错误,请重新获取"); + } + if (!phoneNum.equals(userRegisterEntity.getMobile())) { + return ResultVOUtils.error(500, "手机号与获取验证码不一致"); + } + boolean isExitPhone = userRegisterService.isExit(userRegisterEntity.getMobile()); + if (isExitPhone) { + return ResultVOUtils.error(500, "该手机号已被注册"); + } + //校验邮箱是否正确 + if (StrUtil.isNotBlank(userRegisterEntity.getEmail())) { + boolean match = ReUtil.isMatch("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", userRegisterEntity.getEmail()); + if (!match) { + return ResultVOUtils.error(500, "邮箱格式错误"); + } + } + + String company_check = systemParamConfigService.selectValueByParamKey("register_company_check"); + if (StrUtil.isNotBlank(company_check) && company_check.equals("1")) { + //新用户注册时根据往来单位字典进行企业名称校验 + CustomerInfoEntity customerInfoEntity = customerInfoService.selectById(userRegisterEntity.getCompanyId()); + if (customerInfoEntity != null) { + return ResultVOUtils.error(500, "该企业已被注册!"); + } + } + + userRegisterEntity.setRegisterTime(DateUtil.getDateTime()); + userRegisterEntity.setCheckType(0);//未审核 + String userName = UuidUtils.getShortUuid(4); + switch (userRegisterEntity.getBussinessStatus()) { + case 1: + userName = "YY" + userName; + break; + case 2: + userName = "JYQY" + userName; + break; + default: + userName = "JYQY" + userName; + break; + } + userRegisterEntity.setUserName(userName); + UserRegisterEntity userRegisterEntity1 = userRegisterService.selectByMobile(userRegisterEntity.getMobile()); + if(userRegisterEntity1!=null){ + userRegisterService.deleteByMobile(userRegisterEntity.getMobile(),2); + } + boolean b = userRegisterService.insertUserRegister(userRegisterEntity); + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + //注册成功,删除验证码缓存 + redisUtil.del(Constant.CAPTCHAS + userRegisterEntity.getMobile()); + return ResultVOUtils.success(userRegisterEntity.getUserName()); + } + + @PostMapping("salewarehouse/reset/passwd") + public BaseResponse resetPasswd(@RequestBody @Valid ResetPasswdRequest resetPasswdRequest, HttpSession httpSession, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + log.info(httpSession.getId()); + JSONObject userCode = JSONObject.parseObject(String.valueOf(redisUtil.get(Constant.CAPTCHAS + resetPasswdRequest.getMobile()))); + if (userCode == null) { + return ResultVOUtils.error(500, "验证码已失效,请重新获取"); + } + long lastTime = userCode.getLong("createTime"); + int checkCode = (Integer) userCode.get("code"); + String phoneNum = userCode.getString("memPhone"); + if ((System.currentTimeMillis() - lastTime) > 1000 * 60 * 5) { + return ResultVOUtils.error(500, "验证码已过期,请重新获取"); + } + if (checkCode != resetPasswdRequest.getCheckCode()) { + return ResultVOUtils.error(500, "验证码错误,请重新获取"); + } + if (!phoneNum.equals(resetPasswdRequest.getMobile())) { + return ResultVOUtils.error(500, "手机号与获取验证码不一致"); + } + AuthAdmin authAdmin = authAdminService.findByUserName(resetPasswdRequest.getUserName()); + if (authAdmin == null) { + return ResultVOUtils.error(500, "该用户不存在"); + } + CustomerContactEntity customerContactEntity = customerContactService.selectById(Long.valueOf(String.valueOf(authAdmin.getCustomerId()))); + if (customerContactEntity != null && customerContactEntity.getMobile().equals(phoneNum)) { + authAdmin.setPassWord(resetPasswdRequest.getPassword()); + authAdmin.setLastModifyTime(new Date()); + authAdminService.updateAuthAdmin(authAdmin); + } else { + return ResultVOUtils.error(500, "手机号与该用户不匹配"); + } + + return ResultVOUtils.success("密码修改成功"); + } + + @AuthRuleAnnotation("") + @PostMapping("salewarehouse/register/check") + public BaseResponse checkRegister(@RequestBody @Valid RegisterCheckRequest registerCheckRequest, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + Long customerId = 0L; + UserRegisterEntity userRegisterEntity = userRegisterService.selectById(registerCheckRequest.getId()); + //判断是否选择供应商 + if (StrUtil.isBlank(registerCheckRequest.getCompanyId()) && StrUtil.isBlank(registerCheckRequest.getCompanyName())) { + //根据公司名称查询往来单位信息 + BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByName(userRegisterEntity.getCompanyName()); + //没有就新建 + if (basicUnitMaintainEntity == null) { + if (registerCheckRequest.getCheckType() == 1) { + //注册时新增到往来单位字典 + BasicUnitMaintainEntity basicUnitMaintainEntity1 = new BasicUnitMaintainEntity(); + basicUnitMaintainEntity1.setName(userRegisterEntity.getCompanyName()); + basicUnitMaintainEntity1.setErpId(generateUserId() + ""); + basicUnitMaintainEntity1.setCorpType(2); + basicUnitMaintainEntity1.setOutType(0); + basicUnitMaintainEntity1.setCreditNo(userRegisterEntity.getCreditNum()); + basicUnitMaintainEntity1.setAddr(userRegisterEntity.getArea() + userRegisterEntity.getDetailAddr()); + basicUnitMaintainEntity1.setContact(userRegisterEntity.getRealName()); + basicUnitMaintainEntity1.setMobile(userRegisterEntity.getMobile()); + basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity1); + customerId = Long.parseLong(basicUnitMaintainEntity1.getErpId()); + registerCheckRequest.setCompanyId(basicUnitMaintainEntity1.getErpId()); + registerCheckRequest.setCompanyName(basicUnitMaintainEntity1.getName()); + } + } else { + customerId = Long.parseLong(basicUnitMaintainEntity.getErpId()); + registerCheckRequest.setCompanyId(basicUnitMaintainEntity.getErpId()); + registerCheckRequest.setCompanyName(basicUnitMaintainEntity.getName()); + } + } else { + customerId = Long.parseLong(registerCheckRequest.getCompanyId()); + } + if (registerCheckRequest.getCheckType() == 1) { + //通过就更新用户id 供应商用户 供应商id + userRegisterEntity.setCompanyId(registerCheckRequest.getCompanyId()); + userRegisterEntity.setCompanyName(registerCheckRequest.getCompanyName()); + userRegisterEntity.setUserId(generateUserId() + ""); + } + + userRegisterEntity.setCheckType(registerCheckRequest.getCheckType()); + userRegisterEntity.setCheckTime(DateUtil.getDateTime()); + boolean b = userRegisterService.updateUserRegister(userRegisterEntity); + if (registerCheckRequest.getCheckType() != 1) { + return ResultVOUtils.success("修改成功"); + } + //创建新用户 + AuthAdmin authAdmin = new AuthAdmin(); + authAdmin.setCustomerId(customerId+""); + authAdmin.setPassWord(userRegisterEntity.getPassword()); + authAdmin.setCreateTime(DateUtil.parseDate(userRegisterEntity.getCheckTime())); + authAdmin.setUserName(userRegisterEntity.getUserName()); //用手机号当用户名,通过手机号登录 + authAdmin.setEmployeeName(userRegisterEntity.getNickName()); + authAdmin.setCustomerId(userRegisterEntity.getCompanyId()); + //默认给部门、仓库 + authAdmin.setLocDeptCode("1000"); + authAdmin.setLocInvCode("1000000"); + authAdmin.setUserFlag(1); + authAdmin.setLastModifyTime(new Date()); + authAdminService.insertAuthAdmin(authAdmin); + authAdmin = authAdminService.findByUserName(authAdmin.getUserName()); + + //分配角色 +// List roles = new ArrayList<>(); +// roles.add(Long.valueOf(13));//默认角色 + + + //生产客户信息表 + CustomerInfoEntity customerInfoEntity = new CustomerInfoEntity(); +// customerInfoEntity.setCustomerId(Long.valueOf(String.valueOf(authAdmin.getCustomerId()))); + customerInfoEntity.setCustomerId(customerId); + customerInfoEntity.setArea(userRegisterEntity.getArea()); + customerInfoEntity.setDetailAddr(userRegisterEntity.getDetailAddr()); + customerInfoEntity.setBussinessStatus(userRegisterEntity.getBussinessStatus()); + customerInfoEntity.setCreditNum(userRegisterEntity.getCreditNum()); + customerInfoEntity.setCustomerName(userRegisterEntity.getNickName()); + customerInfoEntity.setUserFlag(1); + customerInfoEntity.setUserMax(2); + customerInfoEntity.setRoleId(registerCheckRequest.getRoles() + ""); + customerInfoEntity.setCompanyName(userRegisterEntity.getCompanyName()); + List roles = new ArrayList<>(); + + if (registerCheckRequest.getRoles() != null) { + roles.add(registerCheckRequest.getRoles()); + authRoleAdminService.insertRolesAdminIdAll(roles, authAdmin.getId()); + } + + + //生产客户信息联系人表 + CustomerContactEntity customerContactEntity = new CustomerContactEntity(); + customerContactEntity.setContacts(userRegisterEntity.getRealName()); + customerContactEntity.setCustomerId(customerId + ""); + customerContactEntity.setEmail(userRegisterEntity.getEmail()); + customerContactEntity.setMobile(userRegisterEntity.getMobile()); + customerContactEntity.setTel(userRegisterEntity.getTel()); + CustomerContactEntity customerContactEntity1 = customerContactService.selectById(customerId); + if(customerContactEntity1==null){ + customerContactService.insertCustomerContact(customerContactEntity); + } + + //生产本企业信息 + CompanyEntity companyEntity = new CompanyEntity(); + companyEntity.setCustomerId(customerId+""); + companyEntity.setArea(userRegisterEntity.getArea()); + companyEntity.setAreaCode(userRegisterEntity.getAreaCode()); + companyEntity.setDetailAddr(userRegisterEntity.getDetailAddr()); + companyEntity.setContacts(customerContactEntity.getContacts()); + companyEntity.setEmail(userRegisterEntity.getEmail()); + companyEntity.setMobile(userRegisterEntity.getMobile()); + companyEntity.setTel(userRegisterEntity.getTel()); + companyEntity.setCompanyName(userRegisterEntity.getCompanyName()); + companyEntity.setUnitIdFk(userRegisterEntity.getCompanyId()); + companyEntity.setClasses(userRegisterEntity.getBussinessStatus() + ""); + companyEntity.setBussinessStatus(userRegisterEntity.getBussinessStatus()); + companyEntity.setCreditNum(userRegisterEntity.getCreditNum()); + + BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(userRegisterEntity.getCompanyId()); + if (basicUnitMaintainEntity != null) { + basicUnitMaintainEntity.setThirdId1(userRegisterEntity.getUdplatCompanyId()); + basicUnitMaintainEntity.setThirdName1(userRegisterEntity.getUdplatCompanyName()); + basicUnitMaintainService.updateById(basicUnitMaintainEntity); + } + + + FilterAliCertRequest filterAliCertRequest = new FilterAliCertRequest(); + filterAliCertRequest.setId(registerCheckRequest.getAliCertId()); + + CustomerInfoFilterRequest request = new CustomerInfoFilterRequest(); + request.setCompanyName(registerCheckRequest.getCompanyName()); + List customerInfoEntities = customerInfoService.filterCustomerInfo(request); + int i=0; + for (CustomerInfoEntity infoEntity : customerInfoEntities) { + if(registerCheckRequest.getCompanyName().equals(infoEntity.getCompanyName())){ + i++; + } + } + if(i<=0){ + customerInfoService.insertCustomerInfo(customerInfoEntity); + companyService.insertCompany(companyEntity);//TODO !!!!!!!!!!! + } + + + + + + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + return ResultVOUtils.success("添加成功"); + } + + public long generateUserId() { + String userId = System.currentTimeMillis() + ""; + userId = userId.substring(1, userId.length()); + int max = 100, min = 1; + int ran2 = (int) (Math.random() * (max - min) + min); + userId = userId + ran2; + return Long.parseLong(userId); + } + + +} diff --git a/src/main/java/com/glxp/api/controller/sup/CustomerController.java b/src/main/java/com/glxp/api/controller/sup/CustomerController.java new file mode 100644 index 00000000..ffc34f15 --- /dev/null +++ b/src/main/java/com/glxp/api/controller/sup/CustomerController.java @@ -0,0 +1,181 @@ +package com.glxp.api.controller.sup; + +import com.github.pagehelper.PageInfo; +import com.glxp.api.annotation.AuthRuleAnnotation; +import com.glxp.api.common.enums.ResultEnum; +import com.glxp.api.common.res.BaseResponse; +import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.entity.auth.*; +import com.glxp.api.entity.purchase.CustomerContactEntity; +import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.req.auth.CustomerInfoFilterRequest; +import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.res.PageSimpleResponse; +import com.glxp.api.service.auth.AuthAdminService; +import com.glxp.api.service.auth.AuthRoleAdminService; +import com.glxp.api.service.auth.CustomerInfoService; +import com.glxp.api.service.purchase.CustomerContactService; +import com.glxp.api.service.system.CompanyService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + +@RestController +@Slf4j +public class CustomerController { + + @Resource + private CompanyService companyService; + @Resource + private CustomerInfoService customerInfoService; + @Resource + private CustomerContactService customerContactService; + // @Resource +// private UserRegisterService userRegisterService; + @Resource + private AuthAdminService authAdminService; + @Resource + private AuthRoleAdminService authRoleAdminService; + + @AuthRuleAnnotation("") + @GetMapping("/spms/customer/list") + public BaseResponse filterCustomers(CustomerInfoFilterRequest customerFilterRequest) { + + List customerDetailEntities = customerInfoService.filterCustomerInfo(customerFilterRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(customerDetailEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(customerDetailEntities); + return ResultVOUtils.success(pageSimpleResponse); + } + + @AuthRuleAnnotation("") + @GetMapping("salewarehouse/customer/list") + public BaseResponse filterList(CustomerInfoFilterRequest customerFilterRequest) { + + List customerDetailEntities = customerInfoService.filterDetailCustomer(customerFilterRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(customerDetailEntities); + PageSimpleResponse pageSimpleResponse = new PageSimpleResponse<>(); + pageSimpleResponse.setTotal(pageInfo.getTotal()); + pageSimpleResponse.setList(customerDetailEntities); + + for (CustomerDetailEntity customerDetailEntity : customerDetailEntities) { + CompanyEntity companyEntity = companyService.findCompany(customerDetailEntity.getCustomerId()); + if (companyEntity != null) { + customerDetailEntity.setFilePath(companyEntity.getFilePath()); + } + } + + return ResultVOUtils.success(pageSimpleResponse); + } + + @AuthRuleAnnotation("") + @GetMapping("salewarehouse/customer/detail") + public BaseResponse customerDetail(CustomerInfoFilterRequest customerFilterRequest) { + + CustomerDetailEntity customerDetailEntity = customerInfoService.selectDetail(customerFilterRequest.getCustomerId()); + if (customerDetailEntity != null) { + return ResultVOUtils.success(customerDetailEntity); + } + return ResultVOUtils.error(500, "用户信息为空"); + } + + @AuthRuleAnnotation("") + @PostMapping("salewarehouse/customer/update") + public BaseResponse updateCustomer(@RequestBody @Valid CustomerDetailEntity customerDetailEntity, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + CustomerInfoEntity customerInfoEntity = new CustomerInfoEntity(); + BeanUtils.copyProperties(customerDetailEntity, customerInfoEntity); + customerInfoEntity.setCustomerId((Long.valueOf(customerDetailEntity.getCustomerId()))); + boolean b = customerInfoService.updateCustomerInfo(customerInfoEntity); + //同时修改用户关联的角色 + List byCustomerld = authAdminService.findByCustomerld(customerDetailEntity.getCustomerId()); + + AuthRoleAdmin authRoleAdmin = new AuthRoleAdmin(); + List objects = new ArrayList<>(); + if( byCustomerld !=null && byCustomerld.size()>0){ + for (AuthAdmin authAdmin : byCustomerld) { + List authRoleAdmins = authRoleAdminService.listByAdminId(authAdmin.getId()); + if(authRoleAdmins!=null && authRoleAdmins.size()>0) { + authRoleAdmin.setRole_id(Long.valueOf(customerDetailEntity.getRoleId())); + authRoleAdmin.setUser_id(authAdmin.getId()); + authRoleAdminService.updateAuthRoleAdmin(authRoleAdmin); + }else{ + authRoleAdmin.setRole_id(Long.valueOf(customerDetailEntity.getRoleId())); + authRoleAdmin.setUser_id(authAdmin.getId()); + objects.add(authRoleAdmin); + authRoleAdminService.insertAuthRoleAdminAll(objects); + } + } + } + + if (customerDetailEntity.getUserFlag() != null) { + UpdateUserflagBean userflagBean = new UpdateUserflagBean(); + userflagBean.setCustomerId(customerDetailEntity.getCustomerId()); + userflagBean.setUserFlag(customerDetailEntity.getUserFlag()); + } + + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + + + return ResultVOUtils.success("更新成功"); + } + + @AuthRuleAnnotation("") + @PostMapping("salewarehouse/customer/modify") + public BaseResponse modifyCustomer(@RequestBody @Valid CustomerDetailEntity customerDetailEntity, + BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + CustomerInfoEntity customerInfoEntity = new CustomerInfoEntity(); + BeanUtils.copyProperties(customerDetailEntity, customerInfoEntity); + boolean b = customerInfoService.updateCustomerInfo(customerInfoEntity); + + CustomerContactEntity customerContactEntity = new CustomerContactEntity(); + BeanUtils.copyProperties(customerDetailEntity, customerContactEntity); + boolean c = customerContactService.updateCustomerContact(customerContactEntity); + if (!b) { + return ResultVOUtils.error(ResultEnum.NOT_NETWORK); + } + return ResultVOUtils.success("更新成功"); + } + + @AuthRuleAnnotation("") + @PostMapping("salewarehouse/customer/delete") + public BaseResponse deleteCustomers(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) { + + if (bindingResult.hasErrors()) { + return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); + } + + String id = deleteRequest.getId(); + customerInfoService.deleteById(id); + customerContactService.deleteById(id); +// userRegisterService.deleteByCustomerId(Long.parseLong(id)); + authAdminService.deleteByCustomerId(id); + companyService.deleteCompany(Long.parseLong(id)); + + return ResultVOUtils.success("删除成功"); + } + + +} diff --git a/src/main/java/com/glxp/api/controller/system/CompanyController.java b/src/main/java/com/glxp/api/controller/system/CompanyController.java index cb1d34de..442c4e94 100644 --- a/src/main/java/com/glxp/api/controller/system/CompanyController.java +++ b/src/main/java/com/glxp/api/controller/system/CompanyController.java @@ -1,6 +1,7 @@ package com.glxp.api.controller.system; import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.req.system.CompanyRequest; import com.glxp.api.service.system.CompanyService; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; @@ -18,8 +19,8 @@ public class CompanyController { private CompanyService companyService; @GetMapping("/warehouse/info/company") - public BaseResponse getCompanyInfo() { - CompanyEntity companyEntity = companyService.findCompany(); + public BaseResponse getCompanyInfo(CompanyRequest companyRequest) { + CompanyEntity companyEntity = companyService.findCompany(companyRequest.getCustomerId()); if (companyEntity != null) { return ResultVOUtils.success(companyEntity); } diff --git a/src/main/java/com/glxp/api/controller/system/ConnectTestController.java b/src/main/java/com/glxp/api/controller/system/ConnectTestController.java index 248419e9..5a0f6463 100644 --- a/src/main/java/com/glxp/api/controller/system/ConnectTestController.java +++ b/src/main/java/com/glxp/api/controller/system/ConnectTestController.java @@ -20,7 +20,7 @@ public class ConnectTestController { @GetMapping("/udiwms/auth/device/connect") public BaseResponse index(FilterConnectRequest connequest) { - CompanyEntity companyEntity = companyService.findCompany(); + CompanyEntity companyEntity = companyService.findCompany("110"); AuthConnectEntity authConnectEntity = new AuthConnectEntity(); authConnectEntity.setCompanyName(companyEntity.getName()); authConnectEntity.setSysName("UDI管理系统"); diff --git a/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java b/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java index 020ead7d..1a3c1abd 100644 --- a/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java +++ b/src/main/java/com/glxp/api/dao/auth/AuthAdminDao.java @@ -1,6 +1,9 @@ package com.glxp.api.dao.auth; +import com.glxp.api.dao.BaseMapperPlus; +import com.glxp.api.dao.inout.IoCodeTempDao; import com.glxp.api.entity.auth.AuthAdmin; +import com.glxp.api.entity.inout.IoCodeTempEntity; import com.glxp.api.req.auth.FilterAuthUserRequest; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -8,7 +11,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; @Mapper -public interface AuthAdminDao { +public interface AuthAdminDao extends BaseMapperPlus { /** * 后台业务查询列表 @@ -17,6 +20,9 @@ public interface AuthAdminDao { */ List listAdminPage(FilterAuthUserRequest filterAuthUserRequest); + List findByCustomerld(String CustomerId); + + boolean replaceAuthAdmin(AuthAdmin authAdmin); /** @@ -67,6 +73,7 @@ public interface AuthAdminDao { */ boolean deleteById(Long id); + /** * 查询医院用户列表 * @@ -74,7 +81,7 @@ public interface AuthAdminDao { */ List selectHospitalUser(); - List selectNotSelectUser(@Param("userIds") List userIds,@Param("deptId") Integer deptId); + List selectNotSelectUser(@Param("userIds") List userIds, @Param("deptId") Integer deptId); List selectAllocatedList(FilterAuthUserRequest filterAuthUserRequest); diff --git a/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java b/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java new file mode 100644 index 00000000..a18dd9ac --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/AuthRoleAdminDao.java @@ -0,0 +1,58 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.entity.auth.AuthRoleAdmin; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + + +@Mapper +public interface AuthRoleAdminDao { + + /** + * 根据 adminId 查询 + * + * @param adminId 传入的 adminId + * @return + */ + List listByAdminId(Long adminId); + + /** + * 根据 多个 adminId 查询 + * + * @param adminIds 传入的 adminIds + * @return + */ + List listByAdminIdIn(List adminIds); + + /** + * 根据 role_id 查询 admin_id + * + * @param roleId 传入的 roleId + * @return + */ + List listByRoleId(Long roleId); + + /** + * 批量插入 + * + * @param authRoleAdminList + * @return + */ + int insertAuthRoleAdminAll(List authRoleAdminList); + + + /** + * 根据 adminId 删除 + * + * @param adminId + * @return + */ + boolean deleteByAdminId(Long adminId); + + boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin); + + + List listAdminRole(Long adminId); +} diff --git a/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java b/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java new file mode 100644 index 00000000..dd0ec29c --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/AuthRoleDao.java @@ -0,0 +1,52 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.req.auth.AuthRoleQueryRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface AuthRoleDao { + + /** + * 后台管理业务查询列表 + * @return 列表 + */ + List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest); + + /** + * 返回id,name 字段的列表 + * @return 列表 + */ + List listAuthAdminRolePage(@Param("status") Integer status); + + List listCustomerRoles(@Param("isCustomer") Integer isCustomer); + + List listAuthRoles2(); + + AuthRole findByName(String name); + + /** + * 插入 + * @param authAdmin + * @return + */ + boolean insertAuthRole(AuthRole authAdmin); + + /** + * 更新 + * @param authAdmin + * @return + */ + boolean updateAuthRole(AuthRole authAdmin); + + /** + * 删除 + * @param id + * @return + */ + boolean deleteById(Long id); + +} diff --git a/src/main/java/com/glxp/api/dao/auth/CustomerInfoDao.java b/src/main/java/com/glxp/api/dao/auth/CustomerInfoDao.java new file mode 100644 index 00000000..328e7432 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/CustomerInfoDao.java @@ -0,0 +1,33 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.entity.auth.CustomerDetailEntity; +import com.glxp.api.entity.auth.CustomerInfoEntity; +import com.glxp.api.req.auth.CustomerInfoFilterRequest; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface CustomerInfoDao { + + + List filterCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest); + + List filterDetailCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest); + + + boolean insertCustomerInfo(CustomerInfoEntity customerInfoEntity); + + boolean updateCustomerInfo(CustomerInfoEntity customerInfoEntity); + + boolean modifyCustomerInfo(CustomerDetailEntity customerDetailEntity); + + boolean deleteById(String customerId); + + CustomerInfoEntity selectById(String customerId); + + CustomerDetailEntity selectDetail(String customerId); + + + CustomerInfoEntity isExitRoleId(String roleId); +} diff --git a/src/main/java/com/glxp/api/dao/auth/UserRegisterDao.java b/src/main/java/com/glxp/api/dao/auth/UserRegisterDao.java new file mode 100644 index 00000000..14605e9f --- /dev/null +++ b/src/main/java/com/glxp/api/dao/auth/UserRegisterDao.java @@ -0,0 +1,31 @@ +package com.glxp.api.dao.auth; + +import com.glxp.api.entity.auth.UserRegisterEntity; +import com.glxp.api.req.auth.UserResisterFilterRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface UserRegisterDao { + + List filterUserRegisters(UserResisterFilterRequest userResisterFilterRequest); + + boolean insertUserRegister(UserRegisterEntity userRegisterEntity); + + boolean updateUserRegister(UserRegisterEntity userRegisterEntity); + + boolean deleteById(Long id); + boolean deleteByMobile(@Param("phone")String phone , @Param("checkType")Integer checkType); + + UserRegisterEntity selectById(Integer id); + + UserRegisterEntity selectByCustomerId(@Param("id") String id); + + UserRegisterEntity selectByMobile(String phone); + + boolean deleteByCustomerId(Long id); + + String isExit(String phoneNum); +} diff --git a/src/main/java/com/glxp/api/dao/basic/BasicBussinessTypeRoleDao.java b/src/main/java/com/glxp/api/dao/basic/BasicBussinessTypeRoleDao.java new file mode 100644 index 00000000..5af75836 --- /dev/null +++ b/src/main/java/com/glxp/api/dao/basic/BasicBussinessTypeRoleDao.java @@ -0,0 +1,27 @@ +package com.glxp.api.dao.basic; + +import com.glxp.api.entity.basic.BasicBussinessTypeRoleEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BasicBussinessTypeRoleDao { + + public List getListByRoleId(@Param("roleId") Long roleId); + + /** + * 删除此角色下所有的扫码单据类型授权数据 + * + * @param roleId + */ + void deleteByRoleId(@Param("roleId") Long roleId); + + /** + * 插入授权数据 + * + * @param basicBussinessTypeRoleEntities + */ + void insert(@Param("basicBussinessTypeRoleEntities") List basicBussinessTypeRoleEntities); +} diff --git a/src/main/java/com/glxp/api/dao/basic/BasicUnitMaintainDao.java b/src/main/java/com/glxp/api/dao/basic/BasicUnitMaintainDao.java new file mode 100644 index 00000000..1d352cbc --- /dev/null +++ b/src/main/java/com/glxp/api/dao/basic/BasicUnitMaintainDao.java @@ -0,0 +1,36 @@ +package com.glxp.api.dao.basic; + +import com.glxp.api.entity.basic.BasicUnitMaintainEntity; +import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface BasicUnitMaintainDao { + List filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest); + + boolean insertBasicUnitMaintain(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean insertBasicUnitMaintainignore(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean insert(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean updateById(BasicUnitMaintainEntity basicUnitMaintainSaveRequest); + + BasicUnitMaintainEntity selectByThirdId(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest); + + boolean deleteById(@Param("id") String id); + + BasicUnitMaintainEntity selectById(@Param("id") String id); + + List batchSelectByIds(@Param("ids") List id); + + List batchSelectByErpIds(@Param("erpIds") List erpIds); + + BasicUnitMaintainEntity selectByName(@Param("name") String name); + + + boolean importBasicUnitMaintain(BasicUnitMaintainEntity basicUnitMaintainEntity); +} diff --git a/src/main/java/com/glxp/api/dao/system/CompanyDao.java b/src/main/java/com/glxp/api/dao/system/CompanyDao.java index 47ef0264..d55a2677 100644 --- a/src/main/java/com/glxp/api/dao/system/CompanyDao.java +++ b/src/main/java/com/glxp/api/dao/system/CompanyDao.java @@ -1,14 +1,30 @@ package com.glxp.api.dao.system; +import com.glxp.api.entity.auth.AliKeyEntity; import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.req.auth.FilterCompanyRequest; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface CompanyDao { CompanyEntity findCompany(String CustomerId); + CompanyEntity findCompanyByName(String companyName); + + List getSubCompany(FilterCompanyRequest companyRequest); + + List getSubCompany2(FilterCompanyRequest companyRequest); + + List filterCompany(FilterCompanyRequest companyRequest); + boolean modifyCompany(CompanyEntity companyEntity); boolean insertCompany(CompanyEntity companyEntity); + + boolean deleteCompany(Long customerId); + + AliKeyEntity findKey(String customerId); } diff --git a/src/main/java/com/glxp/api/dao/system/SetupDao.java b/src/main/java/com/glxp/api/dao/system/SetupDao.java index a2b0abb6..2ae7a77f 100644 --- a/src/main/java/com/glxp/api/dao/system/SetupDao.java +++ b/src/main/java/com/glxp/api/dao/system/SetupDao.java @@ -7,10 +7,10 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SetupDao { - SetupEntity findSetup(FilterSetupRequest filterSetupRequest); - - boolean modifySetup(SetupEntity setupEntity); - - boolean insertSetup(SetupEntity setupEntity); +// SetupEntity findSetup(FilterSetupRequest filterSetupRequest); +// +// boolean modifySetup(SetupEntity setupEntity); +// +// boolean insertSetup(SetupEntity setupEntity); } diff --git a/src/main/java/com/glxp/api/entity/auth/AliKeyEntity.java b/src/main/java/com/glxp/api/entity/auth/AliKeyEntity.java new file mode 100644 index 00000000..9f466d5c --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/AliKeyEntity.java @@ -0,0 +1,13 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +@Data +public class AliKeyEntity { + + private String refEntId; + private String entId; + private String appKey; + private String appSecret; + +} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthAdmin.java b/src/main/java/com/glxp/api/entity/auth/AuthAdmin.java index 147874e8..5b6e2468 100644 --- a/src/main/java/com/glxp/api/entity/auth/AuthAdmin.java +++ b/src/main/java/com/glxp/api/entity/auth/AuthAdmin.java @@ -28,7 +28,7 @@ public class AuthAdmin { private Date lastModifyTime; private String comments; private String employeeName; - private Long CustomerId; + private String CustomerId; private String locDeptCode; private String locInvCode; diff --git a/src/main/java/com/glxp/api/entity/auth/AuthRole.java b/src/main/java/com/glxp/api/entity/auth/AuthRole.java new file mode 100644 index 00000000..2371ca4d --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/AuthRole.java @@ -0,0 +1,30 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +import java.util.Date; + +/** + * 角色表 + */ +@Data +public class AuthRole { + + private Integer roleId; + private String roleName; + private String roleKey; + private Integer roleSort; + private String dataScope; + private Integer menuCheckStrictly; + private Integer deptCheckStrictly; + private String status; + private String delFlag; + private String createBy; + private Date createTime; + private String updateBy; + private Integer isCustomer; + private Date updateTime; + private String remark; + + +} diff --git a/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java b/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java new file mode 100644 index 00000000..321e90f5 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/AuthRoleAdmin.java @@ -0,0 +1,14 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +/** + * 用户角色对应表 + */ +@Data +public class AuthRoleAdmin { + private Long id; + private Long role_id; + private Long user_id; + +} diff --git a/src/main/java/com/glxp/api/entity/auth/CustomerDetailEntity.java b/src/main/java/com/glxp/api/entity/auth/CustomerDetailEntity.java new file mode 100644 index 00000000..cafcc2b1 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/CustomerDetailEntity.java @@ -0,0 +1,31 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +@Data +public class CustomerDetailEntity { + + private String customerId; + private String customerName; + private String creditNum; + private String area; + private String detailAddr; + private Integer bussinessStatus; + private Integer userFlag; + private int isInfoLink; + private String infoLink; + private String roleId; + private int userMax; + private String contacts; + private String mobile; + private String tel; + private String email; + private String companyName; + + private String role; + private String count; + + private String pdfTemplateId; + + private String filePath; +} diff --git a/src/main/java/com/glxp/api/entity/auth/CustomerInfoEntity.java b/src/main/java/com/glxp/api/entity/auth/CustomerInfoEntity.java new file mode 100644 index 00000000..d5243385 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/CustomerInfoEntity.java @@ -0,0 +1,22 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +@Data +public class CustomerInfoEntity { + private Long customerId; + private String customerName; + private String creditNum; + private String area; + private String detailAddr; + private Integer bussinessStatus; + private Integer userFlag; + private Integer isInfoLink; + private String infoLink; + private String roleId; + private String comments; + private int userMax; + private String companyName; + + +} diff --git a/src/main/java/com/glxp/api/entity/auth/UpdateUserflagBean.java b/src/main/java/com/glxp/api/entity/auth/UpdateUserflagBean.java new file mode 100644 index 00000000..d8e110fa --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/UpdateUserflagBean.java @@ -0,0 +1,9 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +@Data +public class UpdateUserflagBean { + private String CustomerId; + private Integer userFlag; +} diff --git a/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java b/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java new file mode 100644 index 00000000..936394cb --- /dev/null +++ b/src/main/java/com/glxp/api/entity/auth/UserRegisterEntity.java @@ -0,0 +1,32 @@ +package com.glxp.api.entity.auth; + +import lombok.Data; + +@Data +public class UserRegisterEntity { + + private Integer id; + private String nickName; + private String password; + private String realName; + private String tel; + private String mobile; + private String userId; + private String email; + private String companyId; + private String companyName; + private String creditNum; + private String area; + private String detailAddr; + private Integer bussinessStatus; + private Integer checkType; + private String registerTime; + private String checkTime; + private String comments; + private int checkCode; + private String areaCode; + private String userName; + private String licenseUrl; + private String udplatCompanyName; + private String udplatCompanyId; +} diff --git a/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeRoleEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeRoleEntity.java new file mode 100644 index 00000000..6469b8d9 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/basic/BasicBussinessTypeRoleEntity.java @@ -0,0 +1,19 @@ +package com.glxp.api.entity.basic; + +import lombok.Data; + +/** + * 扫码单据类型和角色关联表 + */ +@Data +public class BasicBussinessTypeRoleEntity { + + private Integer id; + + //角色id + private Long role_id; + + //业务类型 + private String action; + +} diff --git a/src/main/java/com/glxp/api/entity/basic/BasicUnitMaintainEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicUnitMaintainEntity.java new file mode 100644 index 00000000..d81c6f49 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/basic/BasicUnitMaintainEntity.java @@ -0,0 +1,43 @@ +package com.glxp.api.entity.basic; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Date; + +@Data +public class BasicUnitMaintainEntity { + + private Integer id; + private String erpId; + + @NotBlank(message = "往来单位名称不能为空!") + private String name; + private String spell; + private String addr; + private String status; + private String type; + + @NotBlank(message = "统一社会信用号不能为空!") + private String creditNo; + private String contact; + private String mobile; + + private String thirdId; + private String thirdId1; + private String thirdId2; + private String thirdId3; + private String thirdId4; + + private String thirdName; + private String thirdName1; + private String thirdName2; + private String thirdName3; + private String thirdName4; + + private Date updateTime; + private Integer corpType; + private Integer outType; + + +} diff --git a/src/main/java/com/glxp/api/entity/info/SetupEntity.java b/src/main/java/com/glxp/api/entity/info/SetupEntity.java new file mode 100644 index 00000000..69f5b7d4 --- /dev/null +++ b/src/main/java/com/glxp/api/entity/info/SetupEntity.java @@ -0,0 +1,16 @@ +package com.glxp.api.entity.info; + +import lombok.Data; + +@Data +public class SetupEntity { + + private String customerId; + private boolean checkUpbill; + private boolean checkStock; + private boolean checkRepeat; + private boolean downloadRelation; + private int uploadTime; //自动上传保留时间 + private long lastUploadDate; + +} diff --git a/src/main/java/com/glxp/api/entity/system/CompanyEntity.java b/src/main/java/com/glxp/api/entity/system/CompanyEntity.java index dcc563ce..e2f7f9fd 100644 --- a/src/main/java/com/glxp/api/entity/system/CompanyEntity.java +++ b/src/main/java/com/glxp/api/entity/system/CompanyEntity.java @@ -75,4 +75,5 @@ public class CompanyEntity { private String auditor; private String auditStatusList; + } diff --git a/src/main/java/com/glxp/api/req/auth/AuthRoleQueryRequest.java b/src/main/java/com/glxp/api/req/auth/AuthRoleQueryRequest.java new file mode 100644 index 00000000..01d02718 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/AuthRoleQueryRequest.java @@ -0,0 +1,17 @@ +package com.glxp.api.req.auth; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色的查询表单 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class AuthRoleQueryRequest extends ListPageRequest { + private String name; + private Integer status; + private Integer isCustomer; + +} diff --git a/src/main/java/com/glxp/api/req/auth/CustomerInfoFilterRequest.java b/src/main/java/com/glxp/api/req/auth/CustomerInfoFilterRequest.java new file mode 100644 index 00000000..413d58c0 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/CustomerInfoFilterRequest.java @@ -0,0 +1,14 @@ +package com.glxp.api.req.auth; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +@Data +public class CustomerInfoFilterRequest extends ListPageRequest { + + private String key; + private String customerName; + private String customerId; + private String companyName; + +} diff --git a/src/main/java/com/glxp/api/req/auth/FilterAuthUserRequest.java b/src/main/java/com/glxp/api/req/auth/FilterAuthUserRequest.java index f1d1238e..2583f67e 100644 --- a/src/main/java/com/glxp/api/req/auth/FilterAuthUserRequest.java +++ b/src/main/java/com/glxp/api/req/auth/FilterAuthUserRequest.java @@ -20,6 +20,10 @@ public class FilterAuthUserRequest extends ListPageRequest { private String lastUpdateTime; + + private String CustomerId; + + //用户名 != private String neUserName; diff --git a/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java b/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java new file mode 100644 index 00000000..ca745799 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/FilterCompanyRequest.java @@ -0,0 +1,18 @@ +package com.glxp.api.req.auth; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +import java.util.List; + +@Data +public class FilterCompanyRequest extends ListPageRequest { + + private String customerId; + private String companyName; + private String creditNum; + private String auditStatus; + private String unitIdFk; + + private List auditStatusList; +} diff --git a/src/main/java/com/glxp/api/req/auth/RegisterCheckRequest.java b/src/main/java/com/glxp/api/req/auth/RegisterCheckRequest.java new file mode 100644 index 00000000..c3a80660 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/RegisterCheckRequest.java @@ -0,0 +1,14 @@ +package com.glxp.api.req.auth; + +import lombok.Data; + +@Data +public class RegisterCheckRequest { + + private Integer id; + private Integer checkType; + private Long roles; + private String aliCertId; + private String companyId; + private String companyName; +} diff --git a/src/main/java/com/glxp/api/req/auth/ResetPasswdRequest.java b/src/main/java/com/glxp/api/req/auth/ResetPasswdRequest.java new file mode 100644 index 00000000..531932fd --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/ResetPasswdRequest.java @@ -0,0 +1,13 @@ +package com.glxp.api.req.auth; + +import lombok.Data; + +@Data +public class ResetPasswdRequest { + + private String password; + private String mobile; + private String confirmPassword; + private int checkCode; + private String userName; +} diff --git a/src/main/java/com/glxp/api/req/auth/UserResisterFilterRequest.java b/src/main/java/com/glxp/api/req/auth/UserResisterFilterRequest.java new file mode 100644 index 00000000..834a2544 --- /dev/null +++ b/src/main/java/com/glxp/api/req/auth/UserResisterFilterRequest.java @@ -0,0 +1,12 @@ +package com.glxp.api.req.auth; + +import com.glxp.api.util.page.ListPageRequest; +import lombok.Data; + +@Data +public class UserResisterFilterRequest extends ListPageRequest { + + private String companyName; + private String checkType; + private String companyId; +} diff --git a/src/main/java/com/glxp/api/req/info/FilterAliCertRequest.java b/src/main/java/com/glxp/api/req/info/FilterAliCertRequest.java new file mode 100644 index 00000000..c7fb5c06 --- /dev/null +++ b/src/main/java/com/glxp/api/req/info/FilterAliCertRequest.java @@ -0,0 +1,8 @@ +package com.glxp.api.req.info; + +import lombok.Data; + +@Data +public class FilterAliCertRequest { + private String id; +} diff --git a/src/main/java/com/glxp/api/res/auth/AuthAdminRoleResponse.java b/src/main/java/com/glxp/api/res/auth/AuthAdminRoleResponse.java index dbaeca78..f59f04e3 100644 --- a/src/main/java/com/glxp/api/res/auth/AuthAdminRoleResponse.java +++ b/src/main/java/com/glxp/api/res/auth/AuthAdminRoleResponse.java @@ -8,8 +8,8 @@ import lombok.Data; @Data public class AuthAdminRoleResponse { - private Long id; + private Integer roleId; - private String name; + private String roleName; } diff --git a/src/main/java/com/glxp/api/res/auth/CheckCodeRequest.java b/src/main/java/com/glxp/api/res/auth/CheckCodeRequest.java new file mode 100644 index 00000000..47ee6fe2 --- /dev/null +++ b/src/main/java/com/glxp/api/res/auth/CheckCodeRequest.java @@ -0,0 +1,9 @@ +package com.glxp.api.res.auth; + +import lombok.Data; + +@Data +public class CheckCodeRequest { + private String phoneNum; + private String userName; +} diff --git a/src/main/java/com/glxp/api/service/auth/AuthAdminService.java b/src/main/java/com/glxp/api/service/auth/AuthAdminService.java index 603951e1..31473b9b 100644 --- a/src/main/java/com/glxp/api/service/auth/AuthAdminService.java +++ b/src/main/java/com/glxp/api/service/auth/AuthAdminService.java @@ -11,6 +11,8 @@ public interface AuthAdminService { List listAdminPage(FilterAuthUserRequest filterAuthUserRequest); + List findByCustomerld(String customerld); + AuthAdmin findByUserName(String userName); @@ -25,6 +27,8 @@ public interface AuthAdminService { boolean deleteById(Long id); + int deleteByCustomerId(String customerId); + /** * 获取医院用户列表 * diff --git a/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java b/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java new file mode 100644 index 00000000..36086ad2 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/AuthRoleAdminService.java @@ -0,0 +1,25 @@ +package com.glxp.api.service.auth; + + +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.entity.auth.AuthRoleAdmin; + +import java.util.List; + +public interface AuthRoleAdminService { + + List listByAdminId(Long adminId); + + List listByAdminIdIn(List adminIds); + + List listByRoleId(Long roleId); + + int insertAuthRoleAdminAll(List authRoleAdminList); + + int insertRolesAdminIdAll(List roles, Long adminId); + + boolean deleteByAdminId(Long adminId); + boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin); + + List listAdminRole(Long adminId); +} diff --git a/src/main/java/com/glxp/api/service/auth/AuthRoleService.java b/src/main/java/com/glxp/api/service/auth/AuthRoleService.java new file mode 100644 index 00000000..10db6347 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/AuthRoleService.java @@ -0,0 +1,43 @@ +package com.glxp.api.service.auth; + + +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.entity.basic.BasicBussinessTypeRoleEntity; +import com.glxp.api.req.auth.AuthRoleQueryRequest; + +import java.util.List; + +public interface AuthRoleService { + + List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest); + + List listAuthAdminRolePage(Integer page, Integer limit, Integer status); + + AuthRole findByName(String name); + + boolean insertAuthRole(AuthRole authRole); + + boolean updateAuthRole(AuthRole authRole); + + List listCustomerRoles(Integer page, Integer limit, Integer isCustomer); + + List listAuthRoles2(Integer page, Integer limit); + + boolean deleteById(Long id); + + /** + * 查询角色扫码单据授权数据 + * + * @param roleId + * @return + */ + List getBussinessTypeRole(Long roleId); + + /** + * 更新角色扫码单据类型授权数据 + * + * @param roleId + * @param actions + */ + void updateBussinessTypeRole(Long roleId, List actions); +} diff --git a/src/main/java/com/glxp/api/service/auth/CustomerInfoService.java b/src/main/java/com/glxp/api/service/auth/CustomerInfoService.java new file mode 100644 index 00000000..6984ddad --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/CustomerInfoService.java @@ -0,0 +1,28 @@ +package com.glxp.api.service.auth; + +import com.glxp.api.entity.auth.CustomerDetailEntity; +import com.glxp.api.entity.auth.CustomerInfoEntity; +import com.glxp.api.req.auth.CustomerInfoFilterRequest; + +import java.util.List; + +public interface CustomerInfoService { + + List filterCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest); + + List filterDetailCustomer(CustomerInfoFilterRequest customerInfoFilterRequest); + + boolean insertCustomerInfo(CustomerInfoEntity customerInfoEntity); + + boolean updateCustomerInfo(CustomerInfoEntity customerInfoEntity); + + boolean modifyCustomerInfo(CustomerDetailEntity customerDetailEntity); + + boolean deleteById(String id); + + CustomerInfoEntity selectById(String customerId); + + boolean isExitRoleId(String roleId); + + CustomerDetailEntity selectDetail(String customerId); +} diff --git a/src/main/java/com/glxp/api/service/auth/UserRegisterService.java b/src/main/java/com/glxp/api/service/auth/UserRegisterService.java new file mode 100644 index 00000000..5fd0441f --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/UserRegisterService.java @@ -0,0 +1,29 @@ +package com.glxp.api.service.auth; + +import com.glxp.api.entity.auth.UserRegisterEntity; +import com.glxp.api.req.auth.UserResisterFilterRequest; + +import java.util.List; + +public interface UserRegisterService { + + List filterUserRegisters(UserResisterFilterRequest userResisterFilterRequest); + + boolean insertUserRegister(UserRegisterEntity userRegisterEntity); + + boolean updateUserRegister(UserRegisterEntity userRegisterEntity); + + boolean deleteById(Long id); + + boolean deleteByMobile(String phone,Integer checkType); + + UserRegisterEntity selectById(Integer id); + + UserRegisterEntity selectByMobile(String phone); + + boolean isExit(String phoneNum); + + boolean deleteByCustomerId(Long id); + + UserRegisterEntity selectByCustomerId(String id); +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java index 2f5a6354..727a9ae3 100644 --- a/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java +++ b/src/main/java/com/glxp/api/service/auth/impl/AuthAdminServiceImpl.java @@ -2,6 +2,7 @@ package com.glxp.api.service.auth.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.glxp.api.dao.auth.AuthAdminDao; import com.glxp.api.dao.auth.SysUserRoleMapper; @@ -42,6 +43,11 @@ public class AuthAdminServiceImpl implements AuthAdminService { return authAdminDao.listAdminPage(filterAuthUserRequest); } + @Override + public List findByCustomerld(String customerld) { + return authAdminDao.findByCustomerld(customerld); + } + @Override public AuthAdmin findByUserName(String userName) { return authAdminDao.findByUserName(userName); @@ -123,6 +129,11 @@ public class AuthAdminServiceImpl implements AuthAdminService { return authAdminDao.deleteById(id); } + @Override + public int deleteByCustomerId(String customerId) { + return authAdminDao.delete(new QueryWrapper().eq("CustomerId", customerId)); + } + @Override public List getHospitalUserList() { //查询未被禁用的医院用户 @@ -140,7 +151,7 @@ public class AuthAdminServiceImpl implements AuthAdminService { int offset = (filterNoSelectUserRequest.getPage() - 1) * filterNoSelectUserRequest.getLimit(); PageHelper.offsetPage(offset, filterNoSelectUserRequest.getLimit()); } - return authAdminDao.selectNotSelectUser(filterNoSelectUserRequest.getUserIds(),filterNoSelectUserRequest.getDeptId()); + return authAdminDao.selectNotSelectUser(filterNoSelectUserRequest.getUserIds(), filterNoSelectUserRequest.getDeptId()); } diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java new file mode 100644 index 00000000..4e562d6e --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleAdminServiceImpl.java @@ -0,0 +1,120 @@ +package com.glxp.api.service.auth.impl; + +import com.glxp.api.dao.auth.AuthRoleAdminDao; +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.entity.auth.AuthRoleAdmin; +import com.glxp.api.service.auth.AuthRoleAdminService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +@Service +public class AuthRoleAdminServiceImpl implements AuthRoleAdminService { + + @Resource + private AuthRoleAdminDao authRoleAdminDao; + + /** + * 根据 adminid 获取角色id + * + * @param adminId + * @return + */ + @Override + public List listByAdminId(Long adminId) { + return authRoleAdminDao.listByAdminId(adminId); + } + + /** + * 根据多个 adminId 查询角色列表 + * + * @param adminIds + * @return + */ + @Override + public List listByAdminIdIn(List adminIds) { + if (adminIds.isEmpty()) { + return Collections.emptyList(); + } + return authRoleAdminDao.listByAdminIdIn(adminIds); + } + + /** + * 根据 roleId 获取 管理员id + * + * @param roleId + * @return + */ + @Override + public List listByRoleId(Long roleId) { + return authRoleAdminDao.listByRoleId(roleId); + } + + /** + * 批量插入 + * + * @param authRoleAdminList + * @return + */ + @Override + public int insertAuthRoleAdminAll(List authRoleAdminList) { + + if (authRoleAdminList == null || authRoleAdminList.isEmpty()) { + return 0; + } + + return authRoleAdminDao.insertAuthRoleAdminAll(authRoleAdminList); + } + + /** + * 根据 角色ids 和 管理员 adminId 批量插入 + * + * @param roles + * @param adminId + * @return + */ + @Override + public int insertRolesAdminIdAll(List roles, Long adminId) { + + List authRoleAdminList = roles.stream().map(aLong -> { + AuthRoleAdmin authRoleAdmin = new AuthRoleAdmin(); + authRoleAdmin.setRole_id(aLong); + authRoleAdmin.setUser_id(adminId); + return authRoleAdmin; + }).collect(Collectors.toList()); + if (!authRoleAdminList.isEmpty()) { + return insertAuthRoleAdminAll(authRoleAdminList); + } + + return 0; + } + + /** + * 根据 adminId 删除对应的权限 + * + * @param adminId + * @return + */ + @Override + public boolean deleteByAdminId(Long adminId) { + +// // 删除之前缓存权限规则 +// String aarKey = String.format(CacheConstant.ADMIN_AUTH_RULES, adminId); +// CacheUtils.delete(aarKey); + + return authRoleAdminDao.deleteByAdminId(adminId); + } + + @Override + public boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin) { + return authRoleAdminDao.updateAuthRoleAdmin(authRoleAdmin); + } + + @Override + public List listAdminRole(Long adminId) { + return authRoleAdminDao.listAdminRole(adminId); + } +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java new file mode 100644 index 00000000..67b62758 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/impl/AuthRoleServiceImpl.java @@ -0,0 +1,144 @@ +package com.glxp.api.service.auth.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.auth.AuthRoleDao; +import com.glxp.api.dao.basic.BasicBussinessTypeRoleDao; +import com.glxp.api.entity.auth.AuthRole; +import com.glxp.api.entity.basic.BasicBussinessTypeRoleEntity; +import com.glxp.api.req.auth.AuthRoleQueryRequest; +import com.glxp.api.service.auth.AuthRoleService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Service +public class AuthRoleServiceImpl implements AuthRoleService { + + @Resource + private AuthRoleDao authRoleDao; + @Resource + private BasicBussinessTypeRoleDao basicBussinessTypeRoleDao; + + /** + * 查询列表 + * + * @return + */ + @Override + public List listAdminPage(AuthRoleQueryRequest authRoleQueryRequest) { + int offset = (authRoleQueryRequest.getPage() - 1) * authRoleQueryRequest.getLimit(); + PageHelper.offsetPage(offset, authRoleQueryRequest.getLimit()); + List list = authRoleDao.listAdminPage(authRoleQueryRequest); + return list; + } + + /** + * 查询管理员页面的列表 + * + * @param page + * @param limit + * @param status + * @return + */ + @Override + public List listAuthAdminRolePage(Integer page, Integer limit, Integer status) { + page = page != null && page > 0 ? page : 1; + limit = limit != null && limit > 0 && limit < 100 ? limit : 100; + int offset = (page - 1) * limit; + PageHelper.offsetPage(offset, limit); + List list = authRoleDao.listAuthAdminRolePage(status); + return list; + } + + /** + * 根据名称查询 + * + * @param name + * @return + */ + @Override + public AuthRole findByName(String name) { + return authRoleDao.findByName(name); + } + + /** + * 插入 + * + * @param authRole + * @return + */ + @Override + public boolean insertAuthRole(AuthRole authRole) { + + authRole.setCreateTime(new Date()); + authRole.setUpdateTime(new Date()); + + return authRoleDao.insertAuthRole(authRole); + } + + /** + * 修改 + * + * @param authRole + * @return + */ + @Override + public boolean updateAuthRole(AuthRole authRole) { + authRole.setUpdateTime(new Date()); + return authRoleDao.updateAuthRole(authRole); + } + + @Override + public List listCustomerRoles(Integer page, Integer limit, Integer isCustomer) { + page = page != null && page > 0 ? page : 1; + limit = limit != null && limit > 0 && limit < 100 ? limit : 100; + int offset = (page - 1) * limit; + PageHelper.offsetPage(offset, limit); + List list = authRoleDao.listCustomerRoles(isCustomer); + return list; + } + + @Override + public List listAuthRoles2(Integer page, Integer limit) { + page = page != null && page > 0 ? page : 1; + limit = limit != null && limit > 0 && limit < 100 ? limit : 100; + int offset = (page - 1) * limit; + PageHelper.offsetPage(offset, limit); + List list = authRoleDao.listAuthRoles2(); + return list; + } + + /** + * 删除 + * + * @param id + * @return + */ + @Override + public boolean deleteById(Long id) { + return authRoleDao.deleteById(id); + } + + @Override + public List getBussinessTypeRole(Long roleId) { + return basicBussinessTypeRoleDao.getListByRoleId(roleId); + } + + @Override + public void updateBussinessTypeRole(Long roleId, List actions) { + //删除之前的扫码单据类型授权数据 + basicBussinessTypeRoleDao.deleteByRoleId(roleId); + //添加新的扫码单据数据类型 + List data = new ArrayList<>(actions.size()); + actions.forEach(action -> { + BasicBussinessTypeRoleEntity entity = new BasicBussinessTypeRoleEntity(); + entity.setRole_id(roleId); + entity.setAction(action); + data.add(entity); + }); + basicBussinessTypeRoleDao.insert(data); + } +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/CustomerInfoServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/CustomerInfoServiceImpl.java new file mode 100644 index 00000000..36a101b4 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/impl/CustomerInfoServiceImpl.java @@ -0,0 +1,99 @@ +package com.glxp.api.service.auth.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.auth.CustomerInfoDao; +import com.glxp.api.entity.auth.CustomerDetailEntity; +import com.glxp.api.entity.auth.CustomerInfoEntity; +import com.glxp.api.req.auth.CustomerInfoFilterRequest; +import com.glxp.api.service.auth.CustomerInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class CustomerInfoServiceImpl implements CustomerInfoService { + + + @Resource + private CustomerInfoDao customerInfoDao; + +// @Resource +// private CustomerContacDao customerContacDao; +// +// @Resource +// private AuthAdminDao authAdminDao; +// +// @Resource +// private AuthRoleService authRoleService; + + @Override + public List filterCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest) { + if (customerInfoFilterRequest == null) { + return Collections.emptyList(); + } + + if (customerInfoFilterRequest.getPage() != null) { + int offset = (customerInfoFilterRequest.getPage() - 1) * customerInfoFilterRequest.getLimit(); + PageHelper.offsetPage(offset, customerInfoFilterRequest.getLimit()); + } + return customerInfoDao.filterCustomerInfo(customerInfoFilterRequest); + } + + @Override + public List filterDetailCustomer(CustomerInfoFilterRequest customerInfoFilterRequest) { + if (customerInfoFilterRequest == null) { + return Collections.emptyList(); + } + int offset = (customerInfoFilterRequest.getPage() - 1) * customerInfoFilterRequest.getLimit(); + PageHelper.offsetPage(offset, customerInfoFilterRequest.getLimit()); + List customerDetailEntities = customerInfoDao.filterDetailCustomerInfo(customerInfoFilterRequest); + for (int i = 0; i < customerDetailEntities.size(); i++) { + CustomerDetailEntity customerDetailEntity = customerDetailEntities.get(i); + if (!customerDetailEntity.getRoleId().equals("null") && !customerDetailEntity.getRoleId().equals("") && customerDetailEntity.getRoleId() != null) { + + } + + } + return customerDetailEntities; + } + + @Override + public boolean insertCustomerInfo(CustomerInfoEntity customerInfoEntity) { + return customerInfoDao.insertCustomerInfo(customerInfoEntity); + } + + @Override + public boolean updateCustomerInfo(CustomerInfoEntity customerInfoEntity) { + return customerInfoDao.updateCustomerInfo(customerInfoEntity); + } + + @Override + public boolean modifyCustomerInfo(CustomerDetailEntity customerDetailEntity) { + return false; + } + + @Override + public boolean deleteById(String id) { + return customerInfoDao.deleteById(id); + } + + @Override + public CustomerInfoEntity selectById(String customerId) { + return customerInfoDao.selectById(customerId); + } + + @Override + public boolean isExitRoleId(String roleId) { + CustomerInfoEntity customerInfoEntity = customerInfoDao.isExitRoleId(roleId); + if (customerInfoEntity == null) + return false; + else return true; + } + + @Override + public CustomerDetailEntity selectDetail(String customerId) { + return customerInfoDao.selectDetail(customerId); + } +} diff --git a/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java b/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java new file mode 100644 index 00000000..25e91d76 --- /dev/null +++ b/src/main/java/com/glxp/api/service/auth/impl/UserRegisterServiceImpl.java @@ -0,0 +1,80 @@ +package com.glxp.api.service.auth.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.auth.UserRegisterDao; +import com.glxp.api.entity.auth.UserRegisterEntity; +import com.glxp.api.req.auth.UserResisterFilterRequest; +import com.glxp.api.service.auth.UserRegisterService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class UserRegisterServiceImpl implements UserRegisterService { + + @Resource + private UserRegisterDao userRegisterDao; + + + @Override + public List filterUserRegisters(UserResisterFilterRequest userResisterFilterRequest) { + if (userResisterFilterRequest == null) { + return Collections.emptyList(); + } + int offset = (userResisterFilterRequest.getPage() - 1) * userResisterFilterRequest.getLimit(); + PageHelper.offsetPage(offset, userResisterFilterRequest.getLimit()); + return userRegisterDao.filterUserRegisters(userResisterFilterRequest); + } + + @Override + public boolean insertUserRegister(UserRegisterEntity userRegisterEntity) { + return userRegisterDao.insertUserRegister(userRegisterEntity); + } + + @Override + public boolean updateUserRegister(UserRegisterEntity userRegisterEntity) { + return userRegisterDao.updateUserRegister(userRegisterEntity); + } + + @Override + public boolean deleteById(Long id) { + return userRegisterDao.deleteById(id); + } + + @Override + public boolean deleteByMobile(String phone, Integer checkType) { + return userRegisterDao.deleteByMobile(phone,checkType); + } + + + @Override + public UserRegisterEntity selectById(Integer id) { + return userRegisterDao.selectById(id); + } + + @Override + public UserRegisterEntity selectByMobile(String phone) { + return userRegisterDao.selectByMobile(phone); + } + + @Override + public boolean isExit(String phoneNum) { + String data = userRegisterDao.isExit(phoneNum); + if (data != null) + return true; + else + return false; + } + + @Override + public boolean deleteByCustomerId(Long id) { + return userRegisterDao.deleteByCustomerId(id); + } + + @Override + public UserRegisterEntity selectByCustomerId(String id) { + return userRegisterDao.selectByCustomerId(id); + } +} diff --git a/src/main/java/com/glxp/api/service/basic/BasicUnitMaintainService.java b/src/main/java/com/glxp/api/service/basic/BasicUnitMaintainService.java new file mode 100644 index 00000000..b4b459fb --- /dev/null +++ b/src/main/java/com/glxp/api/service/basic/BasicUnitMaintainService.java @@ -0,0 +1,38 @@ +package com.glxp.api.service.basic; + + +import com.glxp.api.entity.basic.BasicUnitMaintainEntity; +import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; + +import java.util.List; + +public interface BasicUnitMaintainService { + + List filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest); + + boolean insertBasicUnitMaintainignore(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean insertBasicUnitMaintain(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean updateById(BasicUnitMaintainEntity basicUnitMaintainEntity); + + boolean insert(BasicUnitMaintainEntity basicUnitMaintainEntity); + +// boolean updateById(BasicUnitMaintainSaveRequest basicUnitMaintainSaveRequest); + + boolean deleteById(String id); + + BasicUnitMaintainEntity selectByThirdId(String thirdId, String thirdSys); + + List batchSelectByIds(List id); + + List batchSelectByErpIds(List erpIds); + + BasicUnitMaintainEntity selectById(String id); + + BasicUnitMaintainEntity selectByErpId(String id); + + BasicUnitMaintainEntity selectByName(String name); + + boolean isExit(); +} diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicUnitMaintainServiceImpl.java b/src/main/java/com/glxp/api/service/basic/impl/BasicUnitMaintainServiceImpl.java new file mode 100644 index 00000000..9d6de910 --- /dev/null +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicUnitMaintainServiceImpl.java @@ -0,0 +1,123 @@ +package com.glxp.api.service.basic.impl; + +import com.github.pagehelper.PageHelper; +import com.glxp.api.dao.basic.BasicUnitMaintainDao; +import com.glxp.api.entity.basic.BasicUnitMaintainEntity; +import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest; +import com.glxp.api.service.basic.BasicUnitMaintainService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Service +public class BasicUnitMaintainServiceImpl implements BasicUnitMaintainService { + + @Resource + BasicUnitMaintainDao basicUnitMaintainDao; + + @Override + public List filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) { + if (basicUnitMaintainFilterRequest == null) { + return Collections.emptyList(); + } + if (basicUnitMaintainFilterRequest.getPage() != null) { + int offset = (basicUnitMaintainFilterRequest.getPage() - 1) * basicUnitMaintainFilterRequest.getLimit(); + PageHelper.offsetPage(offset, basicUnitMaintainFilterRequest.getLimit()); + } + + List data = basicUnitMaintainDao.filterList(basicUnitMaintainFilterRequest); + return data; + } + + @Override + public boolean insertBasicUnitMaintainignore(BasicUnitMaintainEntity basicUnitMaintainEntity) { + return basicUnitMaintainDao.insertBasicUnitMaintainignore(basicUnitMaintainEntity); + } + + @Override + public boolean insertBasicUnitMaintain(BasicUnitMaintainEntity basicUnitMaintainEntity) { + return basicUnitMaintainDao.insertBasicUnitMaintain(basicUnitMaintainEntity); + } + + @Override + public boolean insert(BasicUnitMaintainEntity basicUnitMaintainEntity) { + return basicUnitMaintainDao.insert(basicUnitMaintainEntity); + } + + @Override + public boolean updateById(BasicUnitMaintainEntity basicUnitMaintainSaveRequest) { + + return basicUnitMaintainDao.updateById(basicUnitMaintainSaveRequest); + } + + @Override + public boolean deleteById(String id) { + return basicUnitMaintainDao.deleteById(id); + } + + @Override + public BasicUnitMaintainEntity selectByThirdId(String thirdId, String thirdSys) { + + + BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest(); + if ("thirdId".equals(thirdSys)) { + filterUdiInfoRequest.setThirdId(thirdId); + } else if ("thirdId1".equals(thirdSys)) { + filterUdiInfoRequest.setThirdId1(thirdId); + } else if ("thirdId2".equals(thirdSys)) { + filterUdiInfoRequest.setThirdId2(thirdId); + } else if ("thirdId3".equals(thirdSys)) { + filterUdiInfoRequest.setThirdId3(thirdId); + } else if ("thirdId4".equals(thirdSys)) { + filterUdiInfoRequest.setThirdId4(thirdId); + } + return basicUnitMaintainDao.selectByThirdId(filterUdiInfoRequest); + } + + @Override + public List batchSelectByIds(List ids) { + return basicUnitMaintainDao.batchSelectByIds(ids); + } + + @Override + public List batchSelectByErpIds(List erpIds) { + return basicUnitMaintainDao.batchSelectByErpIds(erpIds); + } + + @Override + public BasicUnitMaintainEntity selectById(String id) { + return basicUnitMaintainDao.selectById(id); + } + + @Override + public BasicUnitMaintainEntity selectByErpId(String id) { + if (id == null) { + return null; + } + BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest(); + filterUdiInfoRequest.setErpId(id); + List basicUnitMaintainEntities = basicUnitMaintainDao.filterList(filterUdiInfoRequest); + if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0) + return basicUnitMaintainEntities.get(0); + return null; + } + + @Override + public BasicUnitMaintainEntity selectByName(String name) { + return basicUnitMaintainDao.selectByName(name); + } + + @Override + public boolean isExit() { + BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest(); + filterUdiInfoRequest.setPage(1); + filterUdiInfoRequest.setLimit(1); + List data = filterList(filterUdiInfoRequest); + if (data != null && data.size() > 0) { + return true; + } + return false; + } +} diff --git a/src/main/java/com/glxp/api/service/info/impl/SetupServiceImpl.java b/src/main/java/com/glxp/api/service/info/impl/SetupServiceImpl.java new file mode 100644 index 00000000..4a5581d2 --- /dev/null +++ b/src/main/java/com/glxp/api/service/info/impl/SetupServiceImpl.java @@ -0,0 +1,27 @@ +package com.glxp.api.service.info.impl;//package com.glxp.api.service.info.impl; +// +//import com.glxp.api.dao.system.SetupDao; +//import org.springframework.stereotype.Service; +// +//import javax.annotation.Resource; +// +//@Service +//public class SetupServiceImpl implements SetupService { +// @Resource +// SetupDao setupDao; +// +// @Override +// public SetupEntity findSetup(String customerId) { +// return setupDao.findSetup(customerId); +// } +// +// @Override +// public boolean modifySetup(SetupEntity setupEntity) { +// return setupDao.modifySetup(setupEntity); +// } +// +// @Override +// public boolean insertSetup(SetupEntity setupEntity) { +// return setupDao.insertSetup(setupEntity); +// } +//} diff --git a/src/main/java/com/glxp/api/service/system/CompanyService.java b/src/main/java/com/glxp/api/service/system/CompanyService.java index d7364c3b..2c49af8b 100644 --- a/src/main/java/com/glxp/api/service/system/CompanyService.java +++ b/src/main/java/com/glxp/api/service/system/CompanyService.java @@ -1,11 +1,33 @@ package com.glxp.api.service.system; +import com.glxp.api.entity.auth.AliKeyEntity; import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.req.auth.FilterCompanyRequest; + +import java.util.List; public interface CompanyService { + CompanyEntity findCompanyByUnitFk(String unitFk); + + List filterCompany(FilterCompanyRequest companyRequest); + CompanyEntity findCompany(String CustomerId); + List getSubCompany(FilterCompanyRequest commitRequest); + + List getSubCompany2(FilterCompanyRequest commitRequest); + + CompanyEntity findCompanyByName(String companyName); + boolean modifyCompany(CompanyEntity companyEntity); +// boolean insertCompany(CompanyEntity companyEntity); + + AliKeyEntity findKey(String customerId); + + boolean deleteCompany(Long customerId); + + boolean insertCompany(CompanyEntity companyEntity); + } diff --git a/src/main/java/com/glxp/api/service/system/impl/CompanyServiceImpl.java b/src/main/java/com/glxp/api/service/system/impl/CompanyServiceImpl.java index c9b34480..fe053020 100644 --- a/src/main/java/com/glxp/api/service/system/impl/CompanyServiceImpl.java +++ b/src/main/java/com/glxp/api/service/system/impl/CompanyServiceImpl.java @@ -1,11 +1,15 @@ package com.glxp.api.service.system.impl; import com.glxp.api.dao.system.CompanyDao; +import com.glxp.api.entity.auth.AliKeyEntity; import com.glxp.api.entity.system.CompanyEntity; +import com.glxp.api.req.auth.FilterCompanyRequest; import com.glxp.api.service.system.CompanyService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; @Service public class CompanyServiceImpl implements CompanyService { @@ -13,17 +17,71 @@ public class CompanyServiceImpl implements CompanyService { @Resource CompanyDao companyDao; + @Override + public CompanyEntity findCompanyByUnitFk(String unitFk) { + FilterCompanyRequest filterCompanyRequest = new FilterCompanyRequest(); + filterCompanyRequest.setUnitIdFk(unitFk); + List companyEntities = companyDao.filterCompany(filterCompanyRequest); + if (companyEntities != null && companyEntities.size() > 0) { + return companyEntities.get(0); + } + return null; + } + + @Override + public List filterCompany(FilterCompanyRequest companyRequest) { + return companyDao.filterCompany(companyRequest); + } + @Override public CompanyEntity findCompany(String CustomerId) { return companyDao.findCompany(CustomerId); } + @Override + public List getSubCompany(FilterCompanyRequest commitRequest) { + if (commitRequest == null) { + return Collections.emptyList(); + } + int offset = (commitRequest.getPage() - 1) * commitRequest.getLimit(); + PageHelper.offsetPage(offset, commitRequest.getLimit()); + List companyEntities = companyDao.getSubCompany(commitRequest); + return companyEntities; + } + + @Override + public List getSubCompany2(FilterCompanyRequest commitRequest) { + if (commitRequest == null) { + return Collections.emptyList(); + } + int offset = (commitRequest.getPage() - 1) * commitRequest.getLimit(); + PageHelper.offsetPage(offset, commitRequest.getLimit()); + List companyEntities = companyDao.getSubCompany2(commitRequest); + return companyEntities; + } + + @Override + public CompanyEntity findCompanyByName(String companyName) { + return companyDao.findCompanyByName(companyName); + } + @Override public boolean modifyCompany(CompanyEntity companyEntity) { + return companyDao.modifyCompany(companyEntity); + } - if (findCompany(companyEntity.getCustomerId()) == null) { - return companyDao.insertCompany(companyEntity); - } else - return companyDao.modifyCompany(companyEntity); + @Override + public boolean insertCompany(CompanyEntity companyEntity) { + return companyDao.insertCompany(companyEntity); + } + + @Override + public AliKeyEntity findKey(String customerId) { + return companyDao.findKey(customerId); + } + + @Override + public boolean deleteCompany(Long customerId) { + return companyDao.deleteCompany(customerId); } } diff --git a/src/main/java/com/glxp/api/util/Constant.java b/src/main/java/com/glxp/api/util/Constant.java new file mode 100644 index 00000000..487dac38 --- /dev/null +++ b/src/main/java/com/glxp/api/util/Constant.java @@ -0,0 +1,100 @@ +package com.glxp.api.util; + +public class Constant { + + public static String SYSTEM_CUSTOMER_ID = "110"; + public static String MUTI = "MUTI"; + + public static final String SERIAL_CACHE_PREFIX = "serial_"; + public static final String SERIAL_CACHE_PREFIX_ST = "serialst_"; + public static final String SERIAL_CACHE_SYNC_UDI = "syncUdi"; + + public static final String SCAN_ORDER = "MS"; + public static final String BUS_ORDER = "MY"; + public static final String LIN_YONG = "ML"; + public static final String SG_ORDER = "SG"; + public static final String JH_ORDER = "JH"; + public static final String NBM_ORDER = "NBM"; + + + public static final String dlThrProducts = "THR_DOWNLOAD_PRODUCTS"; + public static final String dlThrInvProducts = "THR_DOWNLOAD_INV_PRODUCTS"; + public static final String dlThrOrders = "THR_DOWNLOAD_ORDERS"; + public static final String dlThrCorps = "THR_DOWNLOAD_CORPS"; + + /** + * 用户注册验证码 + */ + public static final String CAPTCHAS = "captchas:"; + + + public static String SPTM_TO_DI = "sptm_to_di"; + + public static String DELAY_SYNC_TIME = "DELAY_SYNC_TIME"; + public static String LAST_THIRD_UPLOAD_TIME = "LAST_THIRD_UPLOAD_TIME"; //最后一次上传第三方单据时间 + + public static final int DB_CHECK_ED = 1; //已校驗 + public static final int DB_CHECK_UN = 0; //未校驗 + public static final int CHECK_EXIT = 1; //校驗成功,存在 + public static final int CHECK_REPEAT = 2; //重複校驗 + public static final int CHECK_NULL = 3; //校驗失敗,不存在 + + /** + * www主域 + */ + public static String WWW = "www."; + + /** + * http请求 + */ + public static String HTTP = "http://"; + + /** + * https请求 + */ + public static String HTTPS = "https://"; + + + /** + * 菜单类型(目录) + */ + public static String TYPE_DIR = "M"; + + /** + * 菜单类型(菜单) + */ + public static String TYPE_MENU = "C"; + + /** + * 菜单类型(按钮) + */ + public static String TYPE_BUTTON = "F"; + + /** + * Layout组件标识 + */ + public static String LAYOUT = "Layout"; + + /** + * 是否菜单外链(是) + */ + public static String YES_FRAME = "0"; + + /** + * 是否菜单外链(否) + */ + public static String NO_FRAME = "1"; + + + /** + * ParentView组件标识 + */ + public static String PARENT_VIEW = "ParentView"; + + /** + * InnerLink组件标识 + */ + public static String INNER_LINK = "InnerLink"; + + +} diff --git a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml index e81cec48..d945b710 100644 --- a/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml +++ b/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml @@ -33,6 +33,9 @@ AND auth_user.locDeptCode = #{deptCode} + + AND auth_user.CustomerId = #{CustomerId} + ORDER BY id DESC @@ -232,4 +235,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml b/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml new file mode 100644 index 00000000..4ae0e5ed --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/AuthRoleAdminDao.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + INSERT INTO auth_user_role + (user_id,role_id) + VALUES + + + (#{item.user_id}, #{item.role_id}) + + + + + + delete from auth_user_role where user_id = #{adminId} + + + + + UPDATE auth_user_role + + + role_id=#{role_id}, + + + WHERE user_id = #{user_id} + + diff --git a/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml b/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml new file mode 100644 index 00000000..f1fe3f55 --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/AuthRoleDao.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + INSERT INTO auth_role(`name`,pid,`status`,`remark`,`listorder`,create_time,update_time,isCustomer) + values + ( + #{name}, + + + #{pid}, + + + 0, + + + #{status}, + + + #{remark}, + + + '', + + + + + #{listorder}, + + + 999, + + + #{createTime}, + #{updateTime}, + #{isCustomer} + ) + + + + UPDATE auth_role + + `name`=#{name}, + pid=#{pid}, + `status`=#{status}, + remark=#{remark}, + `listorder`=#{listorder}, + update_time=#{updateTime}, + isCustomer=#{isCustomer}, + + WHERE id=#{id} + + + + delete + from auth_role + where id = #{id} + + + diff --git a/src/main/resources/mybatis/mapper/auth/CustomerInfoDao.xml b/src/main/resources/mybatis/mapper/auth/CustomerInfoDao.xml new file mode 100644 index 00000000..6bd2e91a --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/CustomerInfoDao.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + INSERT INTO customer_info + (customerId, customerName, creditNum, + area, detailAddr, bussinessStatus, + userFlag, isInfoLink, infoLink, + roleId, comments, userMax, companyName) + values (#{customerId}, #{customerName}, #{creditNum}, + #{area}, #{detailAddr}, #{bussinessStatus}, + #{userFlag}, #{isInfoLink}, #{infoLink}, + #{roleId}, + #{comments}, + #{userMax}, #{companyName}) + + + + UPDATE customer_info + + customerName=#{customerName}, + creditNum=#{creditNum}, + `area`=#{area}, + detailAddr=#{detailAddr}, + `bussinessStatus`=#{bussinessStatus}, + userFlag=#{userFlag}, + isInfoLink=#{isInfoLink}, + infoLink=#{infoLink}, + roleId=#{roleId}, + userMax=#{userMax}, + companyName=#{companyName}, + + WHERE customerId=#{customerId} + + + + + delete + from customer_info + where customerId = #{customerId} + + + + + + + + + diff --git a/src/main/resources/mybatis/mapper/auth/UserRegisterDao.xml b/src/main/resources/mybatis/mapper/auth/UserRegisterDao.xml new file mode 100644 index 00000000..762c2e34 --- /dev/null +++ b/src/main/resources/mybatis/mapper/auth/UserRegisterDao.xml @@ -0,0 +1,108 @@ + + + + + + + + + + INSERT INTO user_register + (nickName, password, realName, + tel, mobile, userId, + email, companyName, creditNum, + area, detailAddr, bussinessStatus, + checkType, registerTime, checkTime, comments, areaCode, userName, licenseUrl, companyId + , udplatCompanyName, udplatCompanyId) + values (#{nickName}, #{password}, #{realName}, + #{tel}, #{mobile}, #{userId}, + #{email}, #{companyName}, #{creditNum}, + #{area}, #{detailAddr}, #{bussinessStatus}, + #{checkType}, #{registerTime}, #{checkTime}, + #{comments}, #{areaCode}, #{userName}, #{licenseUrl}, #{companyId} + , #{udplatCompanyName}, #{udplatCompanyId}) + + + + UPDATE user_register + + `nickName`=#{nickName}, + password=#{password}, + `realName`=#{realName}, + tel=#{tel}, + `mobile`=#{mobile}, + userId=#{userId}, + email=#{email}, + companyName=#{companyName}, + creditNum=#{creditNum}, + area=#{area}, + detailAddr=#{detailAddr}, + bussinessStatus=#{bussinessStatus}, + checkType=#{checkType}, + registerTime=#{registerTime}, + checkTime=#{checkTime}, + areaCode=#{areaCode}, + userName=#{userName}, + licenseUrl=#{licenseUrl}, + companyId=#{companyId}, + + WHERE id=#{id} + + + + delete + from user_register + where id = #{id} + + + delete + from user_register + where mobile = #{phone} and checkType=#{checkType} + + + + delete + from user_register + where userId = #{userId} + + + + + + + + + diff --git a/src/main/resources/mybatis/mapper/basic/BasicUnitMaintainDao.xml b/src/main/resources/mybatis/mapper/basic/BasicUnitMaintainDao.xml new file mode 100644 index 00000000..b58bd21a --- /dev/null +++ b/src/main/resources/mybatis/mapper/basic/BasicUnitMaintainDao.xml @@ -0,0 +1,268 @@ + + + + + + + + + + REPLACE + INTO basic_corp + (thirdId,erpId,`name`,spell, + addr,status,`type`,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4, + thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType) + values + ( + #{thirdId}, + #{erpId}, + #{name}, + #{spell}, + #{addr}, + #{status}, + #{type}, + #{creditNo}, + #{contact}, + #{mobile}, + #{thirdId1}, + #{thirdId2}, + #{thirdId3}, + #{thirdId4}, + #{thirdName}, + #{thirdName1}, + #{thirdName2}, + #{thirdName3}, + #{thirdName4}, + #{updateTime}, + #{corpType}, + #{outType} + ) + + + + + insert + ignore + INTO basic_corp + (thirdId,erpId,`name`,spell, + addr,status,`type`,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4, + thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType) + values + ( + #{thirdId}, + #{erpId}, + #{name}, + #{spell}, + #{addr}, + #{status}, + #{type}, + #{creditNo}, + #{contact}, + #{mobile}, + #{thirdId1}, + #{thirdId2}, + #{thirdId3}, + #{thirdId4}, + #{thirdName}, + #{thirdName1}, + #{thirdName2}, + #{thirdName3}, + #{thirdName4}, + #{updateTime}, + #{corpType}, + #{outType} + ) + + + + + insert INTO basic_corp(thirdId, erpId, `name`, spell, addr, + status, `type`, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4, + thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType, outType) + values (#{thirdId}, + #{erpId}, + #{name}, + #{spell}, + #{addr}, + #{status}, + #{type}, + #{creditNo}, + #{contact}, + #{mobile}, + #{thirdId1}, #{thirdId2}, #{thirdId3}, #{thirdId4}, + #{thirdName}, #{thirdName1}, #{thirdName2}, #{thirdName3}, #{thirdName4}, #{updateTime}, #{corpType}, + #{outType}) + + + + + UPDATE basic_corp + + thirdId=#{thirdId}, + thirdId=null, + erpId=#{erpId}, + `name`=#{name}, + spell=#{spell}, + addr=#{addr}, + status=#{status}, + `type`=#{type}, + creditNo=#{creditNo}, + contact=#{contact}, + mobile=#{mobile}, + thirdId1=#{thirdId1}, + thirdId2=#{thirdId2}, + thirdId3=#{thirdId3}, + thirdId4=#{thirdId4}, + thirdId1=null, + thirdId2=null, + thirdId3=null, + thirdId4=null, + thirdName=#{thirdName}, + thirdName1=#{thirdName1}, + thirdName2=#{thirdName2}, + thirdName3=#{thirdName3}, + thirdName4=#{thirdName4}, + updateTime=#{updateTime}, + corpType=#{corpType}, + outType=#{outType}, + + WHERE id=#{id} + + + + DELETE + FROM basic_corp + WHERE id = #{id} + + + + + + + + + + + + + + + replace + INTO basic_corp + ( thirdId, erpId, `name`, spell, + addr, status, `type`, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4, + thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType,outType) + values ( + #{thirdId}, + #{erpId}, + #{name}, + #{spell}, + #{addr}, + #{status}, + #{type}, + #{creditNo}, + #{contact}, + #{mobile}, + #{thirdId1}, + #{thirdId2}, + #{thirdId3}, + #{thirdId4}, + #{thirdName}, + #{thirdName1}, + #{thirdName2}, + #{thirdName3}, + #{thirdName4}, + #{updateTime}, + #{corpType}, + #{outType} + ) + + diff --git a/src/main/resources/mybatis/mapper/basic/BussinessTypeRoleDao.xml b/src/main/resources/mybatis/mapper/basic/BussinessTypeRoleDao.xml new file mode 100644 index 00000000..3d891161 --- /dev/null +++ b/src/main/resources/mybatis/mapper/basic/BussinessTypeRoleDao.xml @@ -0,0 +1,26 @@ + + + + + + + + delete + from basic_bussiness_type_role + where role_id = #{roleId} + + + + insert into basic_bussiness_type_role + (role_id, action) + values + + (#{item.role_id}, + #{item.action}) + + + diff --git a/src/main/resources/mybatis/mapper/info/SetupDao.xml b/src/main/resources/mybatis/mapper/info/SetupDao.xml new file mode 100644 index 00000000..7e6bac6d --- /dev/null +++ b/src/main/resources/mybatis/mapper/info/SetupDao.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + UPDATE customer_set + + checkUpbill=#{checkUpbill}, + checkStock=#{checkStock}, + checkRepeat=#{checkRepeat}, + downloadRelation=#{downloadRelation}, + uploadTime=#{uploadTime}, + lastUploadDate=#{lastUploadDate}, + + WHERE customerId=#{customerId} + + + + + + replace INTO customer_set(customerId, + checkUpbill,checkStock,checkRepeat,downloadRelation,uploadTime,lastUploadDate) values + ( + #{customerId}, + #{checkUpbill}, #{checkStock} , #{checkRepeat}, #{downloadRelation} + ,#{uploadTime},#{lastUploadDate}) + + + + + diff --git a/src/main/resources/mybatis/mapper/system/CompanyDao.xml b/src/main/resources/mybatis/mapper/system/CompanyDao.xml index c0d4c8e9..8443d859 100644 --- a/src/main/resources/mybatis/mapper/system/CompanyDao.xml +++ b/src/main/resources/mybatis/mapper/system/CompanyDao.xml @@ -11,29 +11,271 @@ where customerId = #{CustomerId} + + + + + delete + from sup_company + where customerId = #{customerId} + + + + + - UPDATE auth_company SET - name = #{name}, - category = #{category}, - creditCode = #{creditCode}, - addr = #{addr}, - productAddr = #{productAddr}, - classes = #{classes}, - appId = #{appId}, - appSecret = #{appSecret} + UPDATE sup_company + + + companyName=#{companyName}, + + + bussinessStatus=#{bussinessStatus}, + + + creditNum=#{creditNum}, + + + classes=#{classes}, + + + area=#{area}, + + + detailAddr=#{detailAddr}, + + + appId=#{appId}, + + + appSecret=#{appSecret}, + + + contacts=#{contacts}, + + + mobile=#{mobile}, + + + tel=#{tel}, + + + email=#{email}, + + + refEntId=#{refEntId}, + + + entId=#{entId}, + + + networkType=#{networkType}, + + + certIdFk=#{certIdFk}, + + + areaCode=#{areaCode}, + + + parentCompany=#{parentCompany}, + + + parentIdFk=#{parentIdFk}, + + + contactsPapersType=#{contactsPapersType}, + + + contactsPapersCode=#{contactsPapersCode}, + + + registerStatus=#{registerStatus}, + + + jyxkzh=#{jyxkzh}, + + + jyxkzfzjg=#{jyxkzfzjg}, + + + jyxkzyxq=#{jyxkzyxq}, + + + jybapzh=#{jybapzh}, + + + jybabm=#{jybabm}, + + + fzrq=#{fzrq}, + + + suihao=#{suihao}, + + + kaihuhang=#{kaihuhang}, + + + kaihuzhanghao=#{kaihuzhanghao}, + + + auditStatus=#{auditStatus}, + + + filePath=#{filePath}, + + + filePath2=#{filePath2}, + + + filePath3=#{filePath3}, + + + filePath4=#{filePath4}, + + + unitIdFk=#{unitIdFk}, + + + WHERE customerId = #{customerId} - INSERT INTO auth_company(name,category,creditCode,addr,productAddr,classes,appId,appSecret) values - ( #{name}, - #{category}, - #{creditCode}, - #{addr}, - #{productAddr}, - #{classes}, - #{appId}, - #{appSecret}) + INSERT INTO sup_company(companyName, bussinessStatus, creditNum, classes, area, + detailAddr, appId, appSecret, contacts, mobile, tel, email, customerId, areaCode, + refEntId, entId, networkType, certIdFk, parentCompany, parentIdFk, + contactsPapersType, contactsPapersCode, registerStatus, jyxkzh, jyxkzfzjg, jyxkzyxq, + jybapzh, jybabm, fzrq, suihao, kaihuhang, kaihuzhanghao, auditStatus, + filePath, filePath2, filePath3, filePath4, unitIdFk) + values (#{companyName}, + #{bussinessStatus}, + #{creditNum}, + #{classes}, + #{area}, + #{detailAddr}, + #{appId}, + #{appSecret}, + #{contacts}, + #{mobile}, + #{tel}, + #{email}, + #{customerId}, + #{areaCode}, + #{refEntId}, + #{entId}, + #{networkType}, + #{certIdFk}, + #{parentCompany}, + #{parentIdFk}, + #{contactsPapersType}, + #{contactsPapersCode}, + #{registerStatus}, + #{jyxkzh}, + #{jyxkzfzjg}, + #{jyxkzyxq}, + #{jybapzh}, + #{jybabm}, + #{fzrq}, + #{suihao}, + #{kaihuhang}, + #{kaihuzhanghao}, + #{auditStatus}, + #{filePath}, + #{filePath2}, + #{filePath3}, + #{filePath4}, #{unitIdFk}) + + + - \ No newline at end of file