Beispiel #1
0
 public string PostUpdateCheckResult(Dictionary <string, object> d, string OPEN_ID)
 {
     try
     {
         wy_check_result wcr = new wy_check_result()
         {
             RESULT_ID = d["RESULT_ID"].ToString(),
             //FWID = d["FWID"].ToString(),
             JCJG = Convert.ToInt32(d["JCJG"]),
             WTMS = d["WTMS"].ToString(),
             ZGYQ = d["ZGYQ"].ToString(),
             BJR  = OPEN_ID,
             BJSJ = DateTime.Now
         };
         List <Dictionary <string, object> > updatelist = JArray.FromObject(d["CHECK_DETAIL_RESULT"]).ToObject <List <Dictionary <string, object> > >();
         List <wy_check_result_detail>       list       = new List <wy_check_result_detail>();
         foreach (Dictionary <string, object> dd in updatelist)
         {
             wy_check_result_detail item = new wy_check_result_detail();
             item.CHECK_DETAIL_ID     = dd["CHECK_DETAIL_ID"].ToString();
             item.CHECK_DETAIL_RESULT = Convert.ToInt32(dd["VALUE"]);
             list.Add(item);
         }
         Dictionary <string, object>   insertlist = JObject.FromObject(d["INSERTINFO"]).ToObject <Dictionary <string, object> >();
         List <wy_check_result_detail> list1      = new List <wy_check_result_detail>();
         foreach (KeyValuePair <string, object> kp in insertlist)
         {
             wy_check_result_detail item1 = new wy_check_result_detail()
             {
                 CHECK_DETAIL_ID     = Guid.NewGuid().ToString(),
                 DETAIL_CODE         = kp.Key,
                 CHECK_DETAIL_RESULT = Convert.ToInt32(kp.Value),
                 CHECK_DETAIL_TIME   = DateTime.Now,
                 JCR       = OPEN_ID,
                 RESULT_ID = d["RESULT_ID"].ToString()
             };
             list1.Add(item1);
         }
         bool imgSte = d.TryGetValue("IMGS", out object IMGS);
         DB.Db().BeginTran();
         if (imgSte)
         {
             wcr.IMGS = IMGS.ToString();
             DB.Db().Updateable(wcr).IgnoreColumns(it => new { it.TASK_ID, it.FWID, it.JCR, it.JCSJ, it.CJR, it.CJSJ, it.IS_DELETE, it.JCCS, it.IS_REVIEW }).ExecuteCommand();
         }
         else
         {
             DB.Db().Updateable(wcr).IgnoreColumns(it => new { it.TASK_ID, it.FWID, it.JCR, it.JCSJ, it.CJR, it.CJSJ, it.IS_DELETE, it.JCCS, it.IS_REVIEW, it.IMGS }).ExecuteCommand();
         }
         DB.Db().Updateable(list).IgnoreColumns(it => new { it.DETAIL_CODE, it.JCR, it.RESULT_ID }).ExecuteCommand();
         DB.Db().Insertable(list1).ExecuteCommand();
         DB.Db().CommitTran();
     }
     catch (Exception e)
     {
         return(e.Message);
     }
     return("success");
 }
Beispiel #2
0
        public string ReviewCheckConfirm(string resultId, string rwbh, string fwbh, string fwmc, string jcr_openid, string rwmc)
        {
            string reslult = "";

            try
            {
                wy_check_result wcr = new wy_check_result()
                {
                    RESULT_ID = resultId,
                    IS_REVIEW = 1
                };
                int res = _Db.Db().Updateable(wcr).UpdateColumns(a => new { a.IS_REVIEW }).WhereColumns(it => it.RESULT_ID).ExecuteCommand();
                if (res > 0)
                {
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("first", "您收到一个商户房屋整改反馈通知:");
                    dic.Add("keyword1", "整改通知");                                       //信息类型
                    dic.Add("keyword2", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); //提交日期
                    //dic.Add("keyword1", rwbh);//检查任务标号
                    //dic.Add("keyword2",rwmc);//检查任务名称
                    //dic.Add("keyword3", fwbh);//检查房屋编号
                    //dic.Add("keyword4", fwmc);//检查房屋名称
                    string str = $"任务编号:{rwbh},任务名称:{rwmc},房屋编号:{fwbh},房屋名称:{fwmc},已经整改完成,请前去复查!";
                    dic.Add("remark", str);

                    sendMSG(dic, jcr_openid);
                    return(reslult);
                }
                else
                {
                    return("提交失败!");
                }
            }
            catch (Exception ex)
            {
                reslult = ex.ToString();
                return(reslult);
            }
        }
Beispiel #3
0
        public string PostCheckResult(Dictionary <string, object> d, string OPEN_ID,
                                      Action <bool, string, string, string, string, string, DateTime?> sendMsg = null)
        {
            wy_check_result             wcr = new wy_check_result();
            Dictionary <string, object> ww  = JObject.FromObject(d["RESULT_DETAIL"]).ToObject <Dictionary <string, object> >();
            string RESULT_ID = Guid.NewGuid().ToString();

            wcr.RESULT_ID = RESULT_ID;
            //wcr.TASK_ID = DB.Db().Queryable<wy_check_task>().Where(a => a.RWBH == d["RWBH"].ToString()).Select(a => a.TASK_ID).ToList()[0];
            wcr.TASK_ID = d["TASK_ID"].ToString();
            if (d["JCJG"].ToString() != "")
            {
                wcr.JCJG = Convert.ToInt32(d["JCJG"]);
            }
            wcr.JCR       = OPEN_ID;
            wcr.JCSJ      = DateTime.Now;
            wcr.ZGYQ      = d["ZGYQ"].ToString();
            wcr.WTMS      = d["WTMS"].ToString();
            wcr.FWID      = d["FWID"].ToString();
            wcr.IMGS      = d["IMGS"].ToString();
            wcr.CJR       = OPEN_ID;
            wcr.CJSJ      = DateTime.Now;
            wcr.IS_DELETE = 0;
            wcr.JCCS      = 0;
            wcr.IS_REVIEW = 0;
            List <wy_check_result_detail> list = new List <wy_check_result_detail>();
            string detailStr = string.Empty;

            foreach (KeyValuePair <string, object> item in ww)
            {
                dynamic Result = item.Value;
                wy_check_result_detail wcrd = new wy_check_result_detail();
                wcrd.CHECK_DETAIL_ID     = Guid.NewGuid().ToString();
                wcrd.RESULT_ID           = RESULT_ID;
                wcrd.DETAIL_CODE         = item.Key;
                wcrd.CHECK_DETAIL_RESULT = Convert.ToInt32(Result.VALUE);
                wcrd.CHECK_DETAIL_TIME   = DateTime.Now;
                wcrd.JCR = OPEN_ID;
                list.Add(wcrd);
                #region 拼接消息推送
                if (wcrd.CHECK_DETAIL_RESULT == 0)
                {
                    detailStr += Result.NAME.ToString() + "(不合格);";
                    continue;
                }
                detailStr += Result.NAME + "(合格);";
                #endregion
            }
            #region 消息推送
            if (sendMsg == null)
            {
                sendMsg = SendMsg;
            }
            bool IsSend = d.TryGetValue("OPID", out object OPID);
            sendMsg(wcr.JCJG == 0 && IsSend && !string.IsNullOrEmpty(OPID?.ToString()), OPID?.ToString(), d["ZHXM"].ToString(), d["FWBH"].ToString()
                    , d["FWMC"].ToString(), detailStr, wcr.JCSJ);
            #endregion
            try
            {
                DB.Db().BeginTran();
                DB.Db().Insertable(wcr).ExecuteCommand();
                DB.Db().Insertable(list).ExecuteCommand();
                DB.Db().CommitTran();
            }
            catch (Exception e)
            {
                DB.Db().RollbackTran();
                return(e.Message);
            }
            return("success");
        }