|
@@ -11,24 +11,20 @@ import com.jeeplus.core.persistence.Page;
|
|
|
import com.jeeplus.core.web.BaseController;
|
|
|
import com.jeeplus.modules.sg.audit.information.entity.Information;
|
|
|
import com.jeeplus.modules.sg.audit.information.service.InformationService;
|
|
|
+import com.jeeplus.modules.sg.audit.information.utils.RandomUtil;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.service.ErpCreditService;
|
|
|
import com.jeeplus.modules.sg.financial.erpcredit.util.*;
|
|
|
+import com.jeeplus.modules.sg.financial.expense.entity.Expense;
|
|
|
+import com.jeeplus.modules.sg.financial.expense.service.ExpenseService;
|
|
|
import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
|
|
|
import com.jeeplus.modules.sg.financial.settlement.service.DataMaintenanceService;
|
|
|
import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
|
|
|
-import com.jeeplus.modules.test.one.dialog.entity.Leave1;
|
|
|
-import groovy.util.IFileNameFinder;
|
|
|
+import com.jeeplus.modules.sg.managementcenter.project.service.ProjectService;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
-import org.omg.PortableServer.LIFESPAN_POLICY_ID;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpRequest;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
@@ -40,12 +36,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
-import javax.validation.ConstraintViolationException;
|
|
|
import java.io.*;
|
|
|
-import java.net.URLDecoder;
|
|
|
-import java.net.URLEncoder;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -60,6 +52,12 @@ public class ErpCreditController extends BaseController {
|
|
|
private ErpCreditService erpCreditService;
|
|
|
@Autowired
|
|
|
private DataMaintenanceService dataMaintenanceService;
|
|
|
+ @Autowired
|
|
|
+ private ExpenseService expenseService;
|
|
|
+ @Autowired
|
|
|
+ private ProjectService projectService;
|
|
|
+ @Autowired
|
|
|
+ private InformationService informationService;
|
|
|
|
|
|
@ModelAttribute
|
|
|
public ErpCredit get(@RequestParam(required=false) String id) {
|
|
@@ -116,48 +114,37 @@ public class ErpCreditController extends BaseController {
|
|
|
提示
|
|
|
*/
|
|
|
@RequestMapping(value = "tips")
|
|
|
- public String Tips(String str,Model model, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
|
|
|
- str = URLDecoder.decode(str,"UTF-8");
|
|
|
- String[] strings2;
|
|
|
- List<ErpJudge> erpJudges = new ArrayList<ErpJudge>();
|
|
|
- ErpJudge erpJudge = null;
|
|
|
- if (str.contains("-")){
|
|
|
- String[] strings = str.split("-");
|
|
|
- for (String str1 :strings){
|
|
|
- strings2 = str1.split(",");
|
|
|
- erpJudge = new ErpJudge();
|
|
|
- erpJudge.setItemId(strings2[0]);
|
|
|
- erpJudge.setMainFlag(strings2[1]);
|
|
|
- erpJudge.setMainStartDate(strings2[2]);
|
|
|
- erpJudge.setMainEndDate(strings2[3]);
|
|
|
- erpJudge.setMainApprovalNumber(strings2[4]);
|
|
|
- erpJudge.setMainDesign(strings2[5]);
|
|
|
- erpJudge.setMainSupervision(strings2[6]);
|
|
|
- erpJudge.setMainConstructionUnits(strings2[7]);
|
|
|
- erpJudge.setMainDesignUnits(strings2[8]);
|
|
|
- erpJudge.setMainInvestmen(strings2[9]);
|
|
|
- erpJudge.setInfoFlag(strings2[10]);
|
|
|
- erpJudges.add(erpJudge);
|
|
|
- }
|
|
|
- }else {
|
|
|
- String[] strings3 = str.split(",");
|
|
|
- erpJudge = new ErpJudge();
|
|
|
- erpJudge.setItemId(strings3[0]);
|
|
|
- erpJudge.setMainFlag(strings3[1]);
|
|
|
- erpJudge.setMainStartDate(strings3[2]);
|
|
|
- erpJudge.setMainEndDate(strings3[3]);
|
|
|
- erpJudge.setMainApprovalNumber(strings3[4]);
|
|
|
- erpJudge.setMainDesign(strings3[5]);
|
|
|
- erpJudge.setMainSupervision(strings3[6]);
|
|
|
- erpJudge.setMainConstructionUnits(strings3[7]);
|
|
|
- erpJudge.setMainDesignUnits(strings3[8]);
|
|
|
- erpJudge.setMainInvestmen(strings3[9]);
|
|
|
- erpJudge.setInfoFlag(strings3[10]);
|
|
|
- erpJudges.add(erpJudge);
|
|
|
+ public String Tips(Model model, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
|
|
|
+ String ftpErpList = erpCreditService.getFtpErpList(request);
|
|
|
+ String[] split = ftpErpList.split(",");
|
|
|
+ List<ErpJudgeAccount> erpJudgeAccounts = new ArrayList<ErpJudgeAccount>();
|
|
|
+ ErpJudgeAccount erpJudgeAccount = null;
|
|
|
+ for (int i = 0; i < split.length; i+=4) {
|
|
|
+ erpJudgeAccount = new ErpJudgeAccount();
|
|
|
+ erpJudgeAccount.setItemId(split[i]);
|
|
|
+ erpJudgeAccount.setItemName(split[i+1]);
|
|
|
+ erpJudgeAccount.setFlagItem(split[i+2]);
|
|
|
+// erpJudgeAccount.setItemSupplierName(split[i+3]);
|
|
|
+ erpJudgeAccounts.add(erpJudgeAccount);
|
|
|
}
|
|
|
- model.addAttribute("erpList",erpJudges);
|
|
|
+ model.addAttribute("erpJudgeAccounts",erpJudgeAccounts);
|
|
|
return "modules/sg/financial/erp/erpCreditTips";
|
|
|
}
|
|
|
+ @RequestMapping(value = "tips1")
|
|
|
+ public String Tips1(Model model, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
|
|
|
+ String ftpErpList = erpCreditService.getFtpErpList(request);
|
|
|
+ String[] split = ftpErpList.split(",");
|
|
|
+ List<ErpJudgeArtificial> erpJudgeArtificials = new ArrayList<ErpJudgeArtificial>();
|
|
|
+ ErpJudgeArtificial erpJudgeArtificial = null;
|
|
|
+ for (int i = 0; i < split.length; i+=2) {
|
|
|
+ erpJudgeArtificial = new ErpJudgeArtificial();
|
|
|
+ erpJudgeArtificial.setItemId(split[i]);
|
|
|
+ erpJudgeArtificial.setNotTheSame(split[i+1]);
|
|
|
+ erpJudgeArtificials.add(erpJudgeArtificial);
|
|
|
+ }
|
|
|
+ model.addAttribute("erpJudgeArtificials",erpJudgeArtificials);
|
|
|
+ return "modules/sg/financial/erp/erpTipsUserJudge";
|
|
|
+ }
|
|
|
/**
|
|
|
* 保存表单
|
|
|
*/
|
|
@@ -220,41 +207,63 @@ public class ErpCreditController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出excel列表文件
|
|
|
- */
|
|
|
- @ResponseBody
|
|
|
+ * 导出excel列表文件
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
@RequiresPermissions("sg:financial:erpCredit:export")
|
|
|
- @RequestMapping(value = "exportList")
|
|
|
- public Result exportFileList(ErpCredit erpCredit,HttpServletRequest request, HttpServletResponse response){
|
|
|
+ @RequestMapping(value = "exportList")
|
|
|
+ public Result exportFileList(ErpCredit erpCredit,HttpServletRequest request, HttpServletResponse response){
|
|
|
HttpSession session = request.getSession();
|
|
|
String attribute = (String) session.getAttribute("erpStatus");
|
|
|
erpCredit.setStatus(attribute);
|
|
|
- Result j = new Result();
|
|
|
- try {
|
|
|
- String fileName = "送审决算信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
|
|
|
- Page<ErpCredit> page = erpCreditService.findPage(new Page<ErpCredit>(request, response, -1), erpCredit);
|
|
|
- new ExportExcel("送审决算信息", ErpCredit.class).setDataList(page.getList()).write(response, fileName).dispose();
|
|
|
+ Result j = new Result();
|
|
|
+ try {
|
|
|
+ String fileName = "送审决算信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
|
|
|
+ Page<ErpCredit> page = erpCreditService.findPage(new Page<ErpCredit>(request, response, -1), erpCredit);
|
|
|
+ new ExportExcel("送审决算信息", ErpCredit.class).setDataList(page.getList()).write(response, fileName).dispose();
|
|
|
+
|
|
|
+ j.setSuccess(true);
|
|
|
+ j.setMsg("导出成功!");
|
|
|
+ }catch (Exception e){
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导出失败!失败信息:"+e.getMessage());
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 导出excel列表文件
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping(value = "exportYesStatus")
|
|
|
+ public Result exportYesStatus(ErpCredit erpCredit,HttpServletRequest request, HttpServletResponse response){
|
|
|
+ Result j = new Result();
|
|
|
+ try {
|
|
|
+ String fileName = "费用入账差异信息"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
|
|
|
+ String ftpErpList = erpCreditService.getFtpErpList(request);
|
|
|
+ List<ErpJudgeExport> erpJudgeExport = ValidationUtils.getErpJudgeExport(ftpErpList);
|
|
|
+ new ExportExcel("费用入账差异信息", ErpJudgeExport.class).setDataList(erpJudgeExport).write(response, fileName).dispose();
|
|
|
+ j.setSuccess(true);
|
|
|
+ j.setMsg("导出成功!");
|
|
|
+ }catch (Exception e){
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导出失败!失败信息:"+e.getMessage());
|
|
|
+ }
|
|
|
+ return j;
|
|
|
+ }
|
|
|
|
|
|
- j.setSuccess(true);
|
|
|
- j.setMsg("导出成功!");
|
|
|
- }catch (Exception e){
|
|
|
- j.setSuccess(false);
|
|
|
- j.setMsg("导出失败!失败信息:"+e.getMessage());
|
|
|
- }
|
|
|
- return j;
|
|
|
- }
|
|
|
/**
|
|
|
* 导出excel文件
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("sg:financial:erpCredit:export")
|
|
|
@RequestMapping(value = "export")
|
|
|
- public Result exportFile(String ids,HttpServletRequest request, HttpServletResponse response){
|
|
|
+ public Result exportFile(HttpServletRequest request, HttpServletResponse response){
|
|
|
Result j = new Result();
|
|
|
try {
|
|
|
+ String allFtpErpList = erpCreditService.getAllFtpErpList(request);
|
|
|
HttpSession session = request.getSession();
|
|
|
String attribute = (String) session.getAttribute("erpStatus");
|
|
|
- erpCreditService.getExport(ids,response,attribute);
|
|
|
+ erpCreditService.getExport(allFtpErpList,response,attribute);
|
|
|
j.setSuccess(true);
|
|
|
j.setMsg("导出成功!");
|
|
|
}catch (Exception e){
|
|
@@ -263,6 +272,8 @@ public class ErpCreditController extends BaseController {
|
|
|
}
|
|
|
return j;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
@ResponseBody
|
|
|
@RequestMapping(value = "detail")
|
|
|
public ErpCredit detail(String id) {
|
|
@@ -274,10 +285,10 @@ public class ErpCreditController extends BaseController {
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("sg:financial:erpCredit:import")
|
|
|
@RequestMapping(value = "import")
|
|
|
- public Result importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request,Model model) throws IOException, InvalidFormatException {
|
|
|
+ public Result importFile(@RequestParam("file")MultipartFile file, HttpServletResponse response, HttpServletRequest request,Model model) {
|
|
|
Result j = new Result();
|
|
|
String str = "";
|
|
|
-// try {
|
|
|
+ try {
|
|
|
int successNum = 0;
|
|
|
int failureNum = 0;
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
@@ -290,29 +301,85 @@ public class ErpCreditController extends BaseController {
|
|
|
}
|
|
|
List<ErpAccount> erpAccounts = ErpInfo.getErpAccount(importUtil);//获取表格数据
|
|
|
List<ErpCredit> erpCredits = ErpInfo.getAllErpCreditList(erpAccounts);//获取单条数据
|
|
|
- //验证方法
|
|
|
- List<ErpJudge> erpJudges = erpCreditService.getAllCheck(erpCredits);
|
|
|
- if (null!=erpJudges&&erpJudges.size()>0){
|
|
|
- String judge = "";
|
|
|
- for (ErpJudge erpJudge:erpJudges){
|
|
|
- judge += erpJudge.getItemId()+","+erpJudge.getMainFlag()+","+
|
|
|
- erpJudge.getMainStartDate()+","+erpJudge.getMainEndDate()+","+
|
|
|
- erpJudge.getMainApprovalNumber()+","+erpJudge.getMainDesign()+"," +
|
|
|
- erpJudge.getMainSupervision()+","+erpJudge.getMainConstructionUnits()+","+
|
|
|
- erpJudge.getMainDesignUnits()+","+erpJudge.getMainInvestmen()+","+erpJudge.getInfoFlag()+"-";
|
|
|
- }
|
|
|
- judge = judge.substring(0,judge.length()-1);
|
|
|
-// j.setErpList(erpJudges);
|
|
|
- j.setList(judge);
|
|
|
- j.setFlag(true);
|
|
|
+
|
|
|
+ //需求基本信息验证
|
|
|
+ List<Project> projects = projectService.findList(new Project());
|
|
|
+ String projectJudge = ValidationUtils.getProjectJudge(erpCredits, projects);
|
|
|
+ if (!"".equals(projectJudge)){
|
|
|
+ erpCreditService.getFtpList(request,projectJudge);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(true);
|
|
|
+ j.setMsg("无需求基本信息数据");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ //项目资本和成本验证
|
|
|
+ String theCostOfCapital = ValidationUtils.getTheCostOfCapital(erpCredits, projects);
|
|
|
+ if (theCostOfCapital.equals("3")){
|
|
|
j.setSuccess(false);
|
|
|
+ j.setMsg("导入失败,项目不能同时存在资本和成本!");
|
|
|
return j;
|
|
|
}
|
|
|
- for (ErpCredit erpCredit:erpCredits){
|
|
|
- str+=erpCredit.getItemId()+",";
|
|
|
+ //验证概预算信息方法
|
|
|
+ List<MaintainData> maintainDatas = dataMaintenanceService.getJudge();//所有概预算信息
|
|
|
+ String dataMainJudge = ValidationUtils.getDataMainJudge(erpCredits, maintainDatas);
|
|
|
+ if (!"".equals(dataMainJudge)){
|
|
|
+ erpCreditService.getFtpList(request,dataMainJudge);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(true);
|
|
|
+ j.setMsg("概预算信息没有项目数据");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ //查询费用入账所有信息
|
|
|
+ List<Expense> expenses = expenseService.findList(new Expense());
|
|
|
+ String expenseJudge = ValidationUtils.getExpenseJudge(erpCredits, expenses);
|
|
|
+ if (!"".equals(expenseJudge)){
|
|
|
+ erpCreditService.getFtpList(request,expenseJudge);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(true);
|
|
|
+ j.setMsg("费用入账没有项目信息数据");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ //验证甲供材
|
|
|
+ List<Information> informationList = informationService.findList(new Information());
|
|
|
+ String informationJudge = ValidationUtils.getInformationJudge(erpCredits, informationList);
|
|
|
+ if (!"".equals(informationJudge)){
|
|
|
+ erpCreditService.getFtpList(request,informationJudge);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(true);
|
|
|
+ j.setMsg("甲供物资核实没有项目信息数据");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ List<Information> infoFlag = erpCreditService.getInfoFlag(erpCredits);
|
|
|
+ String informationJudge1 = ValidationUtils.getInformationJudge1(erpCredits, infoFlag);
|
|
|
+ if (!"".equals(informationJudge1)){
|
|
|
+ erpCreditService.getFtpList(request,informationJudge1);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(true);
|
|
|
+ j.setMsg("甲供物资核实没有完成施工项目");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ //整合 验证费用入账模块
|
|
|
+ List<Expense> expenseList = CostAccountUnits.getQCExpense(erpCredits,expenses);//库存信息区分2020年前和年后
|
|
|
+ //得到验证数据
|
|
|
+ Map<String, List<ErpCredit>> judgeEnterAccount = CostAccountUnits.getJudgeEnterAccount(erpCredits, expenseList, informationList, maintainDatas);
|
|
|
+// //若应付金额(不含税价)<实付金额(不含税价),需要导出差异情况,同时费用入账核实存在问题。
|
|
|
+ List<ErpCredit> listThree = judgeEnterAccount.get("judgeEnterAccountThree");
|
|
|
+ String judgeThree = ValidationUtils.getJudgeThree(listThree);
|
|
|
+ if (!"".equals(listThree)){
|
|
|
+ erpCreditService.getFtpList(request,judgeThree);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setYesStatus(true);
|
|
|
+ j.setMsg("导入失败:费用入账存在差异信息,正在导出差异信息");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ Object allErpPath = request.getSession().getAttribute("AllErpPath");
|
|
|
+ if (allErpPath != null && allErpPath != "") {
|
|
|
+ RandomUtil.delete(allErpPath.toString());
|
|
|
+ request.getSession().removeAttribute("AllErpPath");
|
|
|
}
|
|
|
- str = str.substring(0,str.length()-1);
|
|
|
- String random = random = ErpInfo.getStatus();//保存session
|
|
|
+ String allListErpCredit = ValidationUtils.getAllListErpCredit(erpCredits);
|
|
|
+ erpCreditService.getAllFtpList(request,allListErpCredit);
|
|
|
+ String random = ErpInfo.getStatus();//保存session
|
|
|
request.getSession().setAttribute("erpStatus",random);;
|
|
|
for (ErpCredit erpCredit : erpCredits){
|
|
|
try{
|
|
@@ -322,15 +389,31 @@ public class ErpCreditController extends BaseController {
|
|
|
failureNum++;
|
|
|
}
|
|
|
}
|
|
|
+ //若应付金额(不含税价)>实付金额(不含税价),需要进入人工判断,若人工判断通过,则费用入账核实无问题,若人工判断不通过则费用入账核实存在问题
|
|
|
+ List<ErpCredit> listTwo = judgeEnterAccount.get("judgeEnterAccountTwo");
|
|
|
+ String judgeTwo = ValidationUtils.getJudgeTwo(listTwo);
|
|
|
+ if (!"".equals(judgeTwo)){
|
|
|
+ erpCreditService.getFtpList(request,judgeTwo);
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setFlag(false);
|
|
|
+ j.setNoStatus(true);
|
|
|
+ j.setMsg("部分数据(应付金额>实付金额),请人工判断");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
+ //允许项目关闭
|
|
|
+ if (theCostOfCapital.equals("0")){
|
|
|
+ j.setSuccess(true);
|
|
|
+ j.setMsg("导入成功:允许项目关闭");
|
|
|
+ return j;
|
|
|
+ }
|
|
|
if (failureNum>0){
|
|
|
failureMsg.insert(0, ",失败 "+failureNum+" 条送审决算记录。");
|
|
|
}
|
|
|
j.setMsg( "已成功导入 "+successNum+" 条送审决算记录"+failureMsg);
|
|
|
- j.setList(str);
|
|
|
-// } catch (Exception e) {
|
|
|
-// j.setSuccess(false);
|
|
|
-// j.setMsg("导入送审决算失败!失败信息:"+e.getMessage());
|
|
|
-// }
|
|
|
+ } catch (Exception e) {
|
|
|
+ j.setSuccess(false);
|
|
|
+ j.setMsg("导入送审决算失败!失败信息:"+e.getMessage());
|
|
|
+ }
|
|
|
return j;
|
|
|
}
|
|
|
}
|