Parcourir la source

管理端流程审批

lijie il y a 2 ans
Parent
commit
d8de531336

+ 14 - 9
mhotel/src/com/happy/action/WorkflowAction.java

@@ -3,11 +3,13 @@ package com.happy.action;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.happy.Model.Booking;
+import com.happy.Model.BookingComment;
 import com.happy.Model.FileInfo;
 import com.happy.Model.Workflow;
 import com.happy.Until.GetHttpParam;
 import com.happy.Until.ResUtil;
 import com.happy.Until.UUIDUtil;
+import com.happy.service.BookingCommentService;
 import com.happy.service.FileService;
 import com.happy.service.WorkflowService;
 import com.opensymphony.xwork2.ActionSupport;
@@ -34,7 +36,8 @@ public class WorkflowAction  extends ActionSupport implements ServletRequestAwar
     public WorkflowService workflowService;
     @Resource
     public FileService fileService;
-
+    @Resource(name = "BookingCommentService")
+    private BookingCommentService bookingCommentService;
     public HttpServletRequest getRequest() {
         return request;
     }
@@ -118,23 +121,25 @@ public class WorkflowAction  extends ActionSupport implements ServletRequestAwar
                             fileService.updateFile(file);
                         });
                         workflow1.setStatus(2);//审批通过
-                        m = workflowService.update(workflow1);
                     }else {//审批拒绝
-                        workflow1.setStatus(3);
-                        m = workflowService.update(workflow1);
+                        workflow1.setStatus(3); //拒绝审批
                     }
+                    m = workflowService.update(workflow1);
                 } break;
                 case 2: {
+                    BookingComment bookingComment = bookingCommentService.queryById(workflow1.getLinkId());
                     if (workflow.getStatus() == 2){//审批通过
                         //TODO 评价流程审批通过
-
-
+                        workflow1.setStatus(2);
+                        bookingComment.setStatus("1");
                     }else {//审批拒绝
                         //TODO 评价流程审批通过
                         workflow1.setStatus(3);
-                        m = workflowService.update(workflow1);
+                        bookingComment.setStatus("2");
                     }
-                }
+                    int n = bookingCommentService.update(bookingComment);
+                    m = workflowService.update(workflow1);
+                } break;
             }
             if (m > 0) {
                 resultJson.put("message", "审批成功");
@@ -168,7 +173,7 @@ public class WorkflowAction  extends ActionSupport implements ServletRequestAwar
         if (workflow != null){
             //民宿信息维护流程
             List<FileInfo> fileInfoList;
-            if (workflow.getStatus() == 2){
+            if (workflow.getStatus() == 2 && workflow.getType() == 1){
                 fileInfoList = fileService.queryList("and link_id = '"+workflow.getLinkId()+"'");
             }else {
                 fileInfoList = fileService.queryList("and link_id = '"+workflow.getId()+"'");

+ 4 - 0
mhotel/src/com/happy/dao/BookingCommentDao.java

@@ -21,6 +21,10 @@ public interface BookingCommentDao {
     int insterCommpent(BookingComment bookingComment);
 
     int updateCommpentStatus(BookingComment bookingComment);
+
+    BookingComment queryById(String id);
+
+    int update(BookingComment bookingComment);
     List<BookingCommentPageVo> evaluatePage(String hotelId, int page, int rows);
 
     int evaluateTotal(String hotelId);

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

@@ -398,6 +398,40 @@ public class BookingCommentImplDao implements BookingCommentDao {
     }
 
     @Override
+    public BookingComment queryById(String id) {
+        String sql = selectSql + " and a.id = :id";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("id",id);
+        List<BookingComment> list = null;
+        try {
+            list = namedParameterJdbcTemplate.query(sql, sps,
+                    new BeanPropertyRowMapper<>(BookingComment.class));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        if (list != null && list.size() > 0) return list.get(0);
+        return null;
+    }
+
+    @Override
+    public int update(BookingComment bookingComment) {
+        StringBuffer stringBuffer =  new StringBuffer(" update `booking_comment` set  ");
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        // 将要修改的数据填充到查询语句中
+        appendValue(bookingComment,stringBuffer,sps);
+        stringBuffer.append("  where id=:id  ");
+        sps.addValue("id", bookingComment.getId());
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(stringBuffer.toString(), sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    @Override
     public List<BookingComment> queryPage(String sqlx, int page, int rows) {
         SqlUtil.filterKeyword(sqlx);
         int start = (page - 1) * rows;// 每页的起始下标
@@ -624,7 +658,78 @@ public class BookingCommentImplDao implements BookingCommentDao {
             if (list != null && list.size() > 0) return list.get(0);
             return null;
         }
-
-
+    public void appendValue(BookingComment bookingComment, StringBuffer stringBuffer, MapSqlParameterSource sps){
+        if (!Func.checkNull(bookingComment.getCommentId())){
+            stringBuffer.append(" comment_id=:comment_id ,");
+            sps.addValue("comment_id",bookingComment.getCommentId());
+        }
+        if (!Func.checkNull(bookingComment.getCommentParentId())){
+            stringBuffer.append(" comment_parent_id=:comment_parent_id ,");
+            sps.addValue("comment_parent_id",bookingComment.getCommentParentId());
+        }
+        if (!Func.checkNull(bookingComment.getCommentName())){
+            stringBuffer.append(" comment_name=:comment_name ,");
+            sps.addValue("comment_name",bookingComment.getCommentName());
+        }
+        if (!Func.checkNull(bookingComment.getHotelId())){
+            stringBuffer.append(" hotel_id=:hotel_id ,");
+            sps.addValue("hotel_id",bookingComment.getHotelId());
+        }
+        if (!Func.checkNull(bookingComment.getBookingId())){
+            stringBuffer.append(" booking_id=:booking_id ,");
+            sps.addValue("booking_id",bookingComment.getBookingId());
+        }
+        if (!Func.checkNull(bookingComment.getHouseId())){
+            stringBuffer.append(" house_id=:house_id ,");
+            sps.addValue("house_id",bookingComment.getHouseId());
+        }
+        if (!Func.checkNull(bookingComment.getContent())){
+            stringBuffer.append(" content=:content ,");
+            sps.addValue("content",bookingComment.getContent());
+        }
+        if (!Func.checkNull(bookingComment.getCommentStatus())){
+            stringBuffer.append(" comment_status=:comment_status ,");
+            sps.addValue("comment_status",bookingComment.getCommentStatus());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getScore()))){
+            stringBuffer.append(" score=:score ,");
+            sps.addValue("score",bookingComment.getScore());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getScoreWs()))){
+            stringBuffer.append(" score_ws=:score_ws ,");
+            sps.addValue("score_ws",bookingComment.getScoreWs());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getScoreFw()))){
+            stringBuffer.append(" score_fw=:score_fw ,");
+            sps.addValue("score_fw",bookingComment.getScoreFw());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getScoreSs()))){
+            stringBuffer.append(" score_ss=:score_ss ,");
+            sps.addValue("score_ss",bookingComment.getScoreSs());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getScoreWz()))){
+            stringBuffer.append(" score_wz=:score_wz ,");
+            sps.addValue("score_wz",bookingComment.getScoreWz());
+        }
+        if (!Func.checkNull(String.valueOf(bookingComment.getCreateId()))){
+            stringBuffer.append(" create_id=:create_id ,");
+            sps.addValue("create_id",bookingComment.getCreateId());
+        }
+        if (!Func.checkNull(bookingComment.getCreateUsername())){
+            stringBuffer.append(" create_username=:create_username ,");
+            sps.addValue("create_username",bookingComment.getCreateUsername());
+        }
+        if (!Func.checkNull(bookingComment.getCreateDate())){
+            stringBuffer.append(" create_date=:create_date ,");
+            sps.addValue("create_date",bookingComment.getCreateDate());
+        }
+        if (!Func.checkNull(bookingComment.getStatus())){
+            stringBuffer.append(" status=:status ,");
+            sps.addValue("status",bookingComment.getStatus());
+        }
+        stringBuffer.append(" modify_date=:modify_date ");
+        sps.addValue("modify_date", UUIDUtil.getNewDate());
     }
 
+}
+

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

@@ -146,7 +146,7 @@ public class WorkflowImplDao implements WorkflowDao {
             sps.addValue("workflow_name",workflow.getWorkflowName());
         }
         if (!Func.checkNull(workflow.getWorkflowDate())){
-            stringBuffer.append(" workflow_date=:workflow_date ,");
+            stringBuffer.append(" workflow_date=:workflow_date ");
             sps.addValue("workflow_date",workflow.getWorkflowDate());
         }
     }

+ 4 - 0
mhotel/src/com/happy/service/BookingCommentService.java

@@ -52,6 +52,10 @@ public interface BookingCommentService {
      * @return 影响数量
      */
     int insterCommpent(BookingComment bookingComment);
+
+    BookingComment queryById(String id);
+
+    int update(BookingComment bookingComment);
 	
 	 CommentDetailsVo commentDetails(String bookingId);
 

+ 10 - 0
mhotel/src/com/happy/service/impl/BookingCommentImplService.java

@@ -162,6 +162,16 @@ public class BookingCommentImplService implements BookingCommentService {
     }
 
     @Override
+    public BookingComment queryById(String id) {
+        return bookingCommentDao.queryById(id);
+    }
+
+    @Override
+    public int update(BookingComment bookingComment) {
+        return bookingCommentDao.update(bookingComment);
+    }
+
+    @Override
     public CommentDetailsVo commentDetails(String bookingId) {
         return bookingCommentDao.commentDetails(bookingId);
     }