12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196 |
- package cn.com.usky.iot.maintenanceplan.service;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Calendar;
- import java.util.HashMap;
- import java.util.List;
- import java.util.ArrayList;
- import java.util.Map;
- import cn.com.usky.iot.entity.YtiotTMaintenancePlan;
- import cn.com.usky.iot.entity.YtiotTPatrolPlan;
- import cn.com.usky.iot.entity.YtiotTRoute;
- import cn.com.usky.iot.entity.YtiotVUsercompany;
- import cn.com.usky.iot.entity.YtiotVUsercompanyId;
- import cn.com.usky.iot.entity.YtiotTAdmin;
- import cn.com.usky.iot.entity.YtiotTArea;
- import cn.com.usky.iot.entity.YtiotTInspectors;
- import cn.com.usky.iot.entity.YtiotTMaintenancePerson;
- import cn.com.usky.iot.entity.YtiotTRoute2;
- import cn.com.usky.iot.entity.YtiotVUsercompany;
- import cn.com.usky.iot.entity.YtiotVUsercompanyId;
- import cn.com.usky.iot.admin.dao.YtiotVUserCompanyDao;
- import cn.com.usky.iot.admin.dao.YtiotTAdminDao;
- import cn.com.usky.iot.maintenanceperson.dao.YtiotTMaintenancePersonDao;
- import cn.com.usky.iot.maintenanceplan.dao.YtiotTMaintenancePlanDao;
- import cn.com.usky.iot.route2.dao.YtiotTRoute2Dao;
- import cn.com.usky.utils.DaoResult;
- import cn.com.usky.utils.MD5Util;
- import net.sf.json.JSONArray;
- import net.sf.json.JSONObject;
- public class YtiotTMaintenancePlanServicesImpl implements YtiotTMaintenancePlanService {
- private YtiotTMaintenancePlanDao ytiotTMaintenancePlanDao;
- private YtiotVUserCompanyDao ytiotVUserCompanyDao;
- private YtiotTAdminDao ytiotTAdminDao;
- private YtiotTRoute2Dao ytiotTRoute2Dao;
- private YtiotTMaintenancePersonDao ytiotTMaintenancePersonDao;
-
- public YtiotTAdminDao getYtiotTAdminDao() {
- return ytiotTAdminDao;
- }
- public void setYtiotTAdminDao(YtiotTAdminDao ytiotTAdminDao) {
- this.ytiotTAdminDao = ytiotTAdminDao;
- }
- public YtiotTMaintenancePlanDao getYtiotTMaintenancePlanDao() {
- return ytiotTMaintenancePlanDao;
- }
-
- public void setYtiotTMaintenancePlanDao(YtiotTMaintenancePlanDao ytiotTMaintenancePlanDao) {
- this.ytiotTMaintenancePlanDao = ytiotTMaintenancePlanDao;
- }
- public YtiotVUserCompanyDao getYtiotVUserCompanyDao() {
- return ytiotVUserCompanyDao;
- }
- public void setYtiotVUserCompanyDao(YtiotVUserCompanyDao ytiotVUserCompanyDao) {
- this.ytiotVUserCompanyDao = ytiotVUserCompanyDao;
- }
- public YtiotTMaintenancePersonDao getYtiotTMaintenancePersonDao() {
- return ytiotTMaintenancePersonDao;
- }
-
- public void setYtiotTMaintenancePersonDao(YtiotTMaintenancePersonDao ytiotTMaintenancePersonDao) {
- this.ytiotTMaintenancePersonDao = ytiotTMaintenancePersonDao;
- }
- public YtiotTRoute2Dao getYtiotTRoute2Dao() {
- return ytiotTRoute2Dao;
- }
-
- public void setYtiotTRoute2Dao(YtiotTRoute2Dao ytiotTRoute2Dao) {
- this.ytiotTRoute2Dao = ytiotTRoute2Dao;
- }
- public boolean chk_string_param(String param) {
- if(param==null)
- return true;
- if(param.indexOf("=")>=0)
- return false;
- if(param.indexOf("\'")>=0)
- return false;
- if(param.indexOf("\"")>=0)
- return false;
- return true;
- }
-
- public String chkhw(String hqlwhere){
- if(hqlwhere==null)
- return " where ";
- else
- return hqlwhere+" and ";
- }
- public String fieldname(String field){
- if(field.equals("id"))
- return "id";
- if(field.equals("personnel"))
- return "personnel";
- if(field.equals("route"))
- return "route";
- if(field.equals("planned_date"))
- return "plannedDate";
- if(field.equals("start_time"))
- return "startTime";
- if(field.equals("end_time"))
- return "endTime";
- if(field.equals("completion_status"))
- return "completionStatus";
- if(field.equals("name"))
- return "name";
- if(field.equals("route_name"))
- return "routeName";
- if(field.equals("company_code"))
- return "companyCode";
- return null;
- }
-
-
- public static String[] getDates(String dateFrom, String dateEnd, String weekDays) {
- long time = 1l;
- long perDayMilSec = 24 * 60 * 60 * 1000;
- List<String> dateList = new ArrayList<String>();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- //需要查询的星期系数
- String strWeekNumber = weekForNum(weekDays);
- try {
- dateFrom = sdf.format(sdf.parse(dateFrom).getTime() - perDayMilSec);
- while (true) {
- time = sdf.parse(dateFrom).getTime();
- time = time + perDayMilSec;
- Date date = new Date(time);
- dateFrom = sdf.format(date);
- if (dateFrom.compareTo(dateEnd) <= 0) {
- //查询的某一时间的星期系数
- Integer weekDay = dayForWeek(date);
- //判断当期日期的星期系数是否是需要查询的
- if (strWeekNumber.indexOf(weekDay.toString())!=-1) {
- System.out.println(dateFrom);
- dateList.add(dateFrom);
- }
- } else {
- break;
- }
- }
- } catch (Exception e1) {
- e1.printStackTrace();
- }
- String[] dateArray = new String[dateList.size()];
- dateList.toArray(dateArray);
- return dateArray;
- }
- //等到当期时间的周系数。星期日:1,星期一:2,星期二:3,星期三:4,星期四:5,星期五:6,星期六:7
- public static Integer dayForWeek(Date date) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(date);
- return calendar.get(Calendar.DAY_OF_WEEK);
- }
-
- /**
- * 得到对应星期的系数 星期日:1,星期一:2,星期二:3,星期三:4,星期四:5,星期五:6,星期六:7
- * @param weekDays 星期格式 星期一|星期二
- */
- public static String weekForNum(String weekDays){
- //返回结果为组合的星期系数
- String weekNumber = "";
- //解析传入的星期
- if(weekDays.indexOf("|")!=-1){//多个星期数
- String []strWeeks = weekDays.split("\\|");
- for(int i=0;i<strWeeks.length;i++){
- weekNumber = weekNumber + "" + getWeekNum(strWeeks[i]).toString();
- }
- }else{//一个星期数
- weekNumber = getWeekNum(weekDays).toString();
- }
-
- return weekNumber;
-
- }
-
- //将星期转换为对应的系数 星期日:1,星期一:2,星期二:3,星期三:4,星期四:5,星期五:6,星期六:7
- public static Integer getWeekNum(String strWeek){
- Integer number = 1;//默认为星期日
- if("星期日".equals(strWeek)){
- number = 1;
- }else if("星期一".equals(strWeek)){
- number = 2;
- }else if("星期二".equals(strWeek)){
- number = 3;
- }else if("星期三".equals(strWeek)){
- number = 4;
- }else if("星期四".equals(strWeek)){
- number = 5;
- }else if("星期五".equals(strWeek)){
- number = 6;
- }else if("星期六".equals(strWeek)){
- number = 7;
- }
- return number;
- }
-
-
- @Override
- public String appendMaintenancePlan(String queryJson) throws Exception {
- // TODO Auto-generated method stub
- String id = null;
- String personnel = null;
- String route = null;
- String Inspectiontime = null;
- String start_time = null;
- String end_time = null;
- String start_data = null;
- String end_data = null;
- String completion_status = null;
- String demoArray[]=null;
- String V_LOGINNAME = null;
- String Company_Code_List = null;
-
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "appendMaintenancePlan");
-
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- Company_Code_List = q_json.has("company_code")?q_json.getString("company_code"):null;
- Inspectiontime = q_json.has("Inspectiontime")?q_json.getString("Inspectiontime"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- start_data = q_json.has("start_data")?q_json.getString("start_data"):null;
- end_data = q_json.has("end_data")?q_json.getString("end_data"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
- V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
- json.put("query", queryJson);
- }
- // if((V_LOGINNAME!=null)&&(Company_Code_List==null)&&(!V_LOGINNAME.equals("admin"))) {
- // String where = " where u.id.agentid='"+V_LOGINNAME+"' ";
- // List list = ytiotVUserCompanyDao.query(where, null, null, null, null);
- // if(list.size()>0) {
- // for(int i=0;i<list.size();i++) {
- // YtiotVUsercompany o = (YtiotVUsercompany)list.get(i);
- // YtiotVUsercompanyId oid = o.getId();
- // if(!oid.getOwnerCode().equals("10012")&& !oid.getOwnerCode().equals("10068")) {
- //
- // Company_Code_List = oid.getOwnerCode();
- //
- // }
- // }
- // }
- // }
- // System.out.println(Company_Code_List);
- demoArray=getDates(start_data, end_data,Inspectiontime);
- if(chk_string_param(personnel)&&chk_string_param(route)&&chk_string_param(Inspectiontime)
- &&chk_string_param(start_time)&&chk_string_param(end_time)&&chk_string_param(completion_status)) {
- YtiotTMaintenancePlan o = new YtiotTMaintenancePlan();
- // float F_HEIGHT1 = Float.parseFloat(F_HEIGHT);
- for(int i=0;i<demoArray.length;i++) {
- o.setPlannedDate(demoArray[i]);
-
- o.setPersonnel(personnel);
- o.setCompanyCode(Company_Code_List);
- o.setRoute(route);
- // o.setPlannedDate(planned_date);
- o.setStartTime(start_time);
- o.setEndTime(end_time);
- o.setCompletionStatus("0");
- DaoResult ret = ytiotTMaintenancePlanDao.add(o);
- }
- json.put("success", true);
- json.put("Msg", "成功加入数据库");
- }else {
- json.put("success", false);
- json.put("Msg", "参数验证错误");
- }
- return json.toString();
- }
- @Override
- public String updateMaintenancePlan(String queryJson) throws Exception {
- // TODO Auto-generated method stub
- String id = null;
- String personnel = null;
- String route = null;
- String planned_date = null;
- String start_time = null;
- String end_time = null;
- String completion_status = null;
- String hqlwhere = null;
- String hqlwhere1 = null;
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "updateMaintenancePlan");
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- id = q_json.has("id")?q_json.getString("id"):null;
-
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- planned_date = q_json.has("planned_date")?q_json.getString("planned_date"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
- json.put("query", queryJson);
- }
- if(personnel!=null)
- hqlwhere = "u."+fieldname("name")+"='"+personnel+"'";
- List list1 =ytiotTMaintenancePlanDao.query1(hqlwhere);
- YtiotTMaintenancePerson g = (YtiotTMaintenancePerson)list1.get(0);
- String personnel_id = Integer.toString(g.getId());
- if(route!=null)
- hqlwhere1 = "u."+fieldname("route_name")+"='"+route+"'";
- List list2 =ytiotTMaintenancePlanDao.query2(hqlwhere1);
- YtiotTRoute2 r = (YtiotTRoute2)list2.get(0);
- String route_id = Integer.toString(r.getId());
- if(chk_string_param(id)&&chk_string_param(route_id)&&chk_string_param(personnel_id)&&chk_string_param(planned_date)
- &&chk_string_param(start_time)&&chk_string_param(end_time)&&chk_string_param(completion_status)) {
- if(id!=null) {
- List list = ytiotTMaintenancePlanDao.query(" where u."+fieldname("id")+" ='"+id+"' ", null, null, null, null);
- if(list.size()>0) {
- YtiotTMaintenancePlan o = (YtiotTMaintenancePlan) list.get(0);
- if(personnel!=null)
- o.setPersonnel(personnel_id);
- if(route!=null)
- o.setRoute(route_id);
- if(planned_date!=null)
- o.setPlannedDate(planned_date);
- if(start_time!=null)
- o.setStartTime(start_time);
- if(end_time!=null)
- o.setEndTime(end_time);
- if(completion_status!=null)
- o.setCompletionStatus(completion_status);
- DaoResult ret = ytiotTMaintenancePlanDao.update(o);
- json.put("success", ret.isSuccess());
- json.put("MSG", ret.getResult());
- }else {
- json.put("success", false);
- json.put("MSG", "需要编辑的权限记录不存在");
- }
- }else {
- json.put("success", false);
- json.put("MSG", "记录ID不能为空");
- }
- }else {
- json.put("success", false);
- json.put("MSG", "参数验证错误");
- }
- return json.toString();
- }
- @Override
- public String getMaintenancePlanList(String queryJson, String page, String start, String limit, String sort) throws Exception {
- // TODO Auto-generated method stub
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String id = null;
- String personnel = null;
- String route = null;
- String planned_date = null;
- String start_time = null;
- String end_time = null;
- String completion_status = null;
- String company_code = null;
- String Company_Code_List = null;
- String V_LOGINNAME = null;
- String Page = null;
- String Start = null;
- JSONArray Sort = null;
- String Limit = null;
- String hqlwhere4 = null;
- String hqlwhere3 = null;
- String hqlwhere2 = null;
- String hqlwhere1 = null;
- String hqlwhere = null;
- String order = null;
- String dir = null;
- String order_str = null;
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "getMaintenancePlanList");
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- id = q_json.has("id")?q_json.getString("id"):null;
-
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- planned_date = q_json.has("planned_date")?q_json.getString("planned_date"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
-
- order = q_json.has("order")?q_json.getString("order"):null;
- dir = q_json.has("dir")?q_json.getString("dir"):null;
- Start = q_json.has("start")?q_json.getString("start"):(start!=null)?start:"0";
- Limit = q_json.has("limit")?q_json.getString("limit"):(limit!=null)?limit:null;
- Page = q_json.has("page")?q_json.getString("page"):(page!=null)?page:"0";
- V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
- json.put("query", queryJson);
- }
- if(personnel!=null) {
- hqlwhere3 = "u."+fieldname("name")+"='"+personnel+"'";
- List list3 =ytiotTMaintenancePlanDao.query1(hqlwhere3);
- YtiotTMaintenancePerson p = (YtiotTMaintenancePerson)list3.get(0);
- personnel = Integer.toString(p.getId());
- }
- if(route!=null) {
- hqlwhere4 = "u."+fieldname("route_name")+"='"+route+"'";
- List list4 =ytiotTMaintenancePlanDao.query2(hqlwhere4);
- YtiotTRoute2 t = (YtiotTRoute2)list4.get(0);
- route = Integer.toString(t.getId());
- }
- // System.out.println();
- if(sort!=null) {
- Sort = JSONArray.fromObject(sort);
- if((Sort.isArray())&&(Sort.size()>0)) {
- JSONObject s_json = Sort.getJSONObject(0);
- order = s_json.has("property")?s_json.getString("property"):order;
- dir = s_json.has("direction")?s_json.getString("direction"):dir;
- }
- json.put("sort", sort);
- }
- if((V_LOGINNAME!=null)&&(company_code==null)&&(Company_Code_List==null)) {
- String where = " where u.id.agentid='"+V_LOGINNAME+"' ";
- List list = ytiotVUserCompanyDao.query(where, null, null, null, null);
- if(list.size()>0) {
- for(int i=0;i<list.size();i++) {
- YtiotVUsercompany o = (YtiotVUsercompany)list.get(i);
- YtiotVUsercompanyId oid = o.getId();
-
- if(i==0)
- Company_Code_List = oid.getOwnerCode();
- else
- Company_Code_List += ","+oid.getOwnerCode();
-
- }
- }
- }
- Start = start;
- Limit = limit;
- Page = page;
- if(Company_Code_List!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+" in ("+Company_Code_List+") ";
- if(personnel!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("personnel")+"='"+personnel+"'";
- if(route!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("route")+"='"+route+"'";
- if(start_time!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("start_time")+"='"+start_time+"'";
- if(end_time!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("end_time")+"='"+end_time+"'";
- if(planned_date!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("planned_date")+" like '%"+planned_date+"%'";
- if(completion_status!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("completion_status")+"='"+completion_status+"'";
-
- if(order!=null)
- order_str = " order by u."+fieldname(order);
- else
- order_str = " order by u."+fieldname("id");
- int totalCount = ytiotTMaintenancePlanDao.getCount(hqlwhere);
- //System.out.println(totalCount);
- json.put("totalCount", totalCount);
- if(Start!=null){
- if(Integer.parseInt(Start)>totalCount){
- Start = "0";
- Page = "0";
- }
- if(page==null)
- Page="0";
- }else{
- Start = "0";
- Page = "0";
- }
- json.put("page", Page);
- json.put("start", Start);
- json.put("limit", Limit);
- if(totalCount>0) {
- List list = ytiotTMaintenancePlanDao.query(hqlwhere, order_str, dir, Start, Limit);
- if(list.size()>0) {
- for(int i=0;i<list.size();i++) {
- YtiotTMaintenancePlan o = (YtiotTMaintenancePlan)list.get(i);
- Map map = new HashMap();
- if(o.getPersonnel()!=null) {
- hqlwhere1 = "u."+fieldname("id")+"='"+o.getPersonnel()+"'";
- List list1 = ytiotTMaintenancePlanDao.query1(hqlwhere1);
- if(list1.size()>0) {
- YtiotTMaintenancePerson g = (YtiotTMaintenancePerson)list1.get(0);
- map.put("personnel", g.getName());
- }
- }
- if(o.getRoute()!=null) {
- hqlwhere2 = "u."+fieldname("id")+"='"+o.getRoute()+"'";
- List list2 = ytiotTMaintenancePlanDao.query2(hqlwhere2);
- if(list2.size()>0) {
- YtiotTRoute2 r = (YtiotTRoute2)list2.get(0);
- map.put("route", r.getRouteName());
- }
- }
- map.put("id", o.getId());
- // map.put("personnel", o.getPersonnel());
- // map.put("route", o.getRoute());
- map.put("planned_date", o.getPlannedDate());
- map.put("start_time", o.getStartTime());
- map.put("end_time", o.getEndTime());
- map.put("completion_status", o.getCompletionStatus());
- //map.put("E_STATUS", o.getEStatus());
- // map.put("D_STORETIME", formatter.format(o.getDStoretime()));
- JSONObject jSONObject = JSONObject.fromObject(map);
- jSONArray.add(jSONObject);
- }
- json.put("RESULT", jSONArray);
- }
- }
- return json.toString();
- }
-
- @Override
- public String getMaintenancePlanExcelList(String queryJson) throws Exception {
- // TODO Auto-generated method stub
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String id = null;
- String personnel = null;
- String route = null;
- String planned_date = null;
- String start_time = null;
- String end_time = null;
- String completion_status = null;
- String company_code = null;
- String Company_Code_List = null;
- String V_LOGINNAME = null;
- String Page = null;
- String Start = null;
- JSONArray Sort = null;
- String Limit = null;
- String hqlwhere4 = null;
- String hqlwhere3 = null;
- String hqlwhere2 = null;
- String hqlwhere1 = null;
- String hqlwhere = null;
- String order = null;
- String dir = null;
- String order_str = null;
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "getMaintenancePlanList");
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- id = q_json.has("id")?q_json.getString("id"):null;
-
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- planned_date = q_json.has("planned_date")?q_json.getString("planned_date"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
-
- order = q_json.has("order")?q_json.getString("order"):null;
- dir = q_json.has("dir")?q_json.getString("dir"):null;
- V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
- json.put("query", queryJson);
- }
- if((personnel!=null)&&(personnel.length()>0)) {
- hqlwhere3 = "u."+fieldname("name")+"='"+personnel+"'";
- List list3 =ytiotTMaintenancePlanDao.query1(hqlwhere3);
- YtiotTInspectors p = (YtiotTInspectors)list3.get(0);
- personnel = Integer.toString(p.getId());
- }
- if((route!=null)&&(route.length()>0)) {
- hqlwhere4 = "u."+fieldname("route_name")+"='"+route+"'";
- List list4 =ytiotTMaintenancePlanDao.query2(hqlwhere4);
- YtiotTRoute t = (YtiotTRoute)list4.get(0);
- route = Integer.toString(t.getId());
- }
- // System.out.println();
- if((V_LOGINNAME!=null)&&(company_code==null)&&(Company_Code_List==null)) {
- String where = " where u.id.agentid='"+V_LOGINNAME+"' ";
- List list = ytiotVUserCompanyDao.query(where, null, null, null, null);
- if(list.size()>0) {
- for(int i=0;i<list.size();i++) {
- YtiotVUsercompany o = (YtiotVUsercompany)list.get(i);
- YtiotVUsercompanyId oid = o.getId();
-
- if(i==0)
- Company_Code_List = oid.getOwnerCode();
- else
- Company_Code_List += ","+oid.getOwnerCode();
-
- }
- }
- }
- if(Company_Code_List!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+" in ("+Company_Code_List+") ";
- if((personnel!=null)&&(personnel.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("personnel")+"='"+personnel+"'";
- if((route!=null)&&(route.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("route")+"='"+route+"'";
- if((start_time!=null)&&(start_time.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("start_time")+"='"+start_time+"'";
- if((end_time!=null)&&(end_time.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("end_time")+"='"+end_time+"'";
- if((planned_date!=null)&&(planned_date.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("planned_date")+"='"+planned_date+"'";
- if(completion_status!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("completion_status")+"='"+completion_status+"'";
- System.out.println(hqlwhere);
- if(order!=null)
- order_str = " order by u."+fieldname(order);
- else
- order_str = " order by u."+fieldname("id");
- int totalCount = ytiotTMaintenancePlanDao.getCount(hqlwhere);
-
- json.put("totalCount", totalCount);
- if(totalCount>0) {
- List list = ytiotTMaintenancePlanDao.query(hqlwhere, order_str, dir, Start, Limit);
- if(list.size()>0) {
- for(int i=0;i<list.size();i++) {
- YtiotTMaintenancePlan o = (YtiotTMaintenancePlan)list.get(i);
- Map map = new HashMap();
- if(o.getPersonnel()!=null) {
- hqlwhere1 = "u."+fieldname("id")+"='"+o.getPersonnel()+"'";
- List list1 = ytiotTMaintenancePlanDao.query1(hqlwhere1);
- if(list1.size()>0) {
- YtiotTMaintenancePerson g = (YtiotTMaintenancePerson)list1.get(0);
- map.put("personnel", g.getName());
- }
- }
- if(o.getRoute()!=null) {
- hqlwhere2 = "u."+fieldname("id")+"='"+o.getRoute()+"'";
- List list2 = ytiotTMaintenancePlanDao.query2(hqlwhere2);
- if(list2.size()>0) {
- YtiotTRoute2 r = (YtiotTRoute2)list2.get(0);
- map.put("route", r.getRouteName());
- }
- }
- map.put("id", o.getId());
- map.put("planned_date", o.getPlannedDate());
- map.put("start_time", o.getStartTime());
- map.put("end_time", o.getEndTime());
- map.put("completion_status", o.getCompletionStatus());
- JSONObject jSONObject = JSONObject.fromObject(map);
- jSONArray.add(jSONObject);
- }
- json.put("result", jSONArray);
- }
- }
- return json.toString();
- }
-
- // 巡检记录
- @Override
- public String getCheckRecord2List(String queryJson, String page, String start, String limit, String sort) throws Exception {
- // TODO Auto-generated method stub
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //设置时间格式,将该时间格式的时间转换为时间戳
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
- String id = null;
- String personnel = null;
- String route = null;
- String planned_date = null;
- String start_time = null;
- String end_time = null;
- String completion_status = null;
-
- String sjc1=null;
- String sjc2=null;
-
- String company_code=null;
- String V_LOGINNAME = null;
- String V_PASSWORD = null;
- int E_STATUS=-1;
- String company_code_list = null;
-
-
- String Page = null;
- String Start = null;
- JSONArray Sort = null;
- String Limit = null;
- String hqlwhere4 = null;
- String hqlwhere3 = null;
- String hqlwhere2 = null;
- String hqlwhere1 = null;
- String hqlwhere = null;
- String order = null;
- String dir = null;
- String order_str = null;
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "getMaintenancePlanList");
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- id = q_json.has("id")?q_json.getString("id"):null;
-
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- planned_date = q_json.has("planned_date")?q_json.getString("planned_date"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
-
- V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
- V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
-
- order = q_json.has("order")?q_json.getString("order"):null;
- dir = q_json.has("dir")?q_json.getString("dir"):null;
- Start = q_json.has("start")?q_json.getString("start"):(start!=null)?start:"0";
- Limit = q_json.has("limit")?q_json.getString("limit"):(limit!=null)?limit:null;
- Page = q_json.has("page")?q_json.getString("page"):(page!=null)?page:"0";
- json.put("query", queryJson);
- }
-
- if((V_LOGINNAME!=null)&&(V_PASSWORD!=null)) {
- List list88 = ytiotTAdminDao.query(" where MD5(u.VLoginname)='"+MD5Util.EncoderByMd5(V_LOGINNAME)+"' and u.VPassword='"
- +V_PASSWORD+"' ", null, null, null, null);
- if(list88.size()>0) {
- YtiotTAdmin b2 = (YtiotTAdmin)list88.get(0);
- System.out.println("测试1"+b2.getEStatus());
- E_STATUS = Integer.parseInt(b2.getEStatus());
- // System.out.println("测试2"+E_STATUS);
- }
- }
-
- if(E_STATUS==1) {
- if(V_LOGINNAME!=null) {
- String where99 = " where u.id.agentid='"+V_LOGINNAME+"' ";
- List list66 = ytiotVUserCompanyDao.query(where99, null, null, null, null);
- if(list66.size()>0) {
- for(int i=0;i<list66.size();i++) {
- YtiotVUsercompany b1 = (YtiotVUsercompany)list66.get(i);
- YtiotVUsercompanyId oid = b1.getId();
- if(i==0)
- company_code_list = oid.getOwnerCode();
- else
- company_code_list += ","+oid.getOwnerCode();
- }
- }
- }
-
-
-
- if(personnel!=null) {
- hqlwhere3 = "u."+fieldname("name")+"='"+personnel+"'";
- List list3 =ytiotTMaintenancePlanDao.query1(hqlwhere3);
- YtiotTMaintenancePerson p = (YtiotTMaintenancePerson)list3.get(0);
- personnel = Integer.toString(p.getId());
- }
- if(route!=null) {
- hqlwhere4 = "u."+fieldname("route_name")+"='"+route+"'";
- List list4 =ytiotTMaintenancePlanDao.query2(hqlwhere4);
- YtiotTRoute2 t = (YtiotTRoute2)list4.get(0);
- route = Integer.toString(t.getId());
- }
- // System.out.println();
- if(sort!=null) {
- Sort = JSONArray.fromObject(sort);
- if((Sort.isArray())&&(Sort.size()>0)) {
- JSONObject s_json = Sort.getJSONObject(0);
- order = s_json.has("property")?s_json.getString("property"):order;
- dir = s_json.has("direction")?s_json.getString("direction"):dir;
- }
- json.put("sort", sort);
- }
- Start = start;
- Limit = limit;
- Page = page;
-
- if(company_code!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+"='"+company_code+"'";
- if(company_code_list!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+" in("+company_code_list+")";
-
- if(personnel!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("personnel")+"='"+personnel+"'";
- if(route!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("route")+"='"+route+"'";
- if(start_time!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("start_time")+"='"+start_time+"'";
- if(end_time!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("end_time")+"='"+end_time+"'";
- if(planned_date!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("planned_date")+" like '%"+planned_date+"%'";
- if(completion_status!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("completion_status")+"='"+completion_status+"'";
-
- if(order!=null)
- order_str = " order by u."+fieldname(order);
- else
- order_str = " order by u."+fieldname("id");
- int totalCount = ytiotTMaintenancePlanDao.getCount(hqlwhere);
- //System.out.println(totalCount);
- json.put("totalCount", totalCount);
- if(Start!=null){
- if(Integer.parseInt(Start)>totalCount){
- Start = "0";
- Page = "0";
- }
- if(page==null)
- Page="0";
- }else{
- Start = "0";
- Page = "0";
- }
- json.put("page", Page);
- json.put("start", Start);
- json.put("limit", Limit);
- if(totalCount>0) {
- List list = ytiotTMaintenancePlanDao.query(hqlwhere, order_str, dir, Start, Limit);
- if(list.size()>0) {
- //获得当天时间
- Date date1 = simpleDateFormat.parse(simpleDateFormat.format(new Date()));
- // System.out.println("测试三当前时间yyyy-MM-dd"+simpleDateFormat.format(new Date()));
- long time1 = date1.getTime()/1000;
- sjc1 = String.valueOf(time1);
- for(int i=0;i<list.size();i++) {
- YtiotTMaintenancePlan o = (YtiotTMaintenancePlan)list.get(i);
- Map map = new HashMap();
- //转换为时间戳
- // System.out.println("测试三记录时间yyyy-MM-dd"+o.getPlannedDate());
- Date date2 = simpleDateFormat.parse(o.getPlannedDate());
- long time2 = date2.getTime()/1000;
- sjc2 = String.valueOf(time2);
-
- if(Integer.parseInt(sjc2)<Integer.parseInt(sjc1)) {
- if(o.getPersonnel()!=null) {
- hqlwhere1 = "u."+fieldname("id")+"='"+o.getPersonnel()+"'";
- List list1 = ytiotTMaintenancePlanDao.query1(hqlwhere1);
- if(list1.size()>0) {
- YtiotTMaintenancePerson g = (YtiotTMaintenancePerson)list1.get(0);
- map.put("personnel", g.getName());
- }
- }
- if(o.getRoute()!=null) {
- hqlwhere2 = "u."+fieldname("id")+"='"+o.getRoute()+"'";
- List list2 = ytiotTMaintenancePlanDao.query2(hqlwhere2);
- if(list2.size()>0) {
- YtiotTRoute2 r = (YtiotTRoute2)list2.get(0);
- map.put("route", r.getRouteName());
- }
- }
- map.put("id", o.getId());
- // map.put("personnel", o.getPersonnel());
- // map.put("route", o.getRoute());
- map.put("planned_date", o.getPlannedDate());
- map.put("start_time", o.getStartTime());
- map.put("end_time", o.getEndTime());
- map.put("completion_status", o.getCompletionStatus());
- map.put("company_code1", o.getCompanyCode());
- JSONObject jSONObject = JSONObject.fromObject(map);
- jSONArray.add(jSONObject);
- }
-
- }
- json.put("RESULT", jSONArray);
- }
- }
- }else {
- json.put("success", "false");
- json.put("MSG", "用户权限错误,请重新登录后再试。");
- }
-
-
-
- return json.toString();
- }
-
- @Override
- public String getCheckRecord2ExcelList(String queryJson) throws Exception {
- // TODO Auto-generated method stub
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- //设置时间格式,将该时间格式的时间转换为时间戳
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
- String id = null;
- String personnel = null;
- String route = null;
- String planned_date = null;
- String start_time = null;
- String end_time = null;
- String completion_status = null;
-
- String sjc1=null;
- String sjc2=null;
-
- String company_code=null;
- String V_LOGINNAME = null;
- String V_PASSWORD = null;
- int E_STATUS=-1;
- String company_code_list = null;
-
-
- String Page = null;
- String Start = null;
- JSONArray Sort = null;
- String Limit = null;
- String hqlwhere4 = null;
- String hqlwhere3 = null;
- String hqlwhere2 = null;
- String hqlwhere1 = null;
- String hqlwhere = null;
- String order = null;
- String dir = null;
- String order_str = null;
- JSONObject q_json = null;
- JSONArray jSONArray = new JSONArray();
- JSONObject json = new JSONObject();
- json.put("action", "getPatrolPlanList");
- if(queryJson!=null) {
- q_json = JSONObject.fromObject(queryJson);
- id = q_json.has("id")?q_json.getString("id"):null;
-
- personnel = q_json.has("personnel")?q_json.getString("personnel"):null;
- route = q_json.has("route")?q_json.getString("route"):null;
- planned_date = q_json.has("planned_date")?q_json.getString("planned_date"):null;
- start_time = q_json.has("start_time")?q_json.getString("start_time"):null;
- end_time = q_json.has("end_time")?q_json.getString("end_time"):null;
- completion_status = q_json.has("completion_status")?q_json.getString("completion_status"):null;
-
- V_LOGINNAME = q_json.has("V_LOGINNAME")?q_json.getString("V_LOGINNAME"):null;
- V_PASSWORD = q_json.has("V_PASSWORD")?q_json.getString("V_PASSWORD"):null;
-
- order = q_json.has("order")?q_json.getString("order"):null;
- dir = q_json.has("dir")?q_json.getString("dir"):null;
-
- json.put("query", queryJson);
- }
-
- if((V_LOGINNAME!=null)&&(V_PASSWORD!=null)) {
- List list88 = ytiotTAdminDao.query(" where MD5(u.VLoginname)='"+MD5Util.EncoderByMd5(V_LOGINNAME)+"' and u.VPassword='"
- +V_PASSWORD+"' ", null, null, null, null);
- if(list88.size()>0) {
- YtiotTAdmin b2 = (YtiotTAdmin)list88.get(0);
- // System.out.println("测试1"+b2.getEStatus());
- E_STATUS = Integer.parseInt(b2.getEStatus());
- // System.out.println("测试2"+E_STATUS);
- }
- }
- // System.out.println("bengkui"+E_STATUS);
- if(E_STATUS==1) {
- if(V_LOGINNAME!=null) {
- String where99 = " where u.id.agentid='"+V_LOGINNAME+"' ";
- List list66 = ytiotVUserCompanyDao.query(where99, null, null, null, null);
- if(list66.size()>0) {
- for(int i=0;i<list66.size();i++) {
- YtiotVUsercompany b1 = (YtiotVUsercompany)list66.get(i);
- YtiotVUsercompanyId oid = b1.getId();
- if(i==0)
- company_code_list = oid.getOwnerCode();
- else
- company_code_list += ","+oid.getOwnerCode();
- }
- }
- }
-
-
- if((personnel!=null)&&(personnel.length()>0)) {
- hqlwhere3 = "u."+fieldname("name")+"='"+personnel+"'";
- List list3 =ytiotTMaintenancePlanDao.query1(hqlwhere3);
- YtiotTMaintenancePerson p = (YtiotTMaintenancePerson)list3.get(0);
- personnel = Integer.toString(p.getId());
- }
- if((route!=null)&&(route.length()>0)) {
- hqlwhere4 = "u."+fieldname("route_name")+"='"+route+"'";
- List list4 =ytiotTMaintenancePlanDao.query2(hqlwhere4);
- YtiotTRoute2 t = (YtiotTRoute2)list4.get(0);
- route = Integer.toString(t.getId());
- }
- // System.out.println();
-
-
- if(company_code!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+"='"+company_code+"'";
- if(company_code_list!=null)
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("company_code")+" in("+company_code_list+")";
-
- if((personnel!=null)&&(personnel.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("personnel")+"='"+personnel+"'";
- if((route!=null)&&(route.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("route")+"='"+route+"'";
- if((start_time!=null)&&(start_time.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("start_time")+"='"+start_time+"'";
- if((end_time!=null)&&(end_time.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("end_time")+"='"+end_time+"'";
- if((planned_date!=null)&&(planned_date.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("planned_date")+" like '%"+planned_date+"%'";
- if((completion_status!=null)&&(completion_status.length()>0))
- hqlwhere = chkhw(hqlwhere) + "u."+fieldname("completion_status")+"='"+completion_status+"'";
-
- if(order!=null)
- order_str = " order by u."+fieldname(order);
- else
- order_str = " order by u."+fieldname("id");
- int totalCount = ytiotTMaintenancePlanDao.getCount(hqlwhere);
-
- json.put("totalCount", totalCount);
-
- if(totalCount>0) {
- List list = ytiotTMaintenancePlanDao.query(hqlwhere, order_str, dir, Start, Limit);
- if(list.size()>0) {
- //获得当天时间
- Date date1 = simpleDateFormat.parse(simpleDateFormat.format(new Date()));
- // System.out.println("测试三当前时间yyyy-MM-dd"+simpleDateFormat.format(new Date()));
- long time1 = date1.getTime()/1000;
- sjc1 = String.valueOf(time1);
- for(int i=0;i<list.size();i++) {
- YtiotTMaintenancePlan o = (YtiotTMaintenancePlan)list.get(i);
- Map map = new HashMap();
- //转换为时间戳
- // System.out.println("测试三记录时间yyyy-MM-dd"+o.getPlannedDate());
- Date date2 = simpleDateFormat.parse(o.getPlannedDate());
- long time2 = date2.getTime()/1000;
- sjc2 = String.valueOf(time2);
-
- if(Integer.parseInt(sjc2)<Integer.parseInt(sjc1)) {
- if(o.getPersonnel()!=null) {
- hqlwhere1 = "u."+fieldname("id")+"='"+o.getPersonnel()+"'";
- List list1 = ytiotTMaintenancePlanDao.query1(hqlwhere1);
- if(list1.size()>0) {
- YtiotTMaintenancePerson g = (YtiotTMaintenancePerson)list1.get(0);
- map.put("personnel", g.getName());
- }
- }
- if(o.getRoute()!=null) {
- hqlwhere2 = "u."+fieldname("id")+"='"+o.getRoute()+"'";
- List list2 = ytiotTMaintenancePlanDao.query2(hqlwhere2);
- if(list2.size()>0) {
- YtiotTRoute2 r = (YtiotTRoute2)list2.get(0);
- map.put("route", r.getRouteName());
- }
- }
- map.put("id", o.getId());
- // map.put("personnel", o.getPersonnel());
- // map.put("route", o.getRoute());
- map.put("planned_date", o.getPlannedDate());
- map.put("start_time", o.getStartTime());
- map.put("end_time", o.getEndTime());
- map.put("completion_status", o.getCompletionStatus());
- map.put("company_code1", o.getCompanyCode());
- JSONObject jSONObject = JSONObject.fromObject(map);
- jSONArray.add(jSONObject);
- }
-
- }
- json.put("result", jSONArray);
- }
- }
- }else {
- json.put("success", "false");
- json.put("MSG", "用户权限错误,请重新登录后再试。");
- }
-
-
-
- return json.toString();
- }
-
-
- // @Override
- // public String getPatrolPointVerList(String queryJson, String page, String start, String limit, String sort) throws Exception {
- // // TODO Auto-generated method stub
- // SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- // String UQ_POINT_ID = null;
- // String I_ORDER_IDX = null;
- // String V_POINT_ADDRESS = null;
- // int I_FLOOR = 0;
- // String F_HEIGHT = null;
- // String I_VERSION = null;
- // String D_STORETIME = null;
- // String UQ_ADMIN_ID = null;
- // String V_COMMENT = null;
- //
- // String sqlwhere = null;
- // String order = null;
- // String dir = null;
- // String Start = null;
- // String Limit = null;
- // String Page = null;
- // String order_str = null;
- // JSONObject q_json = null;
- // JSONArray Sort = null;
- // JSONArray jSONArray = new JSONArray();
- // JSONObject json = new JSONObject();
- // json.put("action", "getPointVerList");
- // if(queryJson!=null) {
- // q_json = JSONObject.fromObject(queryJson);
- // UQ_POINT_ID = q_json.has("UQ_POINT_ID")?q_json.getString("UQ_POINT_ID"):null;
- // V_POINT_ADDRESS = q_json.has("V_POINT_ADDRESS")?q_json.getString("V_POINT_ADDRESS"):null;
- // I_FLOOR = q_json.has("I_FLOOR")?q_json.getInt("I_FLOOR"):0;
- // //F_HEIGHT = q_json.has("F_HEIGHT")?q_json.getString("F_HEIGHT"):null;
- // //I_ORDER_IDX= q_json.has("I_ORDER_IDX")?q_json.getString("I_ORDER_IDX"):null;
- // UQ_ADMIN_ID = q_json.has("UQ_ADMIN_ID")?q_json.getString("UQ_ADMIN_ID"):null;
- // I_VERSION = q_json.has("I_VERSION")?q_json.getString("I_VERSION"):null;
- //// System.out.println("测试"+E_STATUS);
- //
- // order = q_json.has("order")?q_json.getString("order"):null;
- // dir = q_json.has("dir")?q_json.getString("dir"):null;
- // Start = q_json.has("start")?q_json.getString("start"):(start!=null)?start:"0";
- // Limit = q_json.has("limit")?q_json.getString("limit"):(limit!=null)?limit:null;
- // Page = q_json.has("page")?q_json.getString("page"):(page!=null)?page:"0";
- // json.put("query", queryJson);
- // }
- //// System.out.println();
- // if(sort!=null) {
- // Sort = JSONArray.fromObject(sort);
- // if((Sort.isArray())&&(Sort.size()>0)) {
- // JSONObject s_json = Sort.getJSONObject(0);
- // order = s_json.has("property")?s_json.getString("property"):order;
- // dir = s_json.has("direction")?s_json.getString("direction"):dir;
- // }
- // json.put("sort", sort);
- // }
- //
- //
- // Start = start;
- // Limit = limit;
- // Page = page;
- // if(V_POINT_ADDRESS!=null)
- // sqlwhere = chkhw(sqlwhere) + "u."+fieldname("V_POINT_ADDRESS")+"='"+V_POINT_ADDRESS+"'";
- // if(I_FLOOR!=0&&I_FLOOR>-1)
- // sqlwhere = chkhw(sqlwhere) + "u."+fieldname("I_FLOOR")+"='"+I_FLOOR+"'";
- //
- // if(UQ_POINT_ID!=null)
- // sqlwhere = chkhw(sqlwhere) + "u."+fieldname("UQ_POINT_ID")+"='"+UQ_POINT_ID+"'";
- //
- // if(UQ_ADMIN_ID!=null)
- // sqlwhere = chkhw(sqlwhere) + "u."+fieldname("UQ_ADMIN_ID")+"='"+UQ_ADMIN_ID+"'";
- //
- // //hqlwhere = chkhw(hqlwhere) + "u."+fieldname("V_UNIT_NAME")+" like '%"+V_UNIT_NAME+"%'";
- //// int b=Integer.parseInt(E_STATUS);
- //// if(b!=10)
- //// hqlwhere = chkhw(hqlwhere) + "u."+fieldname("E_STATUS")+"='"+E_STATUS+"'";
- //
- // if(order!=null)
- // order_str = " order by u."+fieldname(order);
- // else
- // order_str = " order by u."+fieldname("UQ_POINT_ID");
- //
- // //System.out.println("测试:"+sqlwhere);
- //// System.out.println(order_str);
- //
- // //YtiotTPointVerDao
- // int totalCount = ytiotTPointVerDao.getCount(sqlwhere);
- // //System.out.println("测试:"+totalCount);
- // json.put("totalCount", totalCount);
- // if(Start!=null){
- // if(Integer.parseInt(Start)>totalCount){
- // Start = "0";
- // Page = "0";
- // }else if(page==null)
- // Page="0";
- // }else{
- // Start = "0";
- // Page = "0";
- // }
- // json.put("page", Page);
- // json.put("start", Start);
- // json.put("limit", Limit);
- //
- //// System.out.println("测试:"+Page);
- //// System.out.println("测试:"+Start);
- //// System.out.println("测试:"+Limit);
- // if(totalCount>0) {
- // List list = ytiotTPointVerDao.query(sqlwhere, order_str, dir, Start, Limit);
- // System.out.println(list);
- // if(list.size()>0) {
- // for(int i=0;i<list.size();i++) {
- // YtiotTPointver o = (YtiotTPointver)list.get(i);
- // Map map = new HashMap();
- //
- // map.put("UQ_POINT_ID", o.getUqPointId());
- // map.put("V_POINT_ADDRESS", o.getVPointAddress());
- // map.put("I_FLOOR", o.getIFloor());
- // map.put("I_ORDER_IDX", o.getIOrderIdx());
- // map.put("F_HEIGHT", o.getFHeight());
- // map.put("I_VERSION", o.getIVersion());
- // map.put("D_STORETIME", formatter.format(o.getDStoretime()));
- // map.put("V_COMMENT", o.getVComment());
- // map.put("UQ_ADMIN_ID", o.getUqAdminId());
- // JSONObject jSONObject = JSONObject.fromObject(map);
- // jSONArray.add(jSONObject);
- // }
- // json.put("RESULT", jSONArray);
- // }
- // }
- // return json.toString();
- //
- // }
- }
|