You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
5.7 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page import="weaver.general.*" %>
<%@page import="weaver.conn.RecordSet"%>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.formmode.customjavacode.customsearch.contractSearchService.GetTotalService" %>
<%@ page import="weaver.formmode.customjavacode.customsearch.contractSearchService.TotalMoneyDTO" %>
<%@ page import="weaver.formmode.customjavacode.customsearch.contractSearchService.TotalRequestDTO" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%
BaseBean bb = new BaseBean();
String begindate = "" ;
String enddate = "" ;
int year = 0 ;
User user = null;
String type = Util.null2String(request.getParameter("type"));
if("0".equals(type)){
begindate = Util.null2String(request.getParameter("begindate"));
enddate = Util.null2String(request.getParameter("enddate"));
year = Util.getIntValue(request.getParameter("year"));
int userid = Util.getIntValue(request.getParameter("userid"));
user = new User(userid);
}else{
begindate = TimeUtil.getFirstDayOfTheYear();
enddate = TimeUtil.getCurrentDateString();
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
year = calendar.get(Calendar.YEAR);
user = HrmUserVarify.getUser(request , response) ;
}
RecordSet rs = new RecordSet();
int userid = user.getUID();
String field69 = "";
try {
String sql = " select field69 from cus_fielddata where id= ? and len(field69) > 0 " ;
rs.executeQuery(sql,new Object[]{userid});
while (rs.next()){
String value = Util.null2String(rs.getString("field69"));
if(StringUtils.isNotEmpty(value)){
field69 = value;
}
}
}catch (Exception e){
}
if(StringUtils.isEmpty(field69))
{
String posttype = Util.null2String(request.getParameter("posttype"));
field69 = posttype;
}
String posttype = "" ;
bb.writeLog("field69:"+field69);
bb.writeLog("begindate:"+begindate);
bb.writeLog("enddate:"+enddate);
bb.writeLog("year:"+year);
JSONObject jsonObject = new JSONObject();
String msg = "" ;
if(StringUtils.isNotEmpty(field69)){
if("1".equals(field69)){
msg = getSalesPerson(user,begindate,enddate,year);
}
}
jsonObject.put("msg",msg);
jsonObject.put("posttype",posttype);
jsonObject.put("userid",user.getUID());
jsonObject.put("lastname",user.getLastname());
%>
<%=jsonObject.toString() %>
<%!
/***
* 销售显示6个签约合同金额、年度指标、指标完成率、合同收款、客户数量、商机数量
*/
public String getSalesPerson(User user, String begindate, String enddate,int currentYear){
StringBuffer sb = new StringBuffer();
try{
String msg = getSignContract(user,currentYear,begindate,enddate);
sb.append("getSignContract:"+msg);
}catch (Exception e){
}
try {
String msg = getContractCollection(user,currentYear,begindate,enddate);
sb.append("getContractCollection:"+msg);
}catch (Exception e){
}
return sb.toString();
}
/////##########################销售人员##################################//
/***
* 签约合同金额
* @param user
* @param year
* @param startDate
* @param endDate
* @return
*/
public String getSignContract(User user,int year,String startDate,String endDate){
BaseBean bb = new BaseBean();
bb.writeLog("getSignContract:");
String msg = "" ;
String contractTableName = "zxyjlxfb";
String searchFlag = "1";
String dateCondition = "5";
String zxyjFlag = "";
GetTotalService totalService = new GetTotalService();
try {
TotalRequestDTO requestDTO = new TotalRequestDTO();
requestDTO.setDateValue(dateCondition);
requestDTO.setSearchFlag(searchFlag);
requestDTO.setContractTableName(contractTableName);
requestDTO.setUser(user);
requestDTO.setZxyjFlag(zxyjFlag);
TotalMoneyDTO totalMoneyDTO = totalService.getTotalInfo(requestDTO);
msg = totalMoneyDTO.toString();
}catch (Exception e) {
bb.writeLog("getSignContract-e:"+e);
}
return msg;
}
/***
* 合同收款金额
* @param user
* @param year
* @param startDate
* @param endDate
* @return
*/
public String getContractCollection(User user,int year,String startDate,String endDate){
BaseBean bb = new BaseBean();
bb.writeLog("getContractCollection:");
String msg = "" ;
String contractTableName = "zxhtyj";
String searchFlag = "1";
String dateCondition = "5";
String zxyjFlag = "zxhtsknew";
GetTotalService totalService = new GetTotalService();
try {
TotalRequestDTO requestDTO = new TotalRequestDTO();
requestDTO.setDateValue(dateCondition);
requestDTO.setSearchFlag(searchFlag);
requestDTO.setContractTableName(contractTableName);
requestDTO.setUser(user);
requestDTO.setZxyjFlag(zxyjFlag);
TotalMoneyDTO totalMoneyDTO = totalService.getTotalInfo(requestDTO);
msg = totalMoneyDTO.toString();
}catch (Exception e) {
bb.writeLog("getSignContract-e:"+e);
}
return msg;
}
%>