Преглед изворни кода

移动端按月数量统计修改为查询企业的数据统计

hejq пре 8 година
родитељ
комит
002e2bd095

+ 4 - 1
src/main/java/com/uas/platform/b2b/v2/controller/InviteRecordController.java

@@ -185,9 +185,12 @@ public class InviteRecordController {
      * @return
      */
     @RequestMapping(value = "/count/groupBydate", method = RequestMethod.GET)
-    private List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year, String businessCode, String userTel) {
+    private List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year, String businessCode, String userTel) throws IllegalAccessException {
         enUU = checkByBusinessCode(enUU, businessCode);
         userUU = checkByUserTel(userUU, userTel);
+        if (StringUtils.isEmpty(enUU)) {
+            throw new IllegalAccessException("企业UU号不能为空");
+        }
         if (StringUtils.isEmpty(year)) {
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
             year = sdf.format(new Date());

+ 13 - 0
src/main/java/com/uas/platform/b2b/v2/model/Invitation.java

@@ -37,6 +37,11 @@ public class Invitation {
      */
     private Integer doneCount;
 
+    /**
+     * 企业UU
+     */
+    private Long enUU;
+
     public Long getUserUU() {
         return userUU;
     }
@@ -84,4 +89,12 @@ public class Invitation {
     public void setDoneCount(Integer doneCount) {
         this.doneCount = doneCount;
     }
+
+    public Long getEnUU() {
+        return enUU;
+    }
+
+    public void setEnUU(Long enUU) {
+        this.enUU = enUU;
+    }
 }

+ 37 - 12
src/main/java/com/uas/platform/b2b/v2/service/impl/InviteRecordServiceImpl.java

@@ -159,9 +159,13 @@ public class InviteRecordServiceImpl implements InviteRecordService {
      */
     @Override
     public List<Invitation> getCountGroupByDate(Long userUU, Long enUU, String year) {
-        String sql = "select time, count, 0 as doneCount,substr(time, -2) month from v$invitation_all where time like '%" + year + "%' and useruu = " + userUU + "order by time asc";
+        String sql = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
+                "select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + ")" +
+                "where time like '%" + year + "%' group by time,in_enuu order by time";
         List<Invitation> all = commonDao.query(sql, Invitation.class);
-        String sql1 = "select time, count doneCount,substr(time, -2) month from v$invitation where time like'%" + year + "%' and useruu = " + userUU + "and active = 1";
+        String sql1 = "select substr(time, -2) month,in_enuu enUU,count(1) count from(" +
+                "select to_char(in_date, 'yyyy-mm') time,COALESCE(in_active,0),in_enuu from invitationrecords where in_enuu = " + enUU + " and COALESCE(in_active,0) = 1)" +
+                "where time like '%" + year + "%' group by time,in_enuu order by tim";
         List<Invitation> done = commonDao.query(sql1, Invitation.class);
         if (!CollectionUtils.isEmpty(all) && !CollectionUtils.isEmpty(done)) {
             for (Invitation a : all) {
@@ -236,19 +240,40 @@ public class InviteRecordServiceImpl implements InviteRecordService {
                 contactTel = cu.getUserTel();
             }
         }
+        final String enName = v.getEnName();
+        final String contactTel1 = contactTel;
+        final String adminTel1 = adnimTel;
+        final String userName = user.getUserName();
+        final String custName = c.getEnName();
         // 发送短信通知
         if (adnimTel.equals(contactTel)) {// 相同的人调用通知接口
-            try {
-                smsService.send(messageConf.getMsgAddPartForB2B(), adnimTel,
-                        new Object[] { user.getUserName(), c.getEnName(), v.getEnName() });
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
+            ThreadUtils.task(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        smsService.send(messageConf.getMsgAddPartForB2B(), adminTel1,
+                                new Object[] { userName, custName, enName });
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }).run();
+
         } else { // 针对不同的人调用不同的接口
-            // 发送给管理员
-            sendMsgToManager(v.getEnName(), adnimTel);
-            // 发送给联系人
-            sendMsgToManager(v.getEnName(), contactTel);
+            ThreadUtils.task(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        // 发送给管理员
+                        sendMsgToManager(enName, adminTel1);
+
+                        // 发送给联系人
+                        sendMsgToManager(enName, contactTel1);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }).run();
         }
         String result = AccountUtils.addNewRecord(record);
         JSONObject object = JSON.parseObject(result);