Bläddra i källkod

Merge remote-tracking branch 'origin/20210223' into 20210223

wangyangyang 4 år sedan
förälder
incheckning
125c0b23c0

+ 13 - 3
operation_manager/src/main/java/com/huaxu/order/controller/WorkOrderManageController.java

@@ -599,15 +599,25 @@ public class WorkOrderManageController {
                 map.put("deptName", userEntity.getDeptOrgName());
                 if (orderStatusMap != null) {
                     map.put("status", orderStatusMap.get("S").toString());
-                    map.put("address", orderStatusMap.get("X") + "," + orderStatusMap.get("Y"));
-                    if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid) && wkid.equals("2360")){
+                    map.put("address", orderStatusMap.get("X")==null?"-":orderStatusMap.get("X").toString() + "," + orderStatusMap.get("Y")==null?"-":orderStatusMap.get("Y").toString());
+                    if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid)
+                            && wkid.equals("2360")
+                            && orderStatusMap.get("X")!=null
+                            && orderStatusMap.get("Y")!=null){
+
                         MyPoint myPoint= ConvertXY.ConvertXYToXian80(orderStatusMap.get("X").toString(),
                                 orderStatusMap.get("Y").toString(),moveXY);
                         map.put("coords",myPoint.getX()+","+myPoint.getY());
-                    }else if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid) && wkid.equals("3857")){
+                    }else if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid)
+                            && wkid.equals("3857")
+                            && orderStatusMap.get("X")!=null
+                            && orderStatusMap.get("Y")!=null){
                         MyPoint myPoint= ConvertXY.ConvertXYToMercato(orderStatusMap.get("X").toString(),
                                 orderStatusMap.get("Y").toString(),moveXY);
                         map.put("coords",myPoint.getX()+","+myPoint.getY());
+                    }else
+                    {
+                        map.put("coords","");
                     }
                 }
                 else {

+ 5 - 3
operation_manager/src/main/resources/mapper/order/WorkOrderManageMapper.xml

@@ -515,11 +515,13 @@
     order by send_time desc
   </select>
   <select id="selectAppAll" resultMap="BaseResultMap">
-    select id,task_no,send_time,address,order_type_id,current_task_name,create_by,update_by,task_desc,order_status
-    from sc_work_order_manage
+    select distinct t1.id,task_no,send_time,address,order_type_id,current_task_name,t1.create_by,t1.update_by,task_desc,order_status
+    from sc_work_order_manage t1
+    left join sc_work_flow_log t2 ON t1.id=t2.flow_id and flow_type=2 and find_in_set(#{userId},handle_user_id) and left(flow_result,2)='拒单'
     where (find_in_set(#{userId},current_users)
-     or id in(select flow_id from sc_work_flow_log where flow_type=2 and find_in_set(#{userId},handle_user_id)))
+     or t1.id in(select flow_id from sc_work_flow_log where flow_type=2 and find_in_set(#{userId},handle_user_id)))
      and tenant_id = #{tenantId}
+     and (t2.id is null or t1.order_user_id=t2.handle_user_id)
     union
     select id,plan_id,plan_date,task_area_name,task_type,current_task_name,create_by,update_by,task_content,plan_status
     from sc_plan_manage

+ 27 - 20
sms_water/src/main/java/com/huaxu/service/impl/AppPageReportServiceImpl.java

@@ -1,23 +1,15 @@
 package com.huaxu.service.impl;
 
-import com.huaxu.client.UserCenterClient;
-import com.huaxu.dao.HomePageReportMapper;
-import com.huaxu.dao.MonitorDataReportMapper;
 import com.huaxu.dto.MonthRevenueDto;
 import com.huaxu.dto.generalView.DeviceWaterSupply;
-import com.huaxu.model.AjaxMessage;
-import com.huaxu.model.LoginUser;
-import com.huaxu.model.ResultStatus;
 import com.huaxu.service.AppPageReportService;
 import com.huaxu.service.HomePageReportService;
-import com.huaxu.service.MonitorDataReportService;
 import com.huaxu.service.RevenueService;
-import com.huaxu.util.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.text.DecimalFormat;
 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Comparator;
@@ -58,22 +50,37 @@ public class AppPageReportServiceImpl implements AppPageReportService {
      */
     @Override
     public List<DeviceWaterSupply> deviceSellerWaterReportForMonth(Integer companyOrgId,Integer month) {
-        BigDecimal AmountCountMonth = null;
         LocalDate localDate = LocalDate.now();
         List<DeviceWaterSupply> deviceWaterSupplies = new ArrayList<DeviceWaterSupply>();
         List<MonthRevenueDto> sellerWater = revenueService.selectOverviewRevenue(companyOrgId,month);
-        if(sellerWater.size()>0 && sellerWater.get(0).getMeterReadingUsage() != null){
-            AmountCountMonth = new BigDecimal(sellerWater.get(0).getMeterReadingUsage());
+        for (int i = 0; i < month; i++) {
+            LocalDate newLocalDate = localDate.plusMonths(-i);
+            MonthRevenueDto revenue = findRevenue(sellerWater,newLocalDate);
+            DeviceWaterSupply deviceWaterSupply = new DeviceWaterSupply();
+            deviceWaterSupply.setOrderNo(i+1);
+            deviceWaterSupply.setYear(newLocalDate.getYear());
+            deviceWaterSupply.setMonth(newLocalDate.getMonthValue());
+            deviceWaterSupply.setDate(newLocalDate);
+            deviceWaterSupply.setDateLabel(newLocalDate.getYear()+"-"+newLocalDate.getMonthValue());
+            if(revenue == null){
+                deviceWaterSupply.setAmount(BigDecimal.ZERO);
+            }
+            else{
+                deviceWaterSupply.setAmount(new BigDecimal(revenue.getMeterReadingUsage()));
+            }
+            deviceWaterSupplies.add(i, deviceWaterSupply);
         }
-        DeviceWaterSupply deviceWaterSupplyMonth = new DeviceWaterSupply();
-        deviceWaterSupplyMonth.setOrderNo(1);
-        deviceWaterSupplyMonth.setAmount(AmountCountMonth != null ? AmountCountMonth : BigDecimal.ZERO);
-        deviceWaterSupplyMonth.setYear(localDate.getYear());
-        deviceWaterSupplyMonth.setMonth(localDate.getMonthValue());
-        deviceWaterSupplyMonth.setDate(localDate);
-        deviceWaterSupplyMonth.setDateLabel(localDate.getYear() + "-" + localDate.getMonthValue());
-        deviceWaterSupplies.add(0, deviceWaterSupplyMonth);
         deviceWaterSupplies.sort(Comparator.comparing(DeviceWaterSupply::getOrderNo).reversed());
         return deviceWaterSupplies;
     }
+
+    private MonthRevenueDto findRevenue(List<MonthRevenueDto> sellerWater,LocalDate localDate) {
+        String dateString = String.format("%s-%s", localDate.getYear(),new DecimalFormat("#00").format(localDate.getMonthValue()));
+        for (MonthRevenueDto revenue : sellerWater) {
+            if (revenue.getCollectDateString().equals(dateString)) {
+                return revenue;
+            }
+        }
+        return null;
+    }
 }