suochencheng 6 лет назад
Родитель
Сommit
11862eee2b

+ 16 - 0
WebRoot/WEB-INF/jsp/newAdmin/rentInfo.jsp

@@ -375,6 +375,7 @@
                            v-if="row_info.reviewFlag=='N'||userLimit==5"
                            @click="onSubmit">{{edit?'修改并保存':'立即创建'}}
                 </el-button>
+                <el-button @click="notice()" v-if="edit"> 通知</el-button>
                 <el-button @click="reback()">返回</el-button>
             </el-form-item>
         </el-form>
@@ -506,6 +507,21 @@
                     }
                 })
             },
+            notice: function () {
+                var that = this;
+                $.post({
+                    url: '../rentInfo/notice',
+                    data: {
+                        id: this.row_info.id
+                    }
+                }).then(function (res) {
+                    if (res.success) {
+                        that.$message.success('通知成功');
+                    } else {
+                        that.$message.error('通知失败');
+                    }
+                })
+            },
             showBig: function (event) {
                 if (event.srcElement.style.width == '600px') {
                     event.srcElement.style.width = '200px';

+ 2 - 0
src/com/suyuan/dao/RentInfoMapper.java

@@ -26,6 +26,8 @@ public abstract interface RentInfoMapper {
     public abstract RentInfo queryRentInfo(RentInfo paramRentInfo);
 
     public abstract List<RentInfo> queryByLikeByPage(Map<String, Object> paramMap);
+
+    List<RentInfo> queryAutoNoticeList();
 }
 
 /* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\

+ 28 - 0
src/com/suyuan/dao/RentInfoMapper.xml

@@ -1158,6 +1158,34 @@
             </if>
         </where>
         order by id desc
+    </select>
+    <select id="queryAutoNoticeList" parameterType="java.util.Map" resultType="com.suyuan.model.RentInfo">
+
+        SELECT
+            *
+        FROM
+            rent_info
+        WHERE
+            del_flag = 'N'
+        AND review_flag != 'F'
+        AND notice_flag = 'Y'
+        AND DATE_SUB(
+            CURDATE(),
+            INTERVAL (
+                SELECT
+                    day_num
+                FROM
+                    pay_type_info
+                WHERE
+                    pay_type_info.id = rent_info.pay_type_id
+            ) MONTH
+        ) = date(
+            IFNULL(notice_time, contract_start)
+        )
+        <![CDATA[ AND date(contract_end) > CURDATE()
+        ]]>
+
+
     </select>
     <select id="queryRentInfo" parameterType="java.util.Map" resultType="com.suyuan.model.RentInfo">
         select * from rent_info

+ 5 - 0
src/com/suyuan/service/RentInfoService.java

@@ -1,6 +1,7 @@
 package com.suyuan.service;
 
 import com.suyuan.dto.Page;
+import com.suyuan.dto.Result;
 import com.suyuan.model.RentInfo;
 import java.util.List;
 
@@ -21,6 +22,10 @@ public abstract interface RentInfoService
   public abstract boolean deleteRentInfo(String paramString);
 
   public abstract boolean updateRentInfo(RentInfo paramRentInfo);
+
+  Result notice(String id);
+
+  Result autoNotice();
 }
 
 /* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\

+ 181 - 159
src/com/suyuan/service/impl/RentInfoServiceImpl.java

@@ -1,229 +1,169 @@
-/*     */
+
 package com.suyuan.service.impl;
-/*     */
-/*     */
+
 
 import com.suyuan.dao.RentInfoMapper;
-/*     */ import com.suyuan.dto.Page;
-/*     */ import com.suyuan.model.RentInfo;
-/*     */ import com.suyuan.service.RentInfoService;
-/*     */ import java.util.HashMap;
-/*     */ import java.util.List;
-/*     */ import java.util.Map;
-/*     */ import org.apache.log4j.Logger;
-/*     */ import org.springframework.beans.factory.annotation.Autowired;
-/*     */ import org.springframework.stereotype.Service;
-/*     */ import org.springframework.transaction.annotation.Transactional;
-
-/*     */
-/*     */
+import com.suyuan.dto.Page;
+import com.suyuan.dto.Result;
+import com.suyuan.model.RentInfo;
+import com.suyuan.service.RentInfoService;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
 @Service
-/*     */ public class RentInfoServiceImpl
-        /*     */ implements RentInfoService
-        /*     */ {
-    /*  27 */   private static Logger logger = Logger.getLogger(RentInfoServiceImpl.class);
-    /*     */
-    /*     */
+public class RentInfoServiceImpl
+        implements RentInfoService {
+    private static Logger logger = Logger.getLogger(RentInfoServiceImpl.class);
+
+
     @Autowired
-    /*     */ private RentInfoMapper rentInfoMapper;
+    private RentInfoMapper rentInfoMapper;
 
-    /*     */
-    /*     */
-    public List<RentInfo> getRentInfoList(RentInfo record)
-    /*     */ {
-        /*  35 */
+
+    public List<RentInfo> getRentInfoList(RentInfo record) {
         logger.info("getRentInfoList");
-        /*     */
-        try
-            /*     */ {
-            /*  38 */
+
+        try {
             return this.rentInfoMapper.queryAllRentInfo(record);
-            /*     */
+
         } catch (Exception e) {
-            /*  40 */
             logger.error("getRentInfoList", e);
-            /*     */
+
         }
-        /*     */
-        /*  43 */
+
         return null;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public List<RentInfo> getRentInfoByPage(Page page, RentInfo record)
-    /*     */ {
-        /*  50 */
+    public List<RentInfo> getRentInfoByPage(Page page, RentInfo record) {
         logger.info("getRentInfoByPage");
-        /*     */
-        try
-            /*     */ {
-            /*  53 */
+
+        try {
             Map parameter = new HashMap();
-            /*  54 */
             parameter.put("record", record);
-            /*  55 */
             parameter.put("page", page);
-            /*     */
-            /*  57 */
+
             return this.rentInfoMapper.queryRentInfosByPage(parameter);
-            /*     */
+
         } catch (Exception e) {
-            /*  59 */
             logger.error("getRentInfoByPage", e);
-            /*     */
+
         }
-        /*     */
-        /*  62 */
+
         return null;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public RentInfo getRentInfoById(String id)
-    /*     */ {
-        /*  69 */
+    public RentInfo getRentInfoById(String id) {
         logger.info("getRentInfoById");
-        /*     */
-        try
-            /*     */ {
-            /*  72 */
+
+        try {
             return this.rentInfoMapper.selectByPrimaryKey(Integer.valueOf(id));
-            /*     */
+
         } catch (Exception e) {
-            /*  74 */
             logger.error("getRentInfoById", e);
-            /*     */
+
         }
-        /*     */
-        /*  77 */
+
         return null;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public RentInfo getRentInfo(RentInfo record)
-    /*     */ {
-        /*  84 */
+    public RentInfo getRentInfo(RentInfo record) {
         logger.info("getRentInfo");
-        /*     */
-        try
-            /*     */ {
-            /*  87 */
+
+        try {
             return this.rentInfoMapper.queryRentInfo(record);
-            /*     */
+
         } catch (Exception e) {
-            /*  89 */
             logger.error("getRentInfo", e);
-            /*     */
+
         }
-        /*     */
-        /*  92 */
+
         return null;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public boolean createRentInfo(RentInfo record)
-    /*     */ {
-        /*  99 */
+    public boolean createRentInfo(RentInfo record) {
         logger.info("createRentInfo");
-        /*     */
-        try
-            /*     */ {
-            /* 102 */
+
+        try {
             int updates = this.rentInfoMapper.insertSelective(record);
-            /*     */
-            /* 104 */
+
             if (updates > 0)
-                /* 105 */ return true;
-            /*     */
-        }
-        /*     */ catch (Exception e) {
-            /* 108 */
+                return true;
+
+        } catch (Exception e) {
             logger.error("createRentInfo", e);
-            /*     */
+
         }
-        /*     */
-        /* 111 */
+
         return false;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public boolean deleteRentInfo(String id)
-    /*     */ {
-        /* 118 */
+    public boolean deleteRentInfo(String id) {
         logger.info("deleteRentInfo");
-        /*     */
-        try
-            /*     */ {
-            /* 121 */
+
+        try {
             int updates = this.rentInfoMapper.delete(id);
-            /*     */
-            /* 123 */
+
             if (updates > 0)
-                /* 124 */ return true;
-            /*     */
-        }
-        /*     */ catch (Exception e) {
-            /* 127 */
+                return true;
+
+        } catch (Exception e) {
             logger.error("deleteRentInfo", e);
-            /*     */
+
         }
-        /*     */
-        /* 130 */
+
         return false;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public boolean updateRentInfo(RentInfo record)
-    /*     */ {
-        /* 137 */
+    public boolean updateRentInfo(RentInfo record) {
         logger.info("updateRentInfo");
-        /*     */
-        try
-            /*     */ {
-            /* 140 */
+
+        try {
             int updates = this.rentInfoMapper.updateByPrimaryKeySelective(record);
-            /*     */
-            /* 142 */
+
             if (updates > 0)
-                /* 143 */ return true;
-            /*     */
-        }
-        /*     */ catch (Exception e) {
-            /* 146 */
+                return true;
+
+        } catch (Exception e) {
             logger.error("updateRentInfo", e);
-            /*     */
+
         }
-        /*     */
-        /* 149 */
+
         return false;
-        /*     */
+
     }
 
-    /*     */
-    /*     */
+
     @Transactional(rollbackFor = {Exception.class})
-    /*     */ public List<RentInfo> getRentInfoByLike(Page page, RentInfo record)
-    /*     */ {
-        /* 156 */
+    public List<RentInfo> getRentInfoByLike(Page page, RentInfo record) {
         logger.info("getRentInfoByLike");
-        /*     */
+
         try {
 
             Map parameter = new HashMap();
@@ -231,16 +171,98 @@ import com.suyuan.dao.RentInfoMapper;
             parameter.put("page", page);
             return this.rentInfoMapper.queryByLikeByPage(parameter);
         } catch (Exception e) {
-            /* 162 */
             logger.error("getRentInfoByLike", e);
-            /*     */
+
         }
-        /*     */
-        /* 165 */
+
         return null;
-        /*     */
+
+    }
+
+
+    @Transactional(rollbackFor = {Exception.class})
+    public Result notice(String id) {
+        logger.info("notice");
+
+        try {
+            RentInfo rentInfo = this.rentInfoMapper.selectByPrimaryKey(Integer.valueOf(id));
+
+
+            if (rentInfo != null) {
+
+                noticeClient(rentInfo);
+            }
+
+            return new Result(true, "通知成功");
+
+
+        } catch (Exception e) {
+            logger.error("notice", e);
+
+        }
+
+        return new Result(false, "通知异常");
+
+    }
+
+    private void noticeClient(RentInfo rentInfo) {
+        String submitterNotice = "";
+        String nameNotice = "";
+
+
+        if (2 == rentInfo.getType()) {//2 为租房信息
+            submitterNotice = "xxx您好,您维护的 xxx小区xx号,租客 xxx 的房屋快到收租时间请注意";
+            nameNotice = "xxx您好,您租的 xxx小区xx号的房屋快到交租时间请注意";
+
+
+        } else if (1 == rentInfo.getType()) {//1 为收房信息
+            submitterNotice = "xxx您好,您维护的 xxx小区xx号,房东 xxx 的房屋快到交租时间请注意";
+            nameNotice = "xxx您好,您的 xxx小区xx号房屋快到收租时间请注意";
+        }
+
+        //TODO 发短信。
+
+
+    }
+
+    @Transactional(rollbackFor = {Exception.class})
+    public Result autoNotice() {
+        logger.info("autoNotice");
+
+        try {
+            List<RentInfo> rentInfoList = this.rentInfoMapper.queryAutoNoticeList();
+
+            for (RentInfo rentInfo : rentInfoList) {
+
+                try {
+                    noticeClient(rentInfo);
+
+                    RentInfo updateRentInfo = new RentInfo();
+                    updateRentInfo.setId(rentInfo.getId());
+                    updateRentInfo.setNoticeTime(new Date());
+
+                    this.rentInfoMapper.updateByPrimaryKeySelective(updateRentInfo);
+                } catch (Exception e) {
+                    logger.error("通知异常:ID" + rentInfo.getId(), e);
+                }
+
+
+            }
+
+
+            return new Result(true, "通知成功");
+
+
+        } catch (Exception e) {
+            logger.error("autoNotice", e);
+
+        }
+
+        return new Result(false, "通知异常");
+
     }
-    /*     */
+
+
 }
 
 /* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\

+ 57 - 118
src/com/suyuan/web/RentInfoController.java

@@ -1,26 +1,26 @@
-/*     */
 package com.suyuan.web;
-/*     */
-/*     */
+
 
 import com.suyuan.dto.Page;
-/*     */ import com.suyuan.dto.Result;
-/*     */ import com.suyuan.model.RentInfo;
-/*     */ import com.suyuan.model.UserInfo;
-/*     */ import com.suyuan.service.RentInfoService;
-/*     */ import com.suyuan.util.EncodingTool;
-/*     */ import java.util.HashMap;
-/*     */ import java.util.List;
-/*     */ import java.util.Map;
-/*     */ import javax.servlet.http.HttpServletRequest;
-/*     */ 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.RequestParam;
-/*     */ import org.springframework.web.bind.annotation.ResponseBody;
-
-/*     */
-/*     */
+import com.suyuan.dto.Result;
+import com.suyuan.model.RentInfo;
+import com.suyuan.model.UserInfo;
+import com.suyuan.service.RentInfoService;
+import com.suyuan.util.EncodingTool;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+
+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.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+
 @Controller
 @RequestMapping({"/rentInfo"})
 public class RentInfoController extends BaseController {
@@ -28,46 +28,30 @@ public class RentInfoController extends BaseController {
     @Autowired
     private RentInfoService rentInfoService;
 
-    @RequestMapping(value = {"/all"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
+    @RequestMapping(value = {"/all"}, method = {RequestMethod.GET})
     @ResponseBody
-    /*     */ public Result all(RentInfo record)
-        /*     */ {
-        /*  44 */
+    public Result all(RentInfo record) {
         List pp = this.rentInfoService.getRentInfoList(record);
-        /*  45 */
         return new Result(true, pp);
-        /*     */
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/getRentInfo"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
-    /*     */
+    @RequestMapping(value = {"/getRentInfo"}, method = {RequestMethod.GET})
     @ResponseBody
-    /*     */ public Result getRentInfo(@RequestParam(required = false, value = "id") String id)
-    /*     */ {
-        /*  55 */
+    public Result getRentInfo(@RequestParam(required = false, value = "id") String id) {
+
         RentInfo data = this.rentInfoService.getRentInfoById(id);
-        /*  56 */
         return new Result(true, data);
-        /*     */
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/getOne"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
-    /*     */
+    @RequestMapping(value = {"/getOne"}, method = {RequestMethod.GET})
     @ResponseBody
-    /*     */ public Result getOne(RentInfo record)
-    /*     */ {
+    public Result getOne(RentInfo record) {
         record.setAddress(EncodingTool.encodeStr(record.getAddress()));
         RentInfo data = this.rentInfoService.getRentInfo(record);
-        /*  67 */
         return new Result(true, data);
-        /*     */
     }
 
-    @RequestMapping(value = {"/postOne"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
+    @RequestMapping(value = {"/postOne"}, method = {RequestMethod.POST})
     @ResponseBody
     public Result postOne(RentInfo record) {
         RentInfo data = this.rentInfoService.getRentInfo(record);
@@ -76,9 +60,7 @@ public class RentInfoController extends BaseController {
 
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/page"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
+    @RequestMapping(value = {"/page"}, method = {RequestMethod.GET})
     @ResponseBody
     public Result page(HttpServletRequest req, Page page, RentInfo record) {
 
@@ -98,117 +80,74 @@ public class RentInfoController extends BaseController {
 
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/save"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
-    /*     */
+    @RequestMapping(value = {"/save"}, method = {RequestMethod.POST})
     @ResponseBody
-    /*     */ public Result save(RentInfo record)
-    /*     */ {
-        /*  96 */
+    public Result save(RentInfo record) {
         boolean num = this.rentInfoService.createRentInfo(record);
-        /*  97 */
         if (num) {
-            /*  98 */
             return new Result(true, record.getId());
-            /*     */
         }
-        /* 100 */
-        return new Result(false, "淇濆瓨寮傚父");
-        /*     */
+        return new Result(false, "保存异常");
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/update"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
-    /*     */
+    @RequestMapping(value = {"/update"}, method = {RequestMethod.POST})
     @ResponseBody
-    /*     */ public Result updateRentInfo(RentInfo record)
-    /*     */ {
-        /* 110 */
+    public Result updateRentInfo(RentInfo record) {
         boolean num = this.rentInfoService.updateRentInfo(record);
-        /* 111 */
         if (num) {
-            /* 112 */
-            return new Result(true, "淇濆瓨鎴愬姛");
-            /*     */
+            return new Result(true, "更新成功");
         }
-        /* 114 */
-        return new Result(false, "淇濆瓨寮傚父");
-        /*     */
+        return new Result(false, "保存异常");
     }
 
-    /*     */
-    /*     */
-    @RequestMapping(value = {"/del"}, method = {org.springframework.web.bind.annotation.RequestMethod.POST})
-    /*     */
+    @RequestMapping(value = {"/del"}, method = {RequestMethod.POST})
     @ResponseBody
-    /*     */ public Result deleteRentInfo(@RequestParam(required = true, value = "id") String id)
-    /*     */ {
-        /* 124 */
+    public Result deleteRentInfo(@RequestParam(required = true, value = "id") String id) {
         boolean num = this.rentInfoService.deleteRentInfo(id);
-        /* 125 */
         if (num) {
-            /* 126 */
-            return new Result(true, "鍒犻櫎鎴愬姛");
-            /*     */
+            return new Result(true, "删除成功");
         }
-        /* 128 */
-        return new Result(false, "鍒犻櫎寮傚父");
-        /*     */
+        return new Result(false, "删除异常");
     }
 
-    /*     */
-    @RequestMapping(value = {"/rentLike"}, method = {org.springframework.web.bind.annotation.RequestMethod.GET})
-    /*     */
+    @RequestMapping(value = {"/rentLike"}, method = {RequestMethod.GET})
     @ResponseBody
-    /*     */ public Result rentInfoLike(HttpServletRequest req, Page page, RentInfo record) {
-        /* 134 */
+    public Result rentInfoLike(HttpServletRequest req, Page page, RentInfo record) {
         record.setAddress(EncodingTool.encodeStr(record.getAddress()));
         record.setName(EncodingTool.encodeStr(record.getName()));
         record.setNote(EncodingTool.encodeStr(record.getNote()));
         record.setSubmitter(EncodingTool.encodeStr(record.getSubmitter()));
         System.out.println("一阶段       " + record);
-        /* 139 */
         UserInfo user = (UserInfo) req.getSession().getAttribute("userInfo");
-        /* 140 */
         String address = user.getAddress();
-        /* 141 */
         if (address == null) address = "";
-        /*     */
-        /* 154 */
         if ((record.getAddress() == null) || (record.getAddress().equals(""))) {
-            /* 155 */
             record.setAddress(user.getAddress());
-            /*     */
         }
-        /* 157 */
         System.out.println("二阶段       " + user);
-        /* 158 */
         System.out.println("三阶段       " + record);
-        /* 159 */
         Map result = new HashMap();
-        /*     */
-        /* 161 */
         List<RentInfo> pp = this.rentInfoService.getRentInfoByLike(page, record);
-        /* 162 */
         for (RentInfo rent : pp) {
-            /* 163 */
             System.out.println(rent);
-            /*     */
         }
-        /* 165 */
         result.put("page", page);
-        /* 166 */
         result.put("pp", pp);
-        /* 167 */
         return new Result(true, result);
-        /*     */
     }
-    /*     */
-}
 
-/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
- * Qualified Name:     com.suyuan.web.RentInfoController
- * JD-Core Version:    0.6.2
- */
+
+    @RequestMapping(value = {"/notice"}, method = {RequestMethod.POST})
+    @ResponseBody
+    public Result notice(@RequestParam(required = true, value = "id") String id) {
+        return rentInfoService.notice(id);
+
+    }
+
+    @RequestMapping(value = {"/autoNotice"}, method = {RequestMethod.POST})
+    @ResponseBody
+    public Result autoNotice() {
+        return rentInfoService.autoNotice();
+
+    }
+}