百无一用小技巧
String userorg = InvocationInfoProxy.getInstance().getGroupId();//获取当前系统登录组织
String userid = InvocationInfoProxy.getInstance().getUserId();//获取当前系统登录用户
UFDateTime billdate = new UFDateTime(System.currentTimeMillis());//获取当前系统时间
按钮解析参数
public class BillkpsqAction implements ICommonAction{
//nc调用后台方法
BillkpsqService service = ServiceLocator.find(BillkpsqService.class);
/*
解析按钮参数方法
*/
@Override
public Object doAction(IRequest request) {
// TODO Auto-generated method stub
String json = request.getJson();
IJson ijson = JsonFactory.create();
HashMap<String,Object> fromJson = ijson.fromJson(json, HashMap.class);
Logger.error("kpsq wujl6:"+request.getJson());
JSONArray arrjson = JSONArray.parseArray((String) fromJson.get("busiParamJson"));
for (int i = 0; i < arrjson.size(); i++) {
String pk = arrjson.getJSONObject(i).get("pk_bill").toString();
service.requestdel(pk);
}
return "操作成功";
}
}
单例basedao
private BaseDAO baseDao;
private BaseDAO getDao() {
if (baseDao == null) {
baseDao = new BaseDAO();
}
return baseDao;
}
//basedao日常用法
List<Map<String,String>> lsitmaptradetypeidcode = (List<Map<String,String>>) getDao().executeQuery(pkinsql.toString(), new MapListProcessor());
//关联附件工具类
private IAttachmentService ncservice = NCLocator.getInstance().lookup(IAttachmentService.class);
//保存附件关联到表
public void toDataFileIO(InputStream fileInp,String fileName,String pk) throws DAOException {
//把文件上传到对应凭证附件
FileHeader header = ncservice.upload(fileName,fileInp, false, 0, "uapattachroot");
//将凭证和附件关联关系、文件服务器已读文件保存到数据库
this.saveDBInfo(pk, header,fileName);
}
/**
* 保存文件信息到数据库
* @param fullPath
* @param header
* @return
* @throws DAOException
*/
private void saveDBInfo(String fullPath, FileHeader header,String fileName) throws DAOException {
//保存文件和凭证关联关系
NCFileVO attach = new NCFileVO();
attach.setPath(header.getName());
attach.setCreator(AppContext.getInstance().getPkUser());
attach.setFileLen(header.getFileSize());
attach.setPk_doc(header.getPath());
attach.setIsdoc("z");
ncservice.saveAttachDBInfo(fullPath, attach);
}
BaseDao查询单个字段
String value =
(String)getDao().executeQuery(sql, new ColumnProcessor());
BaseDao查询特定VO list
retrieveByClause(vo.class,拼接where条件);
List<PayBillVO> listvo =
(List<PayBillVO>) getDao().retrieveByClause(PayBillVO.class,"pk_paybill = 'PJ1231233' ");
BaseDao查询listmap方法
List<Map<String,String>> list =
(List<Map<String,String>>) getDao().executeQuery(sql, new MapListProcessor());
listdefcodemap= (List<String>) utils.basedao.executeQuery(sql, new ColumnListProcessor());
implements IHttpServletAdaptor 对外接口 获取数据方法
String paramJson = UserApiUtil.getJsonStringFromRequest(request);
JSONObject jsonObj= JSONObject.parseObject(paramJson);
--sql查询自定义档案
select code,shortname from bd_defdoc where pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code = '档案编码')
提交进工作流
CloudPFlowContext context = new CloudPFlowContext();
context.setActionName("START");
String billType = (String) bills[0].getParentVO().getAttributeValue("pk_billtype");
context.setBillType(billType);
context.setTrantype((String) bills[0].getParentVO().getAttributeValue("pk_tradetype"));
context.setBillVos(new AggregatedValueObject[]{bills[0]});
context.setUserObj(new PfUserObject[]{new PfUserObject()});
context.setBatch(false);
ICloudScriptPFlowService service333 = NCLocator.getInstance().lookup(ICloudScriptPFlowService.class);
Object[] objects = service333.exeScriptPFlow(context);
版权声明:本文为weixin_42569837原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。