Эх сурвалжийг харах

修改代码和线上一致

Signed-off-by: zhangzheng <zhangz@usoftchina.com>
zhangzheng 5 жил өмнө
parent
commit
7eaa052d90

+ 1 - 1
WebContent/WEB-INF/spring/config.xml

@@ -19,7 +19,7 @@
 	default-autowire="byName">
 	<bean id="baseUtil" class="com.mes.core.BaseUtil"></bean>
 	<util:properties id="about">
-		<prop key="defaultSob">MES_ZZ</prop><!-- 默认帐套名称 --><!-- 集团中心名称 -->
+		<prop key="defaultSob">MES</prop><!-- 默认帐套名称 --><!-- 集团中心名称 -->
 		<prop key="task.status">true</prop>
 	</util:properties>
 	<mvc:resources mapping="/resources/**" location="/resources/" />

+ 15 - 15
WebContent/WEB-INF/spring/db-config.xml

@@ -9,21 +9,21 @@
 			<value>oracle.jdbc.driver.OracleDriver</value>
 		</property>
 		<property name="url">
-			 <value>jdbc:oracle:thin:@192.168.230.200:1521:orcl</value>
-		      <!--<value>jdbc:oracle:thin:@192.168.230.200:1521:orcl</value>  -->
-		</property>
-		<property name="username">
-			<value>MES_TEST</value>
-		</property>
-		<property name="password" value="select!#%*(" />
-	</bean>
-	<bean id="MES_TEST" class="org.apache.commons.dbcp.BasicDataSource"
-		destroy-method="close">
-		<property name="driverClassName">
-			<value>oracle.jdbc.driver.OracleDriver</value>
-		</property>
-		<property name="url">
-			<!-- <value>jdbc:oracle:thin:@117.25.180.218:1521:orcl</value> -->
+          <value>jdbc:oracle:thin:@117.25.180.218:1521:orcl</value>
+			<!--   <value>jdbc:oracle:thin:@192.168.230.200:1521:orcl</value>-->
+        </property>
+        <property name="username">
+            <value>MES</value>
+        </property>
+        <property name="password" value="select!#%*(" />
+    </bean>
+    <bean id="MES_TEST" class="org.apache.commons.dbcp.BasicDataSource"
+        destroy-method="close">
+        <property name="driverClassName">
+            <value>oracle.jdbc.driver.OracleDriver</value>
+        </property>
+        <property name="url">
+            <!-- <value>jdbc:oracle:thin:@117.25.180.218:1521:orcl</value> -->
 			 <value>jdbc:oracle:thin:@192.168.230.200:1521:orcl</value>
 		</property>
 		<property name="username">

+ 1 - 0
WebContent/WEB-INF/web.xml

@@ -15,6 +15,7 @@
     </init-param>
   </filter>
   <filter-mapping>
+    <filter-name>encodingFilter</filter-name>
     <filter-name>encodingFilter</filter-name>
     <url-pattern>*</url-pattern>
   </filter-mapping>

BIN
classes/artifacts/n_barcode/n_barcode.war


+ 4 - 5
src/com/mes/controller/barcode/BarcodeController.java

@@ -6,7 +6,6 @@ import java.util.Map;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import com.mes.service.barcode.BarcodeService;
@@ -20,7 +19,7 @@ public class BarcodeController{
 	/**
 	 获取条码信息
 	 */
-	@RequestMapping(value="/getBarcodeData.action",method = RequestMethod.GET)
+	@RequestMapping(value="/getBarcodeData.action",method={org.springframework.web.bind.annotation.RequestMethod.GET})
 	@ResponseBody
 	public Map<String, Object> getBarcodeData (String UID){
 		Map<String, Object> modelMap = new HashMap<String, Object >();
@@ -33,7 +32,7 @@ public class BarcodeController{
 	/**
 	 获取条码信息
 	 */
-	@RequestMapping(value="/getStencilUseCount.action",method = RequestMethod.GET)
+	@RequestMapping(value="/getStencilUseCount.action",method={org.springframework.web.bind.annotation.RequestMethod.GET})
 	@ResponseBody
 	public Map<String, Object> getStencilUseCount (String barcode){
 		Map<String, Object> modelMap = new HashMap<String, Object >();
@@ -46,7 +45,7 @@ public class BarcodeController{
 	/**
 	 获取条码信息
 	 */
-	@RequestMapping(value="/updateStencilUseCount.action",method = RequestMethod.GET)
+	@RequestMapping(value="/updateStencilUseCount.action",method={org.springframework.web.bind.annotation.RequestMethod.GET})
 	@ResponseBody
 	public Map<String, Object> updateStencilUseCount (String barcode,String count){
 		Map<String, Object> modelMap = new HashMap<String, Object >();
@@ -59,7 +58,7 @@ public class BarcodeController{
 	/**
 	 获取条码信息
 	 */
-	@RequestMapping(value="/updateBarcode.action",method = RequestMethod.GET)
+	@RequestMapping(value="/updateBarcode.action",method={org.springframework.web.bind.annotation.RequestMethod.GET})
 	@ResponseBody
 	public Map<String, Object> updateBarcode (String barcode,String num){
 		Map<String, Object> modelMap = new HashMap<String, Object >();

+ 24 - 48
src/com/mes/controller/barcode/BaseController.java

@@ -1,84 +1,60 @@
 package com.mes.controller.barcode;
 
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
-
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.ui.ModelMap;
 
-/**
- * 规范controller返回参数格式
- * 
- * @date 2016年11月7日下午2:54:15
- * @author yingp
- *
- */
-public class BaseController {
-	/**
-	 * extjs传回的参数为unicode编码格式时,spring的mvc不能转换过来???貌似因为utf-8为unicode的子格式??? 通过此方法手动将形如\u5800\u5800的字符串转换为汉字
-	 * 
-	 * @add by yingp 或者前台js用unescape解析成汉字也可以
-	 */
-	protected String decodeUnicodeString(String param) {
-		try {
-			return new String(param.getBytes("utf-8"), defultCharset);
-		} catch (UnsupportedEncodingException e) {
-			return param;
-		}
-	}
-
+public class BaseController
+{
 	protected static final String defultCharset = "UTF-8";
-
 	private static final String SUCCESS = "success";
-
 	private static final String ERROR = "error";
-
 	private static final String ERROR_CODE = "errCode";
-
 	private static final String CONTENT = "content";
+	private static final String ERROR_MESSAGE = "exceptionInfo";
 
-	private static final String ERROR_MESSAGE = "exceptionInfo";// 与异常处理的exceptionInfo一致
+	protected String decodeUnicodeString(String param)
+	{
+		try
+		{
+			return new String(param.getBytes("utf-8"), "UTF-8"); } catch (UnsupportedEncodingException e) {
+		}
+		return param;
+	}
 
-	protected ModelMap success() {
-		return new ModelMap(SUCCESS, true);
+	protected ModelMap success()
+	{
+		return new ModelMap("success", Boolean.valueOf(true));
 	}
 
 	protected ModelMap success(Object content) {
-		return success().addAttribute(CONTENT, content);
+		return success().addAttribute("content", content);
 	}
 
 	protected ModelMap error() {
-		return new ModelMap(ERROR, true);
+		return new ModelMap("error", Boolean.valueOf(true));
 	}
 
 	protected ModelMap error(String errMsg) {
-		return error().addAttribute(ERROR_MESSAGE, errMsg);
+		return error().addAttribute("exceptionInfo", errMsg);
 	}
 
 	protected ModelMap error(int errCode, String errMsg) {
-		return error(errMsg).addAttribute(ERROR_CODE, errCode);
+		return error(errMsg).addAttribute("errCode", Integer.valueOf(errCode));
 	}
 
-	/**
-	 * 输出流
-	 * 
-	 * @param fileName
-	 *            文件名
-	 * @param bytes
-	 * @throws IOException
-	 */
-	protected ResponseEntity<byte[]> outputStream(String fileName, byte[] bytes) {
+	protected ResponseEntity<byte[]> outputStream(String fileName, byte[] bytes)
+	{
 		HttpHeaders headers = new HttpHeaders();
 		headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
 		try {
-			headers.setContentDispositionFormData("attachment", URLEncoder.encode(fileName, defultCharset));
-		} catch (UnsupportedEncodingException e) {
+			headers.setContentDispositionFormData("attachment", URLEncoder.encode(fileName, "UTF-8"));
+		} catch (UnsupportedEncodingException localUnsupportedEncodingException) {
 		}
-		return new ResponseEntity<byte[]>(bytes, headers, HttpStatus.CREATED);
+		return new ResponseEntity(bytes, headers, HttpStatus.CREATED);
 	}
-
-}
+}

+ 36 - 36
src/com/mes/dao/BaseDao.java

@@ -49,10 +49,10 @@ import com.mes.model.Employee;
  *        <p>
  *        用到SqlRowSet的方法全部用List<Map<String, Object>>代替, 以解决因jdk问题而导致jboss对RowSet的不支持,调取结果集时出现NullPointerException
  *        </p>
- * 
- * 
+ *
+ *
  * @author yingp
- * 
+ *
  * @since 2015-11-26
  *        <p>
  *        去掉支持Oracle9i的OracleLobHandler,改为使用{@link DefaultLobHandler},在db-config.xml注入
@@ -75,7 +75,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * add object
-	 * 
+	 *
 	 * @param objForSave
 	 * @param tableName
 	 * @param columnAndValue
@@ -104,7 +104,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 批量保存对象
-	 * 
+	 *
 	 * @param objsForSave
 	 * @param tableName
 	 * @return
@@ -121,7 +121,7 @@ public class BaseDao extends JdbcDaoSupport {
 	}
 
 	/**
-	 * 
+	 *
 	 * @param objForSave
 	 * @param tableName
 	 * @param keyColumns
@@ -134,7 +134,7 @@ public class BaseDao extends JdbcDaoSupport {
 	}
 
 	/**
-	 * 
+	 *
 	 * @param objForSave
 	 * @param tableName
 	 * @param columnAndValue
@@ -226,7 +226,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 执行sql <b>支持lob数据的操作</b>
-	 * 
+	 *
 	 * @param sql
 	 */
 	public void execute(SqlMap sql) {
@@ -235,7 +235,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 批量执行Sql
-	 * 
+	 *
 	 * @param sqls
 	 * @param callbackSqls
 	 */
@@ -329,7 +329,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 复制数据库一条或多条数据
-	 * 
+	 *
 	 * @param fTab
 	 *            Form Table
 	 * @param tTab
@@ -585,7 +585,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 获取序列号
-	 * 
+	 *
 	 * @param seq
 	 *            指定的序列名
 	 */
@@ -646,7 +646,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 需要从数据字典的配置更新table时,用到此方法
-	 * 
+	 *
 	 * @param tablename
 	 *            需要更新的tablename
 	 */
@@ -686,7 +686,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 一个字段,一条结果
-	 * 
+	 *
 	 * @param tableName
 	 *            对应要查询的表
 	 * @param field
@@ -714,7 +714,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 一个字段,多条结果
-	 * 
+	 *
 	 * @param tableName
 	 *            对应要查询的表
 	 * @param field
@@ -739,7 +739,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 多个字段,<=1条结果
-	 * 
+	 *
 	 * @param tableName
 	 *            对应要查询的表
 	 * @param fields
@@ -782,7 +782,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 多个字段,<=1条结果
-	 * 
+	 *
 	 * @param tableName
 	 *            对应要查询的表
 	 * @param fields
@@ -825,7 +825,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 多个字段,多条结果
-	 * 
+	 *
 	 * @param tableName
 	 *            对应要查询的表
 	 * @param fields
@@ -940,7 +940,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 修改操作
-	 * 
+	 *
 	 * @param tableName
 	 *            表
 	 * @param update
@@ -980,7 +980,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 获取编号序列
-	 * 
+	 *
 	 * @param myTable
 	 *            Caller
 	 * @param thisType
@@ -1000,7 +1000,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 调用存储过程 无返回值
-	 * 
+	 *
 	 * @param procedureName
 	 *            存储过程名称
 	 * @param args
@@ -1032,7 +1032,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 调用存储过程
-	 * 
+	 *
 	 * @param procedureName
 	 *            存储过程名称
 	 * @param args
@@ -1082,7 +1082,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 调用存储过程
-	 * 
+	 *
 	 * @param procedureName
 	 *            存储过程名称
 	 * @param args
@@ -1130,7 +1130,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 调用存储过程
-	 * 
+	 *
 	 * @param procedureName
 	 *            存储过程名称
 	 * @param cls
@@ -1185,7 +1185,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 查询结果集
-	 * 
+	 *
 	 * @param sql
 	 *            查询语句
 	 */
@@ -1197,7 +1197,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 查询结果集
-	 * 
+	 *
 	 * @param sql
 	 *            查询语句
 	 * @param arg
@@ -1211,7 +1211,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 查询结果集
-	 * 
+	 *
 	 * @param sql
 	 *            查询语句
 	 * @param args
@@ -1225,7 +1225,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 查询结果集
-	 * 
+	 *
 	 * @param sql
 	 *            查询语句
 	 * @param args
@@ -1340,7 +1340,7 @@ public class BaseDao extends JdbcDaoSupport {
 			Object fTab = objs[0];
 			Object fKey = objs[1];
 			Object mKey = objs[2];
-			String kTab = ""; 
+			String kTab = "";
 			if (fTab != null && fKey != null && mKey != null) {
 				Object cKey = objs[3];
 				String code = "";
@@ -1482,7 +1482,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 调用存储过程
-	 * 
+	 *
 	 * @param procedureName
 	 *            存储过程名称
 	 * @param args
@@ -1543,7 +1543,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 将数据库里面的defaultvalue转化成实际要显示的值
-	 * 
+	 *
 	 * @param value
 	 *            formDetail.getFd_defaultvalue()
 	 */
@@ -1577,7 +1577,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 删除、反审核等敏感操作前,关联表数据检查
-	 * 
+	 *
 	 * @param tableName
 	 *            表名
 	 * @param keyData
@@ -1594,7 +1594,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 删除前,关联表数据检查
-	 * 
+	 *
 	 * @param tableName
 	 *            表名
 	 * @param keyData
@@ -1607,7 +1607,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 检测当前日期所在期间是否结账
-	 * 
+	 *
 	 * @param type
 	 *            期间类型
 	 * @param orderdate
@@ -1637,7 +1637,7 @@ public class BaseDao extends JdbcDaoSupport {
 				 * SqlRowList sl = queryForRowSet( "SELECT Instanceid_,max(case when table_ in ('" + tables + "') AND COL_DEL_1=CODEFIELD_ THEN CODEFIELD_ WHEN table_ in ('" + tables +
 				 * "') AND COL_DEL_1=NAMEFIELD_ THEN NAMEFIELD_ else col_rel_1 end ),MAX(CASE WHEN COL_DEL_1=CODEFIELD_ THEN 'CODE_' WHEN COL_DEL_1=NAMEFIELD_ THEN 'DESC_' ELSE  'NONE' END ) from Datalimit_Instance LEFT JOIN Datalimit  ON Datalimit.ID_=Datalimit_Instance.Limit_Id_ AND Datalimit_Instance.Empid_=? and Datalimit_Instance.Nolimit_=0 left join Datacascade on Datalimit.table_=Datacascade.table_del where table_rel IN ('" + tables + "') or table_ in ('" + tables +
 				 * "') group by instanceid_ ", new Object[] { emid }); while (sl.next()) { if (!"NONE".equals(sl.getObject(3))) { appendSql = " Exists (select code_ from datalimit_detail where INSTANCEID_=" + sl.getObject(1) + " AND SEE_=1 AND " + sl.getObject(2) + "=" + sl.getObject(3) + ")"; condition += condition.equals("") ? appendSql : (" AND " + appendSql); }
-				 * 
+				 *
 				 * }
 				 */
 				SqlRowList basesl = queryForRowSet(
@@ -1675,7 +1675,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/***
 	 * 平台传回ERP接收标准方法 content 内容 type 消息类型 noticemans 对应产生的人员名称以#号分隔
-	 * 
+	 *
 	 * **/
 	public List<String> beatchNotices(String content, String type, String noticemans, String condition, String fromcaller) {
 		List<String> sqls = new ArrayList<String>();
@@ -1705,7 +1705,7 @@ public class BaseDao extends JdbcDaoSupport {
 
 	/**
 	 * 批量保存
-	 * 
+	 *
 	 * @param objsForSave
 	 * @return
 	 */

+ 6 - 6
src/com/mes/service/barcode/impl/BarcodeServiceImpl.java

@@ -55,7 +55,7 @@ public class BarcodeServiceImpl implements BarcodeService {
 	@Override
 	public Map<String, Object> getStencilUseCount(String barcode) {
 		Map<String, Object> map = new HashMap<String, Object>();
-		SqlRowList rs = baseDao.queryForRowSet("select * from stencil where st_code='"+barcode+"'");
+		SqlRowList rs = baseDao.queryForRowSet("select * from stencil@MES_ZZ where st_code='"+barcode+"'");
 		if(rs.next()){
 			map.put("code",rs.getString("st_code"));
 			map.put("name",rs.getString("st_name"));
@@ -77,13 +77,13 @@ public class BarcodeServiceImpl implements BarcodeService {
 	@Override
 	public Map<String, Object> updateStencilUseCount(String barcode,String count) {
 		Map<String, Object> map = new HashMap<String, Object>();
-		SqlRowList rs = baseDao.queryForRowSet("select * from stencil where st_code='"+barcode+"'");
+		SqlRowList rs = baseDao.queryForRowSet("select * from stencil@MES_ZZ where st_code='"+barcode+"'");
 		//查询到了钢网信息
 		if(rs.next()){
 			map.put("barcode",barcode);
 			map.put("beforeupdate",rs.getString("st_usecount"));
 			try{
-				baseDao.execute("update stencil set st_usecount=nvl(st_usecount,0)+"+count+" where st_code='"+barcode+"'");
+				baseDao.execute("update stencil@MES_ZZ set st_usecount=nvl(st_usecount,0)+"+count+" where st_code='"+barcode+"'");
 				map.put("count",count) ;
 				map.put("afterupdate",Integer.parseInt(rs.getString("st_usecount"))+Integer.parseInt(count)) ;
 			}
@@ -100,14 +100,14 @@ public class BarcodeServiceImpl implements BarcodeService {
 	@Override
 	public Map<String, Object> updateBarcode(String barcode,String num) {
 		Map<String, Object> map = new HashMap<String, Object>();
-		SqlRowList rs = baseDao.queryForRowSet("select bar_code,bar_remain from barcode where bar_code='"+barcode+"'");
+		SqlRowList rs = baseDao.queryForRowSet("select bar_code,bar_remain from barcode@MES_ZZ where bar_code='"+barcode+"'");
 		//查询到了钢网信息
 		if(rs.next()){
 			map.put("barcode",barcode);
 			map.put("beforeupdate",rs.getString("bar_remain"));
 			try{
-				baseDao.execute("update barcode set bar_remain="+num+" where bar_code='"+barcode+"'");
-				map.put("afterupdate",baseDao.getFieldDataByCondition("barcode","bar_remain","bar_code='"+barcode+"'")) ;
+				baseDao.execute("update barcode@MES_ZZ set bar_remain="+num+" where bar_code='"+barcode+"'");
+				map.put("afterupdate",baseDao.getFieldDataByCondition("barcode@MES_ZZ","bar_remain","bar_code='"+barcode+"'")) ;
 			}
 			catch(Exception e) {
 				map.put("Error",e.getMessage());