shenji 1 vuosi sitten
vanhempi
commit
19b13b5d9f

+ 29 - 30
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/controller/MaterialInController.java

@@ -1,46 +1,42 @@
 package org.jeecg.modules.oa.controller;
 
-import java.io.UnsupportedEncodingException;
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.jeecg.common.system.vo.LoginUser;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.oa.entity.MaterialInDetail;
 import org.jeecg.modules.oa.entity.MaterialIn;
-import org.jeecg.modules.oa.vo.MaterialInPage;
-import org.jeecg.modules.oa.service.IMaterialInService;
+import org.jeecg.modules.oa.entity.MaterialInDetail;
 import org.jeecg.modules.oa.service.IMaterialInDetailService;
+import org.jeecg.modules.oa.service.IMaterialInService;
+import org.jeecg.modules.oa.vo.MaterialInPage;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import lombok.extern.slf4j.Slf4j;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.jeecg.common.aspect.annotation.AutoLog;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
  /**
  * @Description: 物料入库等级
@@ -90,6 +86,9 @@ public class MaterialInController {
 	@ApiOperation(value="物料入库等级-添加", notes="物料入库等级-添加")
 	@PostMapping(value = "/add")
 	public Result<?> add(@RequestBody MaterialInPage materialInPage) {
+		if(materialInPage.getMaterialInDetailList()==null || materialInPage.getMaterialInDetailList().size()==0){
+			return Result.error("请添加至少一个物料");
+		}
 		MaterialIn materialIn = new MaterialIn();
 		BeanUtils.copyProperties(materialInPage, materialIn);
 		materialInService.saveMain(materialIn, materialInPage.getMaterialInDetailList());

+ 4 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/oa/service/impl/MaterialInDetailServiceImpl.java

@@ -35,8 +35,11 @@ public class MaterialInDetailServiceImpl extends ServiceImpl<MaterialInDetailMap
     @Override
     @Transactional
     public boolean save(MaterialInDetail entity) {
-        super.save(entity);
         Material material = materialService.getById(entity.getCdMaterialId());
+        if (material == null) {
+            return false;
+        }
+        super.save(entity);
         material.setQuantity(material.getQuantity().add(entity.getQuantity()));
         return materialService.saveOrUpdate(material);
     }

+ 38 - 30
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -120,12 +120,16 @@ public class SysUserController {
         user.setSyHireType(null);
 
         String username = user.getUsername();
-        user.setUsername(null);
+        if(StringUtils.isNotBlank(username) && username.indexOf(",")<0) {
+            user.setUsername(null);
+        }
         String realname = user.getRealname();
         user.setRealname(null);
 
-		QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
-		queryWrapper.like(StringUtils.isNotBlank(username),"username",username);
+        QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap());
+        if(StringUtils.isNotBlank(username) && username.indexOf(",")<0) {
+            queryWrapper.like(StringUtils.isNotBlank(username),"username",username);
+        }
         queryWrapper.like(StringUtils.isNotBlank(realname),"realname",realname);
 		Page<SysUser> page = new Page<SysUser>(pageNo, pageSize);
 		//根据公司id过滤
@@ -1770,39 +1774,43 @@ public class SysUserController {
             public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
             }
         });
-        ResponseEntity<JSONObject> response = RestUtil.getNative("http://172.18.91.50:9002/prod-api/authEmployee/lastweek",null,null);
-        int statusCode = response.getStatusCodeValue();
-        JSONObject res = response.getBody();
+        try {
+            ResponseEntity<JSONObject> response = RestUtil.getNative("http://172.18.91.50:9002/prod-api/authEmployee/lastweek", null, null);
+            int statusCode = response.getStatusCodeValue();
+            JSONObject res = response.getBody();
 
-        if(HttpStatus.OK.value()!=statusCode){
-            result.setCode(statusCode);
-            result.setMessage(res.getString("error_description"));
-        }else{
-            String code = res.getString("error_code");
-            String msg = res.getString("msg");
-            JSONArray data = res.getJSONArray("data");
+            if(HttpStatus.OK.value()!=statusCode){
+                result.setCode(statusCode);
+                result.setMessage(res.getString("error_description"));
+            }else{
+                String code = res.getString("error_code");
+                String msg = res.getString("msg");
+                JSONArray data = res.getJSONArray("data");
 
-            List<JSONObject> newUser = new ArrayList<>();
+                List<JSONObject> newUser = new ArrayList<>();
 
-            if(data==null || data.size()==0){
-                result.setCode(statusCode);
-                result.setResult(newUser);
-                return result;
-            }
+                if(data==null || data.size()==0){
+                    result.setCode(statusCode);
+                    result.setResult(newUser);
+                    return result;
+                }
 
-            List<SysUser> sysUsers = sysUserService.queryAllUserInfo();
-            List<String> userNames = sysUsers.stream().map(SysUser::getUsername).collect(Collectors.toList());
-            for (int i = 0; i < data.size(); i++) {
-                JSONObject user = data.getJSONObject(i);
-                String userId = user.getString("user_id");
-                int activeState = user.getIntValue("active_state");
-                if (! userNames.contains(userId) && activeState==1) {
-                    newUser.add(user);
+                List<SysUser> sysUsers = sysUserService.queryAllUserInfo();
+                List<String> userNames = sysUsers.stream().map(SysUser::getUsername).collect(Collectors.toList());
+                for (int i = 0; i < data.size(); i++) {
+                    JSONObject user = data.getJSONObject(i);
+                    String userId = user.getString("user_id");
+                    int activeState = user.getIntValue("active_state");
+                    if (! userNames.contains(userId) && activeState==1) {
+                        newUser.add(user);
+                    }
                 }
-            }
 
-            result.setCode(statusCode);
-            result.setResult(newUser);
+                result.setCode(statusCode);
+                result.setResult(newUser);
+            }
+        }catch (Exception e){
+            result.error500("无法获取新增用户");
         }
         return result;
 

+ 2 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/entity/SysUserContact.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -66,6 +67,7 @@ public class SysUserContact implements Serializable {
 	/**性别*/
 	@Excel(name = "性别", width = 15)
 	@ApiModelProperty(value = "性别")
+	@Dict(dicCode = "sex")
 	private java.lang.Integer sex;
 	/**联系方式*/
 	@Excel(name = "联系方式", width = 15)

+ 1 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml

@@ -150,6 +150,7 @@
 				END AS "post",
 			   a.telephone AS "telephone",
 			   a.email AS "email",
+				a.mobile AS "mobile" ,
 			   a.phone AS "phone" ,
 			   a.n_Virtual_No as "nVirtualNo",
 			   a.n_Company_Phone as "nCompanyPhone",