| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.Logging;
- using Microsoft.Extensions.Options;
- using Microsoft.AspNetCore.Authorization;
- using System.Web;
- using MySystem.Models.Main2;
- using MySystem.Service.Main2;
- using LitJson;
- using Library;
- using MySystem.Service.KxsMain;
- namespace MySystem.Areas.Api.Controllers.v1.Main2
- {
- [Area("Api")]
- [Route("/v1/QrCodePlateMain/[controller]/[action]")]
- public class MerchantAddInfoController : BaseController
- {
- public MerchantAddInfoController(IHttpContextAccessor accessor) : base(accessor)
- {
- }
- #region 进件管理-银联商户列表
- [Authorize]
- public JsonResult UnionPayList(string value)
- {
- value = PublicFunction.DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> Other = new Dictionary<string, object>();
- List<Dictionary<string, object>> dataList = UnionPayListDo(value, out Other);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = dataList, Other = Other });
- }
- private List<Dictionary<string, object>> UnionPayListDo(string value, out Dictionary<string, object> Other)
- {
- JsonData data = JsonMapper.ToObject(value);
- string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体)
- string CertMerchantName = data["CertMerchantName"].ToString(); //商户名称
- string ServicePhone = data["ServicePhone"].ToString(); //客服电话
- string MakerCode = data["MakerCode"].ToString(); //所属创客编号
- string Status = data["Status"].ToString(); //商户状态(0 审核中 1 已通过 -1 审核失败 20 微信待签约 21 微信已签约 10 支付宝待签约 11 支付宝已签约)
- int pageSize = int.Parse(function.CheckInt(data["page_size"].ToString()));
- int pageNum = int.Parse(function.CheckInt(data["page_num"].ToString()));
- string condition = "";
- if (!string.IsNullOrEmpty(data["SubjectType"].ToString()))
- {
- if (data["SubjectType"].ToString() == "1") SubjectType = "SUBJECT_TYPE_ENTERPRISE"; //企业公司
- if (data["SubjectType"].ToString() == "2") SubjectType = "SUBJECT_TYPE_INDIVIDUAL"; //个体工商户
- if (data["SubjectType"].ToString() == "3") SubjectType = "SUBJECT_TYPE_SMALL"; //小微商户
- condition += " and SubjectType='" + SubjectType + "'";
- }
- if (!string.IsNullOrEmpty(data["CertMerchantName"].ToString()))
- {
- condition += " and CertMerchantName='" + CertMerchantName + "'";
- }
- if (!string.IsNullOrEmpty(data["ServicePhone"].ToString()))
- {
- condition += " and ServicePhone='" + ServicePhone + "'";
- }
- if (!string.IsNullOrEmpty(data["MakerCode"].ToString()))
- {
- var Ids = MerchantInfoUtil.QueryMerchantIdByMakerCode(MakerCode);
- condition += " and Id in (" + Ids + ")";
- }
- if (!string.IsNullOrEmpty(data["Status"].ToString()))
- {
- if (Status == "0") condition += " and Status=0"; //审核中
- if (Status == "1") condition += " and Status=2 and QueryCount=2"; //已通过
- if (Status == "-1") condition += " and Status=-1"; //审核失败
- if (Status == "20") condition += " and Status=1"; //微信待签约
- if (Status == "21") condition += " and Status=2"; //微信已签约
- if (Status == "10") condition += " and Status=1"; //支付宝待签约
- if (Status == "11") condition += " and Status=2"; //支付宝已签约
- condition += "";
- }
- List<RelationData> relationData = new List<RelationData>();
- List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
- Other = new Dictionary<string, object>();
- int count = 0;
- List<Dictionary<string, object>> source = MerchantAddInfoService.List(relationData, condition, out count, pageNum, pageSize);
- foreach (Dictionary<string, object> subdata in source)
- {
- Dictionary<string, object> curData = new Dictionary<string, object>();
- var status = int.Parse(subdata["Status"].ToString());
- var queryCount = int.Parse(subdata["QueryCount"].ToString());
- //商户Id
- var MerchantId = int.Parse(subdata["Id"].ToString());
- //主体类型
- var subjectType = 0;
- if (subdata["SubjectType"].ToString() == "SUBJECT_TYPE_ENTERPRISE") subjectType = 1; //企业公司
- if (subdata["SubjectType"].ToString() == "SUBJECT_TYPE_INDIVIDUAL") subjectType = 2; //个体工商户
- if (subdata["SubjectType"].ToString() == "SUBJECT_TYPE_SMALL") subjectType = 3; //小微商户
- curData.Add("Id", subdata["Id"].ToString()); //Id
- curData.Add("SubjectType", subjectType); //主体类型(1 企业 2 个体 3 小微)
- curData.Add("CertMerchantName", subdata["CertMerchantName"].ToString()); //商户名称
- curData.Add("ServicePhone", subdata["ServicePhone"].ToString()); //客服电话
- curData.Add("BizStoreAddress", subdata["BizStoreAddress"].ToString()); //门店地址
- curData.Add("CreateDate", subdata["CreateDate"].ToString() == null ? "" : DateTime.Parse(subdata["CreateDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")); //进件时间
- var userInfo = UsersService.Query(MerchantInfoService.Query(MerchantId).UserId);
- curData.Add("MakerCode", userInfo.MakerCode); //所属创客编号
- curData.Add("RealName", userInfo.RealName); //所属创客姓名
- //商户状态
- var MerStatus = 0;
- // if (status == 0) MerStatus = 0; //审核中
- if (status == 2 && queryCount == 2) MerStatus = 1; //已通过
- if (status == -1) MerStatus = -1; //审核失败
- if (status == 1) MerStatus = 20; //微信待签约
- if (status == 2) MerStatus = 21; //微信已签约
- if (queryCount == 1) MerStatus = 10; //支付宝待签约
- if (queryCount == 2) MerStatus = 11; //支付宝已签约
- curData.Add("MerStatus", MerStatus); //所属创客姓名
- //审核平台
- var AuditInfo = 0;
- if (status < 0 && queryCount >= 1) AuditInfo = 2;
- if (status >= 1 && queryCount < 0) AuditInfo = 1;
- if (status < 0 && queryCount == 0) AuditInfo = 3;
- curData.Add("AuditInfo", AuditInfo); //审核平台(1 支付宝 2 微信 3 好哒)
- dataList.Add(curData);
- }
- Other.Add("Count", count); //总数
- return dataList;
- }
- #endregion
- #region 进件管理-银联查看失败原因
- [Authorize]
- public JsonResult UnionPayQueryFailReason(string value)
- {
- value = PublicFunction.DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> Obj = UnionPayQueryFailReasonDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
- }
- private Dictionary<string, object> UnionPayQueryFailReasonDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string MerchantId = data["MerchantId"].ToString(); //商户Id
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- MerchantAddInfo query = new MerchantAddInfo();
- query = MerchantAddInfoService.Query(int.Parse(MerchantId));
- var info = "";
- if (query.Status == -1)
- {
- info += query.WeChatRemark + "\n";
- }
- if (query.QueryCount == -1)
- {
- info += query.AlipayRemark + "\n";
- }
- Obj.Add("Info", info); //失败原因
- return Obj;
- }
- #endregion
- #region 进件管理-银联进件详情
- [Authorize]
- public JsonResult UnionPayDetail(string value)
- {
- value = PublicFunction.DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> Obj = UnionPayDetailDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
- }
- private Dictionary<string, object> UnionPayDetailDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string MerchantId = data["MerchantId"].ToString(); //商户Id
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- Obj = MerchantAddInfoUtil.MerchantAddInfoDetail(int.Parse(MerchantId));
- return Obj;
- }
- #endregion
- #region 进件管理-银联提交进件
- [Authorize]
- public JsonResult UnionPaySubmit(string value)
- {
- value = PublicFunction.DesDecrypt(value);
- JsonData data = JsonMapper.ToObject(value);
- AppResultJson result = UnionPaySubmitDo(value);
- return Json(new AppResultJson() { Status = result.Status, Info = result.Info, Data = result.Data });
- }
- private AppResultJson UnionPaySubmitDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string MerchantId = data["MerchantId"].ToString(); //商户Id
- var info = MerchantAddInfoUtil.DirectSubmitDo(int.Parse(MerchantId));
- if (info == "success")
- {
- return new AppResultJson() { Status = "1", Info = "成功", Data = info };
- }
- else
- {
- return new AppResultJson() { Status = "-1", Info = "失败", Data = info };
- }
- }
- #endregion
- #region 商户管理-银联查询商户交易信息
- [Authorize]
- public JsonResult UnionPayQueryMerchantTradeInfo(string value)
- {
- value = PublicFunction.DesDecrypt(value); ;
- JsonData data = JsonMapper.ToObject(value);
- Dictionary<string, object> Obj = UnionPayQueryMerchantTradeInfoDo(value);
- return Json(new AppResultJson() { Status = "1", Info = "", Data = Obj });
- }
- private Dictionary<string, object> UnionPayQueryMerchantTradeInfoDo(string value)
- {
- JsonData data = JsonMapper.ToObject(value);
- string MerchantName = data["MerchantName"].ToString(); //商户名称
- string Mobile = data["Mobile"].ToString(); //手机号码
- string MakerCode = data["MakerCode"].ToString(); //所属创客
- string MatchNo = data["MatchNo"].ToString(); //商户号
- string SubjectType = data["SubjectType"].ToString(); //主体类型(1 企业 2 个体 3 小微)
- Dictionary<string, object> Obj = new Dictionary<string, object>();
- Obj = MerchantAddInfoUtil.DirectQueryMerchantTradeInfoDo(MerchantName, Mobile, MakerCode, MatchNo, SubjectType);
- return Obj;
- }
- #endregion
- }
- }
|