This commit is contained in:
hodong13 2020-11-12 07:28:05 +00:00
parent 423ea963d6
commit 89359c5315
10 changed files with 121 additions and 31 deletions

View File

@ -255,7 +255,7 @@ namespace NP.Base.Controllers
PPLog ppllog = new PPLog();
ppllog.uno = SUserInfo.UserNo;
ppllog.uip = GetUserIP();
ppllog.cmno = vm.cmno;
ppllog.userno = vm.User.userno;
ppllog.asno = vm.Assign.asno;
ppllog.isready = Request["applicableCM"].ToString() == "정상접수" ? 0 : 1;

View File

@ -689,6 +689,7 @@ create table paycartgroup (
create table pplog (
pplno bigint auto_increment not null
,userno int not null
,cmno int not null
,isready tinyint
,cgcode varchar (20)
,cshape tinyint
@ -767,20 +768,7 @@ create table pay (
,iscanceled tinyint not null default 0
,iscashrct tinyint null
,cashrcthp varbinary (200) null
,iscashrct tinyint
,cashrcthp varbinary (200)
,cgcode varchar (20)
,cshape tinyint
,typeman smallint
,typeedu smallint
,typegrade smallint
,typejob smallint
,cmisno bigint
,isrebate tinyint
,rbankname varchar (50)
,rbankacc varbinary (200)
,rbankowner varchar (20)
,pplno bigint null
,pplno bigint(20)
,cdt datetime not null,cno bigint not NULL,udt datetime not null,uno bigint not NULL,uip varchar(50) not NULL
,primary key(payno));

View File

@ -97,6 +97,7 @@ alter table paycartgroup add constraint foreign key fkpaycartgrouppaycart (pcno)
alter table paycartgroup add constraint foreign key fkpaycartgroupu(userno) references users(userno);
alter table pplog add constraint foreign key fkpplu(userno) references users(userno);
alter table pplog add constraint foreign key fkpplcm(cmno) references cm(cmno);
alter table pplog add constraint foreign key fkppltypeman(typeman) references comcode(ccode);
alter table pplog add constraint foreign key fkppltypeedu(typeedu) references comcode(ccode);
alter table pplog add constraint foreign key fkppltypegrade(typegrade) references comcode(ccode);

View File

@ -22,6 +22,7 @@
<typeAlias alias="questionitem" type="NP.Model.QuestionItem, NP.Model" />
<typeAlias alias="rsc" type="NP.Model.RSC, NP.Model" />
<typeAlias alias="rscq" type="NP.Model.RSCQ, NP.Model" />
<typeAlias alias="pplog" type="NP.Model.PPLog, NP.Model" />
</alias>
<cacheModels>
<cacheModel id="cmCache" implementation="LRU" >
@ -1839,10 +1840,10 @@
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into pplog (
userno,isready,cgcode,cshape,typeman,typeedu,typegrade,typejob,cgno,cmisno,isrebate,rbankname,rbankacc,rbankowner,asname,brno,ceoname,post,address1,address2,btype,bkind,eino,mname
userno,cmno,isready,cgcode,cshape,typeman,typeedu,typegrade,typejob,cgno,cmisno,isrebate,rbankname,rbankacc,rbankowner,asname,brno,ceoname,post,address1,address2,btype,bkind,eino,mname
,mphone,taxemail,userpno,mobile,email,upost,uaddress1,uaddress2,isassignuser,uduty,slevel,<include refid="sql.inc"></include>)
values (
#userno#,#isready#,#cgcode#,#cshape#,#typeman#,#typeedu#,#typegrade#,#typejob#,#cgno#,#cmisno#,#isrebate#,#rbankname#,#rbankacc#,#rbankowner#,#asname#,#brno#,#ceoname#,#post#,#address1#
#userno#,#cmno#,#isready#,#cgcode#,#cshape#,#typeman#,#typeedu#,#typegrade#,#typejob#,#cgno#,#cmisno#,#isrebate#,#rbankname#,#rbankacc#,#rbankowner#,#asname#,#brno#,#ceoname#,#post#,#address1#
,#address2#,#btype#,#bkind#,#eino#,#mname#
,HEX(AES_ENCRYPT(#mphone#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#taxemail#, <include refid="sql.digest"></include>))

View File

@ -28,9 +28,9 @@
<statements>
<insert id="pay.pay.in" parameterClass="pay">
insert into pay(ptype,ispg,isgroup,userno,isexam,pstatus,rstatus,refunding,paylimit,payoktime,pgkey
,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,<include refid="sql.inc"></include>)
,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,pplno,<include refid="sql.inc"></include>)
values (#ptype#,#ispg#,#isgroup#,#userno#,0,#pstatus#,#rstatus#,#refunding#,#paylimit#,case when #isinmoney# is not null then <include refid="sql.now"></include> else #payoktime# end,#pgkey#
,#orgamt#,#discamt#,#deliamt#,#isrefunddvr#,#payamt#,#refundamt#,<include refid="sql.inv"></include>);
,#orgamt#,#discamt#,#deliamt#,#isrefunddvr#,#payamt#,#refundamt#,#pplno#,<include refid="sql.inv"></include>);
<selectKey type="post" property="payno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<insert id="pay.payitem.in" parameterClass="payitem">
@ -39,8 +39,8 @@
<selectKey type="post" property="pino" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<insert id="pay.lect.in" parameterClass="payitem">
insert into lect (cmno,payno,pino,userno,status,iscomplete,orgcmno,attrate,isrebate,ispc,pcno,isjoin,fgno,ischanged,<include refid="sql.inc"></include>)
values(#itemno#,#payno#,#pino#,#userno#,#status#,null,null,0,0,#ispc#,#pcno#,#isjoin#,null,0,<include refid="sql.inv"></include>);
insert into lect (cmno,payno,pino,userno,status,isready,iscomplete,orgcmno,attrate,isrebate,ispc,pcno,isjoin,fgno,ischanged,cmisno,<include refid="sql.inc"></include>)
values(#itemno#,#payno#,#pino#,#userno#,#status#,#isready#,null,null,0,0,#ispc#,#pcno#,#isjoin#,null,0,#cmisno#,<include refid="sql.inv"></include>);
<selectKey type="post" property="lectno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<select id="pay.paydvrs" parameterClass="hashtable" resultClass="paydvr">
@ -819,7 +819,23 @@
set isunpay=2,payoktime=#payoktime#,udt=now(),uno=#uno#,uip=#uip#
where payno=#payno# and isunpay=1;
</update>
<select id="pay.pplogs" parameterClass="hashtable" resultClass="pplog">
select a.pplno,a.isready,a.cmno,a.cmisno
,b.payno
from pplog a
left outer join pay b on b.pplno=a.pplno
<dynamic prepend="where">
<isNotNull property="pplno" prepend="and">a.pplno=#pplno#</isNotNull>
<isNotNull property="userno" prepend="and">a.userno=#userno#</isNotNull>
</dynamic>
</select>
<select id="pay.payresult" parameterClass="hashtable" resultClass="payitem">
select a.payno,a.payamt,a.ptype,a.pstatus
,b.itemno
from pay a
inner join payitem b on b.payno=a.payno
where a.payno=#payno# and a.userno=#userno# and a.ptype &gt; 0 and a.pstatus in (1,22,55)
</select>
</statements>
</sqlMap>

View File

@ -830,15 +830,80 @@ namespace NP.FO.Controllers
return View(vm);
}
public ActionResult Applycomplete(VMCourse vm)
public ActionResult ApplyPay(VMCourse vm)
{
vm.CM = Dao.Get<CM>("cm.cms", new System.Collections.Hashtable() { { "cmno", vm.cmno } }).FirstOrDefault();
if (vm.CM.lectcnt != null)
if (vm.pplno < 1)
{
int? standbyPerson = vm.CM.quota - vm.CM.lectcnt;
vm.CM.applicableCM = (standbyPerson <= 0) ? "대기접수" : "정상접수";
vm.CM.standbyPerson = standbyPerson;
return Redirect("/");
}
var ppl = Dao.Get<PPLog>("pay.pplogs", new Hashtable() { { "pplno", vm.pplno }, { "userno", SUserInfo.UserNo } }).FirstOrDefault();
if (ppl == null)
{
return Redirect("/");
}
if (ppl.payno > 0)
{
//새로고침?
return RedirectPermanent("/Course/ApplyComplete?payno=" + ppl.payno);
}
if (ppl.isready == 1)
{
//대기접수로 결제 및 신청데이터 생성
var payitems = new List<PayItem>() { };
var uip = GetUserIP();
payitems.Add(new PayItem()
{
itemno = vm.cmno,
userno = SUserInfo.UserNo,
status = 6,
pstatus = 55,
pcnt = 1,
payamt = 0,
isready = 1,
cmisno = ppl.cmisno,
uno = SUserInfo.UserNo,
uip = uip
});
//정가확인
var cms = Dao.Get<CM>("cm.cms.forpay", new Hashtable() { { "userno", SUserInfo.UserNo }, { "cmno", ppl.cmno } });
var pi = payitems.First();
pi.orgamt = cms.Where(w => w.cmno == pi.itemno).First().fee;
var pay = new Pay()
{
pplno = vm.pplno,
ptype = 7,
userno = SUserInfo.UserNo,
pstatus = 55,
rstatus = 0,
refunding = 0,
orgamt = cms.Sum(s => s.fee),
//isinmoney = 1,
payamt = payitems.Sum(s => s.payamt),
PIs = payitems,
cmnos = string.Join(",", payitems.Select(s => s.itemno)),
uno = SUserInfo.UserNo,
uip = GetUserIP()
};
Dao.SavePay(pay, true);
if (pay.payno > 0)
{
return RedirectPermanent("/Course/ApplyComplete?payno=" + pay.payno);
}
return Redirect("/");
}
vm.CM = Dao.Get<CM>("cm.cms", new System.Collections.Hashtable() { { "cmno", ppl.cmno } }).First();
return View(vm);
}
public ActionResult ApplyComplete(VMCourse vm)
{
if (vm.payno < 1)
{
return Redirect("/");
}
vm.PayItem = Dao.Get<PayItem>("pay.payresult", new Hashtable() { { "payno", vm.payno }, { "userno", SUserInfo.UserNo } }).First();
vm.CM = Dao.Get<CM>("cm.cms", new System.Collections.Hashtable() { { "cmno", vm.PayItem.itemno } }).FirstOrDefault();
//여기해보자
return View(vm);
}

View File

@ -378,7 +378,8 @@
}
function saveResult() {
if (capResult.code == 1000 && capResult.obj > 0) {
alert("저장되었습니다. pplno : " + capResult.obj);
//alert("저장되었습니다. pplno : " + capResult.obj);
location.href = "/Course/ApplyPay?pplno=" + capResult.obj;
} else {
alert("저장을 실패하였습니다.");
}

View File

@ -11,6 +11,7 @@ namespace NP.Model
{
public Int64 pplno { get; set; }
public int userno { get; set; }
public int cmno { get; set; }
public int? isready { get; set; }
public String cgcode { get; set; }
public int? cshape { get; set; }
@ -50,5 +51,7 @@ namespace NP.Model
public String uduty { get; set; }
public int? slevel { get; set; }
public Int64 payno { get; set; }
}
}

View File

@ -14,7 +14,11 @@ namespace NP.Model
/// </summary>
public Int64 payno { get; set; }
/// <summary>
/// 결제방식 1:신용카드,2:계좌이체,3:가상계좌,4:현금,5:현금+카드,6:무료,9:위탁계약
/// 사용자사이트 수강신청 검색루트를 통한 신청일 경우 pplog 정보 연결
/// </summary>
public Int64? pplno { get; set; }
/// <summary>
/// 결제방식 1:신용카드,2:계좌이체,3:가상계좌,4:현금,5:현금+카드,6:무료,7:대기신청,9:위탁계약
/// </summary>
public int ptype { get; set; }
public String ptypecode
@ -61,7 +65,7 @@ namespace NP.Model
public String username { get; set; }
public String userpno { get; set; }
/// <summary>
/// 결제상태 0:결제시도, 1:결제완료, 21:결제대기(승인심사),22:입금대기, 41:결제취소,42:가상계좌입금대기만료,43:가상계좌입금전취소" lect, examuser 등의 결제상태 sync
/// 결제상태 0:결제시도, 1:결제완료, 21:결제대기(승인심사),22:입금대기, 41:결제취소,42:가상계좌입금대기만료,43:가상계좌입금전취소,55:대기신청" lect, examuser 등의 결제상태 sync
/// </summary>
public int pstatus { get; set; }
public String pstatusname
@ -293,6 +297,14 @@ namespace NP.Model
public int payamt {get;set;}
public int payamt2 { get; set; }
/// <summary>
/// 0:정상, 1:대기신청
/// </summary>
public int isready { get; set; }
/// <summary>
/// 혼합교육 교육일정 cminningscd.cmisno
/// </summary>
public Int64? cmisno { get; set; }
/// <summary>
/// 현금결제액 현금+카드로 결제 시
/// </summary>
public int payamtcash {get;set;}

View File

@ -46,5 +46,8 @@ namespace NP.Model
public Book Book { get; set; }
public int bkno { get; set; }
public int pcnt { get; set; }
public Int64 pplno { get; set; }
public Int64 payno { get; set; }
public PayItem PayItem { get; set; }
}
}