From ccd59cc5812eb084e4bf4688387c8d8bbbd7ba94 Mon Sep 17 00:00:00 2001 From: kdh0120 Date: Thu, 12 Nov 2020 04:12:08 +0000 Subject: [PATCH] --- Base/Controller/ACommonCRoom.cs | 28 ++++++- Dao/DB/DB1.Scheme.txt | 3 + Dao/MyBatis/Maps/Grade.xml | 126 ++++++++++++++++++++++++++++++++ Model/CM.cs | 3 + 4 files changed, 157 insertions(+), 3 deletions(-) diff --git a/Base/Controller/ACommonCRoom.cs b/Base/Controller/ACommonCRoom.cs index fb54723..01ded64 100644 --- a/Base/Controller/ACommonCRoom.cs +++ b/Base/Controller/ACommonCRoom.cs @@ -287,8 +287,18 @@ namespace NP.Base.Controllers } else if (type == "abs") { - - return JsonOK(Dao.Save("grade.lectcomplete.abs", new Hashtable() { { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); + var Lects1 = Dao.Get("grade.nocompletelect", lectnos).Where(w => w.iscomplete != 1 && lectnos.Contains(w.lectno.ToString())).ToList(); + if (Lects1.Count() > 0) + { + lectnos = string.Join(",", Lects1.Select(s => s.lectno)); + var data1 = new Lect() { lectnos = lectnos, uno = SUserInfo.UserNo, uip = GetUserIP() }; + return JsonOK(Dao.Save("grade.lectcomplete.abs2", data1)); + } + else + { + return JsonBack(new JsonRtn() { code = 1, msg = "이미 수료된 데이터는 다시 수료할 수 없습니다." }); + } + //return JsonOK(Dao.Save("grade.lectcomplete.abs", new Hashtable() { { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } else if (type == "batch") { @@ -299,8 +309,20 @@ namespace NP.Base.Controllers { return JsonOK(0); } + lectnos = string.Join(",", Dao.Get("grade.nocompletelectcm", cmnos).Select(s => s.lectno)); } - return JsonOK(Dao.Save("grade.lectcomplete", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); + var Lects2 = Dao.Get("grade.nocompletelect", lectnos).Where(w => w.iscomplete != 1 && lectnos.Contains(w.lectno.ToString())).ToList(); + if (Lects2.Count() > 0) + { + lectnos = string.Join(",", Lects2.Select(s => s.lectno)); + var data2 = new Lect() { uno = SUserInfo.UserNo, uip = GetUserIP(), cmno = Convert.ToInt32(cmno), cmnos = cmnos, lectnos = lectnos }; + return JsonOK(Dao.Save("grade.lectcomplete2", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); + } + else + { + return JsonBack(new JsonRtn() { code = 1, msg = "이미 수료된 데이터는 다시 수료할 수 없습니다." }); + } + //return JsonOK(Dao.Save("grade.lectcomplete", new Hashtable() { { "cmno", cmno }, { "cmnos", cmnos }, { "lectnos", lectnos }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } })); } [HttpPost] public JsonResult CMInningGetForOff(Int64 cmino) diff --git a/Dao/DB/DB1.Scheme.txt b/Dao/DB/DB1.Scheme.txt index 02c901c..d6d9652 100644 --- a/Dao/DB/DB1.Scheme.txt +++ b/Dao/DB/DB1.Scheme.txt @@ -781,6 +781,7 @@ create table pay ( ,rbankname varchar (50) ,rbankacc varbinary (200) ,rbankowner varchar (20) + ,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)); @@ -1036,6 +1037,8 @@ create table lect ( ,ispce tinyint ,fgno2 bigint ,cmisno bigint null + ,completetime datetime + ,completeno varchar(50) ,cdt datetime not null,cno bigint not NULL,udt datetime not null,uno bigint not NULL,uip varchar(50) not NULL ,primary key(lectno)); diff --git a/Dao/MyBatis/Maps/Grade.xml b/Dao/MyBatis/Maps/Grade.xml index add5718..963505f 100644 --- a/Dao/MyBatis/Maps/Grade.xml +++ b/Dao/MyBatis/Maps/Grade.xml @@ -266,6 +266,132 @@ group by a.cmno having ifnull(max(a.iscomplete),0) <>1 + + update lect l + inner join ( + select c.lectno,c.completeno,c.completetime + from ( + select t1.* + ,concat('제 ',t1.cyear,' - ',t1.code1,t1.code2,t1.code3,' - ',lpad(ifnull(t2.seqNo,0)+ t1.rno , 6, 0)) completeno + from ( + select l.lectno + ,date_format(l.cdt,'%Y') cyear + ,pcg.cgcode code2 + ,case when cm.cshape = 1 then 'F' else 'N' end code1 + ,case when te.cremark = '1' then te.refcode + when tm.cremark in ('1','2','3','4') then tm.refcode + else '05' end code3 + ,case when cm.cshape = 0 then now() + when cm.cshape = 1 then cm.setime + else cs.eend end completetime + ,row_number() over(partition by date_format(l.cdt,'%Y') order by l.cdt) rno + from lect l + inner join cm cm on cm.cmno = l.cmno + inner join pay p on p.payno = l.payno + left outer join pplog pl on pl.pplno = p.pplno + inner join cg cg on cg.cgno = cm.cgno + inner join cg pcg on pcg.cgno = cg.pcgno + left outer join comcode tm on tm.isuse=1 and tm.ccode = pl.typeman + left outer join comcode te on te.isuse=1 and te.ccode = pl.typeedu + left outer join cminningscd cs on cs.cmisno = pl.cmisno + where l.lectno in ($lectnos$) + ) t1 + left outer join ( + select date_format(l.cdt, '%Y') cyear,max(substring(l.completeno, -6)) seqNo + from lect l + group by date_format(l.cdt, '%Y') + ) t2 on t2.cyear = t1.cyear + ) c + ) b + inner join cm c on c.cmno = l.cmno + set l.uno = #uno# + ,l.udt = now() + ,l.cno = #uno# + ,l.cdt = now() + ,l.uip= #uip# + ,l.iscomplete=1 + ,l.completetime=b.completetime + ,l.completeno = b.completeno + where l.lectno = b.lectno + + + update lect a + inner join ( + + ) b on b.lectno=a.lectno + inner join ( + select c.lectno,c.completeno,c.completetime + from ( + select t1.* + ,concat('제 ',t1.cyear,' - ',t1.code1,t1.code2,t1.code3,' - ',lpad(ifnull(t2.seqNo,0)+ t1.rno , 6, 0)) completeno + from ( + select l.lectno + ,date_format(l.cdt,'%Y') cyear + ,pcg.cgcode code2 + ,case when cm.cshape = 1 then 'F' else 'N' end code1 + ,case when te.cremark = '1' then te.refcode + when tm.cremark in ('1','2','3','4') then tm.refcode + else '05' end code3 + ,case when cm.cshape = 0 then now() + when cm.cshape = 1 then cm.setime + else cs.eend end completetime + ,row_number() over(partition by date_format(l.cdt,'%Y') order by l.cdt) rno + from lect l + inner join cm cm on cm.cmno = l.cmno + inner join pay p on p.payno = l.payno + left outer join pplog pl on pl.pplno = p.pplno + inner join cg cg on cg.cgno = cm.cgno + inner join cg pcg on pcg.cgno = cg.pcgno + left outer join comcode tm on tm.isuse=1 and tm.ccode = pl.typeman + left outer join comcode te on te.isuse=1 and te.ccode = pl.typeedu + left outer join cminningscd cs on cs.cmisno = pl.cmisno + where l.lectno in ($lectnos$) + ) t1 + left outer join ( + select date_format(l.cdt, '%Y') cyear,max(substring(l.completeno, -6)) seqNo + from lect l + group by date_format(l.cdt, '%Y') + ) t2 on t2.cyear = t1.cyear + ) c + ) c on c.lectno = a.lectno + inner join cm d on d.cmno = a.cmno + set a.udt=,a.uno=#uno#,a.uip=#uip# + ,a.iscomplete=b.ispass + ,a.apoint=b.apoint + ,a.mpoint=a.mpoint + ,a.fpoint=b.fpoint + ,a.spoint=b.spoint + ,a.dpoint=b.dpoint + ,a.tpoint=b.apoint+b.mpoint+b.fpoint+b.spoint+b.dpoint + ,a.completetime = case when b.ispass = 1 then else null end + ,a.completeno = case when b.ispass = 1 then c.completeno else null end + + where a.status=1 and a.ischanged=0 and a.lectno = c.lectno + and a.cmno = #cmno# + and a.lectno = #lectno# + and a.cmno in ($cmnos$) + and a.lectno in ($lectnos$) + + + diff --git a/Model/CM.cs b/Model/CM.cs index 3f99a9c..96849cd 100644 --- a/Model/CM.cs +++ b/Model/CM.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Security.Policy; using System.Text; namespace NP.Model { @@ -1048,6 +1049,8 @@ namespace NP.Model /// 직위 /// public String uduty { get; set; } + public String lectnos { get; set; } + public String cmnos { get; set; } } /// /// 자격검정시험