123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- package com.sinosoft.am.org.linkerHistory.service;
- import java.io.UnsupportedEncodingException;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import javax.ws.rs.POST;
- import javax.ws.rs.Path;
- import javax.ws.rs.ProduceMime;
- import com.sinosoft.am.org.linkerHistory.dao.HistoryLinkerDao;
- import com.sinosoft.lz.system.Utils;
- @Path("/HistoryLinkerService/")
- public class HistoryLinkerService {
-
- /**
- * 组织机构管理/机构人员信息/保存按钮
- *
- * @param params
- * @return
- */
- @ProduceMime("application/json")
- @POST
- @Path("/insertHistoryLinker/")
- public String insertHistoryLinker(String params) {
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
-
- String condition = Utils.getParameter("condition", params) == null ? "" : Utils.getParameter("condition", params);//查询条件
- String madeMan = Utils.getParameter("madeMan", params) == null ? "" : Utils.getParameter("madeMan", params);//操作人
- String madeManId = Utils.getParameter("madeManId", params) == null ? "" : Utils.getParameter("madeManId", params);//操作人ID
- String madeManPhone = Utils.getParameter("madeManPhone", params) == null ? "" : Utils.getParameter("madeManPhone", params);//操作人电话
- String deptName = Utils.getParameter("deptName", params) == null ? "" : Utils.getParameter("deptName", params);//单位名称
- String isIssue = Utils.getParameter("isIssue", params) == null ? "" : Utils.getParameter("isIssue", params);//保存-0或发布-1
- //System.out.println("+++++"+madeMan+"+++++++"+madeManId+"++++++++"+madeManPhone+"++++++++"+condition);
-
- /**
- * 将Date格式化为String
- */
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat sdf1 = new SimpleDateFormat("yy-M-d hh(a):mm:ss");
- Date dd2 = new Date();
- String dateStr = sdf.format(dd2);
- //System.out.println("++++++++++++++++++++++++++++"+dateStr);//2016-07-31 10:58:35
-
- HistoryLinkerDao hisLinkerDao = new HistoryLinkerDao();
- int l = -1;
- int m = -1;
- int n = -1;
- //1-如果是发布(即isIssue的值为1),要把EMC_AM_ORG_INLINK_HISTORY表中其他已发布的记录的改为未发布
- if("1".equals(isIssue)){
- l = hisLinkerDao.updateDataOfInlinkHistory(condition);
- }
-
- //2-把EMC_AM_ORG_INLINK表中查出来要发布的数据加入到表EMC_AM_ORG_INLINK_HISTORY中
- int a = hisLinkerDao.addDataToTable1(condition, dateStr ,madeMan,madeManId,madeManPhone,deptName,isIssue);//a为插入到表EMC_AM_ORG_INLINK_HISTORY中数据的条数
- //System.out.println("+++++++++++++++++++++++插入数据"+ a+ "条");
-
- if("1".equals(isIssue)){
- //3-如果是发布(即isIssue的值为1),要先把表EMC_AM_ORG_INLINK中的信息删掉,
- m = hisLinkerDao.delDatatoInlink(condition);
- //4-再把表EMC_AM_ORG_INLINK_HISTORY中发布的信息添加到表EMC_AM_ORG_INLINK中
- n = hisLinkerDao.addDatatoInlink(condition);
- }
-
-
-
- return a+"";
- }
-
-
-
- @ProduceMime("application/json")
- @POST
- @Path("/selectSimpleData/")
- public String selectSimpleData(String params) {
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
-
- HistoryLinkerDao hisLinkerDao = new HistoryLinkerDao();
-
- String str = "";
- str = hisLinkerDao.getSimpleData();//
- //System.out.println("+++++++++++++++++++++++插入数据"+ a+ "条");
-
- return str;
- }
-
-
- @ProduceMime("application/json")
- @POST
- @Path("/selectPeopleMsg/")
- public String selectPeopleMsg(String params) {
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- String updatedate = Utils.getParameter("updatedate", params) == null ? "" : Utils.getParameter("updatedate", params);
- HistoryLinkerDao hisLinkerDao = new HistoryLinkerDao();
-
- String str = "";
- str = hisLinkerDao.getPeopleMsg(updatedate);//
- //System.out.println("+++++++++++++++++++++++插入数据"+ a+ "条");
-
- return str;
- }
-
- @ProduceMime("application/json")
- @POST
- @Path("/issueLinkerMsg/")
- public String issueLinkerMsg(String params) {
- try {
- params = java.net.URLDecoder.decode(params, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- String updatedate = Utils.getParameter("updateDate", params) == null ? "" : Utils.getParameter("updateDate", params);//dd84a5d4d4b046cca28a52a2445ee55b,2018-03-18 18:38:41
- String issueState = Utils.getParameter("issueState", params) == null ? "" : Utils.getParameter("issueState", params);
- HistoryLinkerDao hisLinkerDao = new HistoryLinkerDao();
-
- /**
- * 将Date格式化为String
- */
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- SimpleDateFormat sdf1 = new SimpleDateFormat("yy-M-d hh(a):mm:ss");
- Date dd2 = new Date();
- String dateStr = sdf.format(dd2);
- //System.out.println("++++++++++++++++++++++++++++"+dateStr);//2016-07-31 10:58:35
-
-
- //1-把表EMC_AM_ORG_INLINK_HISTORY中之前已发布的数据状态都改为未发布
- //update EMC_AM_ORG_INLINK_HISTORY set is_issue='0' where is_del='0' and updatedate='' and VIRTUAL_ORG_ID='';
- int m = hisLinkerDao.updateIssueStateTo0(updatedate);
- System.out.println("+++++++++++++++++++++++第一步:把表EMC_AM_ORG_INLINK_HISTORY中之前已发布的数据状态都改为未发布,共"+ m + "条");
- //2-修改表EMC_AM_ORG_INLINK_HISTORY中相应的信息为发布状态
- //update EMC_AM_ORG_INLINK_HISTORY set IS_ISSUE='"+issueState+"' where updatedate in ("+updatedate+")
- int n = hisLinkerDao.updateIssueState(updatedate,issueState,dateStr);//
- System.out.println("+++++++++++++++++++++++第二步:修改表EMC_AM_ORG_INLINK_HISTORY中相应的信息为发布状态,共"+ n + "条");
- //3-删除表EMC_AM_ORG_INLINK中在列表显示的数据
- //update EMC_AM_ORG_INLINK set is_del='1' where is_del='0' and and VIRTUAL_ORG_ID=''
- //delete from EMC_AM_ORG_INLINK where is_del='0' and and VIRTUAL_ORG_ID=''
- int a = hisLinkerDao.deleteInlinkDate(updatedate);
- System.out.println("+++++++++++++++++++++++第三步:删除表EMC_AM_ORG_INLINK中在列表显示的数据,共"+ a + "条");
- //4-把表EMC_AM_ORG_INLINK_HISTORY中已发布的信息添加到表EMC_AM_ORG_INLINK中
- int b = hisLinkerDao.insertDataToInlink(updatedate,issueState);
- System.out.println("+++++++++++++++++++++++第四步:把表EMC_AM_ORG_INLINK_HISTORY中已发布的信息添加到表EMC_AM_ORG_INLINK中,共"+ b+ "条");
-
- return n+"";
- }
-
-
-
-
- }
|