use of com.kendy.entity.Club in project financial by greatkendy123.
the class DBUtil method getAllClub.
/**
*********************************************************************************
*
* 小工具CRUD
*
*********************************************************************************
*/
/**
* 从数据库获取所有俱乐部信息
*
* @time 2017年11月24日
* @return
*/
public static Map<String, Club> getAllClub() {
Map<String, Club> map = new HashMap<>();
try {
con = DBConnection.getConnection();
String sql = "select * from club";
ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Club club = new Club();
club.setClubId(rs.getString(1));
club.setName(rs.getString(2));
club.setEdu(rs.getString(3));
club.setZhuoFei(rs.getString(4));
club.setYiJieSuan(rs.getString(5));
club.setZhuoFei2(rs.getString(6));
club.setZhuoFei3(rs.getString(7));
club.setYiJieSuan2(rs.getString(8));
club.setYiJieSuan3(rs.getString(9));
club.setEdu2(rs.getString(10));
club.setEdu3(rs.getString(11));
club.setGudong(rs.getString(12));
map.put(club.getClubId(), club);
}
} catch (SQLException e) {
ErrorUtil.err("从数据库获取所有俱乐部信息失败", e);
} finally {
close(con, ps);
}
return map;
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method get_LM_edu.
public String get_LM_edu() {
final Club club = this.getSelectedClub();
final int lmType = this.getCurrentLMType();
String edu = "0";
if (1 == lmType) {
edu = club.getEdu();
} else if (2 == lmType) {
edu = club.getEdu2();
} else if (3 == lmType) {
edu = club.getEdu3();
}
return edu;
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method exportSingleClubAction.
/**
********************************************************************************
*
* 导出Excel
*
**********************************************************************************
*/
/**
* 导出单个俱乐部帐单
*
* @time 2017年11月22日
* @param event
*/
public void exportSingleClubAction(ActionEvent event) {
Club club = getSelectedClub();
if (StringUtil.isBlank(club.getClubId())) {
ShowUtil.show("请先选择俱乐部!");
return;
}
String clubName = club.getName();
String clubId = club.getClubId();
String time = DataConstans.Date_Str;
if (StringUtil.isBlank(time)) {
// ShowUtil.show("导出失败! 您今天还没导入01场次的战绩,无法确认时间!!");
// return;
}
List<LMDetailInfo> list = new ArrayList<>();
ObservableList<LMDetailInfo> obList = tableLMDetail.getItems();
if (obList != null && obList.size() > 0) {
for (LMDetailInfo info : obList) {
list.add(info);
}
} else {
ShowUtil.show(clubName + "没有需要导出的数据!!");
return;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
String title = clubName + "帐单-" + sdf.format(new Date());
log.info(title);
String[] rowsName = new String[] { "场次", "战绩", "保险", "人数" };
List<Object[]> dataList = new ArrayList<Object[]>();
Object[] objs = null;
for (LMDetailInfo info : list) {
objs = new Object[rowsName.length];
objs[0] = info.getLmDetailTableId();
objs[1] = info.getLmDetailZJ();
objs[2] = info.getLmDetailInsure();
objs[3] = info.getLmDetailPersonCount();
dataList.add(objs);
}
String[] rowsName2 = new String[] { "名称", "总战绩", "总保险", "总人数" };
List<Object[]> sumList = new ArrayList<>();
Object[] sumObjs = null;
ObservableList<LMSumInfo> ob_List = tableLMSum.getItems();
if (ob_List != null && ob_List.size() > 0) {
for (LMSumInfo info : ob_List) {
sumObjs = new Object[rowsName2.length];
sumObjs[0] = StringUtil.nvl(info.getLmSumName(), "");
sumObjs[1] = StringUtil.nvl(info.getLmSumZJ(), "");
sumObjs[2] = StringUtil.nvl(info.getLmSumInsure(), "");
sumObjs[3] = StringUtil.nvl(info.getLmSumPersonCount(), "");
sumList.add(sumObjs);
}
}
String out = "D:/" + title + System.currentTimeMillis();
ExportLMExcel ex = new ExportLMExcel(title, rowsName, dataList, out, rowsName2, sumList);
try {
ex.export();
log.info("导出单个联盟帐单完成!");
} catch (Exception e) {
ErrorUtil.err("导出单个联盟帐单失败", e);
}
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method exportAllClubAction.
/**
* 导出所有俱乐部总帐单
* 由沈美女负责提供接口
*
* @author 沈佳琳
* @param event
*/
public void exportAllClubAction(ActionEvent event) {
// 事先判断
int size = allClubMap.size();
if (allClubMap == null || allClubMap.size() == 0) {
ShowUtil.show("无数据可以导出");
return;
}
Map<String, List<Record>> current_LM_Map = LMTotalList.get(getCurrentLMType() - 1);
if (MapUtil.isNullOrEmpty(current_LM_Map)) {
ShowUtil.show("该联盟无数据可以导出");
return;
}
// 组装当前要展示的联盟的相应俱乐部
Map<String, Club> lmClubMap = getLMClub(current_LM_Map);
// 获取所有俱乐部统计结果
Map<String, List<LMSumInfo>> sumMap = getAllClubSumMap(current_LM_Map);
// 计算总桌费
int sumOfZF = getSumOfZF().intValue();
try {
// 调用佳琳的接口
ExportAllLMExcel exportAllLMExcel = new ExportAllLMExcel();
boolean hasExported = exportAllLMExcel.export(sumMap, lmClubMap, sumOfZF);
if (hasExported)
log.info("导出所有联盟总帐单完成!");
} catch (Exception e) {
ErrorUtil.err("导出Excel失败", e);
}
}
use of com.kendy.entity.Club in project financial by greatkendy123.
the class LMController method checkOverEdu.
/**
* 锁定当局后判断俱乐部额度与结余
* 导入战绩后选择不同的联盟就弹框提示哪个联盟的额度超出情况
*
* !!!!可能存在的问题:如果中途两次结算同一个团队,可能服务费会累加
* 如KK团队在导入01场后点击结算,然后又在导入02场后点击结算
* 解决方法:建议在Record表中新增一个字段标志是否已经计算过
*
* @time 2017年11月30日
*/
public static void checkOverEdu(String LMType) {
try {
// 最新一天的战绩记录(也可能是昨天的,是否要做个标记)
String maxRecordTime = DBUtil.getMaxRecordTime();
if (!StringUtil.isBlank(maxRecordTime)) {
List<Record> list = DBUtil.getRecordsByMaxTime(maxRecordTime);
// 2018-01-01 add 大概个联盟分别报额度是否超出
if (!CollectionUtils.isEmpty(list)) {
list = list.stream().filter(record -> LMType.equals(record.getLmType())).collect(Collectors.toList());
}
// 最新的当天所有战绩记录(包含当局记录)
Map<String, List<Record>> map = new HashMap<>();
if (list == null)
list = new ArrayList<>();
list.forEach(record -> {
String clubId = record.getClubId();
List<Record> _list = map.get(clubId);
if (_list == null) {
_list = new ArrayList<>();
}
_list.add(record);
map.put(clubId, _list);
});
// 到这里map
boolean isOver = false;
// 计算总值
for (Map.Entry<String, List<Record>> entry : map.entrySet()) {
String clubId = entry.getKey();
if (allClubMap.get(clubId) == null)
continue;
List<Record> recordList = entry.getValue();
// 求和统计(针对每一场求和)
recordList = computSumList(recordList, false);
Double sumOfZJ = 0d;
Double sumOfBX = 0d;
for (Record record : recordList) {
sumOfZJ += NumUtil.getNum(record.getScore());
sumOfBX += NumUtil.getNum(record.getInsurance());
}
// 结余=sum(当天总账+已结算+桌费)
Club tempClub = allClubMap.get(clubId);
int LMTYPE = Integer.valueOf(LMType.replace("联盟", ""));
double zhuoFei = NumUtil.getNum(get_LM_Zhuofei(tempClub, LMTYPE));
// NumUtil.getNum(tempClub.getZhuoFei())
// +NumUtil.getNum(tempClub.getZhuoFei2())
// +NumUtil.getNum(tempClub.getZhuoFei3());
double yiJiesuan = NumUtil.getNum(get_LM_YiJiesuan(tempClub, LMTYPE));
// NumUtil.getNum(tempClub.getYiJieSuan())
// +NumUtil.getNum(tempClub.getYiJieSuan2())
// +NumUtil.getNum(tempClub.getYiJieSuan3());
double jieyu = sumOfZJ + yiJiesuan + zhuoFei;
double edu = NumUtil.getNum(get_LM_edu(tempClub, Integer.valueOf(LMType.replace("联盟", ""))));
// 结余和额度进行比较
if ((jieyu + edu) < 0) {
isOver = true;
String msg = String.format("%s:%s超过额度!额度:%s,结余%s", LMType, allClubMap.get(clubId).getName(), NumUtil.digit0(edu), NumUtil.digit0(jieyu));
ShowUtil.show(msg);
log.info(msg);
break;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations