Commit 88191fb9 by wancheng

app代码优化

parent ace52f87
package com.baosight.hpjx.hp.mt.service; package com.baosight.hpjx.hp.mt.service;
import cn.hutool.core.util.PageUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile; import com.baosight.hpjx.hp.mt.untils.Base64ToMultipartFile;
import com.baosight.hpjx.hp.mt.untils.Base64Utils;
import com.baosight.hpjx.hp.mt.untils.UploadUtils; import com.baosight.hpjx.hp.mt.untils.UploadUtils;
import com.baosight.hpjx.hp.mt.untils.UploadUtils2;
import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.xs.domain.User; import com.baosight.hpjx.hp.xs.domain.User;
import com.baosight.hpjx.hp.zl.domain.HPZL001; import com.baosight.hpjx.hp.zl.domain.HPZL001;
import com.baosight.hpjx.hp.zl.domain.HPZL001A; import com.baosight.hpjx.hp.zl.domain.HPZL001A;
...@@ -22,7 +28,12 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -22,7 +28,12 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.collections.MapUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
...@@ -55,34 +66,32 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -55,34 +66,32 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmProject(EiInfo inInfo) { public Map pmProject(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String projName = inInfo.getString("projName"); String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页 int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数 int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName); sqlMap.put("projName", projName);
List count = this.dao.query("HPMT002.pmProjectCount", sqlMap); List<Map> count = this.dao.query("HPMT002.pmProjectCount", sqlMap);
offset=(offset-1)*pageSize; offset=(offset-1)*pageSize;
sqlMap.put("offset", offset); sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize); sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmProject", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmProject", sqlMap);
List<Map> maps = new ArrayList<>(); List<Map> maps = new ArrayList<>();
for (Map row : rows) { resultMap.put("result",rows);
if (!row.get("actualCompletionNum").equals(row.get("num"))){ resultMap.put("count",count.size());
maps.add(row); resultMap.put("status",EiConstant.STATUS_SUCCESS);
} resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
} }
EiInfo outInfo = new EiInfo();
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock);
eiBlock.setRows(maps);
outInfo.setBlock(eiBlock);
outInfo.set("count",count.get(0));
return outInfo;
} }
/** /**
...@@ -91,18 +100,24 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -91,18 +100,24 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmProjectCount(EiInfo inInfo) { public Map pmProjectCount(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String projName = inInfo.getString("projName"); String projName = inInfo.getString("projName");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName); sqlMap.put("projName", projName);
int count = this.dao.count("HPMT002.pmProjectCount", sqlMap); int count = this.dao.count("HPMT002.pmProjectCount", sqlMap);
inInfo.set("count", count); resultMap.put("count",count);
return inInfo; resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
} }
/** /**
...@@ -111,20 +126,24 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -111,20 +126,24 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmQuality(EiInfo inInfo) { public Map pmQuality(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String queryMonth = inInfo.getString("queryMonth"); String queryMonth = inInfo.getString("queryMonth");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("queryMonth", queryMonth);
List<Map> rows = this.dao.query("HPMT002.pmQuality", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmQuality", sqlMap);
EiInfo outInfo = new EiInfo(); resultMap.put("result",rows);
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock); resultMap.put("status",EiConstant.STATUS_SUCCESS);
eiBlock.setRows(rows); resultMap.put("message","SUCCESS");
outInfo.setBlock(eiBlock); return resultMap;
return outInfo; } catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
} }
/** /**
...@@ -133,15 +152,14 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -133,15 +152,14 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmQualityList(EiInfo inInfo) { public Map pmQualityList(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String status = inInfo.getString("status"); String status = inInfo.getString("status");
String projName = inInfo.getString("projName"); String projName = inInfo.getString("projName");
int offset = inInfo.getInt("offset");//当前页 int offset = inInfo.getInt("offset");//当前页
int pageSize = inInfo.getInt("pageSize");//每页条数 int pageSize = inInfo.getInt("pageSize");//每页条数
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("projName", projName); sqlMap.put("projName", projName);
...@@ -151,12 +169,16 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -151,12 +169,16 @@ public class ServiceHPMT002 extends ServiceBase {
sqlMap.put("offset", offset); sqlMap.put("offset", offset);
sqlMap.put("pageSize", pageSize); sqlMap.put("pageSize", pageSize);
List<Map> rows = this.dao.query("HPMT002.pmQualityList", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmQualityList", sqlMap);
EiInfo outInfo = new EiInfo(); resultMap.put("result",rows);
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock); resultMap.put("count",count.get(0));
eiBlock.setRows(rows); resultMap.put("status",EiConstant.STATUS_SUCCESS);
outInfo.setBlock(eiBlock); resultMap.put("message","SUCCESS");
outInfo.set("count", count.get(0)); return resultMap;
return outInfo; } catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
} }
...@@ -166,60 +188,47 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -166,60 +188,47 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmQualityDetail(EiInfo inInfo) { public Map pmQualityDetail(EiInfo inInfo) {
EiInfo outInfo = new EiInfo(); Map resultMap = new HashMap();
try { try {
String id = inInfo.getString("id"); String id = inInfo.getString("id");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
outInfo.setMsg("账号异常");
}
Map Map = new HashMap(); Map Map = new HashMap();
Map.put("checkId", id); Map.put("checkId", id);
Map.put("docType",1); Map.put("docType",1);
List<HPZL001A> docIdlist = this.dao.query("HPZL001A.queryDev", Map); List<HPZL001A> docIdlist = this.dao.query("HPZL001A.queryRun", Map);
List<String> imgList = new ArrayList<>(); List<String> imgList = new ArrayList<>();
for (int i = 0; i < docIdlist.size(); i++) { for (int i = 0; i < docIdlist.size(); i++) {
Map dirId = new HashMap();
HPZL001A hpzl001A = docIdlist.get(i); HPZL001A hpzl001A = docIdlist.get(i);
String docId = hpzl001A.getDocId(); String docId = hpzl001A.getDocId();
dirId.put("docId", docId); imgList.add(docId);
List<Map> query = this.dao.query("HPMT002.queryFile", dirId);
File file = new File(UploadUtils.ROOT_PATH + "/A/" + query.get(0).get("CHG_NAME"));
BufferedImage bf = ImageIO.read(file);
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList.add(imgBase64);
} }
//处理的文件 //处理的文件
Map Map2 = new HashMap(); Map Map2 = new HashMap();
Map2.put("checkId", id); Map2.put("checkId", id);
Map2.put("docType",2); Map2.put("docType",2);
List<HPZL001A> docIdlist2 = this.dao.query("HPZL001A.queryDev", Map2); List<HPZL001A> docIdlist2 = this.dao.query("HPZL001A.queryRun", Map2);
List<String> imgList2 = new ArrayList<>(); List<String> imgList2 = new ArrayList<>();
for (int i = 0; i < docIdlist2.size(); i++) { for (int i = 0; i < docIdlist2.size(); i++) {
Map dirId = new HashMap();
HPZL001A hpzl001A = docIdlist2.get(i); HPZL001A hpzl001A = docIdlist2.get(i);
String docId = hpzl001A.getDocId(); String docId = hpzl001A.getDocId();
dirId.put("docId", docId); imgList2.add(docId);
List<Map> query = this.dao.query("HPMT002.queryFile", dirId);
File file = new File(UploadUtils.ROOT_PATH + "/A/" + query.get(0).get("CHG_NAME"));
BufferedImage bf = ImageIO.read(file);
String imgBase64 = UploadUtils.imageToBase64(bf);
imgList2.add(imgBase64);
} }
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("id", id); sqlMap.put("id", id);
List<Map> rows = this.dao.query("HPMT002.pmQualityDetail", sqlMap); List<Map> rows = this.dao.query("HPMT002.pmQualityDetail", sqlMap);
EiBlock eiBlock = new EiBlock(EiConstant.resultBlock); resultMap.put("result",rows);
eiBlock.setRows(rows); resultMap.put("img",imgList);
outInfo.setBlock(eiBlock); resultMap.put("img2",imgList2);
outInfo.set("img",imgList); resultMap.put("status",EiConstant.STATUS_SUCCESS);
outInfo.set("img2",imgList2); resultMap.put("message","SUCCESS");
} catch (Exception e){ return resultMap;
outInfo.setMsg("账号异常"); } catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
} }
return outInfo;
} }
/** /**
...@@ -228,16 +237,15 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -228,16 +237,15 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmQualityXl(EiInfo inInfo) { public Map pmQualityXl(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String factoryId= inInfo.getString("factoryId");//工厂id String factoryId= inInfo.getString("factoryId");//工厂id
String prodCode = inInfo.getString("projCode");//项目id String prodCode = inInfo.getString("projCode");//项目id
String orgNo = inInfo.getString("orgNo");//生产组id String orgNo = inInfo.getString("orgNo");//生产组id
String inventCode = inInfo.getString("inventCode");//部件id String inventCode = inInfo.getString("inventCode");//部件id
String subInventCode = inInfo.getString("subInventCode");//零件id String subInventCode = inInfo.getString("subInventCode");//零件id
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
Map sqlMap = new HashMap(); Map sqlMap = new HashMap();
sqlMap.put("companyCode", companyCode); sqlMap.put("companyCode", companyCode);
sqlMap.put("factoryCode", factoryId); sqlMap.put("factoryCode", factoryId);
...@@ -247,16 +255,30 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -247,16 +255,30 @@ public class ServiceHPMT002 extends ServiceBase {
sqlMap.put("subInventCode", subInventCode); sqlMap.put("subInventCode", subInventCode);
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
TEDCM01 tedcm01 = new TEDCM01(); TEDCM01 tedcm01 = new TEDCM01();
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_FACTORY), null, false); List<Map> queryFactory = this.dao.query("HPMT002.queryFactory", sqlMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PROJCODE), sqlMap, false); List<Map> queryProjCode = this.dao.query("HPMT002.queryProjCode", sqlMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRDTCODE), sqlMap, false); List<Map> queryPrdtCode = this.dao.query("HPMT002.queryPrdtCode", sqlMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_ORG_NO), sqlMap, false); List<Map> queryOrgNo = this.dao.query("HPMT002.queryOrgNo", sqlMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PARTCODE), sqlMap, false); List<Map> queryPartCode = this.dao.query("HPMT002.queryPartCode", sqlMap);
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.POOR_TYPE_BLOCK_ID), null, false); List<Map> queryTedcm01 = this.dao.query("HPXSOrg.queryTedcm01",tedcm01);
if(subInventCode!=null&&!subInventCode.equals("")){ if(subInventCode!=null&&!subInventCode.equals("")){
CommonMethod.initBlock(outInfo, Arrays.asList(DdynamicEnum.APP_MAP_BLOCK_PRODTASKNO), sqlMap, false); List<Map> queryProdTaskNo = this.dao.query("HPMT002.queryProdTaskNo",sqlMap);
resultMap.put("ProdTaskNo",queryProdTaskNo);
} }
return outInfo; resultMap.put("Factory",queryFactory);
resultMap.put("ProjCode",queryProjCode);
resultMap.put("PrdtCode",queryPrdtCode);
resultMap.put("OrgNo",queryOrgNo);
resultMap.put("PartCode",queryPartCode);
resultMap.put("Tedcm01",queryTedcm01);
resultMap.put("status",EiConstant.STATUS_SUCCESS);
resultMap.put("message","SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message",LogUtils.getMsg(e));
return resultMap;
}
} }
/** /**
...@@ -265,56 +287,57 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -265,56 +287,57 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmInsertQuality(EiInfo inInfo) { public Map pmInsertQuality(EiInfo inInfo) {
String docId = inInfo.getString("docId"); Map resultMap = new HashMap();
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try { try {
HPZL001 fZl001 = new HPZL001(); String docId = inInfo.getString("docId");
Map attr = inInfo.getAttr(); String companyCode = UserSessionUtils.getCompanyCode();
fZl001.fromMap(attr); HPZL001 fZl001 = new HPZL001();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Map attr = inInfo.getAttr();
fZl001.setCreatedTime(sdf.format(new Date())); fZl001.fromMap(attr);
fZl001.setReceiptDate(DateUtils.shortDate()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fZl001.setCompanyCode(companyCode); fZl001.setCreatedTime(sdf.format(new Date()));
User user = UserSessionUtils.getUser(); fZl001.setReceiptDate(DateUtils.shortDate());
fZl001.setCheckUser(user.getUserName()); fZl001.setCompanyCode(companyCode);
fZl001.setCheckNo(user.getUserId()); User user = UserSessionUtils.getUser();
// 生成单据号 fZl001.setCheckUser(user.getUserName());
fZl001.setCheckNo(SequenceGenerator.getNextSequence( fZl001.setCheckNo(user.getUserId());
HPConstant.SequenceId.HPZL001_NUMBER)); // 生成单据号
fZl001.setDeleteFlag(CommonConstant.YesNo.NO_0); fZl001.setCheckNo(SequenceGenerator.getNextSequence(
fZl001.setStatus(CommonConstant.YesNo.NO_0); HPConstant.SequenceId.HPZL001_NUMBER));
DaoUtils.insert(HPZL001.INSERT, fZl001); fZl001.setDeleteFlag(CommonConstant.YesNo.NO_0);
//处理文件 fZl001.setStatus(CommonConstant.YesNo.NO_0);
if(!docId.equals("")) { DaoUtils.insert(HPZL001.INSERT, fZl001);
Map fZl0012 = new HashMap(); //处理文件
fZl0012.put("checkNo", fZl001.getCheckNo()); if (!docId.equals("")) {
List<HPZL001> HPZL001 =dao.query("HPZL001.query", fZl0012); Map fZl0012 = new HashMap();
//绑定文件 fZl0012.put("checkNo", fZl001.getCheckNo());
String[] docIds = docId.split(","); List<HPZL001> HPZL001 = dao.query("HPZL001.query", fZl0012);
int num = 0; //绑定文件
while (num < docIds.length) { String[] docIds = docId.split(",");
HPZL001A HPZL001A = new HPZL001A(); int num = 0;
HPZL001A.setDepCode(CommonConstant.YesNo.YES); while (num < docIds.length) {
HPZL001A.setDocType(CommonConstant.YesNo.YES_1); HPZL001A HPZL001A = new HPZL001A();
HPZL001A.setBizType("XJ_WC"); HPZL001A.setDeptCode(CommonConstant.YesNo.YES);
HPZL001A.setDocId(docIds[num]); HPZL001A.setDocType(CommonConstant.YesNo.YES_1);
HPZL001A.setCheckId(HPZL001.get(0).getId()); HPZL001A.setBizType("XJ_WC");
HPZL001A.setCompanyCode(companyCode); HPZL001A.setDocId(docIds[num]);
DaoUtils.insert(HPZL001A.INSERT, HPZL001A); HPZL001A.setCheckId(HPZL001.get(0).getId());
num++; HPZL001A.setCompanyCode(companyCode);
DaoUtils.insert(HPZL001A.INSERT, HPZL001A);
num++;
}
}
resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
} }
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/** /**
...@@ -323,13 +346,11 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -323,13 +346,11 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmModifyQuality(EiInfo inInfo) { public Map pmModifyQuality(EiInfo inInfo) {
Map resultMap = new HashMap();
try {
String docId = inInfo.getString("docId"); String docId = inInfo.getString("docId");
String companyCode = UserSessionUtils.getCompanyCode(); String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try {
HPZL001 fZl001 = new HPZL001(); HPZL001 fZl001 = new HPZL001();
Map attr = inInfo.getAttr(); Map attr = inInfo.getAttr();
fZl001.fromMap(attr); fZl001.fromMap(attr);
...@@ -347,7 +368,7 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -347,7 +368,7 @@ public class ServiceHPMT002 extends ServiceBase {
int num = 0; int num = 0;
while (num < docIds.length) { while (num < docIds.length) {
HPZL001A HPZL001A = new HPZL001A(); HPZL001A HPZL001A = new HPZL001A();
HPZL001A.setDepCode(CommonConstant.YesNo.YES); HPZL001A.setDeptCode(CommonConstant.YesNo.YES);
HPZL001A.setDocType(2); HPZL001A.setDocType(2);
HPZL001A.setBizType("XJ_CL"); HPZL001A.setBizType("XJ_CL");
HPZL001A.setDocId(docIds[num]); HPZL001A.setDocId(docIds[num]);
...@@ -357,11 +378,14 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -357,11 +378,14 @@ public class ServiceHPMT002 extends ServiceBase {
num++; num++;
} }
} }
inInfo.setMsg("处理成功!"); resultMap.put("status", EiConstant.STATUS_SUCCESS);
resultMap.put("message", "SUCCESS");
return resultMap;
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "处理失败"); resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
} }
return inInfo;
} }
...@@ -371,23 +395,22 @@ public class ServiceHPMT002 extends ServiceBase { ...@@ -371,23 +395,22 @@ public class ServiceHPMT002 extends ServiceBase {
* @param inInfo * @param inInfo
* @return * @return
*/ */
public EiInfo pmUploadFile(EiInfo inInfo) { public Map pmUploadFile(EiInfo inInfo) {
String files = inInfo.getString("files"); Map resultMap = new HashMap();
String companyCode = UserSessionUtils.getCompanyCode();
if (StrUtil.isEmpty(companyCode)) {
inInfo.setMsg("账号异常");
}
try { try {
String files = inInfo.getString("files");
CommonsMultipartFile multipartFile = Base64ToMultipartFile.base64toMultipartFile(files); CommonsMultipartFile multipartFile = Base64ToMultipartFile.base64toMultipartFile(files);
JSONObject upload = UploadUtils.upload(multipartFile); System.out.println("--------------------------------转换Base64成功");
inInfo.set("id",upload.getString("docId")); JSONObject upload = UploadUtils2.upload(multipartFile);
inInfo.setMsg("上传成功!"); resultMap.put("id",upload.getString("docId"));
} resultMap.put("status", EiConstant.STATUS_SUCCESS);
catch (Exception e) { resultMap.put("message", "SUCCESS");
LogUtils.setDetailMsg(inInfo, e, "上传失败"); return resultMap;
} catch (Exception e) {
resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
return resultMap;
} }
return inInfo;
} }
} }
...@@ -24,7 +24,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -24,7 +24,7 @@ public class HPZL001A extends DaoEPBase {
public static final String FIELD_ID = "id"; /* 主键ID*/ public static final String FIELD_ID = "id"; /* 主键ID*/
public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/ public static final String FIELD_COMPANY_CODE = "companyCode"; /* 企业编码 预留*/
public static final String FIELD_DEP_CODE = "depCode"; /* 部门编码 预留*/ public static final String FIELD_DEPT_CODE = "deptCode"; /* 部门编码 预留*/
public static final String FIELD_DOC_TYPE = "docType"; /* 附件类型*/ public static final String FIELD_DOC_TYPE = "docType"; /* 附件类型*/
public static final String FIELD_CHECK_ID = "checkId"; /* 质量巡检单ID*/ public static final String FIELD_CHECK_ID = "checkId"; /* 质量巡检单ID*/
public static final String FIELD_DOC_ID = "docId"; /* 文件ID*/ public static final String FIELD_DOC_ID = "docId"; /* 文件ID*/
...@@ -39,7 +39,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -39,7 +39,7 @@ public class HPZL001A extends DaoEPBase {
public static final String COL_ID = "ID"; /* 主键ID*/ public static final String COL_ID = "ID"; /* 主键ID*/
public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/ public static final String COL_COMPANY_CODE = "COMPANY_CODE"; /* 企业编码 预留*/
public static final String COL_DEP_CODE = "DEP_CODE"; /* 部门编码 预留*/ public static final String COL_DEPT_CODE = "DEPT_CODE"; /* 部门编码 预留*/
public static final String COL_DOC_TYPE = "DOC_TYPE"; /* 附件类型*/ public static final String COL_DOC_TYPE = "DOC_TYPE"; /* 附件类型*/
public static final String COL_CHECK_ID = "CHECK_ID"; /* 质量巡检单ID*/ public static final String COL_CHECK_ID = "CHECK_ID"; /* 质量巡检单ID*/
public static final String COL_DOC_ID = "DOC_ID"; /* 文件ID*/ public static final String COL_DOC_ID = "DOC_ID"; /* 文件ID*/
...@@ -60,7 +60,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -60,7 +60,7 @@ public class HPZL001A extends DaoEPBase {
private Long id; /* 主键ID*/ private Long id; /* 主键ID*/
private String companyCode = " "; /* 企业编码 预留*/ private String companyCode = " "; /* 企业编码 预留*/
private String depCode = " "; /* 部门编码 预留*/ private String deptCode = " "; /* 部门编码 预留*/
private Integer docType; /* 附件类型*/ private Integer docType; /* 附件类型*/
private Long checkId; /* 质量巡检单ID*/ private Long checkId; /* 质量巡检单ID*/
private String docId = " "; /* 文件ID*/ private String docId = " "; /* 文件ID*/
...@@ -88,7 +88,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -88,7 +88,7 @@ public class HPZL001A extends DaoEPBase {
eiColumn.setDescName("企业编码 预留"); eiColumn.setDescName("企业编码 预留");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DEP_CODE); eiColumn = new EiColumn(FIELD_DEPT_CODE);
eiColumn.setDescName("部门编码 预留"); eiColumn.setDescName("部门编码 预留");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -179,20 +179,20 @@ public class HPZL001A extends DaoEPBase { ...@@ -179,20 +179,20 @@ public class HPZL001A extends DaoEPBase {
this.companyCode = companyCode; this.companyCode = companyCode;
} }
/** /**
* get the depCode - 部门编码 预留. * get the deptCode - 部门编码 预留.
* @return the depCode * @return the deptCode
*/ */
public String getDepCode() { public String getDeptCode() {
return this.depCode; return this.deptCode;
} }
/** /**
* set the depCode - 部门编码 预留. * set the deptCode - 部门编码 预留.
* *
* @param depCode - 部门编码 预留 * @param deptCode - 部门编码 预留
*/ */
public void setDepCode(String depCode) { public void setDeptCode(String deptCode) {
this.depCode = depCode; this.deptCode = deptCode;
} }
/** /**
* get the docType - 附件类型. * get the docType - 附件类型.
...@@ -380,7 +380,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -380,7 +380,7 @@ public class HPZL001A extends DaoEPBase {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id)); setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_ID)), id));
setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode)); setCompanyCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_CODE)), companyCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_CODE)), depCode)); setDeptCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEPT_CODE)), deptCode));
setDocType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOC_TYPE)), docType)); setDocType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DOC_TYPE)), docType));
setCheckId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_CHECK_ID)), checkId)); setCheckId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_CHECK_ID)), checkId));
setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId)); setDocId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID)), docId));
...@@ -403,7 +403,7 @@ public class HPZL001A extends DaoEPBase { ...@@ -403,7 +403,7 @@ public class HPZL001A extends DaoEPBase {
Map map = new HashMap(); Map map = new HashMap();
map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID))); map.put(FIELD_ID, StringUtils.toString(id, eiMetadata.getMeta(FIELD_ID)));
map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE))); map.put(FIELD_COMPANY_CODE, StringUtils.toString(companyCode, eiMetadata.getMeta(FIELD_COMPANY_CODE)));
map.put(FIELD_DEP_CODE, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_DEP_CODE))); map.put(FIELD_DEPT_CODE, StringUtils.toString(deptCode, eiMetadata.getMeta(FIELD_DEPT_CODE)));
map.put(FIELD_DOC_TYPE, StringUtils.toString(docType, eiMetadata.getMeta(FIELD_DOC_TYPE))); map.put(FIELD_DOC_TYPE, StringUtils.toString(docType, eiMetadata.getMeta(FIELD_DOC_TYPE)));
map.put(FIELD_CHECK_ID, StringUtils.toString(checkId, eiMetadata.getMeta(FIELD_CHECK_ID))); map.put(FIELD_CHECK_ID, StringUtils.toString(checkId, eiMetadata.getMeta(FIELD_CHECK_ID)));
map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID))); map.put(FIELD_DOC_ID, StringUtils.toString(docId, eiMetadata.getMeta(FIELD_DOC_ID)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment