diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java index b3b5b3be..9f83fb57 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/DepotController.java @@ -7,9 +7,11 @@ import com.jsh.erp.base.TableDataInfo; import com.jsh.erp.datasource.entities.Depot; import com.jsh.erp.datasource.entities.DepotEx; import com.jsh.erp.datasource.entities.MaterialInitialStock; +import com.jsh.erp.datasource.entities.User; import com.jsh.erp.service.DepotService; import com.jsh.erp.service.MaterialService; import com.jsh.erp.service.UserBusinessService; +import com.jsh.erp.service.UserService; import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.Constants; import com.jsh.erp.utils.ErpInfo; @@ -27,6 +29,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; import static com.jsh.erp.utils.ResponseJsonUtil.returnStr; @@ -49,6 +53,9 @@ public class DepotController extends BaseController { @Resource private MaterialService materialService; + @Resource + private UserService userService; + @GetMapping(value = "/info") @ApiOperation(value = "根据id获取信息") public String getList(@RequestParam("id") Long id, diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/SupplierController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/SupplierController.java index 347baaf8..1cbe2904 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/SupplierController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/SupplierController.java @@ -350,54 +350,6 @@ public class SupplierController extends BaseController { return obj; } - /** - * 客户对应用户显示 - * @param type - * @param oneValue - * @param request - * @return - */ - @GetMapping(value = "/getCustomerUser") - @ApiOperation(value = "客户对应用户显示") - public JSONArray findUserCustomer(@RequestParam("UBType") String type, @RequestParam("UBValue") String oneValue, - HttpServletRequest request) throws Exception{ - JSONArray arr = new JSONArray(); - try { - //获取权限信息 - List keyIdList = userBusinessService.getUBKeyIdByTypeAndOneValue(type, oneValue); - Map keyIdMap = keyIdList.stream().collect(Collectors.toMap(Function.identity(),Function.identity())); - List dataList = userService.getUser(request); - //开始拼接json数据 - JSONObject outer = new JSONObject(); - outer.put("id", 0); - outer.put("key", 0); - outer.put("value", 0); - outer.put("title", "用户列表"); - outer.put("attributes", "用户列表"); - //存放数据json数组 - JSONArray dataArray = new JSONArray(); - if (null != dataList) { - for (User user : dataList) { - JSONObject item = new JSONObject(); - item.put("id", user.getId()); - item.put("key", user.getId()); - item.put("value", user.getId()); - item.put("title", user.getLoginName() + "(" + user.getUsername() + ")"); - item.put("attributes", user.getLoginName()); - if (keyIdMap.get(user.getId())!=null) { - item.put("checked", true); - } - dataArray.add(item); - } - } - outer.put("children", dataArray); - arr.add(outer); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - return arr; - } - /** * 根据客户或供应商查询期初、期初已收等信息 * @param organId diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java index a2f24833..eae2683c 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java @@ -13,10 +13,7 @@ import com.jsh.erp.datasource.entities.UserEx; import com.jsh.erp.datasource.vo.TreeNodeEx; import com.jsh.erp.exception.BusinessParamCheckingException; import com.jsh.erp.exception.BusinessRunTimeException; -import com.jsh.erp.service.RedisService; -import com.jsh.erp.service.RoleService; -import com.jsh.erp.service.TenantService; -import com.jsh.erp.service.UserService; +import com.jsh.erp.service.*; import com.jsh.erp.utils.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -29,6 +26,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; import static com.jsh.erp.utils.ResponseJsonUtil.returnStr; @@ -54,6 +53,9 @@ public class UserController extends BaseController { @Resource private TenantService tenantService; + @Resource + private UserBusinessService userBusinessService; + @Resource private RedisService redisService; @@ -454,6 +456,54 @@ public class UserController extends BaseController { return res; } + /** + * 获取对应的用户显示 + * @param type + * @param oneValue + * @param request + * @return + */ + @GetMapping(value = "/getUserWithChecked") + @ApiOperation(value = "获取对应的用户显示") + public JSONArray getUserWithChecked(@RequestParam("UBType") String type, @RequestParam("UBValue") String oneValue, + HttpServletRequest request) throws Exception{ + JSONArray arr = new JSONArray(); + try { + //获取权限信息 + List keyIdList = userBusinessService.getUBKeyIdByTypeAndOneValue(type, oneValue); + Map keyIdMap = keyIdList.stream().collect(Collectors.toMap(Function.identity(),Function.identity())); + List dataList = userService.getUser(request); + //开始拼接json数据 + JSONObject outer = new JSONObject(); + outer.put("id", 0); + outer.put("key", 0); + outer.put("value", 0); + outer.put("title", "用户列表"); + outer.put("attributes", "用户列表"); + //存放数据json数组 + JSONArray dataArray = new JSONArray(); + if (null != dataList) { + for (User user : dataList) { + JSONObject item = new JSONObject(); + item.put("id", user.getId()); + item.put("key", user.getId()); + item.put("value", user.getId()); + item.put("title", user.getLoginName() + "(" + user.getUsername() + ")"); + item.put("attributes", user.getLoginName()); + if (keyIdMap.get(user.getId())!=null) { + item.put("checked", true); + } + dataArray.add(item); + } + } + outer.put("children", dataArray); + arr.add(outer); + } catch (Exception e) { + logger.error(e.getMessage(), e); + } + return arr; + } + /** * 获取随机校验码 * @param response diff --git a/jshERP-boot/src/main/resources/mapper_xml/UserBusinessMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/UserBusinessMapperEx.xml index 19f66f37..6e909538 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/UserBusinessMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/UserBusinessMapperEx.xml @@ -22,11 +22,12 @@ update jsh_user_business set value= #{ubValue} where type = #{type} and key_id = #{keyId} + and ifnull(delete_flag,'0') !='1' select * from jsh_user_business ub - where ub.type='UserCustomer' + where ub.type = #{type} and ifnull(ub.delete_flag,'0') !='1' \ No newline at end of file