|
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -47,6 +48,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
+import java.lang.reflect.InvocationTargetException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -195,15 +197,43 @@ public class SysUserController {
|
|
|
// System.out.println(oldUser.getNCompanyLine() +"====="+ newUser.getNCompanyLine());
|
|
|
// System.out.println(oldUser.getTelephone() +"====="+ newUser.getTelephone());
|
|
|
// System.out.println(oldUser.getEmail() +"====="+ newUser.getEmail());
|
|
|
- if(!oldUser.getRealname().equals(newUser.getRealname()) ||
|
|
|
- !oldUser.getWorkNo() .equals( newUser.getWorkNo()) ||
|
|
|
- !oldUser.getPost() .equals( newUser.getPost()) ||
|
|
|
- !oldUser.getPhone() .equals( newUser.getPhone()) ||
|
|
|
- !oldUser.getNVirtualNo() .equals( newUser.getNVirtualNo()) ||
|
|
|
- !oldUser.getNCompanyPhone() .equals( newUser.getNCompanyPhone()) ||
|
|
|
- !oldUser.getNCompanyLine() .equals( newUser.getNCompanyLine()) ||
|
|
|
- !oldUser.getTelephone() .equals( newUser.getTelephone()) ||
|
|
|
- !oldUser.getEmail() .equals( newUser.getEmail())
|
|
|
+
|
|
|
+ String getRealname = StringUtils.isBlank(newUser.getRealname()) ? "0":newUser.getRealname();
|
|
|
+ String oGetRealname = StringUtils.isBlank(oldUser.getRealname()) ? "0":oldUser.getRealname();
|
|
|
+
|
|
|
+ String getWorkNo = StringUtils.isBlank(newUser.getWorkNo()) ? "0":newUser.getWorkNo();
|
|
|
+ String oGetWorkNo = StringUtils.isBlank(oldUser.getWorkNo()) ? "0":oldUser.getWorkNo();
|
|
|
+
|
|
|
+ String getPost = StringUtils.isBlank(newUser.getPost()) ? "0":newUser.getPost();
|
|
|
+ String oGetPost = StringUtils.isBlank(oldUser.getPost()) ? "0":oldUser.getPost();
|
|
|
+
|
|
|
+ String getPhone = StringUtils.isBlank(newUser.getPhone()) ? "0":newUser.getPhone();
|
|
|
+ String oGetPhone = StringUtils.isBlank(oldUser.getPhone()) ? "0":oldUser.getPhone();
|
|
|
+
|
|
|
+ String getNVirtualNo = StringUtils.isBlank(newUser.getNVirtualNo()) ? "0":newUser.getNVirtualNo();
|
|
|
+ String oGetNVirtualNo = StringUtils.isBlank(oldUser.getNVirtualNo()) ? "0":oldUser.getNVirtualNo();
|
|
|
+
|
|
|
+ String getNCompanyPhone = StringUtils.isBlank(newUser.getNCompanyPhone()) ? "0":newUser.getNCompanyPhone();
|
|
|
+ String oGetNCompanyPhone = StringUtils.isBlank(oldUser.getNCompanyPhone()) ? "0":oldUser.getNCompanyPhone();
|
|
|
+
|
|
|
+ String getNCompanyLine = StringUtils.isBlank(newUser.getNCompanyLine()) ? "0":newUser.getNCompanyLine();
|
|
|
+ String oGetNCompanyLine = StringUtils.isBlank(oldUser.getNCompanyLine()) ? "0":oldUser.getNCompanyLine();
|
|
|
+
|
|
|
+ String getTelephone = StringUtils.isBlank(newUser.getTelephone()) ? "0":newUser.getTelephone();
|
|
|
+ String oGetTelephone = StringUtils.isBlank(oldUser.getTelephone()) ? "0":oldUser.getTelephone();
|
|
|
+
|
|
|
+ String getEmail = StringUtils.isBlank(newUser.getEmail()) ? "0":newUser.getEmail();
|
|
|
+ String oGetEmail = StringUtils.isBlank(oldUser.getEmail()) ? "0":oldUser.getEmail();
|
|
|
+
|
|
|
+ if(!getRealname.equals(oGetRealname) ||
|
|
|
+ !getWorkNo.equals(oGetWorkNo) ||
|
|
|
+ !getPost.equals(oGetPost) ||
|
|
|
+ !getPhone.equals(oGetPhone) ||
|
|
|
+ !getNVirtualNo.equals(oGetNVirtualNo) ||
|
|
|
+ !getNCompanyPhone.equals(oGetNCompanyPhone) ||
|
|
|
+ !getNCompanyLine.equals(oGetNCompanyLine) ||
|
|
|
+ !getTelephone.equals(oGetTelephone) ||
|
|
|
+ !getEmail.equals(oGetEmail)
|
|
|
|
|
|
){
|
|
|
return "1";
|
|
@@ -451,7 +481,10 @@ public class SysUserController {
|
|
|
* @param sysUser
|
|
|
*/
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
- public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request) {
|
|
|
+ public ModelAndView exportXls(SysUser sysUser,HttpServletRequest request,String address) throws InvocationTargetException, IllegalAccessException {
|
|
|
+ if(StringUtils.isNotBlank(address)){
|
|
|
+ sysUser.setCommunication("0");
|
|
|
+ }
|
|
|
// Step.1 组装查询条件
|
|
|
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(sysUser, request.getParameterMap());
|
|
|
LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
|
|
@@ -463,14 +496,25 @@ public class SysUserController {
|
|
|
if(!oConvertUtils.isEmpty(selections)){
|
|
|
queryWrapper.in("id",selections.split(","));
|
|
|
}
|
|
|
+ if(StringUtils.isNotBlank(address)){
|
|
|
+ queryWrapper.orderByAsc("work_no");
|
|
|
+ }else{
|
|
|
+ queryWrapper.orderByAsc("create_time");
|
|
|
+ }
|
|
|
+
|
|
|
//update-end--Author:kangxiaolin Date:20180825 for:[03]用户导出,如果选择数据则只导出相关数据----------------------
|
|
|
List<SysUser> pageList = sysUserService.list(queryWrapper);
|
|
|
+ List<SysUserAddress> pageList2 = new ArrayList<>();
|
|
|
List<SysPosition> list2 = sysPositionService.list();
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
for(SysPosition o:list2){
|
|
|
map.put(o.getCode(),o.getName());
|
|
|
}
|
|
|
for(SysUser o:pageList){
|
|
|
+
|
|
|
+ SysUserAddress add = new SysUserAddress();
|
|
|
+
|
|
|
+
|
|
|
if(StringUtils.isNotBlank(o.getIfOa()) && o.getIfOa().equals("1")){
|
|
|
o.setIfOa("是");
|
|
|
}else{
|
|
@@ -485,14 +529,22 @@ public class SysUserController {
|
|
|
if(StringUtils.isNotBlank(o.getPost()) && map.containsKey(o.getPost())){
|
|
|
o.setPost(map.get(o.getPost()));
|
|
|
}
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(add,o);
|
|
|
+ pageList2.add(add);
|
|
|
}
|
|
|
|
|
|
//导出文件名称
|
|
|
mv.addObject(NormalExcelConstants.FILE_NAME, "用户列表");
|
|
|
- mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(address)){
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, SysUserAddress.class);
|
|
|
+ }else{
|
|
|
+ mv.addObject(NormalExcelConstants.CLASS, SysUser.class);
|
|
|
+ }
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("用户列表数据", "导出人:"+user.getRealname(), "导出信息"));
|
|
|
- mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
|
|
+ mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("导出列表数据", "导出人:"+user.getRealname(), "导出信息"));
|
|
|
+ mv.addObject(NormalExcelConstants.DATA_LIST, pageList2);
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
@@ -1310,6 +1362,22 @@ public class SysUserController {
|
|
|
result.setSuccess(true);
|
|
|
result.setResult(pageList);
|
|
|
log.info(pageList.toString());
|
|
|
+ Map<String,Object> mapOne = new HashMap<>();
|
|
|
+
|
|
|
+ List<Map<String,String>> supplierList = new ArrayList<>();//临时字段,存放u8中的供应商档案
|
|
|
+ Map<String,String> map2 = new HashMap<>();
|
|
|
+ map2.put("label","上海供应商");
|
|
|
+ map2.put("value","00001");
|
|
|
+ supplierList.add(map2);
|
|
|
+
|
|
|
+ Map<String,String> map22 = new HashMap<>();
|
|
|
+ map22.put("label","北京供应商");
|
|
|
+ map22.put("value","00002");
|
|
|
+ supplierList.add(map22);
|
|
|
+
|
|
|
+ mapOne.put("supplierList",supplierList);
|
|
|
+ result.setData(mapOne);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -1323,7 +1391,14 @@ public class SysUserController {
|
|
|
String[] idList = ids.split(",");
|
|
|
if(idList.length > 0){
|
|
|
for(String o:idList){
|
|
|
- sysUserService.updateUserBatch(o,Double.valueOf(gongJiJin),Double.valueOf(sheBao));
|
|
|
+ if(StringUtils.isBlank(gongJiJin)){
|
|
|
+ sysUserService.updateUserBatch(o,null,Double.valueOf(sheBao));
|
|
|
+ }else if(StringUtils.isBlank(sheBao)){
|
|
|
+ sysUserService.updateUserBatch(o,Double.valueOf(gongJiJin),null);
|
|
|
+ }else{
|
|
|
+ sysUserService.updateUserBatch(o,Double.valueOf(gongJiJin),Double.valueOf(sheBao));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|