流程生产订单修改
This commit is contained in:
		
							parent
							
								
									12ff9ca7cb
								
							
						
					
					
						commit
						2d34d04fed
					
				|  | @ -2,12 +2,15 @@ package nccloud.pubift.commen.impl.utils; | |||
| 
 | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.InvocationInfoProxy; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.hr.utils.PubEnv; | ||||
| import nc.itf.arap.goldentax.SysParaInitQuery; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.vo.am.common.util.StringUtils; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pubapp.pattern.pub.SqlBuilder; | ||||
| import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; | ||||
| import org.apache.http.Header; | ||||
| import org.apache.http.HttpEntity; | ||||
|  | @ -39,6 +42,7 @@ public class HttpPostOtherSysImpl implements IHttpPostOtherSys { | |||
| 
 | ||||
|     private static final Log obmlog = Log.getInstance(LOG_INFO_NAME); | ||||
| 
 | ||||
|     private static final BaseDAO dao = new BaseDAO(); | ||||
|     @Override | ||||
|     public String callMes(String url, JSONObject json) { | ||||
|         String mesip = SysParaInitQuery.getParaString(PubEnv.getPk_group(), "MESIP"); | ||||
|  | @ -237,4 +241,23 @@ public class HttpPostOtherSysImpl implements IHttpPostOtherSys { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 根据主键查询编码 | ||||
|      */ | ||||
|     public String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException { | ||||
|         if (pk == null || pk.trim().isEmpty()) { | ||||
|             return null; | ||||
|         } | ||||
|         SqlBuilder sqlBuilder = new SqlBuilder(); | ||||
|         sqlBuilder.append(" select " + selectField); | ||||
|         sqlBuilder.append(" from " + tableName); | ||||
|         sqlBuilder.append(" where "); | ||||
|         sqlBuilder.append(pkField, pk); | ||||
|         Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); | ||||
|         if (o == null) { | ||||
|             throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】"); | ||||
|         } | ||||
|         return o.toString(); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -28,4 +28,6 @@ public interface IHttpPostOtherSys { | |||
|     public boolean checkIfExcludeUser(); | ||||
| 
 | ||||
|     public boolean checkIfIncludeOrg(String code) throws BusinessException; | ||||
| 
 | ||||
|     public String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException; | ||||
| } | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ import javax.ws.rs.Produces; | |||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.dao.DAOException; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.jdbc.framework.processor.MapListProcessor; | ||||
| import nc.util.mmf.framework.base.MMCollectionUtil; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; | ||||
|  | @ -17,6 +18,8 @@ import nc.vo.pub.BusinessException; | |||
| import nc.ws.opm.pub.utils.result.APIErrCodeEnum; | ||||
| import nccloud.api.mmpac.pmo.IAPIPmoMaintainService; | ||||
| import nccloud.api.rest.utils.ResultMessageUtil; | ||||
| import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; | ||||
| import nc.bs.mmpac.pmo.pac0002.bp.PMORowPutBP; | ||||
| import nccloud.ws.rest.resource.AbstractNCCRestResource; | ||||
| import org.json.JSONString; | ||||
| 
 | ||||
|  | @ -26,10 +29,13 @@ public class PmoResource extends AbstractNCCRestResource { | |||
|     private static String BODYTABLE = "mm_mo"; | ||||
|     private static String GRANDTABLE = "mm_pmo_procedure"; | ||||
|     private static final BaseDAO BASE_DAO = new BaseDAO(); | ||||
|     IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); | ||||
|     private static final Log logger = Log.getInstance("pmoresoucelogger"); | ||||
| 
 | ||||
|     public PmoResource() { | ||||
|     } | ||||
| 
 | ||||
|     // 找投放 调哪个接口 拿到接口 根据审批状态和组织判断 自动投放 | ||||
|     @POST | ||||
|     @Path("save") | ||||
|     @Consumes({"application/json"}) | ||||
|  | @ -50,9 +56,33 @@ public class PmoResource extends AbstractNCCRestResource { | |||
| 
 | ||||
|                 IAPIPmoMaintainService serv = (IAPIPmoMaintainService) NCLocator.getInstance().lookup(IAPIPmoMaintainService.class); | ||||
|                 insertBills = serv.save(paramList); | ||||
| 
 | ||||
|                 // 遍历paramList,判断组织是否需要自动投放 | ||||
|                 for (Map<String, Object> map : paramList) { | ||||
|                     Map<String, Object> head = (Map<String, Object>) map.get(HEADTABLE); | ||||
|                     if (head == null) continue; | ||||
|                     String pk_org = (String) head.get("pk_org"); | ||||
|                     String orgCode = null; | ||||
|                     orgCode = httpPostOtherSys.transferCodeByPk("org_orgs", "code", "pk_org", pk_org); | ||||
|                     logger.debug("转换pk_org[" + pk_org + "]为组织编码[" + orgCode + "]"); | ||||
|                     boolean isIncludeOrg = false; | ||||
|                     isIncludeOrg = httpPostOtherSys.checkIfIncludeOrg(orgCode); | ||||
|                     logger.debug("检查是否为电缆[" + orgCode + "]返回:" + isIncludeOrg); | ||||
|                     if (isIncludeOrg) { | ||||
|                         PMORowPutBP rowPutBP = NCLocator.getInstance().lookup(PMORowPutBP.class); | ||||
|                         try { | ||||
|                             rowPutBP.rowput(insertBills); | ||||
|                             logger.info("自动投放完成,orgCode=" + orgCode); | ||||
|                         } catch (Exception e) { | ||||
|                             logger.error("自动投放失败,orgCode=" + orgCode, e); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 return ResultMessageUtil.toJSON(insertBills, "Á÷³ÌÉú²ú¶©µ¥±£´æ³É¹¦"); | ||||
|             } | ||||
|         } catch (Exception e) { | ||||
|             logger.error("流程生产订单保存异常", e); | ||||
|             return ResultMessageUtil.exceptionToJSON(e); | ||||
|         } | ||||
|     } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue