|
@@ -8,17 +8,21 @@ import com.jeeplus.common.config.Global;
|
|
|
import com.jeeplus.common.json.AjaxJson;
|
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
|
import com.jeeplus.common.utils.excel.ImportExcel;
|
|
|
+import com.jeeplus.common.utils.text.EncodeUtil;
|
|
|
import com.jeeplus.core.persistence.Page;
|
|
|
import com.jeeplus.core.web.BaseController;
|
|
|
import com.jeeplus.modules.sg.managementcenter.activiti.utils.MyActiviUtils;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleBlockVersion;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleBlock;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleListing;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.entity.ModuleVersion;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.service.ModuleBlockService;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.moduleacquisition.service.ModuleBlockVersionService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.service.ModuleListingService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.moduleacquisition.util.ModuleUtil;
|
|
|
import com.jeeplus.modules.sg.picking.activiti.service.PickIngService;
|
|
|
import com.jeeplus.modules.sys.entity.DictValue;
|
|
|
+import org.apache.http.client.utils.URLEncodedUtils;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -35,6 +39,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.io.IOException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -49,6 +55,8 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
private ModuleListingService moduleListingService;
|
|
|
@Autowired
|
|
|
private PickIngService pickIngService;
|
|
|
+ @Autowired
|
|
|
+ private ModuleBlockVersionService moduleBlockVersionService;
|
|
|
|
|
|
@ModelAttribute
|
|
|
public ModuleBlock get(@RequestParam(required=false) String id) {
|
|
@@ -61,7 +69,15 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
}
|
|
|
return entity;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 文件上传
|
|
|
+ */
|
|
|
+ @RequiresPermissions("user")
|
|
|
+ @RequestMapping(value = "importExcel")
|
|
|
+ public String importExcel() {
|
|
|
+ return "modules/sg/managementcenter/moduleacquisition/importExcel";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 项目列表页面
|
|
|
*/
|
|
@@ -98,9 +114,8 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
@RequestMapping(value = "newData")
|
|
|
public Map<String, Object> newData(ModuleBlock moduleBlock, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
HttpSession session = request.getSession();
|
|
|
- String md_version = (String) session.getAttribute("md_version");
|
|
|
- Integer version = new Integer(md_version) + 1;
|
|
|
- moduleBlock.setMdVersion(String.valueOf(version));
|
|
|
+ String versionName = (String) session.getAttribute("versionName");
|
|
|
+ moduleBlock.setMdVersionName(versionName);
|
|
|
Page<ModuleBlock> page = moduleBlockService.findPage(new Page<ModuleBlock>(request, response), moduleBlock);
|
|
|
//当判定系统为linux的时候
|
|
|
if (Global.SYS_TYPE.equals("2")) {
|
|
@@ -142,8 +157,15 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
@RequiresPermissions(value={"managementcenter:moduleacquisition:add","managementcenter:moduleacquisition:edit"},logical=Logical.OR)
|
|
|
@RequestMapping(value = "save")
|
|
|
public AjaxJson save(ModuleBlock moduleBlock, Model model,HttpServletRequest request) throws Exception{
|
|
|
- HttpSession session = request.getSession();
|
|
|
- String md_version = (String) session.getAttribute("md_version");
|
|
|
+ if (moduleBlock.getIsNewRecord()){
|
|
|
+ HttpSession session = request.getSession();
|
|
|
+ String versionName = (String) session.getAttribute("versionName");
|
|
|
+ ModuleBlockVersion moduleBlockVersion = new ModuleBlockVersion();
|
|
|
+ moduleBlockVersion.setVersionName(versionName);
|
|
|
+ ModuleBlockVersion versionServiceById = moduleBlockVersionService.findById(moduleBlockVersion);//查询版本信息
|
|
|
+ moduleBlock.setMdVersion(versionServiceById.getId());
|
|
|
+ moduleBlock.setMdVersionName(versionName);
|
|
|
+ }
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
/**
|
|
|
* 后台hibernate-validation插件校验
|
|
@@ -155,8 +177,6 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
return j;
|
|
|
}
|
|
|
//新增或编辑表单保存
|
|
|
- Integer version = new Integer(md_version) + 1;
|
|
|
- moduleBlock.setMdVersion(String.valueOf(version));
|
|
|
moduleBlockService.save(moduleBlock);//保存
|
|
|
j.setSuccess(true);
|
|
|
j.setMsg("保存模块成功");
|
|
@@ -225,15 +245,21 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("managementcenter:moduleacquisition:import")
|
|
|
@RequestMapping(value = "import")
|
|
|
- public AjaxJson importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException, InvalidFormatException {
|
|
|
+ public AjaxJson importFile(@RequestParam("file")MultipartFile file, ModuleBlockVersion moduleBlockVersion, HttpServletResponse response, HttpServletRequest request){
|
|
|
AjaxJson j = new AjaxJson();
|
|
|
try {
|
|
|
+ ModuleBlockVersion moduleBlockVersion1 = null;
|
|
|
+ moduleBlockVersion1 = moduleBlockVersionService.findById(moduleBlockVersion);
|
|
|
+ if (null!=moduleBlockVersion1){
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导入失败:版本名称已经存在,请更换版本名称再进行操作");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
ImportExcel importBlock = new ImportExcel(file, 0, "模块表");
|
|
|
ImportExcel importListing = new ImportExcel(file, 0, "模块清单");
|
|
|
List<ModuleBlock> moduleBlockUtil = ModuleUtil.getModuleBlockUtil(importBlock);
|
|
|
List<ModuleListing> moduleListingUtil = ModuleUtil.getModuleListingUtil(importListing);
|
|
|
- String maxVersion = moduleBlockService.findVersion();//获得版本号
|
|
|
- moduleBlockService.savaList(moduleBlockUtil,moduleListingUtil,maxVersion);
|
|
|
+ moduleBlockService.savaList(moduleBlockUtil,moduleListingUtil,moduleBlockVersion);
|
|
|
j.setMsg( "已成功导入 "+moduleBlockUtil.size()+" 条记录");
|
|
|
} catch (Exception e) {
|
|
|
j.setSuccess(false);
|
|
@@ -245,22 +271,36 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
生成新版本
|
|
|
*/
|
|
|
@RequestMapping(value = "insertVersion")
|
|
|
- public String saveVersion(String mdVersion,ModuleBlock moduleBlock,Model model,HttpServletRequest request) {
|
|
|
- String version = moduleBlockService.findVersion();
|
|
|
+ public String saveVersion(ModuleBlock moduleBlock,String versionId,ModuleBlockVersion moduleBlockVersion,Model model,HttpServletRequest request) {
|
|
|
+ String versionName = moduleBlockVersion.getVersionName();
|
|
|
+ String versionAlias = moduleBlockVersion.getVersionAlias();
|
|
|
+ try {
|
|
|
+ moduleBlockVersion.setVersionName(URLDecoder.decode(versionName, "UTF-8"));
|
|
|
+ moduleBlockVersion.setVersionAlias(URLDecoder.decode(versionAlias,"UTF-8"));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ ModuleBlockVersion moduleBlockVersion1 = null;
|
|
|
+ moduleBlockVersion1 = moduleBlockVersionService.findById(moduleBlockVersion);
|
|
|
+ if (null!=moduleBlockVersion1){
|
|
|
+ String str = moduleBlockVersion.getVersionName();
|
|
|
+ moduleBlockVersion.setVersionName(str+"新版");
|
|
|
+ }
|
|
|
HttpSession session = request.getSession();
|
|
|
- session.setAttribute("md_version",version);
|
|
|
- moduleBlock.setMdVersion(mdVersion);
|
|
|
+ session.setAttribute("versionName",moduleBlockVersion.getVersionName());
|
|
|
+ moduleBlock.setMdVersion(versionId);
|
|
|
List<ModuleBlock> moduleBlocks = moduleBlockService.findList(moduleBlock);
|
|
|
List<ModuleListing> moduleListings = moduleListingService.findByList(moduleBlocks);
|
|
|
- moduleBlockService.savaList(moduleBlocks,moduleListings,version);
|
|
|
+ //生成新版本:保存数据
|
|
|
+ moduleBlockService.savaList(moduleBlocks,moduleListings,moduleBlockVersion);
|
|
|
model.addAttribute("ModuleBlock",moduleBlock);
|
|
|
return "modules/sg/managementcenter/moduleacquisition/moduleBlockNewList";
|
|
|
}
|
|
|
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "dataVersion")
|
|
|
- public Map<String, Object> dataVersion(ModuleVersion version, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
- Page<ModuleVersion> page = moduleBlockService.findPage(new Page<ModuleVersion>(request, response), version);
|
|
|
+ public Map<String, Object> dataVersion(ModuleBlockVersion moduleBlockVersion, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
+ Page<ModuleBlockVersion> page = moduleBlockVersionService.findPage(new Page<ModuleBlockVersion>(request, response), moduleBlockVersion);
|
|
|
return getBootstrapData(page);
|
|
|
}
|
|
|
|
|
@@ -269,8 +309,8 @@ public class ModuleBlockWeb extends BaseController {
|
|
|
*/
|
|
|
@RequiresPermissions("managementcenter:moduleacquisition:insertVersion")
|
|
|
@RequestMapping(value ="listVersion")
|
|
|
- public String listVersion(ModuleVersion moduleVersion, Model model,HttpServletRequest request) {
|
|
|
- model.addAttribute("ModuleVersion",moduleVersion);
|
|
|
+ public String listVersion(ModuleBlockVersion moduleBlockVersion, Model model,HttpServletRequest request) {
|
|
|
+ model.addAttribute("moduleBlockVersion",moduleBlockVersion);
|
|
|
return "modules/sg/managementcenter/moduleacquisition/moduleVersionList";
|
|
|
}
|
|
|
|