瀏覽代碼

产业供地 咨询必填相关的修改 门户活动排序相关的修改

huZhiHao 5 年之前
父節點
當前提交
b6e3d8d1d1

+ 87 - 45
src/main/java/platform/modules/government/service/IndustrialLandSupplyDetailService.java

@@ -1200,21 +1200,6 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 }
             }
         }
-        //保存默认咨询列表
-        List<String> defaultList = apply.getDefaultList();
-        if (!CollectionUtils.isEmpty(defaultList)) {
-            for (String departmentId : defaultList) {
-                if (departmentId != null && departmentId != "") {
-                    IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
-                    industrialLandSupplyConsultation.setIsDefault(true);
-                    industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
-                    industrialLandSupplyConsultation.setConsultation_time(dateTime);
-                    industrialLandSupplyConsultation.setDepartment_id(departmentId);
-                    industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
-                    industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
-                }
-            }
-        }
         //保存咨询列表
         List<IndustrialLandSupplyConsultation> industrialLandSupplyConsultationList = apply.getConsultationList();
         if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
@@ -1231,10 +1216,36 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
                 industrialLandSupplyConsultation.setConsultation_time(dateTime);
             }
-            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
-                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
+
+        }
+        //保存默认咨询列表
+        List<String> defaultList = apply.getDefaultList();
+        if (!CollectionUtils.isEmpty(defaultList)) {
+            for (String departmentId : defaultList) {
+                if (departmentId != null && departmentId != "") {
+                    boolean flag = true;
+                    for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
+                        if (departmentId.equals(industrialLandSupplyConsultation.getDepartment_id())) {
+                            industrialLandSupplyConsultation.setIsDefault(true);
+                            flag = false;
+                            break;
+                        }
+                    }
+                    if (flag) {
+                        IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+                        industrialLandSupplyConsultation.setIsDefault(true);
+                        industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
+                        industrialLandSupplyConsultation.setConsultation_time(dateTime);
+                        industrialLandSupplyConsultation.setDepartment_id(departmentId);
+                        industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
+                        industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
+                    }
+                }
             }
         }
+        if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+            industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
+        }
         //如果是发布,进提交流程
         if (Constant.PublishStatus.RELEASE.equals(status)) {
             //直接提交申请,添加流程信息
@@ -1317,23 +1328,34 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
             query.setIndustrial_land_supply_id(apply.getId() + "");
             industrialLandSupplyConsultationService.deleteByWhere(query);
-            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
-                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
-            }
+
             //保存默认咨询列表
             if (!CollectionUtils.isEmpty(defaultList)) {
                 for (String departmentId : defaultList) {
                     if (departmentId != null && departmentId != "") {
-                        IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
-                        industrialLandSupplyConsultation.setIsDefault(true);
-                        industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
-                        industrialLandSupplyConsultation.setConsultation_time(dateTime);
-                        industrialLandSupplyConsultation.setDepartment_id(departmentId);
-                        industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
-                        industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
+                        boolean flag = true;
+                        for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
+                            if (departmentId.equals(industrialLandSupplyConsultation.getDepartment_id())) {
+                                industrialLandSupplyConsultation.setIsDefault(true);
+                                flag = false;
+                                break;
+                            }
+                        }
+                        if (flag) {
+                            IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+                            industrialLandSupplyConsultation.setIsDefault(true);
+                            industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
+                            industrialLandSupplyConsultation.setConsultation_time(dateTime);
+                            industrialLandSupplyConsultation.setDepartment_id(departmentId);
+                            industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
+                            industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
+                        }
                     }
                 }
             }
+            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
+            }
         }
         //如果是发布,进提交流程
         if (Constant.PublishStatus.RELEASE.equals(status)) {
@@ -2147,7 +2169,7 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             approvalService.insertAndGetId(newApproval);
 
             IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
-            query.setIndustrial_land_supply_id(applyId+"");
+            query.setIndustrial_land_supply_id(applyId + "");
             industrialLandSupplyConsultationService.deleteByWhere(query);
             return true;
         } else if (Objects.equals(Constant.LandSupplyApproveStatus.COMMERCE_LEADER_RETURN, approval.getAfter_approvalstatus())) {
@@ -3304,22 +3326,22 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                 }
             }
 
-            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
-                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
-            }
+
             //保存默认咨询列表
             List<String> defaultList = apply.getDefaultList();
             if (!CollectionUtils.isEmpty(defaultList)) {
                 IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
                 query.setIndustrial_land_supply_id(apply.getId() + "");
                 query.setDel_flag(false);
-                List<IndustrialLandSupplyConsultation> oldList = industrialLandSupplyConsultationService.findListByWhere(query);
+//                List<IndustrialLandSupplyConsultation> oldList = industrialLandSupplyConsultationService.findListByWhere(query);
                 for (String departmentId : defaultList) {
                     if (departmentId != null) {
                         boolean flag = true;
-                        for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : oldList) {
+//                        for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : oldList) {
+                            for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
                             if (industrialLandSupplyConsultation.getIsDefault() &&
                                     Objects.equals(industrialLandSupplyConsultation.getDepartment_id(), departmentId)) {
+                                industrialLandSupplyConsultation.setIsDefault(true);
                                 flag = false;
                             }
                         }
@@ -3335,6 +3357,9 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
                     }
                 }
             }
+            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
+            }
         }
     }
 
@@ -3413,8 +3438,14 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
         Approval newApproval = new Approval();
         newApproval.setApply_id(applyId);
         newApproval.setType(Constant.DictionaryType.INDUSTRIAL_LAND_SUPPLY);
-        String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
-        newApproval.setDepartment(departmentname);
+        if (ShiroUtils.getUserType().equals(Constant.UserType.GOVERNMENT)) {
+            if (null != userService.getUser(ShiroUtils.getUserId()).getDepartment_id()) {
+                String departmentname = departmentService.selectById(userService.getUser(ShiroUtils.getUserId()).getDepartment_id()).getName();
+                newApproval.setDepartment(departmentname);
+            }
+        } else if (ShiroUtils.getUserType().equals(Constant.UserType.STREET)) {
+            newApproval.setDepartment(ShiroUtils.getUserEntity().getStreet_name());
+        }
         newApproval.setApproval_comment(comment);
         newApproval.setChecker(ShiroUtils.getUserId());
         newApproval.setOper_type(Constant.OperType.WITHDRAW);
@@ -3552,25 +3583,36 @@ public class IndustrialLandSupplyDetailService extends BaseService<IndustrialLan
             IndustrialLandSupplyConsultation query = new IndustrialLandSupplyConsultation();
             query.setIndustrial_land_supply_id(id + "");
             industrialLandSupplyConsultationService.deleteByWhere(query);
-            if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
-                industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
-            }
+
         }
         //保存默认咨询列表
         List<String> defaultList = apply.getDefaultList();
         if (!CollectionUtils.isEmpty(defaultList)) {
             for (String departmentId : defaultList) {
                 if (departmentId != null && departmentId != "") {
-                    IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
-                    industrialLandSupplyConsultation.setIsDefault(true);
-                    industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
-                    industrialLandSupplyConsultation.setConsultation_time(dateTime);
-                    industrialLandSupplyConsultation.setDepartment_id(departmentId);
-                    industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
-                    industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
+                    boolean flag = true;
+                    for (IndustrialLandSupplyConsultation industrialLandSupplyConsultation : industrialLandSupplyConsultationList) {
+                        if (departmentId.equals(industrialLandSupplyConsultation.getDepartment_id())) {
+                            industrialLandSupplyConsultation.setIsDefault(true);
+                            flag = false;
+                            break;
+                        }
+                    }
+                    if (flag) {
+                        IndustrialLandSupplyConsultation industrialLandSupplyConsultation = new IndustrialLandSupplyConsultation();
+                        industrialLandSupplyConsultation.setIsDefault(true);
+                        industrialLandSupplyConsultation.setIndustrial_land_supply_id(apply.getId() + "");
+                        industrialLandSupplyConsultation.setConsultation_time(dateTime);
+                        industrialLandSupplyConsultation.setDepartment_id(departmentId);
+                        industrialLandSupplyConsultation.setConsultation(CONSULTATION_MESSAGE);
+                        industrialLandSupplyConsultationService.save(industrialLandSupplyConsultation);
+                    }
                 }
             }
         }
+        if (!CollectionUtils.isEmpty(industrialLandSupplyConsultationList)) {
+            industrialLandSupplyConsultationService.saveList(industrialLandSupplyConsultationList);
+        }
         //直接提交申请,添加流程信息
         pass(id, null);
         return id;

+ 28 - 6
src/main/resources/mapper/sys/ActivityDetailDao.xml

@@ -222,19 +222,15 @@
         activity_starttime,
         activity_endtime,
         (
-
         IF (
         activity_state = 0,
         0,
-
         IF (
         activity_state = 2,
         2,
-
         IF (
         NOW() <![CDATA[<]]> activity_starttime,
         1,
-
         IF (
         NOW() <![CDATA[>]]> activity_endtime,
         4,
@@ -244,6 +240,28 @@
         )
         )
         ) state_code,
+        <!-- 20200612 新需求 活动报名进行的在前 正序 活动结束的在后 倒序 ======start====== -->
+        <!-- 使用时间戳及活动状态来改变排序 -->
+        (
+        IF
+        (
+        activity_state = 0,
+        0,
+        IF
+        (
+        activity_state = 2,
+        3000000000 - unix_timestamp ( activity_starttime ),
+        IF
+        (
+        NOW( ) <![CDATA[<]]> activity_starttime, unix_timestamp( activity_starttime ) - 3000000000, IF ( NOW( ) <![CDATA[>]]> activity_endtime,
+        3000000000 - unix_timestamp ( activity_starttime ),
+        unix_timestamp( activity_starttime ) - 3000000000
+        )
+        )
+        )
+        )
+        ) custom_sort1,
+        <!-- 20200612 新需求 活动报名进行的在前 正序 活动结束的在后 倒序 ======end====== -->
         activity_poster,
         push_level,
         reg_num,
@@ -388,14 +406,18 @@
         ) t
         ORDER BY
         <if test="activity.sort_criteria == 1 ">
-            activity_publishtime DESC,
+            activity_starttime DESC,
             create_time DESC
         </if>
         <if test="activity.sort_criteria == 2 ">
+            can_sign_up DESC,
             reg_num DESC
         </if>
         <if test="activity.sort_criteria == 0 ">
-            can_sign_up DESC ,
+            <!-- 20200612 新需求 活动报名进行的在前 正序 活动结束的在后 倒序 ======start====== -->
+            custom_sort1,
+            <!-- 20200612 新需求 活动报名进行的在前 正序 活动结束的在后 倒序 ======end====== -->
+            can_sign_up DESC,
             heat DESC
         </if>
     </select>