Commit 3525ac22d984fcd073d979e4fb5ef211470add42

Authored by xqs
2 parents 250829ea bfd77c01

Merge branch 'develop' of http://www.huahengrobot.com:90/wms/wms2 into develop

Showing 27 changed files with 858 additions and 260 deletions
src/main/java/com/huaheng/common/utils/file/FileUploadUtils.java
@@ -7,6 +7,7 @@ import org.apache.shiro.crypto.hash.Md5Hash; @@ -7,6 +7,7 @@ import org.apache.shiro.crypto.hash.Md5Hash;
7 import org.springframework.web.multipart.MultipartFile; 7 import org.springframework.web.multipart.MultipartFile;
8 8
9 import java.io.File; 9 import java.io.File;
  10 +import java.io.FileNotFoundException;
10 import java.io.IOException; 11 import java.io.IOException;
11 12
12 /** 13 /**
@@ -37,6 +38,16 @@ public class FileUploadUtils @@ -37,6 +38,16 @@ public class FileUploadUtils
37 */ 38 */
38 public static final String IMAGE_JPG_EXTENSION = ".jpg"; 39 public static final String IMAGE_JPG_EXTENSION = ".jpg";
39 40
  41 + /**
  42 + * 图片类型png
  43 + */
  44 + public static final String IMAGE_PNG_EXTENSION = ".png";
  45 +
  46 + /**
  47 + * 图片类型ico
  48 + */
  49 + public static final String IMAGE_ICO_EXTENSION = ".ico";
  50 +
40 private static int counter = 0; 51 private static int counter = 0;
41 52
42 public static void setDefaultBaseDir(String defaultBaseDir) 53 public static void setDefaultBaseDir(String defaultBaseDir)
@@ -130,7 +141,7 @@ public class FileUploadUtils @@ -130,7 +141,7 @@ public class FileUploadUtils
130 } 141 }
131 if (!desc.exists()) 142 if (!desc.exists())
132 { 143 {
133 - desc.createNewFile(); 144 +// desc.createNewFile();
134 } 145 }
135 return desc; 146 return desc;
136 } 147 }
@@ -161,4 +172,16 @@ public class FileUploadUtils @@ -161,4 +172,16 @@ public class FileUploadUtils
161 } 172 }
162 } 173 }
163 174
  175 + /**
  176 + * 公司logo,icon图片上传路径
  177 + * @return
  178 + * @throws FileNotFoundException
  179 + */
  180 + public static String getCorporationUploadPath() throws FileNotFoundException {
  181 + //上传到resource/static/corporation目录下,jar包布署时无法实现
  182 +// String path = ResourceUtils.getURL("classpath:").getPath()+"static/";
  183 + //上传到huangheng.profile配置的目录下
  184 + String path = getDefaultBaseDir();
  185 + return path;
  186 + }
164 } 187 }
src/main/java/com/huaheng/framework/config/ShiroConfig.java
@@ -254,6 +254,7 @@ public class ShiroConfig { @@ -254,6 +254,7 @@ public class ShiroConfig {
254 filterChainDefinitionMap.put("/login", "anon"); 254 filterChainDefinitionMap.put("/login", "anon");
255 filterChainDefinitionMap.put("/api/login", "anon"); 255 filterChainDefinitionMap.put("/api/login", "anon");
256 filterChainDefinitionMap.put("/mobile/login", "anon"); 256 filterChainDefinitionMap.put("/mobile/login", "anon");
  257 + filterChainDefinitionMap.put("/api/getTokenForMobile", "anon");
257 filterChainDefinitionMap.put("/getWarehouseByUserCode", "anon"); 258 filterChainDefinitionMap.put("/getWarehouseByUserCode", "anon");
258 filterChainDefinitionMap.put("/API/WMS/v2/login", "anon"); 259 filterChainDefinitionMap.put("/API/WMS/v2/login", "anon");
259 filterChainDefinitionMap.put("/api/**", "anon"); 260 filterChainDefinitionMap.put("/api/**", "anon");
src/main/java/com/huaheng/framework/token/TokenController.java
@@ -3,16 +3,16 @@ package com.huaheng.framework.token; @@ -3,16 +3,16 @@ package com.huaheng.framework.token;
3 import com.huaheng.common.utils.StringUtils; 3 import com.huaheng.common.utils.StringUtils;
4 import com.huaheng.framework.shiro.service.PasswordService; 4 import com.huaheng.framework.shiro.service.PasswordService;
5 import com.huaheng.framework.web.controller.BaseController; 5 import com.huaheng.framework.web.controller.BaseController;
  6 +import com.huaheng.framework.web.domain.AjaxResult;
6 import com.huaheng.framework.web.domain.Result; 7 import com.huaheng.framework.web.domain.Result;
7 import com.huaheng.pc.system.user.domain.User; 8 import com.huaheng.pc.system.user.domain.User;
8 import com.huaheng.pc.system.user.service.IUserService; 9 import com.huaheng.pc.system.user.service.IUserService;
9 -import org.springframework.web.bind.annotation.PostMapping;  
10 -import org.springframework.web.bind.annotation.RequestMapping;  
11 -import org.springframework.web.bind.annotation.ResponseBody;  
12 -import org.springframework.web.bind.annotation.RestController; 10 +import io.swagger.annotations.ApiParam;
  11 +import org.springframework.web.bind.annotation.*;
13 12
14 import javax.annotation.Resource; 13 import javax.annotation.Resource;
15 import java.util.Calendar; 14 import java.util.Calendar;
  15 +import java.util.Map;
16 16
17 /** 17 /**
18 * Created by Enzo Cotter on 2020/6/11. 18 * Created by Enzo Cotter on 2020/6/11.
@@ -53,4 +53,23 @@ public class TokenController extends BaseController { @@ -53,4 +53,23 @@ public class TokenController extends BaseController {
53 } 53 }
54 54
55 } 55 }
  56 +
  57 + @PostMapping("/getTokenForMobile")
  58 + @ResponseBody
  59 + public AjaxResult getTokenForMobile(@RequestBody @ApiParam(value="code和password的Map集合") Map<String, String> param) {
  60 + String userName = param.get("userName");
  61 + String password = param.get("password");
  62 + if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password)) {
  63 + return AjaxResult.error("用户名和密码不能为空");
  64 + }
  65 + User user = userService.selectUserByLoginName(userName);
  66 +
  67 + if (user.getPassword().equals(passwordService.encryptPassword(user.getLoginName(), password, user.getSalt()))) {
  68 + String token = tokenService.createTokenForMobile(user);
  69 + return AjaxResult.success("获取token成功").setData(token);
  70 + } else {
  71 + return AjaxResult.error("密码错误");
  72 + }
  73 +
  74 + }
56 } 75 }
src/main/java/com/huaheng/framework/token/TokenService.java
@@ -68,6 +68,30 @@ public class TokenService { @@ -68,6 +68,30 @@ public class TokenService {
68 } 68 }
69 69
70 /** 70 /**
  71 + * 创建token
  72 + * @param user 用户
  73 + * @return
  74 + */
  75 + public String createTokenForMobile(User user){
  76 + //签发时间
  77 + Date iatTime = new Date();
  78 + //expire time
  79 + Calendar nowTime = Calendar.getInstance();
  80 + nowTime.add(Calendar.DATE, EXPIRE_TIME);
  81 + Date expireTime = nowTime.getTime();
  82 +
  83 + Claims claims = Jwts.claims();
  84 + claims.put("user", user);
  85 + claims.setIssuedAt(iatTime);
  86 + String token = Jwts.builder().setClaims(claims)
  87 + .signWith(SignatureAlgorithm.HS512,signingKey).compact();
  88 +// if (redisCache.setCacheObject(token, user.toString(), EXPIRE_TIME, TimeUnit.DAYS) == null) {
  89 +// throw new ServiceException("redis异常");
  90 +// }
  91 + return token;
  92 + }
  93 +
  94 + /**
71 * 解析token 95 * 解析token
72 * @param token 96 * @param token
73 */ 97 */
src/main/java/com/huaheng/framework/token/WebAppConfigurer.java
@@ -18,6 +18,7 @@ public class WebAppConfigurer implements WebMvcConfigurer { @@ -18,6 +18,7 @@ public class WebAppConfigurer implements WebMvcConfigurer {
18 public void addInterceptors(InterceptorRegistry interceptorRegistry) { 18 public void addInterceptors(InterceptorRegistry interceptorRegistry) {
19 interceptorRegistry.addInterceptor(apiInterceptor()) 19 interceptorRegistry.addInterceptor(apiInterceptor())
20 .addPathPatterns("/api/**") 20 .addPathPatterns("/api/**")
21 - .excludePathPatterns("/api/getToken"); 21 + .excludePathPatterns("/api/getToken")
  22 + .excludePathPatterns("/api/getTokenForMobile");
22 } 23 }
23 } 24 }
src/main/java/com/huaheng/mobile/download/DownloadController.java 0 → 100644
  1 +package com.huaheng.mobile.download;
  2 +
  3 +import com.huaheng.framework.web.domain.AjaxResult;
  4 +import com.huaheng.pc.config.sendMail.service.MailServiceImpl;
  5 +import org.apache.commons.fileupload.util.Streams;
  6 +import org.apache.commons.io.IOUtils;
  7 +import org.apache.commons.lang.exception.ExceptionUtils;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +import org.springframework.web.multipart.MultipartFile;
  14 +
  15 +import javax.servlet.http.HttpServletRequest;
  16 +import javax.servlet.http.HttpServletResponse;
  17 +import java.io.*;
  18 +
  19 +@RestController
  20 +@RequestMapping("/mobile/download")
  21 +public class DownloadController {
  22 +
  23 + private final static String fileDir="files";
  24 + private final static String rootPath = System.getProperty("user.home")+File.separator+fileDir+File.separator;
  25 + private final Logger logger = LoggerFactory.getLogger(DownloadController.class);
  26 + @RequestMapping("/upload")
  27 + public Object uploadFile(@RequestParam("file") MultipartFile[] multipartFiles, final HttpServletResponse response, final HttpServletRequest request){
  28 + File fileDir = new File(rootPath);
  29 + if (!fileDir.exists() && !fileDir.isDirectory()) {
  30 + fileDir.mkdirs();
  31 + }
  32 + try {
  33 + if (multipartFiles != null && multipartFiles.length > 0) {
  34 + for(int i = 0;i<multipartFiles.length;i++){
  35 + try {
  36 + //以原来的名称命名,覆盖掉旧的
  37 + String storagePath = rootPath+multipartFiles[i].getOriginalFilename();
  38 + logger.info("上传的文件:" + multipartFiles[i].getName() + "," + multipartFiles[i].getContentType() + "," + multipartFiles[i].getOriginalFilename()
  39 + +",保存的路径为:" + storagePath);
  40 + Streams.copy(multipartFiles[i].getInputStream(), new FileOutputStream(storagePath), true);
  41 + //或者下面的
  42 + // Path path = Paths.get(storagePath);
  43 + //Files.write(path,multipartFiles[i].getBytes());
  44 + } catch (IOException e) {
  45 + logger.error(ExceptionUtils.getFullStackTrace(e));
  46 + }
  47 + }
  48 + }
  49 +
  50 + } catch (Exception e) {
  51 + return AjaxResult.error(e.getMessage());
  52 + }
  53 + return AjaxResult.success("上传成功!");
  54 + }
  55 +
  56 + @RequestMapping("/download")
  57 + public Object downloadFile(@RequestParam String fileName, final HttpServletResponse response, final HttpServletRequest request){
  58 + OutputStream os = null;
  59 + InputStream is= null;
  60 + try {
  61 + // 取得输出流
  62 + os = response.getOutputStream();
  63 + // 清空输出流
  64 + response.reset();
  65 + response.setContentType("application/x-download;charset=GBK");
  66 + response.setHeader("Content-Disposition", "attachment;filename="+ new String(fileName.getBytes("utf-8"), "iso-8859-1"));
  67 + //读取流
  68 + File f = new File(rootPath+fileName);
  69 + is = new FileInputStream(f);
  70 + if (is == null) {
  71 + logger.error("下载附件失败,请检查文件“" + fileName + "”是否存在");
  72 + return AjaxResult.error("下载附件失败,请检查文件“" + fileName + "”是否存在");
  73 + }
  74 + //复制
  75 + IOUtils.copy(is, response.getOutputStream());
  76 + response.getOutputStream().flush();
  77 + } catch (IOException e) {
  78 + return AjaxResult.error("下载附件失败,error:"+e.getMessage());
  79 + }
  80 + //文件的关闭放在finally中
  81 + finally
  82 + {
  83 + try {
  84 + if (is != null) {
  85 + is.close();
  86 + }
  87 + } catch (IOException e) {
  88 + logger.error(ExceptionUtils.getFullStackTrace(e));
  89 + }
  90 + try {
  91 + if (os != null) {
  92 + os.close();
  93 + }
  94 + } catch (IOException e) {
  95 + logger.error(ExceptionUtils.getFullStackTrace(e));
  96 + }
  97 + }
  98 + return null;
  99 + }
  100 +
  101 +}
src/main/java/com/huaheng/mobile/receipt/MobileBatchReceiptController.java
@@ -574,4 +574,6 @@ public class MobileBatchReceiptController { @@ -574,4 +574,6 @@ public class MobileBatchReceiptController {
574 return AjaxResult.success(receiptType); 574 return AjaxResult.success(receiptType);
575 } 575 }
576 576
  577 +
  578 +
577 } 579 }
src/main/java/com/huaheng/pc/config/corporation/controller/CorporationController.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 import com.huaheng.common.support.Convert; 7 import com.huaheng.common.support.Convert;
8 import com.huaheng.common.utils.StringUtils; 8 import com.huaheng.common.utils.StringUtils;
  9 +import com.huaheng.common.utils.file.FileUploadUtils;
9 import com.huaheng.common.utils.security.ShiroUtils; 10 import com.huaheng.common.utils.security.ShiroUtils;
10 import com.huaheng.framework.aspectj.lang.annotation.Log; 11 import com.huaheng.framework.aspectj.lang.annotation.Log;
11 import com.huaheng.framework.aspectj.lang.constant.BusinessType; 12 import com.huaheng.framework.aspectj.lang.constant.BusinessType;
@@ -16,13 +17,18 @@ import com.huaheng.framework.web.page.TableDataInfo; @@ -16,13 +17,18 @@ import com.huaheng.framework.web.page.TableDataInfo;
16 import com.huaheng.framework.web.page.TableSupport; 17 import com.huaheng.framework.web.page.TableSupport;
17 import com.huaheng.pc.config.corporation.domain.Corporation; 18 import com.huaheng.pc.config.corporation.domain.Corporation;
18 import com.huaheng.pc.config.corporation.service.CorporationService; 19 import com.huaheng.pc.config.corporation.service.CorporationService;
  20 +import org.apache.commons.io.FileUtils;
19 import org.apache.shiro.authz.annotation.RequiresPermissions; 21 import org.apache.shiro.authz.annotation.RequiresPermissions;
20 import org.springframework.stereotype.Controller; 22 import org.springframework.stereotype.Controller;
21 import org.springframework.ui.ModelMap; 23 import org.springframework.ui.ModelMap;
22 import org.springframework.web.bind.annotation.*; 24 import org.springframework.web.bind.annotation.*;
  25 +import org.springframework.web.multipart.MultipartFile;
23 26
24 import javax.annotation.Resource; 27 import javax.annotation.Resource;
  28 +import java.io.File;
  29 +import java.io.IOException;
25 import java.util.Arrays; 30 import java.util.Arrays;
  31 +import java.util.Date;
26 import java.util.List; 32 import java.util.List;
27 33
28 /** 34 /**
@@ -38,7 +44,7 @@ public class CorporationController extends BaseController { @@ -38,7 +44,7 @@ public class CorporationController extends BaseController {
38 @Resource 44 @Resource
39 private CorporationService corporationService; 45 private CorporationService corporationService;
40 46
41 - private String prefix = "/config/corporation"; 47 + private String prefix = "config/corporation";
42 48
43 @RequiresPermissions("config:corporation:view") 49 @RequiresPermissions("config:corporation:view")
44 @GetMapping() 50 @GetMapping()
@@ -61,7 +67,6 @@ public class CorporationController extends BaseController { @@ -61,7 +67,6 @@ public class CorporationController extends BaseController {
61 67
62 lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), Corporation::getCreated, createdBegin) 68 lambdaQueryWrapper.ge(StringUtils.isNotEmpty(createdBegin), Corporation::getCreated, createdBegin)
63 .le(StringUtils.isNotEmpty(createdEnd), Corporation::getCreated, createdEnd) 69 .le(StringUtils.isNotEmpty(createdEnd), Corporation::getCreated, createdEnd)
64 - .like(StringUtils.isNotEmpty(corporation.getAddress()), Corporation::getAddress, corporation.getAddress())  
65 .like(StringUtils.isNotEmpty(corporation.getName()), Corporation::getName, corporation.getName()); 70 .like(StringUtils.isNotEmpty(corporation.getName()), Corporation::getName, corporation.getName());
66 71
67 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) { 72 if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
@@ -77,6 +82,12 @@ public class CorporationController extends BaseController { @@ -77,6 +82,12 @@ public class CorporationController extends BaseController {
77 } 82 }
78 } 83 }
79 84
  85 +// @GetMapping("/show")
  86 +// @ResponseBody
  87 +// public Corporation show(){
  88 +// return corporationService.getEnableCorporation();
  89 +// }
  90 +
80 /** 91 /**
81 * 新增公司 92 * 新增公司
82 */ 93 */
@@ -86,16 +97,45 @@ public class CorporationController extends BaseController { @@ -86,16 +97,45 @@ public class CorporationController extends BaseController {
86 } 97 }
87 98
88 /** 99 /**
89 - * 新增保存公司 100 + * 新增公司配置
90 */ 101 */
91 @RequiresPermissions("config:corporation:add") 102 @RequiresPermissions("config:corporation:add")
92 - @Log(title = "配置-容器类型设置", operating = "新增容器类型", action = BusinessType.INSERT) 103 + @Log(title = "通用-公司配置", operating = "新增公司配置", action = BusinessType.INSERT)
93 @PostMapping("/add") 104 @PostMapping("/add")
94 @ResponseBody 105 @ResponseBody
95 - public AjaxResult addSave(Corporation corporation) {  
96 - corporation.setCreateBy(ShiroUtils.getLoginName());  
97 - corporation.setCreateBy(ShiroUtils.getLoginName());  
98 - return toAjax(corporationService.save(corporation)); 106 + public AjaxResult addSave(Corporation corporation, @RequestParam("pLogoBigFile") MultipartFile pLogoBigFile,
  107 + @RequestParam("pLogoSmallFile") MultipartFile pLogoSmallFile,
  108 + @RequestParam("pIconFile") MultipartFile pIconFile) {
  109 + corporation.setCreatedBy(ShiroUtils.getLoginName());
  110 + corporation.setCreated(new Date());
  111 + boolean isEnable = corporation.isEnable();
  112 + corporation.setEnable(false);
  113 + String baseAddress = null;
  114 +
  115 + try {
  116 + corporationService.save(corporation);
  117 + baseAddress = FileUploadUtils.getCorporationUploadPath();
  118 + corporation.setBaseAddress(baseAddress);
  119 +
  120 + String subPath = corporation.getSubPath();
  121 + String savePath = corporation.getSavePath();
  122 +
  123 + String pIconName = FileUploadUtils.upload(savePath, pIconFile, FileUploadUtils.IMAGE_ICO_EXTENSION);
  124 + String pLogoBigName = FileUploadUtils.upload(savePath, pLogoBigFile, FileUploadUtils.IMAGE_PNG_EXTENSION);
  125 + String pLogoSmallName = FileUploadUtils.upload(savePath, pLogoSmallFile, FileUploadUtils.IMAGE_PNG_EXTENSION);
  126 +
  127 + corporation.setPIcon(subPath + pIconName);
  128 + corporation.setPLogoBig(subPath + pLogoBigName);
  129 + corporation.setPLogoSmall(subPath + pLogoSmallName);
  130 + corporationService.updateById(corporation);
  131 + if(isEnable) {
  132 + corporationService.enableCorporationById(corporation.getId());
  133 + }
  134 + } catch (Exception e) {
  135 + return error("图片上传失败:" + e.getMessage());
  136 + }
  137 +
  138 + return toAjax(true);
99 } 139 }
100 140
101 /** 141 /**
@@ -114,7 +154,44 @@ public class CorporationController extends BaseController { @@ -114,7 +154,44 @@ public class CorporationController extends BaseController {
114 @Log(title = "配置-公司", operating = "修改公司", action = BusinessType.UPDATE) 154 @Log(title = "配置-公司", operating = "修改公司", action = BusinessType.UPDATE)
115 @PostMapping("/edit") 155 @PostMapping("/edit")
116 @ResponseBody 156 @ResponseBody
117 - public AjaxResult editSave(Corporation corporation) { 157 + public AjaxResult editSave(Corporation corporation, @RequestParam(value = "pLogoBigFile", required = false) MultipartFile pLogoBigFile,
  158 + @RequestParam(value = "pLogoSmallFile", required = false) MultipartFile pLogoSmallFile,
  159 + @RequestParam(value = "pIconFile", required = false) MultipartFile pIconFile) {
  160 +
  161 + String baseAddress = null;
  162 + try {
  163 + baseAddress = FileUploadUtils.getCorporationUploadPath();
  164 + corporation.setBaseAddress(baseAddress);
  165 + String subPath = corporation.getSubPath();
  166 + String savePath = corporation.getSavePath();
  167 + Corporation oldCorp = corporationService.getById(corporation.getId());
  168 + if(pLogoBigFile != null){
  169 + String pLogoBigName = FileUploadUtils.upload(savePath, pLogoBigFile, FileUploadUtils.IMAGE_PNG_EXTENSION);
  170 + FileUtils.deleteQuietly(new File(oldCorp.getPLogoBigPath()));
  171 + corporation.setPLogoBig(subPath + pLogoBigName);
  172 + }
  173 +
  174 + if(pLogoSmallFile != null){
  175 + String pLogoSmallName = FileUploadUtils.upload(savePath, pLogoSmallFile, FileUploadUtils.IMAGE_PNG_EXTENSION);
  176 + FileUtils.deleteQuietly(new File(oldCorp.getPLogoSmallPath()));
  177 + corporation.setPLogoSmall(subPath + pLogoSmallName);
  178 + }
  179 +
  180 + if(pIconFile != null){
  181 + String pIconName = FileUploadUtils.upload(savePath, pIconFile, FileUploadUtils.IMAGE_ICO_EXTENSION);
  182 + FileUtils.deleteQuietly(new File(oldCorp.getPIconPath()));
  183 + corporation.setPIcon(subPath + pIconName);
  184 + }
  185 +
  186 + if(corporation.isEnable()){
  187 + corporationService.enableCorporationById(corporation.getId());
  188 + }
  189 + } catch (Exception e) {
  190 + return error("图片上传失败:" + e.getMessage());
  191 + }
  192 +
  193 + corporation.setLastUpdatedBy(ShiroUtils.getLoginName());
  194 + corporation.setLastUpdated(new Date());
118 return toAjax(corporationService.saveOrUpdate(corporation)); 195 return toAjax(corporationService.saveOrUpdate(corporation));
119 } 196 }
120 197
@@ -129,6 +206,16 @@ public class CorporationController extends BaseController { @@ -129,6 +206,16 @@ public class CorporationController extends BaseController {
129 if (StringUtils.isEmpty(ids)) { 206 if (StringUtils.isEmpty(ids)) {
130 return AjaxResult.error("id不能为空"); 207 return AjaxResult.error("id不能为空");
131 } 208 }
132 - return toAjax(corporationService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); 209 + Corporation corporation = corporationService.getById(ids);
  210 + boolean ret = false;
  211 + try {
  212 + String subPath = "img/corporation/" + corporation.getId() + "/";
  213 + String savePath = corporation.getBaseAddress() + subPath;
  214 + FileUtils.deleteDirectory(new File(savePath));
  215 + ret = corporationService.removeByIds(Arrays.asList(Convert.toIntArray(ids)));
  216 + }catch (IOException e){
  217 + error("文件删除失败:" + e.getMessage());
  218 + }
  219 + return toAjax(ret);
133 } 220 }
134 } 221 }
src/main/java/com/huaheng/pc/config/corporation/domain/Corporation.java
@@ -16,7 +16,7 @@ import lombok.Data; @@ -16,7 +16,7 @@ import lombok.Data;
16 @TableName(value = "corporation") 16 @TableName(value = "corporation")
17 public class Corporation implements Serializable { 17 public class Corporation implements Serializable {
18 @TableId(value = "id", type = IdType.AUTO) 18 @TableId(value = "id", type = IdType.AUTO)
19 - private Long id; 19 + private Integer id;
20 20
21 /** 21 /**
22 * 公司名称 22 * 公司名称
@@ -25,16 +25,59 @@ public class Corporation implements Serializable { @@ -25,16 +25,59 @@ public class Corporation implements Serializable {
25 private String name; 25 private String name;
26 26
27 /** 27 /**
28 - * logo 28 + * pLogoBig
29 */ 29 */
30 - @TableField(value = "logo")  
31 - private String logo; 30 + @TableField(value = "pLogoBig")
  31 + private String pLogoBig;
32 32
33 /** 33 /**
34 - * 地址 34 + * pLogoSmall
35 */ 35 */
36 - @TableField(value = "address")  
37 - private String address; 36 + @TableField(value = "pLogoSmall")
  37 + private String pLogoSmall;
  38 +
  39 + /**
  40 + * pIcon
  41 + */
  42 + @TableField(value = "pIcon")
  43 + private String pIcon;
  44 +
  45 + /**
  46 + * versionInfo
  47 + */
  48 + @TableField(value = "versionInfo")
  49 + private String versionInfo;
  50 +
  51 + /**
  52 + * baseAddress
  53 + */
  54 + @TableField(value = "baseAddress")
  55 + private String baseAddress;
  56 +
  57 + /**
  58 + * enable
  59 + */
  60 + @TableField(value = "enable")
  61 + private boolean enable;
  62 +
  63 + /**
  64 + * userDef1
  65 + */
  66 + @TableField(value = "userDef1")
  67 + private String userDef1;
  68 +
  69 + /**
  70 + * userDef2
  71 + */
  72 + @TableField(value = "userDef2")
  73 + private String userDef2;
  74 +
  75 + /**
  76 + * userDef3
  77 + */
  78 + @TableField(value = "userDef3")
  79 + private String userDef3;
  80 +
38 81
39 /** 82 /**
40 * 创建时间 83 * 创建时间
@@ -43,10 +86,61 @@ public class Corporation implements Serializable { @@ -43,10 +86,61 @@ public class Corporation implements Serializable {
43 private Date created; 86 private Date created;
44 87
45 /** 88 /**
46 - * 创建 89 + * 创建
47 */ 90 */
48 - @TableField(value = "create_by")  
49 - private String createBy; 91 + @TableField(value = "createdBy")
  92 + private String createdBy;
50 93
  94 + /**
  95 + * 更新时间
  96 + */
  97 + @TableField(value = "lastUpdated")
  98 + private Date lastUpdated;
  99 +
  100 + /**
  101 + * 更新者
  102 + */
  103 + @TableField(value = "lastUpdatedBy")
  104 + private String lastUpdatedBy;
51 private static final long serialVersionUID = 1L; 105 private static final long serialVersionUID = 1L;
  106 +
  107 + /**
  108 + * 拼装图片存储
  109 + * @return
  110 + */
  111 + public String getSavePath(){
  112 + return this.getBaseAddress() + this.getSubPath();
  113 + }
  114 +
  115 + /***
  116 + * 拼装图片相对路径
  117 + * @return
  118 + */
  119 + public String getSubPath(){
  120 + return "img/corporation/" + this.getId() + "/";
  121 + }
  122 +
  123 + /**
  124 + * 取pLogoBig的存储路径
  125 + * @return
  126 + */
  127 + public String getPLogoBigPath(){
  128 + return this.getBaseAddress() + this.getPLogoBig();
  129 + }
  130 +
  131 + /**
  132 + * 取pLogoSmall的存储路径
  133 + * @return
  134 + */
  135 + public String getPLogoSmallPath(){
  136 + return this.getBaseAddress() + this.getPLogoSmall();
  137 + }
  138 +
  139 + /**
  140 + * 取pIcon的存储路径
  141 + * @return
  142 + */
  143 + public String getPIconPath(){
  144 + return this.getBaseAddress() + this.getPIcon();
  145 + }
52 } 146 }
53 \ No newline at end of file 147 \ No newline at end of file
src/main/java/com/huaheng/pc/config/corporation/mapper/CorporationMapper.java
@@ -2,10 +2,17 @@ package com.huaheng.pc.config.corporation.mapper; @@ -2,10 +2,17 @@ package com.huaheng.pc.config.corporation.mapper;
2 2
3 import com.baomidou.mybatisplus.core.mapper.BaseMapper; 3 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 import com.huaheng.pc.config.corporation.domain.Corporation; 4 import com.huaheng.pc.config.corporation.domain.Corporation;
  5 +import org.apache.ibatis.annotations.Param;
5 6
6 /** 7 /**
7 * Created by Enzo Cotter on 2020/3/20. 8 * Created by Enzo Cotter on 2020/3/20.
8 */ 9 */
9 10
10 public interface CorporationMapper extends BaseMapper<Corporation> { 11 public interface CorporationMapper extends BaseMapper<Corporation> {
  12 +
  13 + Corporation getEnableCorporation();
  14 +
  15 + int enableCorporationById(@Param("id") Integer id);
  16 +
  17 + int disableAllCorporation();
11 } 18 }
12 \ No newline at end of file 19 \ No newline at end of file
src/main/java/com/huaheng/pc/config/corporation/service/CorporationService.java
1 package com.huaheng.pc.config.corporation.service; 1 package com.huaheng.pc.config.corporation.service;
2 2
  3 +import com.huaheng.framework.web.domain.AjaxResult;
3 import com.huaheng.pc.config.corporation.domain.Corporation; 4 import com.huaheng.pc.config.corporation.domain.Corporation;
4 import com.baomidou.mybatisplus.extension.service.IService; 5 import com.baomidou.mybatisplus.extension.service.IService;
5 - /** 6 +
  7 +import java.util.List;
  8 +
  9 +/**
6 * Created by Enzo Cotter on 2020/3/20. 10 * Created by Enzo Cotter on 2020/3/20.
7 */ 11 */
8 12
9 public interface CorporationService extends IService<Corporation>{ 13 public interface CorporationService extends IService<Corporation>{
10 14
  15 + public Corporation getEnableCorporation();
11 16
  17 + public int enableCorporationById(Integer id);
12 } 18 }
src/main/java/com/huaheng/pc/config/corporation/service/impl/CorporationServiceImpl.java
1 package com.huaheng.pc.config.corporation.service.impl; 1 package com.huaheng.pc.config.corporation.service.impl;
2 2
3 import org.springframework.stereotype.Service; 3 import org.springframework.stereotype.Service;
4 -import javax.annotation.Resource;  
5 -import java.util.List;  
6 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 import com.huaheng.pc.config.corporation.mapper.CorporationMapper; 5 import com.huaheng.pc.config.corporation.mapper.CorporationMapper;
8 import com.huaheng.pc.config.corporation.domain.Corporation; 6 import com.huaheng.pc.config.corporation.domain.Corporation;
9 import com.huaheng.pc.config.corporation.service.CorporationService; 7 import com.huaheng.pc.config.corporation.service.CorporationService;
  8 +import org.springframework.transaction.annotation.Transactional;
  9 +
  10 +import javax.annotation.Resource;
  11 +
10 /** 12 /**
11 * Created by Enzo Cotter on 2020/3/20. 13 * Created by Enzo Cotter on 2020/3/20.
12 */ 14 */
13 15
14 -@Service 16 +@Service("corporationService")
15 public class CorporationServiceImpl extends ServiceImpl<CorporationMapper, Corporation> implements CorporationService{ 17 public class CorporationServiceImpl extends ServiceImpl<CorporationMapper, Corporation> implements CorporationService{
16 18
  19 + @Resource
  20 + private CorporationMapper corporationMapper;
  21 +
  22 + @Override
  23 + public Corporation getEnableCorporation() {
  24 + try {
  25 + return corporationMapper.getEnableCorporation();
  26 + }catch (Exception e){
  27 + //页面判断corporation为空时,会用默认配置,避免页面崩溃
  28 + return null;
  29 + }
  30 + }
  31 +
  32 + @Override
  33 + @Transactional(rollbackFor = Exception.class)
  34 + public int enableCorporationById(Integer id) {
  35 + corporationMapper.disableAllCorporation();
  36 + return corporationMapper.enableCorporationById(id);
  37 + }
17 } 38 }
src/main/java/com/huaheng/pc/system/user/controller/ProfileController.java
@@ -83,7 +83,7 @@ public class ProfileController extends BaseController @@ -83,7 +83,7 @@ public class ProfileController extends BaseController
83 int rows = userService.resetUserPwd(user); 83 int rows = userService.resetUserPwd(user);
84 if (rows > 0) 84 if (rows > 0)
85 { 85 {
86 - setUser(userService.selectUserById(user.getId())); 86 +// setUser(userService.selectUserById(user.getId()));
87 return success(); 87 return success();
88 } 88 }
89 return error(); 89 return error();
@@ -119,7 +119,7 @@ public class ProfileController extends BaseController @@ -119,7 +119,7 @@ public class ProfileController extends BaseController
119 { 119 {
120 if (userService.updateUserInfo(user) > 0) 120 if (userService.updateUserInfo(user) > 0)
121 { 121 {
122 - setUser(userService.selectUserById(user.getId())); 122 +// setUser(userService.selectUserById(user.getId()));
123 return success(); 123 return success();
124 } 124 }
125 return error(); 125 return error();
@@ -138,10 +138,13 @@ public class ProfileController extends BaseController @@ -138,10 +138,13 @@ public class ProfileController extends BaseController
138 if (!file.isEmpty()) 138 if (!file.isEmpty())
139 { 139 {
140 String avatar = FileUploadUtils.upload(file); 140 String avatar = FileUploadUtils.upload(file);
  141 + user.setId(getUser().getId());
141 user.setAvatar(avatar); 142 user.setAvatar(avatar);
142 if (userService.updateUserInfo(user) > 0) 143 if (userService.updateUserInfo(user) > 0)
143 { 144 {
144 - setUser(userService.selectUserById(user.getId())); 145 + User loginUser = getUser();
  146 + loginUser.setAvatar(avatar);
  147 + setUser(loginUser);
145 return success(); 148 return success();
146 } 149 }
147 } 150 }
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
@@ -628,7 +628,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -628,7 +628,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
628 } 628 }
629 629
630 @Override 630 @Override
631 - @Transactional(rollbackFor = Exception.class)  
632 public AjaxResult completeTaskByWMS(Integer[] taskIds, String[] weightConvert) { 631 public AjaxResult completeTaskByWMS(Integer[] taskIds, String[] weightConvert) {
633 for (int i = 0;i<taskIds.length;i++) { 632 for (int i = 0;i<taskIds.length;i++) {
634 TaskHeader task = taskHeaderService.getById(taskIds[i]); 633 TaskHeader task = taskHeaderService.getById(taskIds[i]);
@@ -671,12 +670,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -671,12 +670,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
671 * 670 *
672 * @param task 671 * @param task
673 */ 672 */
674 - @Transactional(rollbackFor = Exception.class)  
675 public void completeTask(TaskHeader task) { 673 public void completeTask(TaskHeader task) {
676 //区分任务类型 674 //区分任务类型
677 if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_SHELF) ) { 675 if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_SHELF) ) {
678 //入库任务 676 //入库任务
679 this.completeReceiptTask(task); 677 this.completeReceiptTask(task);
  678 +// combineInventory(task);
680 } 679 }
681 if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_PICKING) && 680 if (task.getInternalTaskType().equals(QuantityConstant.TASK_INTENERTYPE_PICKING) &&
682 (task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLESHIPMENT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT))) { 681 (task.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLESHIPMENT) || task.getTaskType().equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT))) {
@@ -716,35 +715,44 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -716,35 +715,44 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
716 if (taskReceiptContainerDetail.size() < 1) { 715 if (taskReceiptContainerDetail.size() < 1) {
717 return AjaxResult.success("未找到对应任务的入库单号!!!"); 716 return AjaxResult.success("未找到对应任务的入库单号!!!");
718 } 717 }
  718 + LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery();
  719 + inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode())
  720 + .eq(InventoryHeader::getLocationCode, task.getFromLocation())
  721 + .eq(InventoryHeader::getContainerCode, task.getContainerCode());
  722 + InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper);
  723 +
  724 + if(header == null) {
  725 + //添加库存单
  726 + header = new InventoryHeader();
  727 + header.setWarehouseCode(task.getWarehouseCode());
  728 + header.setCompanyCode(task.getCompanyCode());//货主
  729 + header.setContainerCode(task.getContainerCode());
  730 + header.setContainerStatus("some");
  731 + header.setLocationCode(task.getToLocation());
  732 + header.setLocking(1);
  733 + header.setEnable(1);
  734 + header.setTotalQty(new BigDecimal(0));
  735 + header.setTotalWeight(task.getWeight());
  736 + header.setCreatedBy(ShiroUtils.getLoginName());
  737 + header.setCreated(new Date());
  738 + header.setLastUpdatedBy(ShiroUtils.getLoginName());
  739 + header.setLastUpdated(new Date());
  740 + if (!inventoryHeaderService.save(header)) {
  741 + throw new ServiceException("添加库存单失败");
  742 + }
  743 + }
719 for (Map<String, Object> map : taskReceiptContainerDetail) { 744 for (Map<String, Object> map : taskReceiptContainerDetail) {
720 //将未完成的任务数量更新到库存表 745 //将未完成的任务数量更新到库存表
721 if (DataUtils.getInteger(map.get("status")) < QuantityConstant.TASK_STATUS_COMPLETED) { 746 if (DataUtils.getInteger(map.get("status")) < QuantityConstant.TASK_STATUS_COMPLETED) {
  747 +
  748 +
722 LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); 749 LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery();
723 inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) 750 inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode())
724 .eq(InventoryDetail::getLocationCode, task.getFromLocation()) 751 .eq(InventoryDetail::getLocationCode, task.getFromLocation())
725 -// .eq(InventoryDetail::getReceiptDetailId, DataUtils.getString(map.get("receiptDetailId"))) 752 + .eq(InventoryDetail::getMaterialCode, DataUtils.getString(map.get("materialCode")))
726 .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode"))); 753 .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode")));
727 InventoryDetail detail = inventoryDetailService.getOne(inventory); 754 InventoryDetail detail = inventoryDetailService.getOne(inventory);
728 if (detail == null) { 755 if (detail == null) {
729 - //添加库存单  
730 - InventoryHeader header = new InventoryHeader();  
731 - header.setWarehouseCode(DataUtils.getString(map.get("warehouseCode")));//仓库  
732 - header.setCompanyCode(task.getCompanyCode());//货主  
733 - header.setContainerCode(DataUtils.getString(map.get("containerCode")));//容器号  
734 - header.setContainerStatus("some");  
735 - header.setLocationCode(task.getToLocation());  
736 - header.setTotalQty(DataUtils.getBigDecimal(map.get("totalQty")));//总数量  
737 - header.setLocking(1);  
738 - header.setEnable(1);  
739 - header.setTotalWeight(task.getWeight());  
740 - header.setCreatedBy(ShiroUtils.getLoginName());  
741 - header.setCreated(new Date());  
742 - header.setLastUpdatedBy(ShiroUtils.getLoginName());  
743 - header.setLastUpdated(new Date());  
744 - if (!inventoryHeaderService.save(header)) {  
745 - throw new ServiceException("添加库存单失败");  
746 - }  
747 -  
748 //库存明细添加 756 //库存明细添加
749 detail = new InventoryDetail(); 757 detail = new InventoryDetail();
750 detail.setInventoryHeaderId(header.getId());//库存头ID 758 detail.setInventoryHeaderId(header.getId());//库存头ID
@@ -775,9 +783,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -775,9 +783,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
775 detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty")))); 783 detail.setQty(detail.getQty().add(DataUtils.getBigDecimal(map.get("qty"))));
776 detail.setLastUpdatedBy(ShiroUtils.getLoginName()); 784 detail.setLastUpdatedBy(ShiroUtils.getLoginName());
777 LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate(); 785 LambdaUpdateWrapper<InventoryDetail> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
778 - lambdaUpdateWrapper.eq(InventoryDetail::getId, DataUtils.getInteger(map.get("receiptDetailId"))); 786 + lambdaUpdateWrapper.eq(InventoryDetail::getId, detail.getId());
779 if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)){ 787 if (!inventoryDetailService.update(detail, lambdaUpdateWrapper)){
780 - throw new ServiceException("更新入库单明细失败"); 788 + throw new ServiceException("更新库存明细失败");
781 } 789 }
782 } 790 }
783 //记录库存交易记录 791 //记录库存交易记录
@@ -815,73 +823,89 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea @@ -815,73 +823,89 @@ public class TaskHeaderServiceImpl extends ServiceImpl&lt;TaskHeaderMapper, TaskHea
815 throw new ServiceException("修改入库单明细失败"); 823 throw new ServiceException("修改入库单明细失败");
816 } 824 }
817 825
818 - //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成  
819 - task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);  
820 - task.setLastUpdatedBy(ShiroUtils.getLoginName());  
821 - task.setLastUpdated(new Date());  
822 - LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate();  
823 - taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId());  
824 - if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){  
825 - throw new ServiceException("更新任务主表失败");  
826 - }  
827 - //修改库位状态和对应的容器  
828 - Location location = new Location();  
829 - location.setContainerCode(task.getContainerCode());  
830 - location.setStatus("empty");  
831 - LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate();  
832 - locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation());  
833 - if (!locationService.update(location, locationLambdaUpdateWrapper)){  
834 - throw new ServiceException("更新库位失败");  
835 - }  
836 - //修改容器状态和对应的库位  
837 - Container container = new Container();  
838 - container.setLocationCode(task.getToLocation());  
839 - container.setStatus("some");  
840 - LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate();  
841 - containerLambdaUpdateWrapper.eq(Container::getCode, task.getContainerCode());  
842 - if (!containerService.update(container, containerLambdaUpdateWrapper)) {  
843 - throw new ServiceException("更新容器失败");  
844 - }  
845 - //修改组盘表状态为20  
846 - ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail();  
847 - receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_REVIEWSUCCESS);  
848 - receiptContainerDetail.setProcessStamp("0");  
849 - receiptContainerDetail.setLastUpdated(new Date());  
850 - receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName());  
851 - LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate();  
852 - receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(map.get("receiptId")));  
853 - if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){  
854 - throw new ServiceException("更新组盘状态失败");  
855 - }  
856 -  
857 - //修改入库组盘头表状态 826 + }
858 827
859 - ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader();  
860 - receiptContainerHeader.setId(task.getAllocationHeadId());  
861 - receiptContainerHeader.setLastUpdated(new Date());  
862 - receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName());  
863 - receiptContainerHeader.setStatus((short) QuantityConstant.RECEIPT_CONTAINER_FINISHED.intValue());  
864 - if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) {  
865 - throw new ServiceException("更新入库组盘头表状态失败");  
866 - } 828 + }
  829 + //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成
  830 + task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED);
  831 + task.setLastUpdatedBy(ShiroUtils.getLoginName());
  832 + task.setLastUpdated(new Date());
  833 + LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  834 + taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId());
  835 + if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){
  836 + throw new ServiceException("更新任务主表失败");
  837 + }
  838 + //修改库位状态和对应的容器
  839 + Location location = new Location();
  840 + location.setContainerCode(task.getContainerCode());
  841 + location.setStatus("empty");
  842 + LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  843 + locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation());
  844 + if (!locationService.update(location, locationLambdaUpdateWrapper)){
  845 + throw new ServiceException("更新库位失败");
  846 + }
  847 + //修改容器状态和对应的库位
  848 + Container container = new Container();
  849 + container.setLocationCode(task.getToLocation());
  850 + container.setStatus("some");
  851 + LambdaUpdateWrapper<Container> containerLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  852 + containerLambdaUpdateWrapper.eq(Container::getCode, task.getContainerCode());
  853 + if (!containerService.update(container, containerLambdaUpdateWrapper)) {
  854 + throw new ServiceException("更新容器失败");
  855 + }
  856 + //修改组盘表状态为20
  857 + ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail();
  858 + receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_REVIEWSUCCESS);
  859 + receiptContainerDetail.setProcessStamp("0");
  860 + receiptContainerDetail.setLastUpdated(new Date());
  861 + receiptContainerDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
  862 + LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  863 + receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getReceiptId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId")));
  864 + if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){
  865 + throw new ServiceException("更新组盘状态失败");
  866 + }
867 867
868 - //修改入库单状态  
869 - ReceiptHeader receiptHeader = new ReceiptHeader();  
870 - receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING);  
871 - receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING);  
872 - receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName());  
873 - receiptHeader.setLastUpdated(new Date());  
874 - LambdaUpdateWrapper<ReceiptHeader> receiptHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate();  
875 - receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId, DataUtils.getInteger(map.get("receiptId")));  
876 - if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) {  
877 - throw new ServiceException("更新入库头表状态失败");  
878 - }  
879 - } 868 + //修改入库组盘头表状态
880 869
  870 + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader();
  871 + receiptContainerHeader.setId(task.getAllocationHeadId());
  872 + receiptContainerHeader.setLastUpdated(new Date());
  873 + receiptContainerHeader.setLastUpdatedBy(ShiroUtils.getLoginName());
  874 + receiptContainerHeader.setStatus((short) QuantityConstant.RECEIPT_CONTAINER_FINISHED.intValue());
  875 + if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) {
  876 + throw new ServiceException("更新入库组盘头表状态失败");
  877 + }
  878 +
  879 + //修改入库单状态
  880 + ReceiptHeader receiptHeader = new ReceiptHeader();
  881 + receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_POSTING);
  882 + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING);
  883 + receiptHeader.setLastUpdatedBy(ShiroUtils.getLoginName());
  884 + receiptHeader.setLastUpdated(new Date());
  885 + LambdaUpdateWrapper<ReceiptHeader> receiptHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate();
  886 + receiptHeaderLambdaUpdateWrapper.eq(ReceiptHeader::getId, DataUtils.getInteger(taskReceiptContainerDetail.get(0).get("receiptId")));
  887 + if (!receiptHeaderService.update(receiptHeader, receiptHeaderLambdaUpdateWrapper)) {
  888 + throw new ServiceException("更新入库头表状态失败");
881 } 889 }
882 return AjaxResult.success("完成入库任务"); 890 return AjaxResult.success("完成入库任务");
883 } 891 }
884 892
  893 +// private void combineInventory(TaskHeader task) {
  894 +// LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery();
  895 +// inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode())
  896 +// .eq(InventoryHeader::getLocationCode, task.getFromLocation())
  897 +// .eq(InventoryHeader::getContainerCode, task.getContainerCode());
  898 +// InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper);
  899 +// if(header != null) {
  900 +// LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery();
  901 +// inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode())
  902 +// .eq(InventoryDetail::getLocationCode, task.getFromLocation())
  903 +// .eq(InventoryDetail::getMaterialCode, DataUtils.getString(map.get("materialCode")))
  904 +// .eq(InventoryDetail::getContainerCode, DataUtils.getString(map.get("containerCode")));
  905 +// List<InventoryDetail> detail = inventoryDetailService.list(inventory);
  906 +// }
  907 +// }
  908 +
885 /** 909 /**
886 * 移动端创建入库任务 910 * 移动端创建入库任务
887 * 911 *
src/main/resources/application-druid.properties
@@ -4,12 +4,12 @@ spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver @@ -4,12 +4,12 @@ spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
4 # ���� 4 # ����
5 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8 5 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8
6 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false 6 #spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/huahengExample?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
7 -spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_v2?characterEncoding=utf8&serverTimezone=GMT%2b8 7 +spring.datasource.druid.master.url=jdbc:mysql://172.16.29.45:3306/wms_v2?characterEncoding=utf8&serverTimezone=GMT%2b8
8 8
9 -#spring.datasource.druid.master.username=softhuaheng  
10 -#spring.datasource.druid.master.password=HHrobot123.  
11 -spring.datasource.druid.master.username=root  
12 -spring.datasource.druid.master.password=123456 9 +spring.datasource.druid.master.username=softhuaheng
  10 +spring.datasource.druid.master.password=HHrobot123.
  11 +#spring.datasource.druid.master.username=root
  12 +#spring.datasource.druid.master.password=123456
13 # �ӿ� 13 # �ӿ�
14 spring.datasource.druid.slave.open = false 14 spring.datasource.druid.slave.open = false
15 spring.datasource.druid.slave.url=jdbc:mysql://199.19.109.117:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false 15 spring.datasource.druid.slave.url=jdbc:mysql://199.19.109.117:3306/wms_v2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
@@ -48,4 +48,4 @@ logging.level.org.springframework=warn @@ -48,4 +48,4 @@ logging.level.org.springframework=warn
48 logging.level.spring.springboot.dao=DEBUG 48 logging.level.spring.springboot.dao=DEBUG
49 49
50 #���Է���˿ڡ�������ĿcontextPath 50 #���Է���˿ڡ�������ĿcontextPath
51 - 51 +server.servlet.context-path= /wms
src/main/resources/application.yml
@@ -11,7 +11,7 @@ huaheng: @@ -11,7 +11,7 @@ huaheng:
11 #版权年份 11 #版权年份
12 copyrightYear: 2018 12 copyrightYear: 2018
13 # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) 13 # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
14 - profile: D:/Huaheng/uploadPath 14 + profile: D:/Huaheng/uploadPath/
15 # 获取ip地址开关 15 # 获取ip地址开关
16 addressEnabled: false 16 addressEnabled: false
17 17
@@ -42,6 +42,10 @@ user: @@ -42,6 +42,10 @@ user:
42 42
43 # Spring配置 43 # Spring配置
44 spring: 44 spring:
  45 + mvc:
  46 + static-path-pattern: /**
  47 + resources:
  48 + static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${huaheng.profile}
45 http: 49 http:
46 encoding: 50 encoding:
47 charset: utf-8 51 charset: utf-8
src/main/resources/mybatis/config/CorporationMapper.xml
@@ -6,13 +6,33 @@ @@ -6,13 +6,33 @@
6 <!--@Table corporation--> 6 <!--@Table corporation-->
7 <id column="id" jdbcType="BIGINT" property="id" /> 7 <id column="id" jdbcType="BIGINT" property="id" />
8 <result column="name" jdbcType="VARCHAR" property="name" /> 8 <result column="name" jdbcType="VARCHAR" property="name" />
9 - <result column="logo" jdbcType="VARCHAR" property="logo" />  
10 - <result column="address" jdbcType="VARCHAR" property="address" /> 9 + <result column="pLogoBig" jdbcType="VARCHAR" property="column" />
  10 + <result column="pLogoSmall" jdbcType="VARCHAR" property="column" />
  11 + <result column="pIcon" jdbcType="VARCHAR" property="pIcon" />
  12 + <result column="versionInfo" jdbcType="VARCHAR" property="versionInfo" />
  13 + <result column="baseAddress" jdbcType="VARCHAR" property="baseAddress" />
  14 + <result column="enable" jdbcType="VARCHAR" property="enable" />
  15 + <result column="userDef1" jdbcType="VARCHAR" property="userDef1" />
  16 + <result column="userDef2" jdbcType="VARCHAR" property="userDef2" />
  17 + <result column="userDef3" jdbcType="VARCHAR" property="userDef3" />
  18 + <result column="lastUpdated" jdbcType="TIMESTAMP" property="lastUpdated" />
  19 + <result column="lastUpdatedBy" jdbcType="VARCHAR" property="lastUpdatedBy" />
11 <result column="created" jdbcType="TIMESTAMP" property="created" /> 20 <result column="created" jdbcType="TIMESTAMP" property="created" />
12 - <result column="create_by" jdbcType="VARCHAR" property="createBy" /> 21 + <result column="createdBy" jdbcType="VARCHAR" property="createdBy" />
13 </resultMap> 22 </resultMap>
14 <sql id="Base_Column_List"> 23 <sql id="Base_Column_List">
15 <!--@mbg.generated--> 24 <!--@mbg.generated-->
16 - id, `name`, logo, address, created, create_by 25 + id, `name`, pLogoBig, pLogoSmall, pIcon, versionInfo, baseAddress, enable, userDef1, userDef2, userDef3, lastUpdated, lastUpdatedBy, created, createdBy
17 </sql> 26 </sql>
  27 + <select id="getEnableCorporation" resultType="com.huaheng.pc.config.corporation.domain.Corporation">
  28 + select * from corporation where enable = 1
  29 + </select>
  30 +
  31 + <update id="disableAllCorporation">
  32 + update corporation set enable = 0
  33 + </update>
  34 +
  35 + <update id="enableCorporationById">
  36 + update corporation set enable = 1 where id=#{id}
  37 + </update>
18 </mapper> 38 </mapper>
19 \ No newline at end of file 39 \ No newline at end of file
src/main/resources/static/huaheng/js/huahengUI.js
@@ -110,7 +110,11 @@ var table = { @@ -110,7 +110,11 @@ var table = {
110 clickToSelect: options.clickToSelect, // 是否启用点击选中行 110 clickToSelect: options.clickToSelect, // 是否启用点击选中行
111 mobileResponsive: options.mobileResponsive, // 是否支持移动端适配 111 mobileResponsive: options.mobileResponsive, // 是否支持移动端适配
112 onClickRow: options.onClickRow, // 点击某行触发的事件 112 onClickRow: options.onClickRow, // 点击某行触发的事件
113 - onDblClickRow: options.onDblClickRow, // 双击某行触发的事件 113 + onDblClickRow:function(row){
  114 + if (typeof detail != 'undefined') {
  115 + detail(row.id, row.code)
  116 + }
  117 + }, // 双击某行触发的事件
114 onClickCell: options.onClickCell, // 单击某格触发的事件 118 onClickCell: options.onClickCell, // 单击某格触发的事件
115 onDblClickCell: options.onDblClickCell, // 双击某格触发的事件 119 onDblClickCell: options.onDblClickCell, // 双击某格触发的事件
116 onEditableSave: options.onEditableSave, // 行内编辑保存的事件 120 onEditableSave: options.onEditableSave, // 行内编辑保存的事件
@@ -139,6 +143,7 @@ var table = { @@ -139,6 +143,7 @@ var table = {
139 }); 143 });
140 return optionsIds.substring(0, optionsIds.length - 1); 144 return optionsIds.substring(0, optionsIds.length - 1);
141 }, 145 },
  146 +
142 // 查询条件 147 // 查询条件
143 queryParams: function(params) { 148 queryParams: function(params) {
144 var curParams = { 149 var curParams = {
@@ -901,21 +906,23 @@ var table = { @@ -901,21 +906,23 @@ var table = {
901 }, 906 },
902 // 删除信息 907 // 删除信息
903 remove: function(id) { 908 remove: function(id) {
904 - $.modal.confirm("确定删除该条" + $.table.options.modalName + "信息吗?", function() {  
905 - var url = $.common.isEmpty(id) ? $.table.options.removeUrl : $.table.options.removeUrl.replace("{id}", id); 909 + table.set();
  910 + $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() {
  911 + var url = $.common.isEmpty(id) ? table.options.removeUrl : table.options.removeUrl.replace("{id}", id);
906 var data = { "ids": id }; 912 var data = { "ids": id };
907 $.operate.submit(url, "post", "json", data); 913 $.operate.submit(url, "post", "json", data);
908 }); 914 });
909 }, 915 },
910 // 批量删除信息 916 // 批量删除信息
911 batRemove: function() { 917 batRemove: function() {
912 - var rows = $.common.isEmpty($.table.options.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table.options.id); 918 + table.set();
  919 + var rows = $.common.isEmpty(table.options.id) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.id);
913 if (rows.length == 0) { 920 if (rows.length == 0) {
914 $.modal.alertWarning("请至少选择一条记录"); 921 $.modal.alertWarning("请至少选择一条记录");
915 return; 922 return;
916 } 923 }
917 $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { 924 $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() {
918 - var url = $.table.options.removeUrl; 925 + var url = table.options.removeUrl;
919 var data = { "ids": rows.join() }; 926 var data = { "ids": rows.join() };
920 $.operate.submit(url, "post", "json", data); 927 $.operate.submit(url, "post", "json", data);
921 }); 928 });
@@ -923,7 +930,7 @@ var table = { @@ -923,7 +930,7 @@ var table = {
923 // 添加信息 930 // 添加信息
924 add: function(id) { 931 add: function(id) {
925 table.set(); 932 table.set();
926 - var url = $.common.isEmpty(id) ? table.options.createUrl : $.table.options.createUrl.replace("{id}", id); 933 + var url = $.common.isEmpty(id) ? table.options.createUrl : table.options.createUrl.replace("{id}", id);
927 $.modal.open("添加" + table.options.modalName, url); 934 $.modal.open("添加" + table.options.modalName, url);
928 }, 935 },
929 // 修改信息 936 // 修改信息
src/main/resources/templates/config/corporation/add.html
1 -<!DOCTYPE html>  
2 -<html lang="en">  
3 -<head>  
4 - <meta charset="UTF-8">  
5 - <title>Title</title>  
6 -</head>  
7 -<body> 1 +<!DOCTYPE HTML>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<meta charset="utf-8">
  4 +<head th:include="include :: header"></head>
  5 +<body class="white-bg">
  6 +<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  7 + <form class="form-horizontal m" id="form-corporation-add">
  8 + <div class="form-group">
  9 + <label class="col-sm-3 control-label">公司名称:</label>
  10 + <div class="col-sm-6">
  11 + <input id="name" name="name" class="form-control" type="text">
  12 + </div>
  13 + </div>
  14 + <div class="form-group">
  15 + <label class="col-sm-3 control-label">公司Logo(大):</label>
  16 + <div class="col-sm-6">
  17 + <input id="pLogoBig" name="pLogoBig" class="form-control" type="file" >
  18 + </div>
  19 + <div class="col-sm-3" id="pLogoBigPreview" name="pLogoBigPreview"></div>
  20 +</div>
  21 + <div class="form-group">
  22 + <label class="col-sm-3 control-label">公司Logo(小):</label>
  23 + <div class="col-sm-6">
  24 + <input id="pLogoSmall" name="pLogoSmall" class="form-control" type="file" >
  25 + </div>
  26 + <div class="col-sm-3" id="pLogoSmallPreview" name="pLogoBigPreview"></div>
  27 + </div>
  28 + <div class="form-group">
  29 + <label class="col-sm-3 control-label">网站图标:</label>
  30 + <div class="col-sm-6">
  31 + <input id="pIcon" name="pIcon" class="form-control" type="file" >
  32 + </div>
  33 + <div class="col-sm-3" id="pIconPreview" name="pLogoBigPreview"></div>
  34 + </div>
  35 + <div class="form-group">
  36 + <label class="col-sm-3 control-label">版本信息:</label>
  37 + <div class="col-sm-6">
  38 + <input id="versionInfo" name="versionInfo" class="form-control" type="text" >
  39 + </div>
  40 + </div>
8 41
  42 + <div class="form-group">
  43 + <label class="col-sm-3 control-label">启用:</label>
  44 + <div class="col-sm-6">
  45 + <div class="onoffswitch">
  46 + <input type="checkbox" class="onoffswitch-checkbox" id="enable" name="enable" checked="checked">
  47 + <label class="onoffswitch-label" for="enable">
  48 + <span class="onoffswitch-inner"></span>
  49 + <span class="onoffswitch-switch"></span>
  50 + </label>
  51 + </div>
  52 + </div>
  53 + </div>
  54 +
  55 + <div class="form-group">
  56 + <div class="form-control-static col-sm-offset-9">
  57 + <button id="blobSubmit" class="btn btn-primary" type="button">提交</button>
  58 + <!--<button type="botton" class="btn btn-primary">提交</button>-->
  59 + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  60 + </div>
  61 + </div>
  62 + </form>
  63 +</div>
  64 +<div th:include="include::footer"></div>
  65 +<script type="text/javascript">
  66 +
  67 + $('#blobSubmit').on('click', function(){
  68 + var formdata = new FormData();
  69 + formdata.append("pLogoBigFile", $('#pLogoBig')[0].files[0]);
  70 + formdata.append("pLogoSmallFile", $('#pLogoSmall')[0].files[0]);
  71 + formdata.append("pIconFile", $('#pIcon')[0].files[0]);
  72 + formdata.append("name", $("#name").val());
  73 + formdata.append("versionInfo", $("#versionInfo").val());
  74 + formdata.append("enable", $("#enable").is(':checked'));
  75 + $.ajax({
  76 + url: ctx + "config/corporation/add",
  77 + data: formdata,
  78 + type: "post",
  79 + processData: false,
  80 + contentType: false,
  81 + success: function(result) {
  82 + $.operate.saveSuccess(result);
  83 + }
  84 + })
  85 + })
  86 +
  87 + function preview(id){
  88 + $('#'+id).on('change',function () {
  89 + var reader = new FileReader();
  90 + reader.onload = function(e) {
  91 + var img = "<img src='"+e.target.result+"' height=\"40\" title='预览图'/>";
  92 + var obj = document.getElementById(id + "Preview")
  93 + obj.innerHTML = img;
  94 + }
  95 + reader.readAsDataURL(this.files[0]);
  96 + })
  97 + }
  98 + preview("pLogoBig")
  99 + preview("pLogoSmall")
  100 + preview("pIcon")
  101 +</script>
9 </body> 102 </body>
10 -</html>  
11 \ No newline at end of file 103 \ No newline at end of file
  104 +</html>
src/main/resources/templates/config/corporation/corporation.html
@@ -6,18 +6,15 @@ @@ -6,18 +6,15 @@
6 <div class="container-div"> 6 <div class="container-div">
7 <div class="row"> 7 <div class="row">
8 <div class="col-sm-12 select-info"> 8 <div class="col-sm-12 select-info">
9 - <form id="customer-form"> 9 + <form id="corporation-form">
10 <div class="select-list"> 10 <div class="select-list">
11 <ul> 11 <ul>
12 <li> 12 <li>
13 - 编码:<input type="text" name="code"/>  
14 - </li>  
15 - <li>  
16 - 名称:<input type="text" name="name"/> 13 + 公司名称:<input type="text" name="name"/>
17 </li> 14 </li>
18 <li> 15 <li>
19 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> 16 <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
20 - <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('customer-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a> 17 + <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('corporation-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
21 </li> 18 </li>
22 </ul> 19 </ul>
23 </div> 20 </div>
@@ -25,10 +22,10 @@ @@ -25,10 +22,10 @@
25 </div> 22 </div>
26 23
27 <div class="btn-group hidden-xs" id="toolbar" role="group"> 24 <div class="btn-group hidden-xs" id="toolbar" role="group">
28 - <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:customer:add"> 25 + <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="config:corporation:add">
29 <i class="fa fa-plus"></i> 新增 26 <i class="fa fa-plus"></i> 新增
30 </a> 27 </a>
31 - <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:customer:remove"> 28 + <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="config:corporation:remove">
32 <i class="fa fa-trash-o"></i> 删除 29 <i class="fa fa-trash-o"></i> 删除
33 </a> 30 </a>
34 </div> 31 </div>
@@ -40,9 +37,9 @@ @@ -40,9 +37,9 @@
40 </div> 37 </div>
41 <div th:include="include :: footer"></div> 38 <div th:include="include :: footer"></div>
42 <script th:inline="javascript"> 39 <script th:inline="javascript">
43 - var editFlag = [[${@permission.hasPermi('config:customer:edit')}]];  
44 - var removeFlag = [[${@permission.hasPermi('config:customer:remove')}]];  
45 - var prefix = ctx + "config/customer" 40 + var editFlag = [[${@permission.hasPermi('config:corporation:edit')}]];
  41 + var removeFlag = [[${@permission.hasPermi('config:corporation:remove')}]];
  42 + var prefix = ctx + "config/corporation"
46 var datas = [[${@dict.getType('sys_normal_disable')}]]; 43 var datas = [[${@dict.getType('sys_normal_disable')}]];
47 44
48 $(function() { 45 $(function() {
@@ -51,7 +48,7 @@ @@ -51,7 +48,7 @@
51 createUrl: prefix + "/add", 48 createUrl: prefix + "/add",
52 updateUrl: prefix + "/edit/{id}", 49 updateUrl: prefix + "/edit/{id}",
53 removeUrl: prefix + "/remove", 50 removeUrl: prefix + "/remove",
54 - modalName: "客户", 51 + modalName: "公司配置",
55 search: false, 52 search: false,
56 sortName: "id", 53 sortName: "id",
57 sortOrder: "desc", 54 sortOrder: "desc",
@@ -63,80 +60,51 @@ @@ -63,80 +60,51 @@
63 title : 'id' 60 title : 'id'
64 }, 61 },
65 { 62 {
66 - field : 'code',  
67 - title : '编码' 63 + field : 'name',
  64 + title : '公司名称'
68 }, 65 },
69 { 66 {
70 - field : 'shipToCode',  
71 - title : '配送点代码' 67 + field : 'pLogoBig',
  68 + title : '公司logo(大)',
  69 + formatter: function(value, row, index) {
  70 + var actions = [];
  71 + actions.push('<img src="' + ctx + value +'" height="40" title="'+ value +'"/>')
  72 + return actions.join(" ")
  73 + }
72 }, 74 },
73 { 75 {
74 - field : 'warehouseCode',  
75 - title : '仓库编码',  
76 - visible : false 76 + field : 'pLogoSmall',
  77 + title : '公司logo(小)',
  78 + formatter: function(value, row, index) {
  79 + var actions = [];
  80 + actions.push('<img src="' + ctx + value +'" height="40" title="'+ value +'"/>')
  81 + return actions.join(" ")
  82 + }
77 }, 83 },
78 { 84 {
79 - field : 'companyCode',  
80 - title : '货主代码' 85 + field : 'pIcon',
  86 + title : '网站图标',
  87 + formatter: function(value, row, index) {
  88 + var actions = [];
  89 + actions.push('<img src="' + ctx + value +'" height="40" title="'+ value +'"/>')
  90 + return actions.join(" ")
  91 + }
81 }, 92 },
82 { 93 {
83 - field : 'name',  
84 - title : '名称' 94 + field : 'versionInfo',
  95 + title : '版本信息'
85 }, 96 },
86 { 97 {
87 - field : 'address1',  
88 - title : '地址1' 98 + field : 'baseAddress',
  99 + title : '存储路径'
89 }, 100 },
  101 + /**
90 { 102 {
91 field : 'address2', 103 field : 'address2',
92 title : '地址2' , 104 title : '地址2' ,
93 visible:false 105 visible:false
94 }, 106 },
95 - {  
96 - field : 'city',  
97 - title : '城市'  
98 - },  
99 - {  
100 - field : 'province',  
101 - title : '省份' ,  
102 - visible:false  
103 - },  
104 - {  
105 - field : 'country',  
106 - title : '国家' ,  
107 - visible:false  
108 - },  
109 - {  
110 - field : 'postalCode',  
111 - title : '邮编' ,  
112 - visible:false  
113 - },  
114 - {  
115 - field : 'parent',  
116 - title : '父',  
117 - visible:false  
118 - },  
119 - {  
120 - field : 'attentionTo',  
121 - title : '联系人'  
122 - },  
123 - {  
124 - field : 'phoneNum',  
125 - title : '电话'  
126 - },  
127 - {  
128 - field : 'mobile',  
129 - title : '手机'  
130 - },  
131 - {  
132 - field : 'faxNum',  
133 - title : '传真' ,  
134 - visible:false  
135 - },  
136 - {  
137 - field : 'email',  
138 - title : 'E-mail'  
139 - }, 107 +
140 { 108 {
141 field : 'created', 109 field : 'created',
142 title : '创建时间' 110 title : '创建时间'
@@ -153,6 +121,7 @@ @@ -153,6 +121,7 @@
153 field : 'lastUpdatedBy', 121 field : 'lastUpdatedBy',
154 title : '更新用户' 122 title : '更新用户'
155 }, 123 },
  124 + **/
156 { 125 {
157 field : 'enable', 126 field : 'enable',
158 title : '是否有效' , 127 title : '是否有效' ,
@@ -162,26 +131,6 @@ @@ -162,26 +131,6 @@
162 } 131 }
163 }, 132 },
164 { 133 {
165 - field : 'deleted',  
166 - title : '是否删除' ,  
167 - visible:false  
168 - },  
169 - {  
170 - field : 'userDef1',  
171 - title : '自定义字段1' ,  
172 - visible:false  
173 - },  
174 - {  
175 - field : 'userDef2',  
176 - title : '自定义字段2' ,  
177 - visible:false  
178 - },  
179 - {  
180 - field : 'userDef3',  
181 - title : '自定义字段3' ,  
182 - visible:false  
183 - },  
184 - {  
185 title: '操作', 134 title: '操作',
186 align: 'center', 135 align: 'center',
187 formatter: function(value, row, index) { 136 formatter: function(value, row, index) {
src/main/resources/templates/config/corporation/edit.html
1 -<!DOCTYPE html>  
2 -<html lang="en">  
3 -<head>  
4 - <meta charset="UTF-8">  
5 - <title>Title</title>  
6 -</head>  
7 -<body> 1 +<!DOCTYPE HTML>
  2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org">
  3 +<meta charset="utf-8">
  4 +<head th:include="include :: header"></head>
  5 +<body class="white-bg">
  6 +<div class="wrapper wrapper-content animated fadeInRight ibox-content">
  7 + <form class="form-horizontal m" id="form-corporation-add" th:object="${corporation}">
  8 + <input type="hidden" id="id" name="id" th:field="*{id}"/>
  9 + <div class="form-group">
  10 + <label class="col-sm-3 control-label">公司名称1:</label>
  11 + <div class="col-sm-6">
  12 + <input id="name" name="name" class="form-control" type="text" th:field="*{name}">
  13 + </div>
  14 + </div>
  15 + <div class="form-group">
  16 + <label class="col-sm-3 control-label">公司Logo(大):</label>
  17 + <div class="col-sm-6">
  18 + <input id="pLogoBig" name="pLogoBig" class="form-control" type="file" >
  19 + </div>
  20 + <div class="col-sm-3" id="pLogoBigPreview" name="pLogoBigPreview">
  21 + <img th:src="@{/}+*{pLogoBig}" height="40" title='预览图'/>
  22 + </div>
  23 + </div>
  24 + <div class="form-group">
  25 + <label class="col-sm-3 control-label">公司Logo(小):</label>
  26 + <div class="col-sm-6">
  27 + <input id="pLogoSmall" name="pLogoSmall" class="form-control" type="file" >
  28 + </div>
  29 + <div class="col-sm-3" id="pLogoSmallPreview" name="pLogoSmallPreview">
  30 + <img th:src="@{/}+*{pLogoSmall}" height="40" title='预览图'/>
  31 + </div>
  32 + </div>
  33 + <div class="form-group">
  34 + <label class="col-sm-3 control-label">网站图标:</label>
  35 + <div class="col-sm-6">
  36 + <input id="pIcon" name="pIcon" class="form-control" type="file" >
  37 + </div>
  38 + <div class="col-sm-3" id="pIconPreview" name="pIconPreview">
  39 + <img th:src="@{/}+*{pIcon}" height="40" title='预览图'/>
  40 + </div>
  41 + </div>
  42 + <div class="form-group">
  43 + <label class="col-sm-3 control-label">版本信息:</label>
  44 + <div class="col-sm-6">
  45 + <input id="versionInfo" name="versionInfo" class="form-control" type="text" th:field="*{versionInfo}">
  46 + </div>
  47 + </div>
8 48
  49 + <div class="form-group">
  50 + <label class="col-sm-3 control-label">启用:</label>
  51 + <div class="col-sm-6">
  52 + <div class="onoffswitch">
  53 + <input type="checkbox" class="onoffswitch-checkbox" id="enable" name="enable" th:checked="*{enable}" onchange="alert(this.val())">
  54 + <label class="onoffswitch-label" for="enable">
  55 + <span class="onoffswitch-inner"></span>
  56 + <span class="onoffswitch-switch"></span>
  57 + </label>
  58 + </div>
  59 + </div>
  60 + </div>
  61 +
  62 + <div class="form-group">
  63 + <div class="form-control-static col-sm-offset-9">
  64 + <button id="blobSubmit" class="btn btn-primary" type="button">提交</button>
  65 + <!--<button type="botton" class="btn btn-primary">提交</button>-->
  66 + <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  67 + </div>
  68 + </div>
  69 + </form>
  70 +</div>
  71 +<div th:include="include::footer"></div>
  72 +<script th:inline="javascript">
  73 +
  74 + $('#blobSubmit').on('click', function(){
  75 + var formdata = new FormData();
  76 + if ($('#pLogoBig')[0].files[0] != undefined)
  77 + formdata.append("pLogoBigFile", $('#pLogoBig')[0].files[0]);
  78 + if ($('#pLogoSmall')[0].files[0] != undefined)
  79 + formdata.append("pLogoSmallFile", $('#pLogoSmall')[0].files[0]);
  80 + if ($('#pIcon')[0].files[0] != undefined)
  81 + formdata.append("pIconFile", $('#pIcon')[0].files[0]);
  82 + formdata.append("id", $("#id").val());
  83 + formdata.append("name", $("#name").val());
  84 + formdata.append("versionInfo", $("#versionInfo").val());
  85 + formdata.append("enable", $("#enable").is(':checked'));
  86 + $.ajax({
  87 + url: ctx + "config/corporation/edit",
  88 + data: formdata,
  89 + type: "post",
  90 + processData: false,
  91 + contentType: false,
  92 + success: function(result) {
  93 + $.operate.saveSuccess(result);
  94 + }
  95 + })
  96 + })
  97 +
  98 + function preview(id){
  99 + $('#'+id).on('change',function () {
  100 + var reader = new FileReader();
  101 + reader.onload = function(e) {
  102 + var img = "<img src='"+e.target.result+"' height=\"40\" title='预览图'/>";
  103 + var obj = document.getElementById(id + "Preview")
  104 + obj.innerHTML = img;
  105 + }
  106 + reader.readAsDataURL(this.files[0]);
  107 + })
  108 + }
  109 + preview("pLogoBig")
  110 + preview("pLogoSmall")
  111 + preview("pIcon")
  112 +</script>
9 </body> 113 </body>
10 -</html>  
11 \ No newline at end of file 114 \ No newline at end of file
  115 +</html>
src/main/resources/templates/index.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html lang="zh" xmlns:th="http://www.thymeleaf.org"> 2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" th:with="corp = ${@corporationService.getEnableCorporation()}">
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <meta name="renderer" content="webkit"> 6 <meta name="renderer" content="webkit">
7 - <title>华恒WMS管理系统首页</title>  
8 - <meta name="keywords" content="华恒WMS管理系统首页">  
9 - <meta name="description" content="华恒WMS管理系统首页"> 7 + <title th:text="${corp}?${corp.getName()} + '- 首页 ':'华恒WMS仓库管理系统首页'"></title>
  8 + <meta name="keywords" th:attr="content=${corp}?${corp.getName()}">
  9 + <meta name="description" th:attr="content=${corp}?${corp.getName()}">
  10 + <meta name="description" th:attr="content=${corp}?${corp.getName()}">
10 <!--[if lt IE 9]> 11 <!--[if lt IE 9]>
11 <meta http-equiv="refresh" content="0;ie.html"/> 12 <meta http-equiv="refresh" content="0;ie.html"/>
12 <![endif]--> 13 <![endif]-->
13 - <link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/> 14 + <link rel="shortcut icon" href="../static/favicon.ico" th:href="${corp}?${corp.getPIcon()}:@{favicon.ico}"/>
14 <!--<link th:href="@{favicon.ico}" rel="shortcut icon"/>--> 15 <!--<link th:href="@{favicon.ico}" rel="shortcut icon"/>-->
15 <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/> 16 <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
16 <link th:href="@{/css/font-awesome.css}" rel="stylesheet"/> 17 <link th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
@@ -31,7 +32,7 @@ @@ -31,7 +32,7 @@
31 <li class="nav-header"> 32 <li class="nav-header">
32 <div class="dropdown profile-element"> 33 <div class="dropdown profile-element">
33 <span class="pull-left" style="padding-right: 10px;"> 34 <span class="pull-left" style="padding-right: 10px;">
34 - <img th:src="(${user.avatar} == '') ? 'img/profile.jpg' : 'profile/' + ${user.avatar}" alt="image" class="img-circle" height="45" width="45"/> 35 + <img th:src="(${user.avatar} == '') ? (${corp}?${corp.getPLogoSmall()}:'img/profile.jpg') : 'profile/' + ${user.avatar}" alt="image" class="img-circle" height="45" width="45"/>
35 </span> 36 </span>
36 <a href="#" class="dropdown-toggle" data-toggle="dropdown"> 37 <a href="#" class="dropdown-toggle" data-toggle="dropdown">
37 <span class="pull-left clear"> 38 <span class="pull-left clear">
src/main/resources/templates/login.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html lang="zh" xmlns:th="http://www.thymeleaf.org"> 2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" th:with="corp = ${@corporationService.getEnableCorporation()}">
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
6 6
7 - <title>华恒WMS仓库管理系统 - 登录</title>  
8 - <meta name="keywords" content="华恒WMS管理系统"> 7 + <title th:text="${corp}?${corp.getName()} + '- 登录 ':'华恒WMS仓库管理系统 - 登录'"></title>
  8 + <meta name="keywords" th:attr="content=${corp}?${corp.getName()}">
9 <meta name="description" content="huaheng"> 9 <meta name="description" content="huaheng">
10 <link href="../static/css/bootstrap.min.css" th:href="@{css/bootstrap.min.css}" rel="stylesheet"/> 10 <link href="../static/css/bootstrap.min.css" th:href="@{css/bootstrap.min.css}" rel="stylesheet"/>
11 <link href="../static/css/font-awesome.css" th:href="@{css/font-awesome.css}" rel="stylesheet"/> 11 <link href="../static/css/font-awesome.css" th:href="@{css/font-awesome.css}" rel="stylesheet"/>
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 <!--[if lt IE 9]> 16 <!--[if lt IE 9]>
17 <meta http-equiv="refresh" content="0;ie.html"/> 17 <meta http-equiv="refresh" content="0;ie.html"/>
18 <![endif]--> 18 <![endif]-->
19 - <link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/> 19 + <link rel="shortcut icon" href="../static/favicon.ico" th:href="${corp}?${corp.getPIcon()}:@{favicon.ico}"/>
20 <style type="text/css">label.error { 20 <style type="text/css">label.error {
21 position: inherit; 21 position: inherit;
22 }</style> 22 }</style>
@@ -35,10 +35,12 @@ @@ -35,10 +35,12 @@
35 <div class="col-sm-6"> 35 <div class="col-sm-6">
36 <div class="signin-info"> 36 <div class="signin-info">
37 <div class="logopanel m-b"> 37 <div class="logopanel m-b">
38 - <h1><img alt="[ 华恒 ]" src="../static/huaheng.png" th:src="@{/huaheng.png}" style="max-height: 200px"></h1> 38 +
  39 + <!-- @{/huaheng.png} -->
  40 + <h1><img alt="[ 华恒 ]" src="../static/huaheng.png" th:src="${corp}?${corp.getPLogoBig()}:@{/huaheng.png}" style="max-height: 200px"></h1>
39 </div> 41 </div>
40 <div class="m-b"></div> 42 <div class="m-b"></div>
41 - <h4>欢迎使用华恒WMS仓库管理系统_v2.0</h4> 43 + <h4 th:text="${corp}?${corp.getVersionInfo()}:'欢迎使用华恒WMS仓库管理系统_v2.0'"></h4>
42 <!--<ul class="m-b">--> 44 <!--<ul class="m-b">-->
43 <!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>--> 45 <!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>-->
44 <!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>--> 46 <!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>-->
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
@@ -186,6 +186,9 @@ @@ -186,6 +186,9 @@
186 <a class="btn btn-outline btn-success btn-rounded" onclick="receiptDetailPrint()" shiro:hasPermission="shipment:bill:report"> 186 <a class="btn btn-outline btn-success btn-rounded" onclick="receiptDetailPrint()" shiro:hasPermission="shipment:bill:report">
187 <i class="fa fa-print"></i> 打印 187 <i class="fa fa-print"></i> 打印
188 </a> 188 </a>
  189 + <a class="btn btn-outline btn-primary btn-rounded" onclick="Toreceiving(receiptCode)">
  190 + <i class="fa fa-cart-plus"></i> 收货
  191 + </a>
189 </div> 192 </div>
190 <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table> 193 <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
191 </div> 194 </div>
src/main/resources/templates/system/user/profile/avatar.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html lang="zh" xmlns:th="http://www.thymeleaf.org" > 2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" th:with="corp = ${@corporationService.getEnableCorporation()}">
3 <meta charset="utf-8"> 3 <meta charset="utf-8">
4 <title>用户头像修改</title> 4 <title>用户头像修改</title>
5 <link href="/ajax/libs/cropbox/cropbox.css" th:href="@{/ajax/libs/cropbox/cropbox.css}" rel="stylesheet"/> 5 <link href="/ajax/libs/cropbox/cropbox.css" th:href="@{/ajax/libs/cropbox/cropbox.css}" rel="stylesheet"/>
@@ -24,12 +24,12 @@ @@ -24,12 +24,12 @@
24 </div> 24 </div>
25 <div th:include="include::footer"></div> 25 <div th:include="include::footer"></div>
26 <script th:src="@{/ajax/libs/cropbox/cropbox.js}"></script> 26 <script th:src="@{/ajax/libs/cropbox/cropbox.js}"></script>
27 -<script type="text/javascript"> 27 + <script th:inline="javascript">
28 $(window).load(function() { 28 $(window).load(function() {
29 var options = { 29 var options = {
30 thumbBox: '.thumbBox', 30 thumbBox: '.thumbBox',
31 spinner: '.spinner', 31 spinner: '.spinner',
32 - imgSrc: '/wms/img/profile.jpg' 32 + imgSrc: ctx + [[${user.avatar}!=''?('profile/' + ${user.avatar}):(${corp}?${corp.getPLogoSmall()}:'img/profile.jpg')]]
33 } 33 }
34 var cropper = $('.imageBox').cropbox(options); 34 var cropper = $('.imageBox').cropbox(options);
35 $('#avatar').on('change', 35 $('#avatar').on('change',
src/main/resources/templates/system/user/profile/edit.html
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 } 81 }
82 }, 82 },
83 dataFilter: function (data, type) { 83 dataFilter: function (data, type) {
84 - if (data == "0") return true; 84 + if (data == "\"0\"") return true;
85 else return false; 85 else return false;
86 } 86 }
87 } 87 }
@@ -102,8 +102,10 @@ @@ -102,8 +102,10 @@
102 } 102 }
103 }, 103 },
104 dataFilter: function (data, type) { 104 dataFilter: function (data, type) {
105 - if (data == "0") return true;  
106 - else return false; 105 + if (data == "\"0\"")
  106 + return true;
  107 + else
  108 + return false;
107 } 109 }
108 } 110 }
109 }, 111 },
src/main/resources/templates/system/user/profile/profile.html
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 -<html lang="zh" xmlns:th="http://www.thymeleaf.org" > 2 +<html lang="zh" xmlns:th="http://www.thymeleaf.org" th:with="corp = ${@corporationService.getEnableCorporation()}">
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <div class="contact-box"> 35 <div class="contact-box">
36 <div class="col-sm-4"> 36 <div class="col-sm-4">
37 <div class="text-center"> 37 <div class="text-center">
38 - <img alt="image" class="img-circle m-t-xs img-responsive" th:src="(${user.avatar} == '') ? '../../img/profiles.jpg' : '/profile/' + ${user.avatar}"> 38 + <img alt="image" class="img-circle m-t-xs img-responsive" th:src="(${user.avatar} == '') ?(${corp}?@{/}+${corp.getPLogoSmall()}:(@{/}+'img/profile.jpg')) : @{/}+ 'profile/' + ${user.avatar}">
39 <div class="m-t-xs font-bold">[[${user.loginIp}]]</div> 39 <div class="m-t-xs font-bold">[[${user.loginIp}]]</div>
40 </div> 40 </div>
41 </div> 41 </div>