anderx 1 день назад
Родитель
Сommit
55f56e4c93

+ 43 - 0
src/main/java/com/goafanti/common/enums/AssistContentType.java

@@ -0,0 +1,43 @@
+package com.goafanti.common.enums;
+
+public enum AssistContentType {
+    //内容 0=其他,1=会议,2=写方案,3=接待
+    OTHER(0,"其他"),
+    MEETING(1,"会议"),
+    WRITE_SCHEME(2,"写方案"),
+    RECEPTION(3,"接待");
+    private Integer code;
+    private String desc;
+    AssistContentType(int code, String desc) {
+        this.code = code;
+        this.desc = desc;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public static String getDesc(int code) {
+        for (AssistContentType type : AssistContentType.values()) {
+            if (type.getCode() == code) {
+                return type.getDesc();
+            }
+        }
+        return null;
+    }
+
+    public static Integer getCode(String desc) {
+        for (AssistContentType type : AssistContentType.values()) {
+            if (type.getDesc().equals(desc)) {
+                return type.getCode();
+            }
+        }
+        return null;
+    }
+
+
+}

+ 67 - 0
src/main/java/com/goafanti/common/enums/AssistType.java

@@ -0,0 +1,67 @@
+package com.goafanti.common.enums;
+
+public enum AssistType {
+    //分类 0=其他,1=高企认定,2=会员服务,3=科技项目,4=研动力系统,5=知识产权,6=军工,7=涉密,8=技术合同登记,9=第三方认证项目
+    GQRD(1,"高企认定"),
+    HYFW(2,"会员服务"),
+    KJXM(3,"科技项目"),
+    YKJX(4,"研动力系统"),
+    ZKNW(5,"知识产权"),
+    GYJG(6,"军工"),
+    SEM(7,"涉密"),
+    THHD(8,"技术合同登记"),
+    SQZC(9,"第三方认证项目");
+    private Integer code;
+    private String message;
+    AssistType(Integer code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+    public Integer getCode() {
+        return code;
+    }
+    public String getMessage() {
+        return message;
+    }
+    public static String getDesc(Integer code) {
+        for (AssistType type : AssistType.values()) {
+            if (type.getCode().equals(code)) {
+                return type.getMessage();
+            }
+        }
+        return null;
+    }
+    public static Integer getCodeByMessage(String message) {
+        for (AssistType type : AssistType.values()) {
+            if (type.getMessage().equals(message)) {
+                return type.getCode();
+            }
+        }
+        return null;
+    }
+    public static AssistType getByCode(Integer code) {
+        for (AssistType type : AssistType.values()) {
+            if (type.getCode().equals(code)) {
+                return type;
+            }
+        }
+        return null;
+    }
+    public static AssistType getByMessage(String message) {
+        for (AssistType type : AssistType.values()) {
+            if (type.getMessage().equals(message)) {
+                return type;
+            }
+        }
+        return null;
+    }
+    public static String getMessageByCode(String code) {
+        for (AssistType type : AssistType.values()) {
+            if (type.getCode().equals(Integer.valueOf(code))) {
+                return type.getMessage();
+            }
+        }
+        return null;
+    }
+
+}

+ 1 - 1
src/main/java/com/goafanti/common/mapper/PublicReleaseMapper.xml

@@ -1296,7 +1296,7 @@
     </select>
 
     <select id="findAssistList" resultType="com.goafanti.weChat.bo.OutListAssist">
-        select a.id ,if(a.`type` &lt; 5,0,1)  assistType,
+        select a.id ,if(a.`type` &lt; 5,0,1) type,c.type assistType,
                c.content_type contentType,c.content ,a.aname,a.assist_aid_name assistAidName,
         a.user_names userNames ,d.sign_number signNumber ,d.public_count publicCount,d.assist_count assistCount ,
         d.public_assist_count  publicAssistCount ,d.non_public_count nonPublicCount,a.release_start releaseStart,

+ 12 - 1
src/main/java/com/goafanti/core/mybatis/BaseMybatisDao.java

@@ -121,6 +121,10 @@ public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
 		}
 		return page;
 	}
+	public List<?> findList(String sqlId, Object params) {
+		Map<String, Object> map = BeanUtilsExt.pushMap(params);
+		return findListAll(sqlId, map);
+	}
 
 	public List<?> findList(String sqlId, Object params, Integer pageNo, Integer pageSize) {
 		Map<String, Object> map = BeanUtilsExt.pushMap(params);
@@ -149,7 +153,14 @@ public class BaseMybatisDao<T> extends SqlSessionDaoSupport {
 		params.put("page_sql", page_sql);
 		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
 
-        return this.getSqlSession().selectList(sqlId, params);
+		return this.getSqlSession().selectList(sqlId, params);
+	}
+
+	public List<?> findListAll(String sqlId, Map<String, Object> params) {
+		String page_sql = String.format(" ");
+		params.put("page_sql", page_sql);
+		sqlId = String.format("%s.%s", NAMESPACE, sqlId);
+		return this.getSqlSession().selectList(sqlId, params);
 	}
 
 	/**

+ 28 - 7
src/main/java/com/goafanti/weChat/bo/OutListAssist.java

@@ -1,13 +1,12 @@
 package com.goafanti.weChat.bo;
 
+import com.goafanti.common.utils.excel.Excel;
+
 public class OutListAssist {
     private Integer id;
 
-    /**
-     * 协单类型
-     */
-    private Integer assistType;
-
+    @Excel(name = "协单类型",readConverterExp = "0=公出协单,1=非公出协单")
+    private  Integer type;
 
     /**
      * 协单内容类型
@@ -16,54 +15,76 @@ public class OutListAssist {
     /**
      * 协单内容
      */
+    @Excel(name = "内容")
     private String content;
     /**
      * 协单发起人
      */
+    @Excel(name = "发起人员")
     private String aname;
     /**
      * 协单人
      */
+    @Excel(name = "协单人员")
     private String assistAidName;
     /**
      * 客户名称
      */
+    @Excel(name = "客户名称")
     private String userNames;
     /**
      * 签单次数
      */
+    @Excel(name = "签单次数")
     private String signNumber;
     /**
      * 公出次数
      */
+    @Excel(name = "公出次数")
     private String publicCount;
     /**
      * 协单总数
      */
+    @Excel(name = "协单总数")
     private String assistCount;
     /**
      * 公出协单数
      */
+    @Excel(name = "公出协单数")
     private String publicAssistCount;
     /**
      * 非公出协单数
      */
+    @Excel(name = "非公出协单数")
     private String nonPublicCount;
     /**
      * 协单开始时间
      */
+    @Excel(name = "协单时间")
     private String releaseStart;
+    @Excel(name = "协单项目")
+    private String assistType;
 
     /**
      * 已签项目
      */
+    @Excel(name = "已签项目")
     private String taskNames;
 
-    public Integer getAssistType() {
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getAssistType() {
         return assistType;
     }
 
-    public void setAssistType(Integer assistType) {
+    public void setAssistType(String assistType) {
         this.assistType = assistType;
     }
 

+ 4 - 4
src/main/java/com/goafanti/weChat/bo/OutPublicDtails.java

@@ -113,14 +113,14 @@ public class OutPublicDtails  {
 	private String contractNo;
 	@Excel(name = "订单总金额" ,scale = 6)
 	private BigDecimal totalAmout;
-	@Excel(name = "协单类型",readConverterExp = "0=其他,1=高企认定,2=会员服务,3=科技项目,4=研动力系统,5=知识产权,6=军工,7=涉密,8=技术合同登记,9=第三方认证项目")
-	private Integer assistType;
+	@Excel(name = "协单类型")
+	private String assistType;
 
-	public Integer getAssistType() {
+	public String getAssistType() {
 		return assistType;
 	}
 
-	public void setAssistType(Integer assistType) {
+	public void setAssistType(String assistType) {
 		this.assistType = assistType;
 	}
 

+ 9 - 0
src/main/java/com/goafanti/weChat/controller/AdminReleaseApiController.java

@@ -649,4 +649,13 @@ public class AdminReleaseApiController extends CertifyApiController{
 		res.setData(publicReleaseService.listAssist(in));
 		return res;
 	}
+
+	/**
+	 * 协单统计列表-导出
+	 */
+	@RequestMapping(value = "/listAssistExprot", method = RequestMethod.GET)
+	public void listAssistExprot(InputListAssist in,HttpServletResponse response){
+		Result res =new Result();
+		publicReleaseService.listAssistExprot(in, response);
+	}
 }

+ 3 - 0
src/main/java/com/goafanti/weChat/service/PublicReleaseService.java

@@ -3,6 +3,7 @@ package com.goafanti.weChat.service;
 import com.goafanti.common.model.PublicConfig;
 import com.goafanti.weChat.bo.*;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
 
@@ -99,4 +100,6 @@ public interface PublicReleaseService {
 	Object getPublicConfig();
 
 	Object listAssist(InputListAssist in);
+
+	void listAssistExprot(InputListAssist in, HttpServletResponse response);
 }

+ 55 - 1
src/main/java/com/goafanti/weChat/service/impl/PublicReleaseServiceImpl.java

@@ -8,10 +8,13 @@ import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
+import com.goafanti.common.enums.AssistContentType;
+import com.goafanti.common.enums.AssistType;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.*;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.common.utils.weChat.WeChatUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -30,6 +33,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.socket.TextMessage;
 
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
@@ -1721,8 +1725,55 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 
 	@Override
 	public Object listAssist(InputListAssist in) {
+		Pagination<OutListAssist> page = (Pagination<OutListAssist>) findPage("findAssistList", "findAssistCount", in);
+		for (OutListAssist e : (List<OutListAssist>)page.getList()) {
+			pushTypeName(e);
+		}
+		return page;
+	}
+
+	@Override
+	public void listAssistExprot(InputListAssist in, HttpServletResponse response) {
+		List<OutListAssist> list = (List<OutListAssist>) findList("findAssistList", in);
+		for (OutListAssist e : list) {
+			pushTypeName(e);
+		}
+		NewExcelUtil<OutListAssist> excelExport = new NewExcelUtil<>(OutListAssist.class);
+		excelExport.exportExcel(list,  "协单统计列表",response);
+	}
+
+	private void pushTypeName(OutListAssist e) {
+		//处理公出项目分类
+		e.setAssistType(pushAssistTypeName(e.getAssistType()));
+
+		//处理公出内容分类
+		if (StringUtils.isNotBlank(e.getContentType())){
+			String[] split = e.getContentType().split(",");
+			StringBuilder str=new StringBuilder();
+			for (String s : split) {
+				str.append(AssistContentType.getDesc(Integer.valueOf(s))).append(",");
+			}
+			if (StringUtils.isNotBlank(e.getContent())){
+				str.append(e.getContent());
+			}else {
+				str.deleteCharAt(str.length()-1);
+			}
+
+			e.setContent(str.toString());
+		}
+	}
 
-		return findPage("findAssistList", "findAssistCount", in);
+	private String pushAssistTypeName(String assistType) {
+		if (StringUtils.isNotBlank(assistType)){
+			String[] split = assistType.split(",");
+			StringBuilder str=new StringBuilder();
+			for (String s : split) {
+				str.append(AssistType.getDesc(Integer.valueOf(s))).append(",");
+			}
+			str.deleteCharAt(str.length()-1);
+			return str.toString();
+		}
+		return "";
 	}
 
 	private void pushCompleteMaxDuration(String orderNo) {
@@ -2623,6 +2674,9 @@ public class PublicReleaseServiceImpl extends BaseMybatisDao<PublicReleaseMapper
 			List<PublicReleaseClock> publicReleaseClocks = publicReleaseClockMapper.selectList(collect);
 			pushiClockInTime(list, publicReleaseClocks);
 		}
+		list.forEach(e -> {
+			e.setAssistType(pushAssistTypeName(e.getAssistType()));
+		});
 		return page;
 	}