|
@@ -10,13 +10,15 @@ import com.jeeplus.core.service.CrudService;
|
|
import com.jeeplus.modules.sg.audit.information.entity.Information;
|
|
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.service.InformationService;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.entity.*;
|
|
-import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditChild1Mapper;
|
|
|
|
-import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditChild2Mapper;
|
|
|
|
|
|
+import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditEquipmentMapper;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMapper;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMapper;
|
|
|
|
+import com.jeeplus.modules.sg.financial.erpcredit.mapper.ErpCreditMaterialMapper;
|
|
|
|
+import com.jeeplus.modules.sg.financial.erpcredit.util.ErpInfo;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.util.ExportTemplate;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.util.ExportTemplate;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil2;
|
|
import com.jeeplus.modules.sg.financial.erpcredit.util.ExportUtil2;
|
|
import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
|
|
import com.jeeplus.modules.sg.financial.settlement.entity.MaintainData;
|
|
import com.jeeplus.modules.sg.financial.settlement.mapper.DataMaintenanceMapper;
|
|
import com.jeeplus.modules.sg.financial.settlement.mapper.DataMaintenanceMapper;
|
|
|
|
+import com.jeeplus.modules.sg.financial.settlement.service.DataMaintenanceService;
|
|
import org.apache.poi.hssf.usermodel.HSSFFont;
|
|
import org.apache.poi.hssf.usermodel.HSSFFont;
|
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
@@ -29,39 +31,46 @@ import javax.servlet.http.HttpServletResponse;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Transactional(readOnly = true)
|
|
@Transactional(readOnly = true)
|
|
public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
@Autowired
|
|
@Autowired
|
|
- private ErpCreditChild1Mapper erpCreditChild1Mapper;
|
|
|
|
|
|
+ private ErpCreditEquipmentMapper erpCreditEquipmentMapper;
|
|
@Autowired
|
|
@Autowired
|
|
- private ErpCreditChild2Mapper erpCreditChild2Mapper;
|
|
|
|
|
|
+ private ErpCreditMaterialMapper erpCreditMaterialMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private ErpCreditMapper erpCreditMapper;
|
|
private ErpCreditMapper erpCreditMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private DataMaintenanceMapper dataMaintenanceMapper;
|
|
private DataMaintenanceMapper dataMaintenanceMapper;
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private InformationService informationService;
|
|
private InformationService informationService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataMaintenanceService dataMaintenanceService;
|
|
|
|
|
|
- public List<ErpCredit> getListErpCredit(List<String> strings){
|
|
|
|
- List<ErpCredit> erpCreditList = erpCreditMapper.findErpCreditList(strings);
|
|
|
|
- List<ErpCreditChild1> erpCreditChild1List = erpCreditChild1Mapper.findErpCreditChild1List(strings);
|
|
|
|
- List<ErpCreditChild2> erpCreditChild2List = erpCreditChild2Mapper.findErpCreditChild2List(strings);
|
|
|
|
|
|
+ public List<ErpCredit> getListErpCredit(List<String> itemId){
|
|
|
|
+ List<ErpCredit> erpCreditList = erpCreditMapper.findErpCreditList(itemId);
|
|
|
|
+ List<String> strings = new ArrayList<String>();
|
|
|
|
+ for (ErpCredit erpCredit:erpCreditList){
|
|
|
|
+ strings.add(erpCredit.getId());
|
|
|
|
+ }
|
|
|
|
+ List<ErpCreditEquipment> erpCreditChild1List = erpCreditEquipmentMapper.findErpCreditChild1List(strings);
|
|
|
|
+ List<ErpCreditMaterial> erpCreditChild2List = erpCreditMaterialMapper.findErpCreditChild2List(strings);
|
|
if (null!=erpCreditList&&erpCreditList.size()>0){
|
|
if (null!=erpCreditList&&erpCreditList.size()>0){
|
|
for (ErpCredit erpCredit:erpCreditList){
|
|
for (ErpCredit erpCredit:erpCreditList){
|
|
if (null!=erpCreditChild1List&&erpCreditChild1List.size()>0){
|
|
if (null!=erpCreditChild1List&&erpCreditChild1List.size()>0){
|
|
- for (ErpCreditChild1 erpCreditChild1:erpCreditChild1List){
|
|
|
|
- if (erpCredit.getId().equals(erpCreditChild1.getErpCredit().getId())){
|
|
|
|
- erpCredit.getErpCreditChild1s().add(erpCreditChild1);
|
|
|
|
|
|
+ for (ErpCreditEquipment erpCreditEquipment:erpCreditChild1List){
|
|
|
|
+ if (erpCredit.getId().equals(erpCreditEquipment.getErpCredit().getId())){
|
|
|
|
+ erpCredit.getErpCreditChild1s().add(erpCreditEquipment);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (null!=erpCreditChild2List&&erpCreditChild2List.size()>0){
|
|
if (null!=erpCreditChild2List&&erpCreditChild2List.size()>0){
|
|
- for (ErpCreditChild2 erpCreditChild2:erpCreditChild2List){
|
|
|
|
|
|
+ for (ErpCreditMaterial erpCreditChild2:erpCreditChild2List){
|
|
if (erpCredit.getId().equals(erpCreditChild2.getErpCredit().getId())){
|
|
if (erpCredit.getId().equals(erpCreditChild2.getErpCredit().getId())){
|
|
erpCredit.getErpCreditChild2s().add(erpCreditChild2);
|
|
erpCredit.getErpCreditChild2s().add(erpCreditChild2);
|
|
}
|
|
}
|
|
@@ -73,8 +82,8 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
}
|
|
}
|
|
public ErpCredit get(String id) {
|
|
public ErpCredit get(String id) {
|
|
ErpCredit erpCredit = super.get(id);
|
|
ErpCredit erpCredit = super.get(id);
|
|
- erpCredit.setErpCreditChild1s(erpCreditChild1Mapper.findList(new ErpCreditChild1(erpCredit)));
|
|
|
|
- erpCredit.setErpCreditChild2s(erpCreditChild2Mapper.findList(new ErpCreditChild2(erpCredit)));
|
|
|
|
|
|
+ erpCredit.setErpCreditChild1s(erpCreditEquipmentMapper.findList(new ErpCreditEquipment(erpCredit)));
|
|
|
|
+ erpCredit.setErpCreditChild2s(erpCreditMaterialMapper.findList(new ErpCreditMaterial(erpCredit)));
|
|
// erpCredit.setErpCreditChild3s(erpCreditChild3Mapper.findList(new ErpCreditChild3(erpCredit)));
|
|
// erpCredit.setErpCreditChild3s(erpCreditChild3Mapper.findList(new ErpCreditChild3(erpCredit)));
|
|
return erpCredit;
|
|
return erpCredit;
|
|
}
|
|
}
|
|
@@ -88,34 +97,35 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
}
|
|
}
|
|
|
|
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
- public void save(ErpCredit erpCredit) {
|
|
|
|
|
|
+ public void save(ErpCredit erpCredit,String string) {
|
|
|
|
+ erpCredit.setStatus(string);
|
|
super.save(erpCredit);
|
|
super.save(erpCredit);
|
|
- for (ErpCreditChild1 erpCreditChild1 : erpCredit.getErpCreditChild1s()){
|
|
|
|
- if (ErpCreditChild1.DEL_FLAG_NORMAL.equals(erpCredit.getDelFlag())){
|
|
|
|
|
|
+ for (ErpCreditEquipment erpCreditChild1 : erpCredit.getErpCreditChild1s()){
|
|
|
|
+ if (ErpCreditEquipment.DEL_FLAG_NORMAL.equals(erpCredit.getDelFlag())){
|
|
if (StringUtils.isBlank(erpCreditChild1.getId())) {
|
|
if (StringUtils.isBlank(erpCreditChild1.getId())) {
|
|
erpCreditChild1.setErpCredit(erpCredit);
|
|
erpCreditChild1.setErpCredit(erpCredit);
|
|
erpCreditChild1.preInsert();
|
|
erpCreditChild1.preInsert();
|
|
- erpCreditChild1Mapper.insert(erpCreditChild1);
|
|
|
|
|
|
+ erpCreditEquipmentMapper.insert(erpCreditChild1);
|
|
}else {
|
|
}else {
|
|
erpCreditChild1.preUpdate();
|
|
erpCreditChild1.preUpdate();
|
|
- erpCreditChild1Mapper.update(erpCreditChild1);
|
|
|
|
|
|
+ erpCreditEquipmentMapper.update(erpCreditChild1);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- erpCreditChild1Mapper.delete(erpCreditChild1);
|
|
|
|
|
|
+ erpCreditEquipmentMapper.delete(erpCreditChild1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (ErpCreditChild2 erpCreditChild2 : erpCredit.getErpCreditChild2s()){
|
|
|
|
- if (ErpCreditChild2.DEL_FLAG_NORMAL.equals(erpCreditChild2.getDelFlag())){
|
|
|
|
|
|
+ for (ErpCreditMaterial erpCreditChild2 : erpCredit.getErpCreditChild2s()){
|
|
|
|
+ if (ErpCreditMaterial.DEL_FLAG_NORMAL.equals(erpCreditChild2.getDelFlag())){
|
|
if (StringUtils.isBlank(erpCreditChild2.getId())){
|
|
if (StringUtils.isBlank(erpCreditChild2.getId())){
|
|
erpCreditChild2.setErpCredit(erpCredit);
|
|
erpCreditChild2.setErpCredit(erpCredit);
|
|
erpCreditChild2.preInsert();
|
|
erpCreditChild2.preInsert();
|
|
- erpCreditChild2Mapper.insert(erpCreditChild2);
|
|
|
|
|
|
+ erpCreditMaterialMapper.insert(erpCreditChild2);
|
|
}else {
|
|
}else {
|
|
erpCreditChild2.preUpdate();
|
|
erpCreditChild2.preUpdate();
|
|
- erpCreditChild2Mapper.update(erpCreditChild2);
|
|
|
|
|
|
+ erpCreditMaterialMapper.update(erpCreditChild2);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- erpCreditChild2Mapper.delete(erpCreditChild2);
|
|
|
|
|
|
+ erpCreditMaterialMapper.delete(erpCreditChild2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// for (ErpCreditChild3 erpCreditChild3 : erpCredit.getErpCreditChild3s()){
|
|
// for (ErpCreditChild3 erpCreditChild3 : erpCredit.getErpCreditChild3s()){
|
|
@@ -137,20 +147,25 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
public void delete(ErpCredit erpCredit) {
|
|
public void delete(ErpCredit erpCredit) {
|
|
super.delete(erpCredit);
|
|
super.delete(erpCredit);
|
|
- erpCreditChild1Mapper.delete(new ErpCreditChild1(erpCredit));
|
|
|
|
- erpCreditChild2Mapper.delete(new ErpCreditChild2(erpCredit));
|
|
|
|
|
|
+ erpCreditEquipmentMapper.delete(new ErpCreditEquipment(erpCredit));
|
|
|
|
+ erpCreditMaterialMapper.delete(new ErpCreditMaterial(erpCredit));
|
|
// erpCreditChild3Mapper.delete(new ErpCreditChild3(erpCredit));
|
|
// erpCreditChild3Mapper.delete(new ErpCreditChild3(erpCredit));
|
|
}
|
|
}
|
|
|
|
|
|
//维护表
|
|
//维护表
|
|
public List<MaintainData> getFindListMain(List<String> strings){
|
|
public List<MaintainData> getFindListMain(List<String> strings){
|
|
- return dataMaintenanceMapper.getFindListMain(strings);
|
|
|
|
|
|
+ return dataMaintenanceMapper.findListMain();
|
|
}
|
|
}
|
|
|
|
|
|
//导出
|
|
//导出
|
|
- public void getExport(List<String> strings, HttpServletResponse response){
|
|
|
|
- List<ErpCredit> erpCreditList = getListErpCredit(strings);
|
|
|
|
- List<MaintainData> maintainDatas = getFindListMain(strings);
|
|
|
|
|
|
+ public void getExport(String ids, HttpServletResponse response){
|
|
|
|
+ String[] strings = ids.split(",");
|
|
|
|
+ List<String> strs = new ArrayList<String>();
|
|
|
|
+ for (String str:strings){
|
|
|
|
+ strs.add(str);
|
|
|
|
+ }
|
|
|
|
+ List<ErpCredit> erpCreditList = getListErpCredit(strs);
|
|
|
|
+ List<MaintainData> maintainDatas = getFindListMain(strs);
|
|
ExportTemplate exportTemplate = new ExportTemplate();
|
|
ExportTemplate exportTemplate = new ExportTemplate();
|
|
File newFile = exportTemplate.createNewFile();
|
|
File newFile = exportTemplate.createNewFile();
|
|
// 新文件写入数据,并下载
|
|
// 新文件写入数据,并下载
|
|
@@ -229,41 +244,123 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
// this.deleteFile(newFile);
|
|
// this.deleteFile(newFile);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<ErpJudge> getCheck1(List<ErpCredit> erpCredits){
|
|
|
|
+ List<ErpJudge> erpJudges = new ArrayList<>();
|
|
|
|
+ ErpJudge erpJudge = null;
|
|
|
|
+ Map<String,List> map = new HashMap<String,List>();
|
|
|
|
+ List<String> strings = new ArrayList<String>();
|
|
|
|
+ for (ErpCredit erpCredit:erpCredits){
|
|
|
|
+ strings.add(erpCredit.getItemId());
|
|
|
|
+ }
|
|
|
|
+ List<Information> informationList = informationService.findNoFinishList(strings);
|
|
|
|
+ List<String> maintainDataList = dataMaintenanceService.getJudge(strings);
|
|
|
|
+ if (null!=informationList&&informationList.size()>0){
|
|
|
|
+ for (Information information:informationList){
|
|
|
|
+ erpJudge=new ErpJudge();
|
|
|
|
+ erpJudge.setItemId(information.getProjectId());
|
|
|
|
+ erpJudge.setMainFlag("有");
|
|
|
|
+ erpJudge.setInfoFlag("否");
|
|
|
|
+ }
|
|
|
|
+ erpJudges.add(erpJudge);
|
|
|
|
+ }
|
|
|
|
+ if (null!=maintainDataList&&maintainDataList.size()>0){
|
|
|
|
+ Boolean flag = true;
|
|
|
|
+ for (String maintain:maintainDataList){
|
|
|
|
+ flag=true;
|
|
|
|
+ if (null!=informationList&&informationList.size()>0){
|
|
|
|
+ for (ErpJudge erpJudge1:erpJudges){
|
|
|
|
+ if (erpJudge1.getItemId().equals(maintain)){
|
|
|
|
+ erpJudge1.setMainFlag("无");
|
|
|
|
+ flag = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (flag){
|
|
|
|
+ erpJudge=new ErpJudge();
|
|
|
|
+ erpJudge.setItemId(maintain);
|
|
|
|
+ erpJudge.setMainFlag("无");
|
|
|
|
+ erpJudge.setInfoFlag("是");
|
|
|
|
+ erpJudges.add(erpJudge);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return erpJudges;
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 判断
|
|
* 判断
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public List getCheck(String ids){
|
|
public List getCheck(String ids){
|
|
List<String> lists = new ArrayList<String>();
|
|
List<String> lists = new ArrayList<String>();
|
|
- boolean flag = true;
|
|
|
|
|
|
+// Map<String,String> map = new HashMap<String, String>();
|
|
|
|
+// List<String> itemIdList = new ArrayList<String>();
|
|
|
|
+// List<String> sortList = null;
|
|
|
|
+// List<String> sortList2=null;
|
|
|
|
+// boolean flag = false;
|
|
String[] idArray =ids.split(",");
|
|
String[] idArray =ids.split(",");
|
|
- for (String str:idArray){
|
|
|
|
- lists.add(str);
|
|
|
|
- }
|
|
|
|
-// List<MaintainData> maintainDatas = getFindListMain(lists);
|
|
|
|
- List<Information> informationList = informationService.findNoFinishList(lists);
|
|
|
|
|
|
+ for (String str:idArray){ lists.add(str); }
|
|
|
|
+// List<ErpCredit> erpCreditList = getListErpCredit(lists);
|
|
|
|
+// for (ErpCredit erpCredit:erpCreditList){
|
|
|
|
+// map.put(erpCredit.getId(),erpCredit.getItemId());
|
|
|
|
+// itemIdList.add(erpCredit.getItemId());
|
|
|
|
+// }
|
|
|
|
+// List<MaintainData> maintainDatas =getFindListMain(itemIdList);//维护数据集合
|
|
|
|
+// List<Information> informationList = informationService.findNoFinishList(itemIdList);
|
|
// if (null!=informationList&&informationList.size()>0){
|
|
// if (null!=informationList&&informationList.size()>0){
|
|
-// for (int k = 0; k < lists.size(); k++) {
|
|
|
|
-// flag = true;
|
|
|
|
|
|
+// sortList = new ArrayList<String>();
|
|
|
|
+// sortList2=new ArrayList<String>();
|
|
|
|
+// for (String list2:itemIdList) {
|
|
// for(Information information:informationList){
|
|
// for(Information information:informationList){
|
|
-// if (information.getProjectId().equals(lists.get(k))){
|
|
|
|
-// flag=false;
|
|
|
|
|
|
+// if (information.getProjectId().equals(list2)){
|
|
|
|
+// sortList.add(list2);
|
|
// break;
|
|
// break;
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
-// if (flag){
|
|
|
|
-// lists.remove(k);
|
|
|
|
-// k--;
|
|
|
|
|
|
+// }
|
|
|
|
+// for(Map.Entry<String, String> entry : map.entrySet()){
|
|
|
|
+// String mapKey = entry.getKey();
|
|
|
|
+// String mapValue = entry.getValue();
|
|
|
|
+// for (String str : sortList){
|
|
|
|
+// if (mapValue.equals(str)){
|
|
|
|
+// sortList2.add(mapKey);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// for (int i = 0; i < lists.size(); i++) {
|
|
|
|
+// for (String str2:sortList2){
|
|
|
|
+// if (str2.equals(lists.get(i))){
|
|
|
|
+// lists.remove(i);
|
|
|
|
+// i--;
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
-// }else {
|
|
|
|
-// lists=new ArrayList<String>();
|
|
|
|
// }
|
|
// }
|
|
// if (null!=maintainDatas&&maintainDatas.size()>0){
|
|
// if (null!=maintainDatas&&maintainDatas.size()>0){
|
|
-// for (int i = 0; i < lists.size(); i++) {
|
|
|
|
-// flag=true;
|
|
|
|
-// for (MaintainData maintainData:maintainDatas){
|
|
|
|
-// if (maintainData.getProjectId().equals(lists.get(i))){
|
|
|
|
|
|
+// sortList = new ArrayList<String>();
|
|
|
|
+// sortList2 = new ArrayList<String>();
|
|
|
|
+// for (MaintainData maintainData:maintainDatas){
|
|
|
|
+// for (String str3:itemIdList){
|
|
|
|
+// if (maintainData.getProjectId().equals(str3)){
|
|
|
|
+// sortList.add(str3);//有数据
|
|
|
|
+// break;
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// for(Map.Entry<String, String> entry : map.entrySet()){
|
|
|
|
+// String mapKey1 = entry.getKey();
|
|
|
|
+// String mapValue1 = entry.getValue();
|
|
|
|
+// for (String str4: sortList){
|
|
|
|
+// if (mapValue1.equals(str4)){
|
|
|
|
+// sortList2.add(mapKey1);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// for (int i = 0; i < lists.size(); i++) {
|
|
|
|
+// flag = true;
|
|
|
|
+// for (String str2:sortList2){
|
|
|
|
+// if (str2.equals(lists.get(i))){
|
|
// flag=false;
|
|
// flag=false;
|
|
// break;
|
|
// break;
|
|
// }
|
|
// }
|
|
@@ -272,7 +369,7 @@ public class ErpCreditService extends CrudService<ErpCreditMapper,ErpCredit> {
|
|
// lists.remove(i);
|
|
// lists.remove(i);
|
|
// i--;
|
|
// i--;
|
|
// }
|
|
// }
|
|
-// }
|
|
|
|
|
|
+// }
|
|
// }else {
|
|
// }else {
|
|
// lists=null;
|
|
// lists=null;
|
|
// }
|
|
// }
|