123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using System;
- using System.Data.SqlClient;
- using System.Linq;
- using JLHHJSvr.BLL;
- using JLHHJSvr.Com;
- using JLHHJSvr.Com.Model;
- using JLHHJSvr.Helper;
- using JLHHJSvr.LJException;
- using LJLib.DAL.SQL;
- using LJLib.Net.SPI.Server;
- namespace JLHHJSvr.Excutor
- {
- internal sealed class MattressJSAuditExcutor : ExcutorBase<MattressJSAuditRequest, MattressJSAuditResponse>
- {
- protected override void ExcuteInternal(MattressJSAuditRequest request, object state, MattressJSAuditResponse rslt)
- {
- var tokendata = BllHelper.GetToken(request.token);
- if (tokendata == null)
- {
- rslt.ErrMsg = "会话已经中断,请重新登录";
- return;
- }
- if (!request.list.Any())
- {
- rslt.ErrMsg = "至少提交一条需要审核的记录";
- return;
- }
- using (var con = new SqlConnection(GlobalVar.ConnectionString))
- using (var cmd = con.CreateCommand())
- {
- con.Open();
- if (request.type == 1)
- {
- var power83 = UserHelper.CheckFuncPower(cmd, tokendata.empid, 83);
- if (!power83)
- {
- throw new LJCommonException("你没有审核权限");
- }
- }
- else
- {
- var power84 = UserHelper.CheckFuncPower(cmd, tokendata.empid, 84);
- if (!power84)
- {
- throw new LJCommonException("你没有撤审权限");
- }
- }
- var mattressHelper = HelperBase.GetHelper<MattressHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
- using (cmd.Transaction = con.BeginTransaction())
- {
- try
- {
- foreach (var bill in request.list)
- {
- if (request.type == 1) mattressHelper.MattressJSAudit(bill.mattressid);
- else mattressHelper.MattressJSCancelAudit(bill.mattressid);
- }
- cmd.Transaction.Commit();
- }
- catch (Exception e)
- {
- cmd.Transaction.Rollback();
- rslt.ErrMsg = e.ToString();
- }
- }
- }
- }
- }
- }
|