lijie 2 years ago
parent
commit
23fea88765

+ 13 - 0
mhotel/src/com/happy/Model/Hotel.java

@@ -120,6 +120,11 @@ public class Hotel {
 	private String lockTime;
 
 	/**
+	 * 取消订单时间
+	 */
+	private String cancelTime;
+
+	/**
 	 * 是否能取消订单(1是 2否)
 	 */
 	private Integer isCanorder;
@@ -465,4 +470,12 @@ public class Hotel {
 	public void setLinkProUrl(String linkProUrl) {
 		this.linkProUrl = linkProUrl;
 	}
+
+	public String getCancelTime() {
+		return cancelTime;
+	}
+
+	public void setCancelTime(String cancelTime) {
+		this.cancelTime = cancelTime;
+	}
 }

+ 13 - 4
mhotel/src/com/happy/action/hotelAction.java

@@ -129,13 +129,17 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 }
                 //判断是否修改图片
                 for(FileInfo file : fileList){
-                    if ( "0".equals(file.getLinkId())) isOk = true; break;
+                    if ( "".equals(file.getLinkId()) || file.getLinkId()==null || file.getLinkId().length() == 0) {
+                        isOk = true;
+                        break;
+                    }
                 }
                 if (isOk){
                     Workflow workflow = new Workflow();
                     String id = String.valueOf(UUID.randomUUID());
-                    workflow.setLinkId(String.valueOf(hotel.getId()));
+                    workflow.setLinkId(String.valueOf(hotel.getManagerId()));
                     workflow.setRemark(hotel.getRemark());
+                    workflow.setCreateId(String.valueOf(hotel.getCreateId()));
                     workflow.setId(id);
                     workflow.setStatus(1);
                     workflow.setType(1);
@@ -160,10 +164,15 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                         ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                         return null;
                     }
+                }else{
+                    hotel.setId(hotelId);
+                    m = hotelService.updateHotel(hotel);
                 }
             }else{
-                hotel.setId(hotelId);
-                m = hotelService.insertHotel(hotel);
+                resultJson.put("message", "未找到数据Id:"+hotelId);
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
             }
             if (m > 0) {
                 if(hotel.getId()!= null){

+ 8 - 2
mhotel/src/com/happy/dao/impl/HotelImplDao.java

@@ -33,9 +33,9 @@ public class HotelImplDao implements HotelDao {
     public int insertHotel(Hotel hotel) {
         String sql = "INSERT INTO hotel (id, manager_id,cover_img, hname, hposition, hposition_wens, htype, hstatus, open_time," +
                 " fitup_time, live_time, leave_time, room_number, remark, hconfig, is_order, is_checkout, lock_time, is_canorder," +
-                " create_id, create_date, status) VALUES (:id,:manager_id,:cover_img,:hname,:hposition,:hposition_wens,:htype," +
+                " create_id, create_date, status ,cancel_time) VALUES (:id,:manager_id,:cover_img,:hname,:hposition,:hposition_wens,:htype," +
                 ":hstatus,:open_time,:fitup_time,:live_time,:leave_time,:room_number,:remark,:hconfig,:is_order,:is_checkout," +
-                ":lock_time,:is_canorder, :create_id, :create_date, :status)";
+                ":lock_time,:is_canorder, :create_id, :create_date, :status , :cancel_time)";
 
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("manager_id",hotel.getManagerId());
@@ -59,6 +59,8 @@ public class HotelImplDao implements HotelDao {
         sps.addValue("create_id", hotel.getCreateId());
         sps.addValue("create_date",UUIDUtil.getNewDate());
         sps.addValue("status", 1);
+        sps.addValue("cancel_time", hotel.getCancelTime());
+
         if(hotel.getId()==null){
             sps.addValue("id", UUIDUtil.generateID());
         }else{
@@ -303,6 +305,10 @@ public class HotelImplDao implements HotelDao {
             stringBuffer.append(" status=:status ,");
             sps.addValue("status", hotel.getStatus());
         }
+        if (!Func.checkNull(String.valueOf(hotel.getCancelTime()))){
+            stringBuffer.append(" cancel_time=:cancel_time ,");
+            sps.addValue("cancel_time", hotel.getCancelTime());
+        }
         stringBuffer.append(" modify_date=:modify_date ");
         sps.addValue("modify_date", UUIDUtil.getNewDate());
     }

+ 2 - 2
mhotel/src/com/happy/dao/impl/WorkflowImplDao.java

@@ -41,8 +41,8 @@ public class WorkflowImplDao implements WorkflowDao {
 
     @Override
     public int insert(Workflow workflow) {
-        String sql = "insert into `workflow`(id,link_id,type,title,status,remark,create_id)" +
-                "values(:id,:link_id,:type,:title,:status,:remark,:create_id) ";
+        String sql = "insert into `workflow`(id,link_id,type,title,status,remark,create_id,create_date)" +
+                "values(:id,:link_id,:type,:title,:status,:remark,:create_id,:create_date) ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("link_id",workflow.getLinkId());
         sps.addValue("type",workflow.getType());