同步代码
parent
1f66bdec10
commit
5c066735f7
@ -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<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByRoleId(authAdminQueryRequest.getRoleId());
|
||||
// List<Long> ids = new ArrayList<>();
|
||||
// if (authRoleAdmins != null && !authRoleAdmins.isEmpty()) {
|
||||
// ids = authRoleAdmins.stream().map(AuthRoleAdmin::getAdmin_id).collect(Collectors.toList());
|
||||
// }
|
||||
// authAdminQueryRequest.setIds(ids);
|
||||
// }
|
||||
// List<AuthAdmin> authAdminList = authAdminService.listAdminPage(authAdminQueryRequest);
|
||||
// // 查询所有的权限
|
||||
// List<Long> adminIds = authAdminList.stream().map(AuthAdmin::getId).collect(Collectors.toList());
|
||||
// List<AuthRoleAdmin> authRoleAdminList = authRoleAdminService.listByAdminIdIn(adminIds);
|
||||
//
|
||||
// // 视图列表
|
||||
// List<AuthAdminResponse> authAdminResponseList = authAdminList.stream().map(item -> {
|
||||
// AuthAdminResponse authAdminResponse = new AuthAdminResponse();
|
||||
// BeanUtils.copyProperties(item, authAdminResponse);
|
||||
// List<Long> 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<AuthAdmin> authAdminPageInfo = new PageInfo<>(authAdminList);
|
||||
// PageSimpleResponse<AuthAdminResponse> 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<AuthRole> authRoleList = authRoleService.listAuthAdminRolePage(page, limit, null);
|
||||
// PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList);
|
||||
// PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
// List<AuthAdminRoleResponse> 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<AuthRole> authRoles = authRoleAdminService.listAdminRole(authAdmin.getId());
|
||||
// List<AuthRole> 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<AuthRole> pageInfo = new PageInfo<>(authRoleList);
|
||||
// PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
// List<AuthAdminRoleResponse> 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<AuthRole> authRoleList = authRoleService.listCustomerRoles(page, limit, 1);
|
||||
// List<AuthRole> authRoleList = authRoleService.listAuthRoles2(page, limit);
|
||||
PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList);
|
||||
PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
List<AuthAdminRoleResponse> 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<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByAdminId(curUser.getId());
|
||||
// List<Long> roles = new ArrayList<>();
|
||||
// if (!authRoleAdmins.isEmpty()) {
|
||||
// for (AuthRoleAdmin authRoleAdmin : authRoleAdmins) {
|
||||
// roles.add(authRoleAdmin.getRole_id());
|
||||
// }
|
||||
// authRoleAdminService.insertRolesAdminIdAll(roles, authAdmin.getId());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Map<String, Long> 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<WarehouseUserEntity> warehouseUserEntityList = warehouseUserService.filterWarehouseUsers(warehouseUser);
|
||||
// if (warehouseUserEntityList.size() == 0) {
|
||||
// FilterInvBusUserRequest invBusUserEntity = new FilterInvBusUserRequest();
|
||||
// invBusUserEntity.setUserId(authAdminSaveRequest.getId() + "");
|
||||
// List<InvBusUserEntity> 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<Long> 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<AuthRoleAdmin> authRoleAdmins = authRoleAdminService.listByAdminId(authAdmin.getId());
|
||||
// roleIds = authRoleAdmins.stream().map(AuthRoleAdmin::getRole_id).collect(Collectors.toList());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // 角色授权列表
|
||||
// List<AuthPermission> authPermissions = authPermissionService.listByRoleIdIn(roleIds);
|
||||
// List<Long> permissionRuleIds = authPermissions.stream().map(AuthPermission::getPermissionRuleId).collect(Collectors.toList());
|
||||
//
|
||||
// // 获取授权的规则
|
||||
// List<AuthPermissionRule> authPermissionRules = authPermissionRuleService.listByIdIn(permissionRuleIds);
|
||||
//
|
||||
//
|
||||
// if (authAdmin.getId() == 1) {//admin 用户获取所有菜单项
|
||||
// authPermissionRules = authPermissionRuleService.listAll();
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// List<AuthPermissionRule> menus = authPermissionRuleService.selectMenuTreeByUserId(authPermissionRules);
|
||||
// List<RouterEntity> 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<AuthAdmin> hospitalUserList = authAdminService.getHospitalUserList();
|
||||
// return ResultVOUtils.success(hospitalUserList);
|
||||
// }
|
||||
}
|
@ -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<CustomerInfoEntity> customerDetailEntities = customerInfoService.filterCustomerInfo(customerFilterRequest);
|
||||
PageInfo<CustomerInfoEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(customerDetailEntities);
|
||||
PageSimpleResponse<CustomerInfoEntity> 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<CustomerDetailEntity> customerDetailEntities = customerInfoService.filterDetailCustomer(customerFilterRequest);
|
||||
PageInfo<CustomerDetailEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(customerDetailEntities);
|
||||
PageSimpleResponse<CustomerDetailEntity> 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<AuthAdmin> byCustomerld = authAdminService.findByCustomerld(customerDetailEntity.getCustomerId());
|
||||
|
||||
AuthRoleAdmin authRoleAdmin = new AuthRoleAdmin();
|
||||
List<AuthRoleAdmin> objects = new ArrayList<>();
|
||||
if( byCustomerld !=null && byCustomerld.size()>0){
|
||||
for (AuthAdmin authAdmin : byCustomerld) {
|
||||
List<AuthRoleAdmin> 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("删除成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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<AuthRoleAdmin> listByAdminId(Long adminId);
|
||||
|
||||
/**
|
||||
* 根据 多个 adminId 查询
|
||||
*
|
||||
* @param adminIds 传入的 adminIds
|
||||
* @return
|
||||
*/
|
||||
List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
|
||||
|
||||
/**
|
||||
* 根据 role_id 查询 admin_id
|
||||
*
|
||||
* @param roleId 传入的 roleId
|
||||
* @return
|
||||
*/
|
||||
List<AuthRoleAdmin> listByRoleId(Long roleId);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param authRoleAdminList
|
||||
* @return
|
||||
*/
|
||||
int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
|
||||
|
||||
|
||||
/**
|
||||
* 根据 adminId 删除
|
||||
*
|
||||
* @param adminId
|
||||
* @return
|
||||
*/
|
||||
boolean deleteByAdminId(Long adminId);
|
||||
|
||||
boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin);
|
||||
|
||||
|
||||
List<AuthRole> listAdminRole(Long adminId);
|
||||
}
|
@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest);
|
||||
|
||||
/**
|
||||
* 返回id,name 字段的列表
|
||||
* @return 列表
|
||||
*/
|
||||
List<AuthRole> listAuthAdminRolePage(@Param("status") Integer status);
|
||||
|
||||
List<AuthRole> listCustomerRoles(@Param("isCustomer") Integer isCustomer);
|
||||
|
||||
List<AuthRole> 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);
|
||||
|
||||
}
|
@ -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<CustomerInfoEntity> filterCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest);
|
||||
|
||||
List<CustomerDetailEntity> 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);
|
||||
}
|
@ -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<UserRegisterEntity> 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);
|
||||
}
|
@ -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<BasicBussinessTypeRoleEntity> getListByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
/**
|
||||
* 删除此角色下所有的扫码单据类型授权数据
|
||||
*
|
||||
* @param roleId
|
||||
*/
|
||||
void deleteByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
/**
|
||||
* 插入授权数据
|
||||
*
|
||||
* @param basicBussinessTypeRoleEntities
|
||||
*/
|
||||
void insert(@Param("basicBussinessTypeRoleEntities") List<BasicBussinessTypeRoleEntity> basicBussinessTypeRoleEntities);
|
||||
}
|
@ -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<BasicUnitMaintainEntity> 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<BasicUnitMaintainEntity> batchSelectByIds(@Param("ids") List<Integer> id);
|
||||
|
||||
List<BasicUnitMaintainEntity> batchSelectByErpIds(@Param("erpIds") List<String> erpIds);
|
||||
|
||||
BasicUnitMaintainEntity selectByName(@Param("name") String name);
|
||||
|
||||
|
||||
boolean importBasicUnitMaintain(BasicUnitMaintainEntity basicUnitMaintainEntity);
|
||||
}
|
@ -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<CompanyEntity> getSubCompany(FilterCompanyRequest companyRequest);
|
||||
|
||||
List<CompanyEntity> getSubCompany2(FilterCompanyRequest companyRequest);
|
||||
|
||||
List<CompanyEntity> filterCompany(FilterCompanyRequest companyRequest);
|
||||
|
||||
boolean modifyCompany(CompanyEntity companyEntity);
|
||||
|
||||
boolean insertCompany(CompanyEntity companyEntity);
|
||||
|
||||
boolean deleteCompany(Long customerId);
|
||||
|
||||
AliKeyEntity findKey(String customerId);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.glxp.api.entity.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateUserflagBean {
|
||||
private String CustomerId;
|
||||
private Integer userFlag;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<String> auditStatusList;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.glxp.api.req.info;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FilterAliCertRequest {
|
||||
private String id;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.glxp.api.res.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CheckCodeRequest {
|
||||
private String phoneNum;
|
||||
private String userName;
|
||||
}
|
@ -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<AuthRoleAdmin> listByAdminId(Long adminId);
|
||||
|
||||
List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
|
||||
|
||||
List<AuthRoleAdmin> listByRoleId(Long roleId);
|
||||
|
||||
int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
|
||||
|
||||
int insertRolesAdminIdAll(List<Long> roles, Long adminId);
|
||||
|
||||
boolean deleteByAdminId(Long adminId);
|
||||
boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin);
|
||||
|
||||
List<AuthRole> listAdminRole(Long adminId);
|
||||
}
|
@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest);
|
||||
|
||||
List<AuthRole> listAuthAdminRolePage(Integer page, Integer limit, Integer status);
|
||||
|
||||
AuthRole findByName(String name);
|
||||
|
||||
boolean insertAuthRole(AuthRole authRole);
|
||||
|
||||
boolean updateAuthRole(AuthRole authRole);
|
||||
|
||||
List<AuthRole> listCustomerRoles(Integer page, Integer limit, Integer isCustomer);
|
||||
|
||||
List<AuthRole> listAuthRoles2(Integer page, Integer limit);
|
||||
|
||||
boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 查询角色扫码单据授权数据
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<BasicBussinessTypeRoleEntity> getBussinessTypeRole(Long roleId);
|
||||
|
||||
/**
|
||||
* 更新角色扫码单据类型授权数据
|
||||
*
|
||||
* @param roleId
|
||||
* @param actions
|
||||
*/
|
||||
void updateBussinessTypeRole(Long roleId, List<String> actions);
|
||||
}
|
@ -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<CustomerInfoEntity> filterCustomerInfo(CustomerInfoFilterRequest customerInfoFilterRequest);
|
||||
|
||||
List<CustomerDetailEntity> 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);
|
||||
}
|
@ -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<UserRegisterEntity> 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);
|
||||
}
|
@ -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<AuthRoleAdmin> listByAdminId(Long adminId) {
|
||||
return authRoleAdminDao.listByAdminId(adminId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据多个 adminId 查询角色列表
|
||||
*
|
||||
* @param adminIds
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds) {
|
||||
if (adminIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return authRoleAdminDao.listByAdminIdIn(adminIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 roleId 获取 管理员id
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AuthRoleAdmin> listByRoleId(Long roleId) {
|
||||
return authRoleAdminDao.listByRoleId(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param authRoleAdminList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList) {
|
||||
|
||||
if (authRoleAdminList == null || authRoleAdminList.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return authRoleAdminDao.insertAuthRoleAdminAll(authRoleAdminList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据 角色ids 和 管理员 adminId 批量插入
|
||||
*
|
||||
* @param roles
|
||||
* @param adminId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int insertRolesAdminIdAll(List<Long> roles, Long adminId) {
|
||||
|
||||
List<AuthRoleAdmin> 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<AuthRole> listAdminRole(Long adminId) {
|
||||
return authRoleAdminDao.listAdminRole(adminId);
|
||||
}
|
||||
}
|
@ -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<AuthRole> listAdminPage(AuthRoleQueryRequest authRoleQueryRequest) {
|
||||
int offset = (authRoleQueryRequest.getPage() - 1) * authRoleQueryRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, authRoleQueryRequest.getLimit());
|
||||
List<AuthRole> list = authRoleDao.listAdminPage(authRoleQueryRequest);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询管理员页面的列表
|
||||
*
|
||||
* @param page
|
||||
* @param limit
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AuthRole> 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<AuthRole> 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<AuthRole> 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<AuthRole> list = authRoleDao.listCustomerRoles(isCustomer);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuthRole> 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<AuthRole> list = authRoleDao.listAuthRoles2();
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Long id) {
|
||||
return authRoleDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicBussinessTypeRoleEntity> getBussinessTypeRole(Long roleId) {
|
||||
return basicBussinessTypeRoleDao.getListByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBussinessTypeRole(Long roleId, List<String> actions) {
|
||||
//删除之前的扫码单据类型授权数据
|
||||
basicBussinessTypeRoleDao.deleteByRoleId(roleId);
|
||||
//添加新的扫码单据数据类型
|
||||
List<BasicBussinessTypeRoleEntity> 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);
|
||||
}
|
||||
}
|
@ -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<CustomerInfoEntity> 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<CustomerDetailEntity> filterDetailCustomer(CustomerInfoFilterRequest customerInfoFilterRequest) {
|
||||
if (customerInfoFilterRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
int offset = (customerInfoFilterRequest.getPage() - 1) * customerInfoFilterRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, customerInfoFilterRequest.getLimit());
|
||||
List<CustomerDetailEntity> 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);
|
||||
}
|
||||
}
|
@ -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<UserRegisterEntity> 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);
|
||||
}
|
||||
}
|
@ -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<BasicUnitMaintainEntity> 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<BasicUnitMaintainEntity> batchSelectByIds(List<Integer> id);
|
||||
|
||||
List<BasicUnitMaintainEntity> batchSelectByErpIds(List<String> erpIds);
|
||||
|
||||
BasicUnitMaintainEntity selectById(String id);
|
||||
|
||||
BasicUnitMaintainEntity selectByErpId(String id);
|
||||
|
||||
BasicUnitMaintainEntity selectByName(String name);
|
||||
|
||||
boolean isExit();
|
||||
}
|
@ -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<BasicUnitMaintainEntity> 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<BasicUnitMaintainEntity> 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<BasicUnitMaintainEntity> batchSelectByIds(List<Integer> ids) {
|
||||
return basicUnitMaintainDao.batchSelectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicUnitMaintainEntity> batchSelectByErpIds(List<String> 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<BasicUnitMaintainEntity> 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<BasicUnitMaintainEntity> data = filterList(filterUdiInfoRequest);
|
||||
if (data != null && data.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -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);
|
||||
// }
|
||||
//}
|
@ -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<CompanyEntity> filterCompany(FilterCompanyRequest companyRequest);
|
||||
|
||||
CompanyEntity findCompany(String CustomerId);
|
||||
|
||||
List<CompanyEntity> getSubCompany(FilterCompanyRequest commitRequest);
|
||||
|
||||
List<CompanyEntity> 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);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.auth.AuthRoleAdminDao">
|
||||
|
||||
<select id="listByAdminId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
|
||||
SELECT role_id
|
||||
FROM auth_user_role
|
||||
where user_id = #{adminId}
|
||||
</select>
|
||||
|
||||
<select id="listAdminRole" resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
select * from auth_role INNER JOIN auth_user_role on auth_role.id = auth_user_role.role_id
|
||||
WHERE auth_user_role.user_id = #{adminId};
|
||||
</select>
|
||||
|
||||
<select id="listByAdminIdIn" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
|
||||
SELECT *
|
||||
FROM auth_user_role
|
||||
where user_id in
|
||||
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="listByRoleId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">
|
||||
SELECT admin_id
|
||||
FROM auth_user_role
|
||||
where role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<insert id="insertAuthRoleAdminAll">
|
||||
INSERT INTO auth_user_role
|
||||
(user_id,role_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
<if test="item.role_id != null and item.user_id != null">
|
||||
(#{item.user_id}, #{item.role_id})
|
||||
</if>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByAdminId" parameterType="java.lang.Long">
|
||||
delete from auth_user_role where user_id = #{adminId}
|
||||
</delete>
|
||||
|
||||
|
||||
<update id="updateAuthRoleAdmin" parameterType="com.glxp.api.entity.auth.AuthRoleAdmin">
|
||||
UPDATE auth_user_role
|
||||
<set>
|
||||
<if test="role_id != null">
|
||||
role_id=#{role_id},
|
||||
</if>
|
||||
</set>
|
||||
WHERE user_id = #{user_id}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.auth.AuthRoleDao">
|
||||
|
||||
<select id="listAdminPage" parameterType="com.glxp.api.req.auth.AuthRoleQueryRequest"
|
||||
resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
SELECT id,name,status,remark,create_time,listorder,isCustomer
|
||||
FROM auth_role
|
||||
<where>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="isCustomer != null">
|
||||
AND isCustomer = #{isCustomer}
|
||||
</if>
|
||||
<if test="name != null and '' != name">
|
||||
AND `name` LIKE CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="listAuthAdminRolePage" resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
SELECT id,name
|
||||
FROM auth_role
|
||||
<where>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="findByName" resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
SELECT id
|
||||
FROM auth_role
|
||||
where `name` = #{name}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listCustomerRoles" parameterType="java.lang.Integer"
|
||||
resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
SELECT role_id, role_name
|
||||
FROM auth_role
|
||||
where `isCustomer` = #{isCustomer}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listAuthRoles2" parameterType="java.lang.Integer" resultType="com.glxp.api.entity.auth.AuthRole">
|
||||
SELECT irole_id, role_name
|
||||
FROM auth_role
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertAuthRole" keyProperty="id" parameterType="com.glxp.api.entity.auth.AuthRole">
|
||||
INSERT INTO auth_role(`name`,pid,`status`,`remark`,`listorder`,create_time,update_time,isCustomer)
|
||||
values
|
||||
(
|
||||
#{name},
|
||||
<choose>
|
||||
<when test="pid != null">
|
||||
#{pid},
|
||||
</when>
|
||||
<otherwise>
|
||||
0,
|
||||
</otherwise>
|
||||
</choose>
|
||||
#{status},
|
||||
<choose>
|
||||
<when test="remark != null">
|
||||
#{remark},
|
||||
</when>
|
||||
<otherwise>
|
||||
'',
|
||||
</otherwise>
|
||||
</choose>
|
||||
<choose>
|
||||
<when test="listorder != null">
|
||||
#{listorder},
|
||||
</when>
|
||||
<otherwise>
|
||||
999,
|
||||
</otherwise>
|
||||
</choose>
|
||||
#{createTime},
|
||||
#{updateTime},
|
||||
#{isCustomer}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateAuthRole" parameterType="com.glxp.api.entity.auth.AuthRole">
|
||||
UPDATE auth_role
|
||||
<set>
|
||||
<if test="name != null">`name`=#{name},</if>
|
||||
<if test="pid != null">pid=#{pid},</if>
|
||||
<if test="status != null">`status`=#{status},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="listorder != null">`listorder`=#{listorder},</if>
|
||||
<if test="updateTime != null">update_time=#{updateTime},</if>
|
||||
<if test="isCustomer != null">isCustomer=#{isCustomer},</if>
|
||||
</set>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from auth_role
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.auth.CustomerInfoDao">
|
||||
|
||||
<select id="filterCustomerInfo" parameterType="com.glxp.api.req.auth.CustomerInfoFilterRequest"
|
||||
resultType="com.glxp.api.entity.auth.CustomerInfoEntity">
|
||||
SELECT *
|
||||
FROM customer_info
|
||||
<where>
|
||||
<if test="customerName != null and ''!=customerName">
|
||||
AND customerName LIKE concat('%',#{customerName},'%')
|
||||
</if>
|
||||
<if test="companyName != null and ''!=companyName">
|
||||
AND companyName LIKE concat('%',#{companyName},'%')
|
||||
</if>
|
||||
<if test="key != null and ''!=key">
|
||||
AND (
|
||||
companyName LIKE concat('%',#{key},'%')
|
||||
or customerName LIKE concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="filterDetailCustomerInfo" parameterType="com.glxp.api.req.auth.CustomerInfoFilterRequest"
|
||||
resultType="com.glxp.api.entity.auth.CustomerDetailEntity">
|
||||
SELECT customer_info.customerId,customer_info.customerName,
|
||||
customer_info.creditNum,customer_info.area,customer_info.detailAddr,
|
||||
customer_info.bussinessStatus,customer_info.isInfoLink,customer_info.infoLink,customer_info.roleId,customer_info.userFlag,
|
||||
customer_contact.contacts,customer_contact.mobile,customer_info.userMax,customer_contact.email,customer_contact.tel,customer_info.companyName
|
||||
,auth_role.role_name role
|
||||
FROM customer_info
|
||||
left JOIN customer_contact on customer_info.customerId=customer_contact.customerId
|
||||
left JOIN auth_role on customer_info.roleId = auth_role.role_id
|
||||
<where>
|
||||
<if test="customerName != null and ''!=customerName">
|
||||
AND customer_info.customerName LIKE concat('%',#{customerName},'%')
|
||||
</if>
|
||||
<if test="companyName != null and ''!=companyName">
|
||||
AND customer_info.companyName LIKE concat('%',#{companyName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDetail" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.auth.CustomerDetailEntity">
|
||||
SELECT customer_info.customerId,
|
||||
customer_info.customerName,
|
||||
customer_info.creditNum,
|
||||
customer_info.area,
|
||||
customer_info.detailAddr,
|
||||
customer_info.bussinessStatus,
|
||||
customer_info.isInfoLink,
|
||||
customer_info.infoLink,
|
||||
customer_info.roleId,
|
||||
customer_info.userFlag,
|
||||
customer_contact.contacts,
|
||||
customer_contact.mobile,
|
||||
customer_info.userMax,
|
||||
customer_contact.email,
|
||||
customer_contact.tel,
|
||||
customer_info.companyName
|
||||
FROM customer_info
|
||||
INNER JOIN customer_contact on customer_info.customerId = customer_contact.customerId
|
||||
where customer_info.customerId = #{customerId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCustomerInfo" keyProperty="customerId"
|
||||
parameterType="com.glxp.api.entity.auth.CustomerInfoEntity">
|
||||
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})
|
||||
</insert>
|
||||
|
||||
<update id="updateCustomerInfo" parameterType="com.glxp.api.entity.auth.CustomerInfoEntity">
|
||||
UPDATE customer_info
|
||||
<set>
|
||||
<if test="customerName != null">customerName=#{customerName},</if>
|
||||
<if test="creditNum != null">creditNum=#{creditNum},</if>
|
||||
<if test="area != null">`area`=#{area},</if>
|
||||
<if test="detailAddr != null">detailAddr=#{detailAddr},</if>
|
||||
<if test="bussinessStatus != null">`bussinessStatus`=#{bussinessStatus},</if>
|
||||
<if test="userFlag != null">userFlag=#{userFlag},</if>
|
||||
<if test="isInfoLink != null">isInfoLink=#{isInfoLink},</if>
|
||||
<if test="infoLink != null">infoLink=#{infoLink},</if>
|
||||
<if test="roleId != null">roleId=#{roleId},</if>
|
||||
<if test="userMax != null">userMax=#{userMax},</if>
|
||||
<if test="companyName != null">companyName=#{companyName},</if>
|
||||
</set>
|
||||
WHERE customerId=#{customerId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.String">
|
||||
delete
|
||||
from customer_info
|
||||
where customerId = #{customerId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectById" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.auth.CustomerInfoEntity">
|
||||
SELECT *
|
||||
FROM customer_info
|
||||
WHERE (
|
||||
customerId = #{customerId}) limit 1
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<select id="isExitRoleId" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.auth.CustomerInfoEntity">
|
||||
SELECT *
|
||||
FROM customer_info
|
||||
WHERE (
|
||||
roleId = #{roleId}) limit 1
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.auth.UserRegisterDao">
|
||||
|
||||
<select id="filterUserRegisters" parameterType="com.glxp.api.req.auth.UserResisterFilterRequest"
|
||||
resultType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
SELECT *
|
||||
FROM user_register
|
||||
<where>
|
||||
<if test="companyName != null and '' !=companyName">
|
||||
AND companyName like concat(#{companyName},'%')
|
||||
</if>
|
||||
<if test="checkType != null and ''!=checkType">
|
||||
AND checkType = #{checkType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertUserRegister" keyProperty="id" parameterType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
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})
|
||||
</insert>
|
||||
|
||||
<update id="updateUserRegister" parameterType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
UPDATE user_register
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="nickName != null">`nickName`=#{nickName},</if>
|
||||
<if test="password != null">password=#{password},</if>
|
||||
<if test="realName != null">`realName`=#{realName},</if>
|
||||
<if test="tel != null">tel=#{tel},</if>
|
||||
<if test="mobile != null">`mobile`=#{mobile},</if>
|
||||
<if test="userId != null">userId=#{userId},</if>
|
||||
<if test="email != null">email=#{email},</if>
|
||||
<if test="companyName != null">companyName=#{companyName},</if>
|
||||
<if test="creditNum != null">creditNum=#{creditNum},</if>
|
||||
<if test="area != null">area=#{area},</if>
|
||||
<if test="detailAddr != null">detailAddr=#{detailAddr},</if>
|
||||
<if test="bussinessStatus != null">bussinessStatus=#{bussinessStatus},</if>
|
||||
<if test="checkType != null">checkType=#{checkType},</if>
|
||||
<if test="registerTime != null">registerTime=#{registerTime},</if>
|
||||
<if test="checkTime != null">checkTime=#{checkTime},</if>
|
||||
<if test="areaCode != null">areaCode=#{areaCode},</if>
|
||||
<if test="userName != null">userName=#{userName},</if>
|
||||
<if test="licenseUrl != null">licenseUrl=#{licenseUrl},</if>
|
||||
<if test="companyId != null">companyId=#{companyId},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from user_register
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteByMobile" parameterType="map">
|
||||
delete
|
||||
from user_register
|
||||
where mobile = #{phone} and checkType=#{checkType}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByCustomerId" parameterType="java.lang.String">
|
||||
delete
|
||||
from user_register
|
||||
where userId = #{userId}
|
||||
</delete>
|
||||
<select id="selectById" parameterType="java.lang.Integer"
|
||||
resultType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
SELECT *
|
||||
FROM user_register
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByMobile" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
SELECT *
|
||||
FROM user_register
|
||||
WHERE mobile = #{phone}
|
||||
</select>
|
||||
|
||||
<select id="selectByCustomerId" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.auth.UserRegisterEntity">
|
||||
SELECT *
|
||||
FROM user_register
|
||||
WHERE companyId = #{id}
|
||||
</select>
|
||||
|
||||
<select id="isExit" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
SELECT 1
|
||||
FROM user_register
|
||||
WHERE (
|
||||
mobile = #{phoneNum} and checkType !=2 ) limit 1
|
||||
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,268 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.basic.BasicUnitMaintainDao">
|
||||
|
||||
<select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
|
||||
resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
SELECT * FROM basic_corp
|
||||
<where>
|
||||
<if test="key != '' and key!=null">
|
||||
and
|
||||
( name like concat('%',#{key},'%')
|
||||
or spell like concat('%',#{key},'%')
|
||||
or erpId like concat('%',#{key},'%')
|
||||
or creditNo like concat('%',#{key},'%')
|
||||
or thirdId like concat('%',#{key},'%')
|
||||
or thirdId1 like concat('%',#{key},'%')
|
||||
or thirdId2 like concat('%',#{key},'%')
|
||||
or thirdId3 like concat('%',#{key},'%')
|
||||
or thirdId4 like concat('%',#{key},'%')
|
||||
or addr like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="unitId != '' and unitId != null">
|
||||
AND unitId = #{unitId}
|
||||
</if>
|
||||
<if test="erpId != '' and erpId != null">
|
||||
AND erpId = #{erpId}
|
||||
</if>
|
||||
<if test="corpType != null">
|
||||
AND corpType = #{corpType}
|
||||
</if>
|
||||
<if test="outType != null">
|
||||
AND ( outType <![CDATA[ <> ]]> #{outType} or outType is NULL)
|
||||
</if>
|
||||
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
||||
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
||||
</if>
|
||||
</where>
|
||||
order by updateTime desc
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectByThirdId" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
|
||||
resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
select * FROM basic_corp
|
||||
<where>
|
||||
<if test="thirdId != '' and thirdId != null">
|
||||
AND thirdId = #{thirdId}
|
||||
</if>
|
||||
<if test="thirdId1 != '' and thirdId1 != null">
|
||||
AND thirdId1 = #{thirdId1}
|
||||
</if>
|
||||
<if test="thirdId2 != '' and thirdId2 != null">
|
||||
AND thirdId2 = #{thirdId2}
|
||||
</if>
|
||||
<if test="thirdId3 != '' and thirdId3 != null">
|
||||
AND thirdId3 = #{thirdId3}
|
||||
</if>
|
||||
<if test="thirdId4 != '' and thirdId4 != null">
|
||||
AND thirdId4 = #{thirdId4}
|
||||
</if>
|
||||
<if test="corpType != null">
|
||||
AND corpType = #{corpType}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
limit 1
|
||||
</select>
|
||||
<insert id="insertBasicUnitMaintain" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
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>
|
||||
|
||||
|
||||
<insert id="insertBasicUnitMaintainignore" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
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>
|
||||
|
||||
|
||||
<insert id="insert" parameterType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
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})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById" parameterType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
UPDATE basic_corp
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="thirdId != null">thirdId=#{thirdId},</if>
|
||||
<if test="thirdId == ''">thirdId=null,</if>
|
||||
<if test="erpId != null">erpId=#{erpId},</if>
|
||||
<if test="name != null">`name`=#{name},</if>
|
||||
<if test="spell != null">spell=#{spell},</if>
|
||||
<if test="addr != null">addr=#{addr},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="type != null">`type`=#{type},</if>
|
||||
<if test="creditNo != null">creditNo=#{creditNo},</if>
|
||||
<if test="contact != null">contact=#{contact},</if>
|
||||
<if test="mobile != null">mobile=#{mobile},</if>
|
||||
<if test="thirdId1 != null">thirdId1=#{thirdId1},</if>
|
||||
<if test="thirdId2 != null">thirdId2=#{thirdId2},</if>
|
||||
<if test="thirdId3 != null">thirdId3=#{thirdId3},</if>
|
||||
<if test="thirdId4 != null">thirdId4=#{thirdId4},</if>
|
||||
<if test="thirdId1 == ''">thirdId1=null,</if>
|
||||
<if test="thirdId2 == ''">thirdId2=null,</if>
|
||||
<if test="thirdId3 == ''">thirdId3=null,</if>
|
||||
<if test="thirdId4 == ''">thirdId4=null,</if>
|
||||
<if test="thirdName != null">thirdName=#{thirdName},</if>
|
||||
<if test="thirdName1 != null">thirdName1=#{thirdName1},</if>
|
||||
<if test="thirdName2 != null">thirdName2=#{thirdName2},</if>
|
||||
<if test="thirdName3 != null">thirdName3=#{thirdName3},</if>
|
||||
<if test="thirdName4 != null">thirdName4=#{thirdName4},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="corpType != null">corpType=#{corpType},</if>
|
||||
<if test="outType != null">outType=#{outType},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_corp
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectById" parameterType="Map" resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
select *
|
||||
FROM basic_corp
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="batchSelectByIds" resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
select *
|
||||
from basic_corp where id in
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="batchSelectByErpIds" resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
select *
|
||||
from basic_corp where erpId in
|
||||
<foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectByName" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.basic.BasicUnitMaintainEntity">
|
||||
SELECT *
|
||||
FROM basic_corp
|
||||
WHERE (name = #{name}) limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="importBasicUnitMaintain" keyProperty="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}
|
||||
)
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.basic.BasicBussinessTypeRoleDao">
|
||||
<select id="getListByRoleId" resultType="com.glxp.api.entity.basic.BasicBussinessTypeRoleEntity">
|
||||
select *
|
||||
from basic_bussiness_type_role
|
||||
where role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
delete
|
||||
from basic_bussiness_type_role
|
||||
where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
<insert id="insert" parameterType="com.glxp.api.entity.basic.BasicBussinessTypeRoleEntity">
|
||||
insert into basic_bussiness_type_role
|
||||
(role_id, action)
|
||||
values
|
||||
<foreach collection="basicBussinessTypeRoleEntities" index="index" item="item" separator=",">
|
||||
(#{item.role_id},
|
||||
#{item.action})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.system.SetupDao">
|
||||
|
||||
|
||||
<select id="findSetup" parameterType="Long"
|
||||
resultType="com.glxp.api.entity.info.SetupEntity">
|
||||
SELECT * FROM customer_set where customerId = #{customerId}
|
||||
</select>
|
||||
|
||||
<update id="modifySetup" parameterType="com.glxp.api.entity.info.SetupEntity">
|
||||
|
||||
UPDATE customer_set
|
||||
<set>
|
||||
<if test="checkUpbill != null">checkUpbill=#{checkUpbill},</if>
|
||||
<if test="checkStock != null">checkStock=#{checkStock},</if>
|
||||
<if test="checkRepeat != null">checkRepeat=#{checkRepeat},</if>
|
||||
<if test="downloadRelation != null">downloadRelation=#{downloadRelation},</if>
|
||||
<if test="uploadTime != null">uploadTime=#{uploadTime},</if>
|
||||
<if test="lastUploadDate != null">lastUploadDate=#{lastUploadDate},</if>
|
||||
</set>
|
||||
WHERE customerId=#{customerId}
|
||||
|
||||
|
||||
</update>
|
||||
|
||||
<insert id="insertSetup" parameterType="com.glxp.api.entity.info.SetupEntity">
|
||||
replace INTO customer_set(customerId,
|
||||
checkUpbill,checkStock,checkRepeat,downloadRelation,uploadTime,lastUploadDate) values
|
||||
(
|
||||
#{customerId},
|
||||
#{checkUpbill}, #{checkStock} , #{checkRepeat}, #{downloadRelation}
|
||||
,#{uploadTime},#{lastUploadDate})
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue