chenrj-PC\chenrj před 8 roky
rodič
revize
f07d834a13

+ 2 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/CheckAppeal.java

@@ -7,8 +7,10 @@ import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 
 import lombok.Data;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 
 @Data
 @Data
+@EqualsAndHashCode(callSuper = false)
 public class CheckAppeal {
 public class CheckAppeal {
 	//编号
 	//编号
     private Long id;
     private Long id;

+ 45 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/bean/CheckAppealStatistic.java

@@ -0,0 +1,45 @@
+package com.xintong.visualinspection.bean;
+
+import java.util.Date;
+import java.util.List;
+
+import org.springframework.format.annotation.DateTimeFormat;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import lombok.Data;
+
+@Data
+public class CheckAppealStatistic {
+	
+	// 开始时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")  
+    private Date start_time;
+    
+    // 结束时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") 
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")  
+    private Date end_time;
+    
+    private Integer appeal_result ;
+    
+    private Integer appeal_success_num ;
+    
+    private Integer appeal_other_num;
+    
+    private Integer appeal_fail_num ;
+    
+    private Integer appeal_num;
+    
+    private String fee_station_name;
+    
+    private Integer dept_id ;
+    
+    private List<Organ> dept_list  ;
+    
+    private Integer parent_dept_id ;
+    
+    private List<CheckAppealStatistic> subCheckApealStatistic ;
+    
+}

+ 11 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/StatisticsController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
+import com.xintong.visualinspection.bean.CheckAppealStatistic;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBo;
 import com.xintong.visualinspection.bean.StatisticsBo;
@@ -218,4 +219,14 @@ public class StatisticsController extends BaseController {
     	List<StatisticsFsWork> returnObj=  statisticsService.getFsWorkUnregularWorkPerson(obj);
     	List<StatisticsFsWork> returnObj=  statisticsService.getFsWorkUnregularWorkPerson(obj);
     	return super.returnSuccessResultTime(returnObj);
     	return super.returnSuccessResultTime(returnObj);
     }
     }
+    
+    /**
+     * 
+     */
+    @RequestMapping(value = "/check/appeal")
+    public String getCheckAppeal(@RequestBody CheckAppealStatistic obj){
+    	List<CheckAppealStatistic> returnObj=  statisticsService.getCheckAppealStatistic(obj);
+    	return super.returnSuccessResultTime(returnObj);
+    }
+    
 }
 }

+ 3 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/dao/master/StatisticsDao.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 
 
+import com.xintong.visualinspection.bean.CheckAppealStatistic;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsFsWork;
 import com.xintong.visualinspection.bean.StatisticsFsWork;
@@ -53,4 +54,6 @@ public interface StatisticsDao  {
 	public List<StatisticsFsWork> selectFsWorkGatherGroupByWorkType(StatisticsFsWork obj);
 	public List<StatisticsFsWork> selectFsWorkGatherGroupByWorkType(StatisticsFsWork obj);
 	
 	
 	public List<StatisticsFsWork> selectFsUnregularWorkGatherGroupByWorkType(StatisticsFsWork obj);
 	public List<StatisticsFsWork> selectFsUnregularWorkGatherGroupByWorkType(StatisticsFsWork obj);
+	
+	public List<CheckAppealStatistic> selectCheckAppealNum(CheckAppealStatistic obj);
 }
 }

+ 32 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/mapper/master/StatisticsMapper.xml

@@ -392,5 +392,36 @@
     	<include refid="select_Fswork_condition"/>
     	<include refid="select_Fswork_condition"/>
     	GROUP BY t.user_id , t.class_type
     	GROUP BY t.user_id , t.class_type
     </select>
     </select>
-
+	
+	<resultMap id="appealNum" type="com.xintong.visualinspection.bean.CheckAppealStatistic">
+        <id property="dept_id" column="dept_id"/>
+        <collection property="subCheckApealStatistic" ofType="com.xintong.visualinspection.bean.CheckAppealStatistic">
+            <result column="appeal_num" property="appeal_num"/>
+            <result property="appeal_result" column="appeal_result"/>
+        </collection>
+    </resultMap>
+	
+	<select id="selectCheckAppealNum" parameterType="com.xintong.visualinspection.bean.CheckAppealStatistic" resultMap="appealNum" >
+		SELECT COUNT(t.appeal_dept) AS appeal_num ,t.appeal_dept AS dept_id,t.appeal_result FROM check_appeal t 
+			INNER JOIN check_task ct ON t.task_id = ct.id WHERE 1=1
+			<if test="start_time!=null and start_time!=''">
+	   			AND t.appeal_time >= #{start_time}
+	   		</if>
+	   		<if test="end_time!=null and end_time!=''">
+	   			AND t.appeal_time &lt;= #{end_time}
+	   		</if>
+	   		<if test="dept_list!=null and dept_list.size()>0 ">
+	    		AND	t.appeal_dept IN
+			    	<foreach item="obj"  collection="dept_list" open="("
+			            separator="," close=")">
+			            #{obj.id}  
+			         </foreach>
+		    </if>
+	   		<if test="dept_id!=null">
+	   			AND t.appeal_dept=#{dept_id}
+	   		</if>
+			GROUP BY t.appeal_dept , t.appeal_result
+			ORDER BY t.appeal_dept
+	</select>
+	
 </mapper>
 </mapper>

+ 3 - 1
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/StatisticsService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 
 
+import com.xintong.visualinspection.bean.CheckAppealStatistic;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBean;
 import com.xintong.visualinspection.bean.StatisticsBo;
 import com.xintong.visualinspection.bean.StatisticsBo;
@@ -83,5 +84,6 @@ public interface StatisticsService {
 	// 顶岗人数统计
 	// 顶岗人数统计
 	public List<StatisticsFsWork> getFsWorkUnregularWorkPerson(StatisticsFsWork obj);
 	public List<StatisticsFsWork> getFsWorkUnregularWorkPerson(StatisticsFsWork obj);
 	
 	
-	
+	// 申诉情况统计
+	public List<CheckAppealStatistic> getCheckAppealStatistic(CheckAppealStatistic obj); 
 }
 }

+ 78 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/service/impl/StatisticsServiceImpl.java

@@ -7,6 +7,7 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStream;
+import java.lang.reflect.Method;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Comparator;
@@ -25,6 +26,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import com.xintong.visualinspection.bean.CheckAppealStatistic;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.CheckmanStatisticsBean;
 import com.xintong.visualinspection.bean.Constant;
 import com.xintong.visualinspection.bean.Constant;
 import com.xintong.visualinspection.bean.FeeStation;
 import com.xintong.visualinspection.bean.FeeStation;
@@ -1133,4 +1135,80 @@ public class StatisticsServiceImpl extends BaseService implements StatisticsServ
 		return sFsList;
 		return sFsList;
 	}
 	}
 	
 	
+	// 将list 转化为 HashMap
+	private <T> Map<Integer,T> getMapFromList(List<T> list,String fieldName ){
+		if(list!=null && list.size() >0){
+			try {
+				Map<Integer,T> map = new HashMap<>();
+				for(T obj : list){
+					Method m = obj.getClass().getMethod("get"+fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1));
+					Integer value = (Integer)m.invoke(obj);
+					map.put(value, obj);
+				}
+				return map;
+			} catch (Exception e) {
+				
+				e.printStackTrace();
+			}			
+		}
+		return null;
+	}
+	
+	@Override
+	public List<CheckAppealStatistic> getCheckAppealStatistic(CheckAppealStatistic obj) {
+		// 根据不同检索条件,分别检索去 公司、道管或者收费站 下的收费站列表
+		List<Organ> list ;
+		if(obj.getDept_id()!=null){
+			Organ organ =new Organ();
+			organ.setId(obj.getDept_id());
+			list = departmentDao.getOrgan(organ);
+		}else if(obj.getParent_dept_id()!=null){
+			list = getFsStationList(obj.getParent_dept_id());
+			obj.setDept_list(list);
+		}else{
+			list = new ArrayList<>();
+			List<FeeStation> lists = departmentDao.getAllFS();
+			for(FeeStation e : lists){
+				Organ organ = new Organ();
+				organ.setId(Integer.parseInt(e.getDeptid()));
+				organ.setOrganname(e.getName());
+				list.add(organ);
+			}
+		}
+
+		// 将检索的数据填充list中
+		List<CheckAppealStatistic> ObjList = statisticsDao.selectCheckAppealNum(obj);
+		Map<Integer,CheckAppealStatistic>  map = getMapFromList(ObjList,"dept_id");
+		
+		for(Organ organObj :list ){
+			if(map!=null && map.containsKey(organObj.getId())){
+				CheckAppealStatistic reObj = map.get(organObj.getId());
+				reObj.setFee_station_name(organObj.getOrganname());
+				Integer appeal_num = 0;
+				for(CheckAppealStatistic subObj:reObj.getSubCheckApealStatistic()){
+					appeal_num += subObj.getAppeal_num();
+					if(subObj.getAppeal_result() ==null){
+						reObj.setAppeal_other_num(subObj.getAppeal_num());
+					}else if(subObj.getAppeal_result()==1){
+						reObj.setAppeal_success_num(subObj.getAppeal_num());
+					}else{
+						reObj.setAppeal_fail_num(subObj.getAppeal_fail_num());
+					}
+				}
+				reObj.setAppeal_num(appeal_num);
+				reObj.setSubCheckApealStatistic(null);
+			}else{
+				CheckAppealStatistic reobj = new CheckAppealStatistic();
+				reobj.setFee_station_name(organObj.getOrganname());
+				reobj.setAppeal_num(0);
+				reobj.setAppeal_fail_num(0);
+				reobj.setAppeal_other_num(0);
+				reobj.setAppeal_result(0);
+				ObjList.add(reobj);
+			}
+		}
+		
+		return ObjList;
+	}
+	
 }
 }