603 lines
26 KiB
C#
603 lines
26 KiB
C#
using Apache.NMS;
|
||
using Apache.NMS.ActiveMQ;
|
||
using Com.Alipay;
|
||
using Com.Alipay.Business;
|
||
using Com.Alipay.Domain;
|
||
using Com.Alipay.Model;
|
||
using dccdc.BLL;
|
||
using dccdc.Models;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Configuration;
|
||
using System.Drawing;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Net;
|
||
using System.Web;
|
||
using System.Web.Mvc;
|
||
using WxPayAPI;
|
||
|
||
namespace dccdc.Controllers
|
||
{
|
||
|
||
public class zzjController : Controller
|
||
{
|
||
BLL.zzjBLL zzj = new BLL.zzjBLL();
|
||
|
||
|
||
[AllowAnonymous]
|
||
public string getxgyyxx(string id)
|
||
{
|
||
var dal = new DAL.xgDal();
|
||
var yy= dal.getjryy(id);
|
||
OperationResult or = new OperationResult();
|
||
if(yy!=null)
|
||
{
|
||
or.State = 1;
|
||
or.Message = "成功!";
|
||
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(yy);
|
||
}
|
||
else
|
||
{
|
||
or.State = 0;
|
||
or.Message = "没有找到你今日的核酸检测登记信息!";
|
||
}
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(or);
|
||
}
|
||
[AllowAnonymous]
|
||
public string getxgyyxxsjh(string id)
|
||
{
|
||
var dal = new DAL.xgDal();
|
||
var yy = dal.getjryysjh(id);
|
||
OperationResult or = new OperationResult();
|
||
if (yy .Count>0)
|
||
{
|
||
or.State = 1;
|
||
or.Message = "成功!";
|
||
or.Tag = Newtonsoft.Json.JsonConvert.SerializeObject(yy);
|
||
}
|
||
else
|
||
{
|
||
or.State = 0;
|
||
or.Message = "没有找到你今日的核酸检测登记信息!";
|
||
}
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(or);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取预约列表
|
||
/// </summary>
|
||
/// <param name="id">身份证号</param>
|
||
/// <param name="jgid"></param>
|
||
/// <returns></returns>
|
||
[AllowAnonymous]
|
||
// GET: zzj
|
||
public string getYYXX(string id, int jgid = 49)
|
||
{
|
||
//return View();
|
||
var loger = log4net.LogManager.GetLogger(this.GetType());
|
||
loger.Info("id:" + id);
|
||
loger.Info("jgid:" + jgid);
|
||
var yylist = zzj.getYYList(id, jgid);
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(yylist);
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string register(string id, string img, string csrq, string idcard, string jtzz, string xm, string regp)
|
||
{
|
||
var loger = log4net.LogManager.GetLogger(this.GetType());
|
||
loger.Info("登记人姓名:" + xm);
|
||
loger.Info("登记机器:" + regp);
|
||
loger.Info("ID:" + id);
|
||
loger.Info("img:" + img);
|
||
loger.Info("csrq:" + csrq);
|
||
loger.Info("idcard:" + idcard);
|
||
loger.Info("jtzz:" + jtzz);
|
||
loger.Info("xm:" + xm);
|
||
loger.Info("regp:" + regp);
|
||
img = ZWL.Common.ImgUtil.ConvertImg(img);
|
||
Models.OperationResult or = zzj.register(id, img, csrq, idcard, jtzz, xm, regp);
|
||
string sor= Newtonsoft.Json.JsonConvert.SerializeObject(or);
|
||
loger.Info("自助机登记结果:"+sor);
|
||
return sor;
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string yyxm()
|
||
{
|
||
var xm = new MedicalSchemeMaintainBll().GetAllList();
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(xm);
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string yydj(string sfz, string xm, string yyrq, string tjfa, string tjfaname, string sjh, string qyxx)
|
||
{
|
||
|
||
OperationResult or = new BLL.MedicalAppointmentBll().canYY(DateTime.Parse(yyrq), sfz, int.Parse(tjfa));
|
||
if (or.State == 0)
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(or);
|
||
}
|
||
MedicalAppointment ma = new MedicalAppointment();
|
||
ma.xingMing = xm;
|
||
ma.IDCard = sfz;
|
||
ma.CYFA = int.Parse(tjfa);
|
||
ma.CYFAName = tjfaname;
|
||
ma.MType = 1;
|
||
ma.Mobile = sjh;
|
||
ma.QYXX = qyxx;
|
||
ma.ADate = DateTime.Parse(yyrq);
|
||
ma.ATime = DateTime.Now;
|
||
ma.jgid = 49;
|
||
ma = new BLL.MedicalAppointmentBll().WXYY(ma, 2);
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new OperationResult { State = 1, Message = ma.id.ToString(), Tag = Newtonsoft.Json.JsonConvert.SerializeObject(ma) });
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string getBGXX(string id)
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.ProfessionalExamRegisterBll().getKDYBGXX(id));
|
||
}
|
||
[AllowAnonymous]
|
||
public string getBGXX2(string id)
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.ProfessionalExamRegisterBll().getKDYBGXX2(id));
|
||
}
|
||
|
||
//职业--根据身份证获取体检编号
|
||
[AllowAnonymous]
|
||
public string getPhysicalNumByIDCard(string id, string enableReprint = "0")
|
||
{
|
||
return new BLL.ProfessionalExamRegisterBll().getPhysicalNumByIDCard(id,enableReprint);
|
||
}
|
||
/// <summary>
|
||
/// 根据physical_num更新状态为“打印指引单”
|
||
/// </summary>
|
||
/// <param name="physical_num"></param>
|
||
[AllowAnonymous]
|
||
public void updateProcedureStatus(string physical_num)
|
||
{
|
||
new BLL.ProfessionalExamRegisterBll().updateProcedureStatus(physical_num);
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string getYYJFXX(string id)
|
||
{
|
||
var x = new BLL.chargeBll().getYYJFXX(id);
|
||
if (x.id == 0)
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(x);
|
||
//NativePay nativePay = new NativePay();
|
||
Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");
|
||
string zfid = WxPayApi.GenerateOutTradeNo();
|
||
x.zfid = zfid;
|
||
new BLL.chargeBll().UpdateZfCode(x.id.ToString(), zfid);
|
||
WxPayData data = new WxPayData();
|
||
data.SetValue("body", "疫苗缴费");//商品描述
|
||
data.SetValue("attach", x.xingming);//附加数据
|
||
data.SetValue("out_trade_no", zfid);//随机字符串
|
||
data.SetValue("total_fee", (int)(x.money * 100));//总金额
|
||
data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));//交易起始时间
|
||
data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));//交易结束时间
|
||
data.SetValue("goods_tag", x.id);//商品标记
|
||
data.SetValue("trade_type", "NATIVE");//交易类型
|
||
data.SetValue("notify_url", WxPayAPI.WxPayConfig.NOTIFY_URL_Charge);
|
||
data.SetValue("product_id", x.id);//商品ID
|
||
WxPayData result = WxPayApi.UnifiedOrder(data);//调用统一下单接口
|
||
string url = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接
|
||
Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
|
||
x.zfurl = url;
|
||
|
||
|
||
|
||
|
||
#region 支付宝扫码支付
|
||
AlipayTradePrecreateContentBuilder builder = BuildPrecreateContent(x);
|
||
string out_trade_no = builder.out_trade_no;
|
||
IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(Com.Alipay.Config.serverUrl, Com.Alipay.Config.appId, Com.Alipay.Config.merchant_private_key, Com.Alipay.Config.version,
|
||
Com.Alipay.Config.sign_type, Com.Alipay.Config.alipay_public_key, Com.Alipay.Config.charset);
|
||
//如果需要接收扫码支付异步通知,那么请把下面两行注释代替本行。
|
||
//推荐使用轮询撤销机制,不推荐使用异步通知,避免单边账问题发生。
|
||
//AlipayF2FPrecreateResult precreateResult = serviceClient.tradePrecreate(builder);
|
||
string notify_url = "http://dc.51csharp.com/dccdc/weixin/notify_alipay"; //商户接收异步通知的地址
|
||
AlipayF2FPrecreateResult precreateResult = serviceClient.tradePrecreate(builder, notify_url);
|
||
|
||
//以下返回结果的处理供参考。
|
||
//payResponse.QrCode即二维码对于的链接
|
||
//将链接用二维码工具生成二维码打印出来,顾客可以用支付宝钱包扫码支付。
|
||
string ali_result = "";
|
||
|
||
switch (precreateResult.Status)
|
||
{
|
||
case ResultEnum.SUCCESS:
|
||
x.zfurl_alipay = precreateResult.response.QrCode;
|
||
break;
|
||
case ResultEnum.FAILED:
|
||
ali_result = precreateResult.response.Body;
|
||
//Response.Redirect("result.aspx?Text=" + result);
|
||
x.State = 0;
|
||
x.Message = ali_result;
|
||
break;
|
||
|
||
case ResultEnum.UNKNOWN:
|
||
if (precreateResult.response == null)
|
||
{
|
||
ali_result = "配置或网络异常,请检查后重试";
|
||
}
|
||
else
|
||
{
|
||
ali_result = "系统异常,请更新外部订单后重新发起请求";
|
||
}
|
||
//Response.Redirect("result.aspx?Text=" + result);
|
||
x.State = 0;
|
||
x.Message = ali_result;
|
||
break;
|
||
}
|
||
#endregion
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(x);
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string getTJJFXX(string id)
|
||
{
|
||
var x = new BLL.chargeBll().getTJJFXX(id);
|
||
if (x.id == 0)
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(x);
|
||
//NativePay nativePay = new NativePay();
|
||
Log.Info(this.GetType().ToString(), "Native pay mode 2 url is producing...");
|
||
string zfid = WxPayApi.GenerateOutTradeNo();
|
||
x.zfid = zfid;
|
||
new BLL.chargeBll().UpdateZfCode(x.id.ToString(), zfid);
|
||
WxPayData data = new WxPayData();
|
||
data.SetValue("body", "体检缴费");//商品描述
|
||
data.SetValue("attach", x.xingming);//附加数据
|
||
data.SetValue("out_trade_no", zfid);//随机字符串
|
||
data.SetValue("total_fee", (int)(x.money * 100));//总金额
|
||
data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));//交易起始时间
|
||
data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));//交易结束时间
|
||
data.SetValue("notify_url", WxPayAPI.WxPayConfig.NOTIFY_URL_Charge);
|
||
data.SetValue("trade_type", "NATIVE");//交易类型
|
||
data.SetValue("product_id", x.id);//商品ID
|
||
WxPayData result = WxPayApi.UnifiedOrder(data);//调用统一下单接口
|
||
string url = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接
|
||
Log.Info(this.GetType().ToString(), "Get native pay mode 2 url : " + url);
|
||
x.zfurl = url;
|
||
|
||
|
||
|
||
|
||
#region 支付宝扫码支付
|
||
AlipayTradePrecreateContentBuilder builder = BuildPrecreateContent(x, "体检费用");
|
||
string out_trade_no = builder.out_trade_no;
|
||
IAlipayTradeService serviceClient = F2FBiz.CreateClientInstance(Com.Alipay.Config.serverUrl, Com.Alipay.Config.appId, Com.Alipay.Config.merchant_private_key, Com.Alipay.Config.version,
|
||
Com.Alipay.Config.sign_type, Com.Alipay.Config.alipay_public_key, Com.Alipay.Config.charset);
|
||
//如果需要接收扫码支付异步通知,那么请把下面两行注释代替本行。
|
||
//推荐使用轮询撤销机制,不推荐使用异步通知,避免单边账问题发生。
|
||
//AlipayF2FPrecreateResult precreateResult = serviceClient.tradePrecreate(builder);
|
||
string notify_url = "http://dc.51csharp.com/dccdc/weixin/notify_alipay"; //商户接收异步通知的地址
|
||
AlipayF2FPrecreateResult precreateResult = serviceClient.tradePrecreate(builder, notify_url);
|
||
|
||
//以下返回结果的处理供参考。
|
||
//payResponse.QrCode即二维码对于的链接
|
||
//将链接用二维码工具生成二维码打印出来,顾客可以用支付宝钱包扫码支付。
|
||
string ali_result = "";
|
||
|
||
switch (precreateResult.Status)
|
||
{
|
||
case ResultEnum.SUCCESS:
|
||
x.zfurl_alipay = precreateResult.response.QrCode;
|
||
break;
|
||
case ResultEnum.FAILED:
|
||
ali_result = precreateResult.response.Body;
|
||
//Response.Redirect("result.aspx?Text=" + result);
|
||
x.State = 0;
|
||
x.Message = ali_result;
|
||
break;
|
||
|
||
case ResultEnum.UNKNOWN:
|
||
if (precreateResult.response == null)
|
||
{
|
||
ali_result = "配置或网络异常,请检查后重试";
|
||
}
|
||
else
|
||
{
|
||
ali_result = "系统异常,请更新外部订单后重新发起请求";
|
||
}
|
||
//Response.Redirect("result.aspx?Text=" + result);
|
||
x.State = 0;
|
||
x.Message = ali_result;
|
||
break;
|
||
}
|
||
#endregion
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(x);
|
||
}
|
||
/// <summary>
|
||
/// 构造支付请求数据
|
||
/// </summary>
|
||
/// <returns>请求数据集</returns>
|
||
private AlipayTradePrecreateContentBuilder BuildPrecreateContent(Models.DTO.YMJFXX x, string fy = "疫苗费用")
|
||
{
|
||
//线上联调时,请输入真实的外部订单号。
|
||
string out_trade_no = "";
|
||
out_trade_no = x.zfid;
|
||
|
||
AlipayTradePrecreateContentBuilder builder = new AlipayTradePrecreateContentBuilder();
|
||
//收款账号
|
||
builder.seller_id = Com.Alipay.Config.pid;
|
||
//订单编号
|
||
builder.out_trade_no = out_trade_no;
|
||
//订单总金额
|
||
builder.total_amount = x.money.ToString();
|
||
//参与优惠计算的金额
|
||
//builder.discountable_amount = "";
|
||
//不参与优惠计算的金额
|
||
//builder.undiscountable_amount = "";
|
||
//订单名称
|
||
builder.subject = fy + "-" + x.xingming;
|
||
//自定义超时时间
|
||
builder.timeout_express = "5m";
|
||
//订单描述
|
||
builder.body = "";
|
||
//门店编号,很重要的参数,可以用作之后的营销
|
||
builder.store_id = "自助机";
|
||
//操作员编号,很重要的参数,可以用作之后的营销
|
||
builder.operator_id = "自助机";
|
||
|
||
//传入商品信息详情
|
||
/*
|
||
List<GoodsInfo> gList = new List<GoodsInfo>();
|
||
GoodsInfo goods = new GoodsInfo();
|
||
goods.goods_id = "goods id";
|
||
goods.goods_name = "goods name";
|
||
goods.price = "0.01";
|
||
goods.quantity = "1";
|
||
gList.Add(goods);
|
||
builder.goods_detail = gList;
|
||
*/
|
||
//系统商接入可以填此参数用作返佣
|
||
//ExtendParams exParam = new ExtendParams();
|
||
//exParam.sysServiceProviderId = "20880000000000";
|
||
//builder.extendParams = exParam;
|
||
|
||
return builder;
|
||
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
|
||
public string getzfstate(string id)
|
||
{
|
||
var cm = new BLL.chargeBll().getModel(id);
|
||
if (cm.status == "已缴费")
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 1, Message = "支付成功!" });
|
||
}
|
||
else
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new { State = 0, Message = "支付未成功!" });
|
||
}
|
||
}
|
||
|
||
public string test()
|
||
{
|
||
//MedicalAppointmentBll bll = new MedicalAppointmentBll();
|
||
//bll.UpdateZfzt("148549239220170912163153503");
|
||
register("1758", "", "1964-05-25", "372401196405251547", "", "", "");
|
||
return "OK! My is a tester!";
|
||
}
|
||
[AllowAnonymous]
|
||
public string getaccesstoken()
|
||
{
|
||
return Common.Global.getAccessTokenYM.access_token;
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
public string omg()
|
||
{
|
||
#region 临时使用处理6000条数据
|
||
string dqtj = @"select * from professionalExam_register a where a.register_date<'2019-10-01' and trade_type_maintain_id in (1,2)
|
||
and not exists(
|
||
select 1 from professionalExam_register b where b.register_date>'2019-12-14' and a.card_number=b.card_number
|
||
)";
|
||
var dal = new DAL.ProfessionalExamRegisterDal();
|
||
List<dccdc.Models.ProfessionalExamRegisterModel> dqlist = dal.getdqlist(dqtj);
|
||
for (int i = 0; i < 4800; i++)
|
||
{
|
||
var m = dqlist[i];
|
||
List<dccdc.Models.ProfessionalExamProjectResultModel> results = dal.getResult(m.physical_num);
|
||
List<dccdc.Models.ExaminationProcessModel> processlist = dal.getexamprocess(m.physical_num);
|
||
/*
|
||
* physical_num
|
||
age
|
||
register_date
|
||
printtimes
|
||
main_review_date
|
||
check_date
|
||
*/
|
||
var d = DateTime.Parse(m.register_date);
|
||
m.register_date = d.AddYears(DateTime.Now.Year - d.Year).ToString("yyyy-MM-dd");
|
||
m.physical_num = dal.physical_num(m.register_date);
|
||
m.person_age = (int)((d - DateTime.Parse(m.birth)).TotalDays / 365);
|
||
if (!string.IsNullOrEmpty(m.printtimes))
|
||
m.printtimes = DateTime.Now.ToString("yyyy") + m.printtimes.Substring(4);
|
||
if (!string.IsNullOrEmpty(m.check_date))
|
||
m.check_date = DateTime.Now.ToString("yyyy") + m.check_date.Substring(4);
|
||
if (!string.IsNullOrEmpty(m.main_review_date))
|
||
m.main_review_date = DateTime.Now.ToString("yyyy") + m.main_review_date.Substring(4);
|
||
m.id = dal.Add(m).ToString();
|
||
processlist.ForEach(pro => {
|
||
if (!string.IsNullOrEmpty(pro.entry_date))
|
||
pro.entry_date = DateTime.Now.ToString("yyyy") + pro.entry_date.Substring(4);
|
||
if (!string.IsNullOrEmpty(pro.complete_date))
|
||
pro.complete_date = DateTime.Now.ToString("yyyy") + pro.complete_date.Substring(4);
|
||
pro.person_id = int.Parse(m.id);
|
||
pro.physical_num = m.physical_num;
|
||
new DAL.examination_processDal().Add(pro);
|
||
});
|
||
results.ForEach(res => {
|
||
res.physical_num = m.physical_num;
|
||
res.person_id = int.Parse(m.id);
|
||
if (!string.IsNullOrEmpty(res.inspection_time))
|
||
res.inspection_time = DateTime.Now.ToString("yyyy") + res.inspection_time.Substring(4);
|
||
if (!string.IsNullOrEmpty(res.commit_date))
|
||
res.commit_date = DateTime.Now.ToString("yyyy") + res.commit_date.Substring(4);
|
||
new DAL.professionalExam_project_resultDal().Add(res);
|
||
});
|
||
}
|
||
#endregion
|
||
return "ok";
|
||
}
|
||
|
||
#region 疫苗接种相关自助机功能
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string JiaoHao()
|
||
{
|
||
PaiDuiJiaoHaoBLL bll = new PaiDuiJiaoHaoBLL();
|
||
var state = bll.JiaoHao();
|
||
if (state.State == 1)
|
||
{
|
||
IConnection connection;
|
||
ISession session;
|
||
IMessageProducer prod;
|
||
string address = System.Configuration.ConfigurationManager.AppSettings["MQAddress"];
|
||
IConnectionFactory factory = new ConnectionFactory(address);
|
||
connection = factory.CreateConnection();
|
||
connection.ClientId = Dns.GetHostName() + "_gxpdrs";
|
||
connection.Start();
|
||
//Create the Session
|
||
session = connection.CreateSession();
|
||
|
||
//Create the Producer for the topic/queue
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("sxpdrs"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
var imesg = prod.CreateTextMessage();
|
||
imesg.Text = state.Message.Split('|')[2];
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
prod.Close();
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("gxpdlb"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
imesg = prod.CreateTextMessage();
|
||
imesg.Text = "gxpdlb";
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
|
||
|
||
prod.Close();
|
||
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("sxpdrs"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
imesg = prod.CreateTextMessage();
|
||
imesg.Text = "";
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
prod.Close();
|
||
session.Close();
|
||
connection.Close();
|
||
}
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(state);
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string getParm(string key)
|
||
{
|
||
return new BLL.Common().getParm_Value(key, "", "");
|
||
}
|
||
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string getPdrs()
|
||
{
|
||
return new BLL.PaiDuiJiaoHaoBLL().getPdrs();
|
||
}
|
||
static readonly object jho = new object();
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string hj(int ksid,string ksmc,string hm,bool gh=false)
|
||
{
|
||
var bll = new BLL.PaiDuiJiaoHaoBLL();
|
||
lock (jho)
|
||
{
|
||
var or= bll.hj(ksid, ksmc, hm,gh);
|
||
if(or.State==1)
|
||
{
|
||
IConnection connection;
|
||
ISession session;
|
||
IMessageProducer prod;
|
||
string address = System.Configuration.ConfigurationManager.AppSettings["MQAddress"];
|
||
IConnectionFactory factory = new ConnectionFactory(address);
|
||
connection = factory.CreateConnection();
|
||
connection.ClientId = Dns.GetHostName() + "_gxpdlb";
|
||
connection.Start();
|
||
//Create the Session
|
||
session = connection.CreateSession();
|
||
|
||
//Create the Producer for the topic/queue
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("gxpdlb"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
var imesg = prod.CreateTextMessage();
|
||
imesg.Text = "gxpdlb";
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
|
||
|
||
prod.Close();
|
||
prod = null;
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("hujiao"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
imesg = prod.CreateTextMessage();
|
||
imesg.Text =or.Message;
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
|
||
|
||
prod.Close();
|
||
prod = session.CreateProducer(
|
||
new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic("sxpdrs"));
|
||
prod.DeliveryMode = MsgDeliveryMode.Persistent;
|
||
imesg = prod.CreateTextMessage();
|
||
imesg.Text = "";
|
||
//imesg.Properties.SetString("dept_code", ksbh);
|
||
prod.Send(imesg, MsgDeliveryMode.Persistent, MsgPriority.Normal, TimeSpan.MinValue);
|
||
prod.Close();
|
||
session.Close();
|
||
connection.Close();
|
||
}
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(or);
|
||
}
|
||
}
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string getPD_XX (string id)
|
||
{
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.PaiDuiJiaoHaoBLL().getModel(id));
|
||
}
|
||
[AllowAnonymous]
|
||
[HttpPost]
|
||
public string getpdlb()
|
||
{
|
||
pdxx pd = new Controllers.pdxx();
|
||
var bll = new PaiDuiJiaoHaoBLL();
|
||
pd.jhs = bll.getYJH();
|
||
pd.dds = bll.getWJH();
|
||
return Newtonsoft.Json.JsonConvert.SerializeObject(pd);
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
|
||
public class pdxx
|
||
{
|
||
public List<Models.PD_XX> jhs { get; set; }
|
||
public List<Models.PD_XX> dds { get; set; }
|
||
|
||
}
|
||
|
||
|
||
} |