init:米东项目初始化
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.CashUnilateralService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 现金单边账 废弃
|
||||
* @date 2021/11/8 14:34
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/cashUnilateral")
|
||||
public class CashUnilateralController_delete {
|
||||
|
||||
@Autowired
|
||||
private CashUnilateralService cashUnilateralService;
|
||||
|
||||
/**
|
||||
* @description: 到单边账页面
|
||||
* @author thuang
|
||||
* @date 2021/11/8 14:40
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/toCashUnilateral")
|
||||
public String toCashUnilateral(ModelMap modelMap){
|
||||
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE,-1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime= DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd,startDate);
|
||||
String endTime= DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime",startTime);
|
||||
modelMap.addAttribute("endTime",endTime);
|
||||
|
||||
return "financialReconciliation/cashUnilateral";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,315 @@
|
||||
package com.saye.hospitalgd.controller.FinancialReconciliation;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.service.ReconciliationResultService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 对账结果
|
||||
* @date 2021/8/31 10:17
|
||||
*/
|
||||
@Api(tags = "对账结果相关接口")
|
||||
@Controller
|
||||
@RequestMapping("/reconciliationResult")
|
||||
public class ReconciliationResultController {
|
||||
|
||||
@Autowired
|
||||
private ReconciliationResultService reconciliationResultService;
|
||||
|
||||
@RequestMapping("/toReconciliationResult")
|
||||
public String toReconciliationResult(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
return "financialReconciliation/reconciliationResult";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询对账的结果记录
|
||||
* @author thuang
|
||||
* @date 2021/8/30 14:30
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findReconciliationResultPageList")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询对账的结果记录")
|
||||
public HashMap<Object, Object> findReconciliationResultPageList(@ApiParam(name = "开始时间") String startTime,
|
||||
@ApiParam(name = "结束时间") String endTime,
|
||||
@ApiParam(name = "页码") int page,
|
||||
@ApiParam(name = "每页限制个数") int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(reconciliationResultService.findReconciliationResultPageList(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 导出对账结果excel
|
||||
* @author thuang
|
||||
* @date 2021/10/22 10:43
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/exportReconciliationResult")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "导出对账结果excel")
|
||||
public HashMap<Object, Object> exportReconciliationResult(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
|
||||
List<HashMap<Object, Object>> list = reconciliationResultService.findReconciliationResultPageList(map);
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
|
||||
//创建工作薄对象
|
||||
XSSFWorkbook xwb = new XSSFWorkbook();//这里也可以设置sheet的Name
|
||||
//创建工作表对象
|
||||
XSSFSheet sheet = xwb.createSheet("sheet0");
|
||||
//设置主标题样式
|
||||
XSSFFont mainTitleFont = xwb.createFont();
|
||||
mainTitleFont.setFontName("宋体");
|
||||
mainTitleFont.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//字体加粗
|
||||
mainTitleFont.setFontHeightInPoints((short) 14);// 字体大小
|
||||
XSSFCellStyle mainTitleStyle = xwb.createCellStyle();
|
||||
mainTitleStyle.setFont(mainTitleFont);
|
||||
mainTitleStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);// 左右居中
|
||||
mainTitleStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// 上下居中
|
||||
mainTitleStyle.setLocked(true);
|
||||
//标题样式
|
||||
XSSFFont titleFont = xwb.createFont();
|
||||
titleFont.setFontName("宋体");
|
||||
titleFont.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);//字体加粗
|
||||
titleFont.setFontHeightInPoints((short) 10);// 字体大小
|
||||
XSSFCellStyle titleStyle = xwb.createCellStyle();
|
||||
titleStyle.setFont(titleFont);
|
||||
titleStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);// 左右居中
|
||||
titleStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// 上下居中
|
||||
titleStyle.setFillForegroundColor(new XSSFColor(new Color(225, 225, 225)));
|
||||
titleStyle.setFillBackgroundColor(new XSSFColor(new Color(225, 225, 225)));
|
||||
titleStyle.setFillPattern(XSSFCellStyle.SPARSE_DOTS);
|
||||
titleStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); // 下边框
|
||||
titleStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);// 左边框
|
||||
titleStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);// 上边框
|
||||
titleStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);// 右边框
|
||||
titleStyle.setLocked(true);
|
||||
//内容样式
|
||||
XSSFFont contentFont = xwb.createFont();
|
||||
contentFont.setFontName("宋体");
|
||||
contentFont.setFontHeightInPoints((short) 10);// 字体大小
|
||||
XSSFCellStyle contentStyle = xwb.createCellStyle();
|
||||
contentStyle.setFont(contentFont);
|
||||
contentStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);// 左右居中
|
||||
contentStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);// 上下居中
|
||||
contentStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); // 下边框
|
||||
contentStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN);// 左边框
|
||||
contentStyle.setBorderTop(XSSFCellStyle.BORDER_THIN);// 上边框
|
||||
contentStyle.setBorderRight(XSSFCellStyle.BORDER_THIN);// 右边框
|
||||
contentStyle.setWrapText(true);
|
||||
contentStyle.setLocked(true);
|
||||
|
||||
//标题
|
||||
LinkedHashMap<String, String> titleMap = new LinkedHashMap<>();
|
||||
// titleMap.put("院区", "1,2");//一列两行
|
||||
titleMap.put("日期", "1,2");
|
||||
titleMap.put("结算金额", "4,1");
|
||||
titleMap.put("单边账", "2,1");
|
||||
titleMap.put("对账情况", "1,1");
|
||||
|
||||
//第二行标题
|
||||
List<String> titleList2 = new ArrayList<>();
|
||||
titleList2.add("第三方支付结算");
|
||||
titleList2.add("HIS结算金额");
|
||||
titleList2.add("三方单边账");
|
||||
titleList2.add("HIS单边账");
|
||||
titleList2.add("处理历史单边账金额");
|
||||
titleList2.add("当日结算单边账条数");
|
||||
titleList2.add("是否通过");
|
||||
|
||||
//内容key
|
||||
List<String> contentKey = new ArrayList<>();
|
||||
// contentKey.add("AREA");
|
||||
contentKey.add("TRADE_DATE");
|
||||
contentKey.add("THIRD_MONEY");
|
||||
contentKey.add("HIS_MONEY");
|
||||
contentKey.add("THIRD_UNILATERAL");
|
||||
contentKey.add("HIS_UNILATERAL");
|
||||
contentKey.add("MANAGER_HISTORY_UNILATERAL");
|
||||
contentKey.add("UNILATERAL_NUM");
|
||||
contentKey.add("STATUS_STR");
|
||||
|
||||
//定义列宽
|
||||
sheet.setColumnWidth(0, 5000);
|
||||
sheet.setColumnWidth(1, 5000);
|
||||
sheet.setColumnWidth(2, 5000);
|
||||
sheet.setColumnWidth(3, 5000);
|
||||
sheet.setColumnWidth(4, 5000);
|
||||
sheet.setColumnWidth(5, 5000);
|
||||
sheet.setColumnWidth(6, 5000);
|
||||
sheet.setColumnWidth(7, 5000);
|
||||
// sheet.setColumnWidth(8, 5000);
|
||||
|
||||
//刚开始先创建大标题
|
||||
//设置行单元格合并
|
||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 7));
|
||||
//创建工作表的行
|
||||
XSSFRow mainRow = sheet.createRow(0);//设置第一行,从零开始
|
||||
mainRow.setHeight((short) 375);
|
||||
XSSFCell mainCell = mainRow.createCell(0);
|
||||
mainCell.setCellStyle(mainTitleStyle);
|
||||
mainCell.setCellValue(startTime + "~" + endTime + "对账结果表(金额单位:元)");
|
||||
|
||||
//创建标题行
|
||||
XSSFRow titleRow1 = sheet.createRow(1);
|
||||
XSSFRow titleRow2 = sheet.createRow(2);
|
||||
|
||||
int thisColNum = 0;
|
||||
for (String title : titleMap.keySet()) {
|
||||
String value = titleMap.get(title);
|
||||
|
||||
String[] split = value.split(",");
|
||||
int colNum = Integer.parseInt(split[0]);
|
||||
int rowNum = Integer.parseInt(split[1]);
|
||||
|
||||
|
||||
XSSFCell cell = titleRow1.createCell(thisColNum);
|
||||
cell.setCellStyle(titleStyle);
|
||||
cell.setCellValue(title);
|
||||
|
||||
if (rowNum != 1) {
|
||||
|
||||
XSSFCell cell2 = titleRow2.createCell(thisColNum);
|
||||
cell2.setCellStyle(titleStyle);
|
||||
|
||||
sheet.addMergedRegion(new CellRangeAddress(1, rowNum, thisColNum, thisColNum));
|
||||
}
|
||||
if (colNum != 1) {
|
||||
for (int i = 1; i < colNum; i++) {
|
||||
XSSFCell cell2 = titleRow1.createCell(thisColNum + i);
|
||||
cell2.setCellStyle(titleStyle);
|
||||
}
|
||||
|
||||
sheet.addMergedRegion(new CellRangeAddress(1, 1, thisColNum, thisColNum + colNum - 1));
|
||||
}
|
||||
|
||||
//将大小加上 之后计算起始要用到
|
||||
thisColNum = thisColNum + colNum;
|
||||
}
|
||||
|
||||
//第二行标题
|
||||
int title2StartCol = 1; //第二行标题开始列是第三列
|
||||
for (int i = 0; i < titleList2.size(); i++) {
|
||||
String title2 = titleList2.get(i);
|
||||
XSSFCell cell2 = titleRow2.createCell(title2StartCol + i);
|
||||
cell2.setCellStyle(titleStyle);
|
||||
cell2.setCellValue(title2);
|
||||
}
|
||||
|
||||
//循环内容
|
||||
int startRow = 3; //标题加上抬头名称 共用了三行
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
int thisRow = startRow + i;
|
||||
XSSFRow contentRow = sheet.createRow(thisRow);
|
||||
HashMap<Object, Object> hashMap = list.get(i);
|
||||
for (int j = 0; j < contentKey.size(); j++) {
|
||||
String s = contentKey.get(j);
|
||||
String content = StringDUtil.changeNullToEmpty(hashMap.get(s));
|
||||
XSSFCell otherCell = contentRow.createCell(j);
|
||||
otherCell.setCellStyle(contentStyle);
|
||||
otherCell.setCellValue(content);
|
||||
}
|
||||
}
|
||||
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/ReconciliaionResult/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
// 设置输入流
|
||||
FileOutputStream fOut = new FileOutputStream(savePath);
|
||||
// 将模板的内容写到输出文件上
|
||||
xwb.write(fOut);
|
||||
fOut.flush();
|
||||
|
||||
// 操作结束,关闭文件
|
||||
fOut.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "ReconciliaionResult/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.excel.ExportXLSX;
|
||||
import com.saye.hospitalgd.commons.excel.HashMapConversionImpl;
|
||||
import com.saye.hospitalgd.commons.excel.IConversionByExport;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.service.HisDetailService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: his账单明细
|
||||
* @date 2021/9/28 11:13
|
||||
*/
|
||||
@Api(value = "his账单明细相关接口")
|
||||
@Controller
|
||||
@RequestMapping("/hisDetail")
|
||||
public class HisDetailController {
|
||||
|
||||
@Autowired
|
||||
private HisDetailService hisDetailService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@RequestMapping("/toHisDetail")
|
||||
public String toHisDetail(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
// 支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
modelMap.addAttribute("payTypeList", pay_type);
|
||||
|
||||
// 业务类型
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
modelMap.addAttribute("bizTypeList", biz_type);
|
||||
|
||||
return "financialReconciliation/hisDetail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询his 详细记录
|
||||
* @author thuang
|
||||
* @date 2021/9/17 8:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@ApiOperation(value = "查询his详细记录", notes = "")
|
||||
@GetMapping("/findHisDetail")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findHisDetail(@ApiParam(value = "付款方式") String payType, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("payType", payType);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(hisDetailService.findHisDetail(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询his记录统计数据
|
||||
* @author thuang
|
||||
* @date 2022/1/7 9:46
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findHisCountData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询his记录统计数据", notes = "")
|
||||
public HashMap<Object, Object> findHisCountData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
List<HashMap<Object, Object>> hisDetailCount = hisDetailService.findHisDetailCountData(map);
|
||||
|
||||
responseMap.put("money", hisDetailCount.get(0).get("MONEY"));
|
||||
responseMap.put("num", hisDetailCount.get(0).get("NUM"));
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询his记录统计数据,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 导出HIS明细
|
||||
* @author thuang
|
||||
* @date 2021/10/22 15:12
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/exportHisDetail")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "导出HIS明细", notes = "")
|
||||
public HashMap<Object, Object> exportHisDetail(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
|
||||
List<HashMap<Object, Object>> list = hisDetailService.findHisDetail(map);
|
||||
|
||||
// 支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
HashMap<String, String> peyTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
peyTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
// 业务类型
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
HashMap<String, String> bizTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : biz_type) {
|
||||
bizTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String paymethod = StringDUtil.changeNullToEmpty(hashMap.get("VISITZORG"));
|
||||
if ("1".equals(paymethod)) {
|
||||
hashMap.put("VISITZORG", "门诊");
|
||||
} else if ("2".equals(paymethod)) {
|
||||
hashMap.put("VISITZORG", "住院");
|
||||
} else {
|
||||
hashMap.put("VISITZORG", "");
|
||||
}
|
||||
|
||||
String tradingStatus = StringDUtil.changeNullToEmpty(hashMap.get("H_JYLX"));
|
||||
if ("1".equals(tradingStatus)) {
|
||||
hashMap.put("H_JYLX", "收款记录");
|
||||
} else if ("2".equals(tradingStatus)) {
|
||||
hashMap.put("H_JYLX", "退款记录");
|
||||
} else {
|
||||
hashMap.put("H_JYLX", "");
|
||||
}
|
||||
|
||||
String biztype = StringDUtil.changeNullToEmpty(hashMap.get("BIZTYPE"));
|
||||
hashMap.put("BIZTYPE", bizTypeMap.get(biztype));
|
||||
|
||||
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE"));
|
||||
hashMap.put("PAYTYPE", peyTypeMap.get(paytype));
|
||||
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
// 定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"交易状态", "业务类型", "支付方式", "交易时间", "交易日期", "操作员", "总金额", "平台交易号", "his订单号", "患者id", "患者姓名", "来源"};
|
||||
String[] sqlKey = {"TRADINGSTATUS", "BIZTYPE", "PAYTYPE", "TRADETIME", "TRADE_DATE", "HISOPERCODE", "AMOUNT", "PLATFORMTRANSID", "HISTRANSID", "PATIENTID", "PATIENTNAME", "SOURCE"};
|
||||
|
||||
List<Object> rulList = new ArrayList<Object>(list);
|
||||
|
||||
// 创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("5000", 3);
|
||||
exportXLS.modifyWidthOfHeader("5000", 4);
|
||||
exportXLS.modifyWidthOfHeader("5000", 5);
|
||||
exportXLS.modifyWidthOfHeader("8000", 6);
|
||||
exportXLS.modifyWidthOfHeader("5000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("10000", 11);
|
||||
// exportXLS.modifyWidthOfHeader("5000", 12);
|
||||
|
||||
// 文件名称
|
||||
// 产生4位长度的随机码(由字母和数字组成)
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/HisDetail/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "HisDetail/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,730 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.*;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 主页数据
|
||||
* @date 2021/10/15 15:54
|
||||
*/
|
||||
|
||||
@RequestMapping("/home")
|
||||
@Controller
|
||||
@Slf4j
|
||||
@Api(tags = "主页数据")
|
||||
public class HomeDateController {
|
||||
|
||||
@Autowired
|
||||
private UnilateralService unilateralService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@Autowired
|
||||
private BankbillHistoryService bankbillHistoryService;
|
||||
|
||||
@Autowired
|
||||
private HisInterFaceConfigService hisInterFaceConfigService;
|
||||
|
||||
@Autowired
|
||||
private HisDetailService hisDetailService;
|
||||
|
||||
@Autowired
|
||||
private TransactionDetailService transactionDetailService;
|
||||
|
||||
/**
|
||||
* @param modelMap
|
||||
* @return
|
||||
* @description 主页面
|
||||
* @author dqzhang
|
||||
* @created 2019年11月13日 下午5:10:21
|
||||
*/
|
||||
@RequestMapping("/toHome")
|
||||
public String home(ModelMap modelMap) {
|
||||
|
||||
return "home/home";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询对账总览数据
|
||||
* @author thuang
|
||||
* @date 2021/9/18 16:26
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findDZData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询对账总览数据")
|
||||
public HashMap<Object, Object> findDZData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
|
||||
//查询关联表数据
|
||||
map.put("is_active", "1");
|
||||
map.put("check_result", "1");
|
||||
List<HashMap<Object, Object>> hisAndThirdJoinData = transactionDetailService.findHisAndThirdJoinData(map);
|
||||
int unilateralNum = hisAndThirdJoinData.size();
|
||||
|
||||
BigDecimal his_unilateral = new BigDecimal(0);
|
||||
BigDecimal third_unilateral = new BigDecimal(0);
|
||||
for (int i = 0; i < hisAndThirdJoinData.size(); i++) {
|
||||
HashMap<Object, Object> hashMap = hisAndThirdJoinData.get(i);
|
||||
String his_money = StringDUtil.changeNullToEmpty(hashMap.get("AMOUNT"));
|
||||
if (!"".equals(his_money)) {
|
||||
his_unilateral = his_unilateral.add(new BigDecimal(his_money));
|
||||
}
|
||||
|
||||
String third_money = StringDUtil.changeNullToEmpty(hashMap.get("I_JYJE"));
|
||||
if (!"".equals(third_money)) {
|
||||
third_unilateral = third_unilateral.add(new BigDecimal(third_money));
|
||||
}
|
||||
}
|
||||
|
||||
responseMap.put("unilateralNum", unilateralNum);
|
||||
responseMap.put("his_unilateral", his_unilateral);
|
||||
responseMap.put("third_unilateral", third_unilateral);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询交易总览数据
|
||||
* @author thuang
|
||||
* @date 2021/10/15 16:08
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findJYData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询交易总览数据")
|
||||
public HashMap<Object, Object> findJYData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
//计算两个日期间总共的天
|
||||
//先计算相差几天
|
||||
long daysOfTowDiffDate = DateDUtil.getDaysOfTowDiffDate(startTime, endTime);
|
||||
//补充被减的当天
|
||||
daysOfTowDiffDate++;
|
||||
|
||||
//从关联表查询交易笔数和金额
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findAllBankDetailNum(map);
|
||||
int num = 0;
|
||||
if (list.size() > 0) {
|
||||
num = Integer.parseInt(StringDUtil.changeNullToEmpty(list.get(0).get("NUM")));
|
||||
}
|
||||
|
||||
BigDecimal avgNum = new BigDecimal(num).divide(new BigDecimal(daysOfTowDiffDate), 0, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
|
||||
List<HashMap<Object, Object>> list2 = transactionDetailService.findAllBankDetailSum(map);
|
||||
BigDecimal money = new BigDecimal(0);
|
||||
if (list2.size() > 0) {
|
||||
money = new BigDecimal(StringDUtil.changeNullToEmpty(list2.get(0).get("MONEY")));
|
||||
}
|
||||
|
||||
BigDecimal avgMoney = money.divide(new BigDecimal(daysOfTowDiffDate), 2, BigDecimal.ROUND_HALF_UP);
|
||||
money = money.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
|
||||
responseMap.put("allNum", num);
|
||||
responseMap.put("avgNum", avgNum);
|
||||
responseMap.put("allMoney", money);
|
||||
responseMap.put("avgMoney", avgMoney);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询单边账数量
|
||||
* @author thuang
|
||||
* @date 2021/10/18 13:14
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findDBZNum")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询单边账数量")
|
||||
public HashMap<Object, Object> findDBZNum(@RequestBody HashMap<Object, Object> map) {
|
||||
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
|
||||
List<String> betweenDate = DateDUtil.getBetweenDate(startTime, endTime);
|
||||
|
||||
//先生成key为日期的linkhashMap
|
||||
LinkedHashMap<String, Integer> numMap = new LinkedHashMap<String, Integer>();
|
||||
for (String day : betweenDate) {
|
||||
numMap.put(day, 0);
|
||||
}
|
||||
|
||||
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findDBZNum(map);
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String trade_date = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String num = StringDUtil.changeNullToEmpty(hashMap.get("NUM"));
|
||||
numMap.put(trade_date, Integer.parseInt(num));
|
||||
}
|
||||
|
||||
List<String> betweenDateList = new ArrayList<>();
|
||||
List<Integer> numList = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
|
||||
for (String key : numMap.keySet()) {
|
||||
Date date = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, key);
|
||||
betweenDateList.add(sdf.format(date));
|
||||
|
||||
Integer integer = numMap.get(key);
|
||||
numList.add(integer);
|
||||
}
|
||||
|
||||
responseMap.put("betweenDate", betweenDateList);
|
||||
responseMap.put("numList", numList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询单边账数量失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询单边账概率
|
||||
* @author thuang
|
||||
* @date 2021/10/18 14:10
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findDBZPro")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询单边账概率")
|
||||
public HashMap<Object, Object> findDBZPro(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
|
||||
List<String> betweenDate = DateDUtil.getBetweenDate(startTime, endTime);
|
||||
|
||||
//查询字典表支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> payMethodMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
String dicname = dicinfo.getDicname();
|
||||
String dicvalue = dicinfo.getDicvalue();
|
||||
|
||||
//聚合支付 银行卡支付 其他剩下的全算其他
|
||||
if ((dicname).contains("微信支付") || (dicname).contains("支付宝支付")) {
|
||||
payMethodMap.put(dicvalue, dicname);
|
||||
}
|
||||
}
|
||||
|
||||
//先组织好map
|
||||
LinkedHashMap<String, LinkedHashMap<String, String>> managerMap = new LinkedHashMap<>();// 每天每种数量map
|
||||
LinkedHashMap<String, LinkedHashMap<String, String>> unilateralMap = new LinkedHashMap<>();// 单边账记录数map
|
||||
LinkedHashMap<String, String> addMap = new LinkedHashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
|
||||
List<String> betweenDateList = new ArrayList<>();
|
||||
for (String s : betweenDate) {
|
||||
addMap.put(s, "0");
|
||||
|
||||
Date date = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, s);
|
||||
betweenDateList.add(sdf.format(date));
|
||||
}
|
||||
|
||||
managerMap.put("微信支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
managerMap.put("支付宝支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
managerMap.put("其他", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
|
||||
unilateralMap.put("微信支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
unilateralMap.put("支付宝支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
unilateralMap.put("其他", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
|
||||
//返回格式化后的日期数组
|
||||
responseMap.put("betweenDate", betweenDateList);
|
||||
|
||||
//查询能对上的数量 对不上的都不能确定该记录是否存在 所以除以对的上的数量
|
||||
map.put("is_active", "1");
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findJoinDataNumByTime(map);
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String i_jyqd = StringDUtil.changeNullToEmpty(hashMap.get("I_ZFFS"));
|
||||
String i_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String totalNum = StringDUtil.changeNullToEmpty(hashMap.get("TOTALNUM"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(i_jyqd);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = managerMap.get(str_zffs);
|
||||
/*if (zffsMap==null){
|
||||
managerMap.put(str_zffs,new LinkedHashMap<String,String>(){{putAll(addMap);}});
|
||||
zffsMap = managerMap.get(str_zffs);
|
||||
}*/
|
||||
String countNum = zffsMap.get(i_jyrq);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(totalNum)).toString();
|
||||
zffsMap.put(i_jyrq, countNum);
|
||||
}
|
||||
|
||||
//查询单边账记录
|
||||
List<HashMap<Object, Object>> dbzList = transactionDetailService.findDBZFLNumByTime(map);
|
||||
for (HashMap<Object, Object> hashMap : dbzList) {
|
||||
String payType = StringDUtil.changeNullToEmpty(hashMap.get("I_ZFFS"));
|
||||
String trade_date = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String num = StringDUtil.changeNullToEmpty(hashMap.get("NUM"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(payType);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = unilateralMap.get(str_zffs);
|
||||
/*if (zffsMap==null){
|
||||
unilateralMap.put(str_zffs,new LinkedHashMap<String,String>(){{putAll(addMap);}});
|
||||
zffsMap = unilateralMap.get(str_zffs);
|
||||
}*/
|
||||
String countNum = zffsMap.get(trade_date);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(num)).toString();
|
||||
zffsMap.put(trade_date, countNum);
|
||||
}
|
||||
|
||||
LinkedHashMap<String, String> alldayNumMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, String> allDBZMap = new LinkedHashMap<>();
|
||||
|
||||
List<HashMap<String, Object>> resultManagerList = new ArrayList<>();
|
||||
|
||||
//key 支付方式
|
||||
for (String key : unilateralMap.keySet()) {
|
||||
LinkedHashMap<String, String> dbzMap = unilateralMap.get(key);
|
||||
LinkedHashMap<String, String> allMap = managerMap.get(key);
|
||||
|
||||
List<String> newList = new ArrayList<>();
|
||||
|
||||
//key2 日期
|
||||
for (String key2 : dbzMap.keySet()) {
|
||||
String dbzNum = dbzMap.get(key2);
|
||||
String allNum = allMap.get(key2);
|
||||
|
||||
//统计总共
|
||||
String num = alldayNumMap.get(key2);
|
||||
if (num != null) {
|
||||
alldayNumMap.put(key2, new BigDecimal(num).add(new BigDecimal(allNum)).toString());
|
||||
} else {
|
||||
alldayNumMap.put(key2, allNum);
|
||||
}
|
||||
|
||||
//统计单边账总共
|
||||
String dbz = allDBZMap.get(key2);
|
||||
if (dbz != null) {
|
||||
allDBZMap.put(key2, new BigDecimal(dbz).add(new BigDecimal(dbzNum)).toString());
|
||||
} else {
|
||||
allDBZMap.put(key2, dbzNum);
|
||||
}
|
||||
|
||||
//计算不同支付方式的数据
|
||||
if ("0".equals(dbzNum)) {
|
||||
newList.add("0");
|
||||
} else {
|
||||
if ("0".equals(allNum)) {
|
||||
newList.add("100");
|
||||
} else {
|
||||
BigDecimal divide = new BigDecimal(dbzNum).multiply(new BigDecimal(100)).divide(new BigDecimal(allNum), 2, BigDecimal.ROUND_HALF_UP);
|
||||
if (divide.compareTo(new BigDecimal(100)) > 0) {
|
||||
newList.add("100");
|
||||
} else {
|
||||
newList.add(divide.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HashMap<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("name", key);
|
||||
newMap.put("data", newList);
|
||||
|
||||
resultManagerList.add(newMap);
|
||||
}
|
||||
|
||||
List<HashMap<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
//计算总共的
|
||||
HashMap<String, Object> newMap = new HashMap<>();
|
||||
List<String> newList = new ArrayList<>();
|
||||
newMap.put("name", "全部");
|
||||
for (String s : allDBZMap.keySet()) {
|
||||
String dbzNum = allDBZMap.get(s);
|
||||
String allNum = alldayNumMap.get(s);
|
||||
|
||||
//计算不同支付方式的数据
|
||||
if ("0".equals(dbzNum)) {
|
||||
newList.add("0");
|
||||
} else {
|
||||
if ("0".equals(allNum)) {
|
||||
newList.add("100");
|
||||
} else {
|
||||
BigDecimal divide = new BigDecimal(dbzNum).multiply(new BigDecimal(100)).divide(new BigDecimal(allNum), 2, BigDecimal.ROUND_HALF_UP);
|
||||
if (divide.compareTo(new BigDecimal(100)) > 0) {
|
||||
newList.add("100");
|
||||
} else {
|
||||
newList.add(divide.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newMap.put("data", newList);
|
||||
resultList.add(newMap);
|
||||
resultList.addAll(resultManagerList);
|
||||
|
||||
responseMap.put("resultList", resultList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询单边账概率失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询交易趋势
|
||||
* @author thuang
|
||||
* @date 2021/10/18 14:51
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findjyqsChartsData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询交易趋势")
|
||||
public HashMap<Object, Object> findjyqsChartsData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
String num = StringDUtil.changeNullToEmpty(map.get("num")); //1笔数 2金额
|
||||
|
||||
List<String> betweenDate = DateDUtil.getBetweenDate(startTime, endTime);
|
||||
|
||||
//查询字典表支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> payMethodMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
String dicname = dicinfo.getDicname();
|
||||
String dicvalue = dicinfo.getDicvalue();
|
||||
|
||||
//聚合支付,银行卡支付 其他剩下的全算其他
|
||||
if ((dicname).contains("微信支付") || (dicname).contains("支付宝支付")) {
|
||||
payMethodMap.put(dicvalue, dicname);
|
||||
}
|
||||
}
|
||||
|
||||
//先组织好map
|
||||
LinkedHashMap<String, LinkedHashMap<String, String>> managerMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, String> addMap = new LinkedHashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
|
||||
List<String> betweenDateList = new ArrayList<>();
|
||||
for (String s : betweenDate) {
|
||||
addMap.put(s, "0");
|
||||
|
||||
Date date = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, s);
|
||||
betweenDateList.add(sdf.format(date));
|
||||
}
|
||||
|
||||
managerMap.put("微信支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
managerMap.put("支付宝支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
managerMap.put("其他", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
|
||||
//返回格式化后的日期数组
|
||||
responseMap.put("betweenDate", betweenDateList);
|
||||
|
||||
//查询一段时间内每种支付方式的笔数或金额 以银行端为主要数据 num为区分查询笔数还是金额
|
||||
if ("1".equals(num)) {
|
||||
List<HashMap<Object, Object>> thirdList = transactionDetailService.findBankBillNumByTime(map);
|
||||
|
||||
for (HashMap<Object, Object> hashMap : thirdList) {
|
||||
String num1 = StringDUtil.changeNullToEmpty(hashMap.get("NUM"));
|
||||
String i_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String i_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(i_zffs);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = managerMap.get(str_zffs);
|
||||
/*if (zffsMap==null){
|
||||
managerMap.put(str_zffs,new LinkedHashMap<String,String>(){{putAll(addMap);}});
|
||||
zffsMap = managerMap.get(str_zffs);
|
||||
}*/
|
||||
String countNum = zffsMap.get(i_jyrq);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(num1)).toString();
|
||||
zffsMap.put(i_jyrq, countNum);
|
||||
}
|
||||
|
||||
} else if ("2".equals(num)) {
|
||||
List<HashMap<Object, Object>> thirdList = transactionDetailService.findBankBillMoneyByTime(map);
|
||||
for (HashMap<Object, Object> hashMap : thirdList) {
|
||||
String money = StringDUtil.changeNullToEmpty(hashMap.get("MONEY"));
|
||||
log.info("hhuoqude money is :" + money);
|
||||
String i_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String i_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(i_zffs);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = managerMap.get(str_zffs);
|
||||
/*if (zffsMap==null){
|
||||
managerMap.put(str_zffs,new LinkedHashMap<String,String>(){{putAll(addMap);}});
|
||||
zffsMap = managerMap.get(str_zffs);
|
||||
}*/
|
||||
String countNum = zffsMap.get(i_jyrq);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(money)).toString();
|
||||
zffsMap.put(i_jyrq, countNum);
|
||||
}
|
||||
}
|
||||
|
||||
//将linkedHashMap转为list<hashMap<>> hashMap 中 name 支付方式,data list集合 内容为计算的数据
|
||||
List<HashMap<String, Object>> resultList = new ArrayList<>();
|
||||
for (String key : managerMap.keySet()) {
|
||||
LinkedHashMap<String, String> linkedHashMap = managerMap.get(key);
|
||||
List<String> newList = new ArrayList<>();
|
||||
for (String key2 : linkedHashMap.keySet()) {
|
||||
String s = linkedHashMap.get(key2);
|
||||
newList.add(s);
|
||||
}
|
||||
HashMap<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("name", key);
|
||||
newMap.put("data", newList);
|
||||
resultList.add(newMap);
|
||||
}
|
||||
responseMap.put("resultList", resultList);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询交易趋势失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 查询交易占比
|
||||
* @author thuang
|
||||
* @date 2021/10/18 14:51
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findjyzbChartsData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询交易占比")
|
||||
public HashMap<Object, Object> findjyzbChartsData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
String num = StringDUtil.changeNullToEmpty(map.get("num"));//1笔数 2金额
|
||||
|
||||
|
||||
//查询字典表支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> payMethodMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
String dicname = dicinfo.getDicname();
|
||||
String dicvalue = dicinfo.getDicvalue();
|
||||
|
||||
//微信支付支付宝支付 其他剩下的全算其他
|
||||
if (dicname.contains("微信") || dicname.contains("支付宝")) {
|
||||
payMethodMap.put(dicvalue, dicname);
|
||||
}
|
||||
}
|
||||
|
||||
//查询一段时间内每种支付方式的笔数或金额 以银行端为主要数据
|
||||
List<HashMap<Object, Object>> resultList = new ArrayList<>();
|
||||
String allDataNum = "";
|
||||
if ("1".equals(num)) {
|
||||
List<HashMap<Object, Object>> thirdList = transactionDetailService.findBankBillNumByTime(map);
|
||||
|
||||
//循环记录 只分为支付宝和其他
|
||||
String oldZffs = "";
|
||||
HashMap<String, String> newMap = new HashMap<>();
|
||||
int jyNum = 0;
|
||||
int allNum = 0;
|
||||
for (int i = 0; i < thirdList.size(); i++) {
|
||||
HashMap<Object, Object> hashMap = thirdList.get(i);
|
||||
String num1 = StringDUtil.changeNullToEmpty(hashMap.get("NUM"));
|
||||
String i_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String i_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
|
||||
allNum = allNum + Integer.parseInt(num1);
|
||||
|
||||
String s = payMethodMap.get(i_zffs);
|
||||
if (s == null) {
|
||||
s = "其他";
|
||||
}
|
||||
String numStr = newMap.get(s);
|
||||
if (numStr == null) {
|
||||
newMap.put(s, "0");
|
||||
}
|
||||
numStr = newMap.get(s);
|
||||
int thisNum = Integer.parseInt(numStr) + Integer.parseInt(num1);
|
||||
newMap.put(s, "" + thisNum);
|
||||
|
||||
}
|
||||
|
||||
for (String key : newMap.keySet()) {
|
||||
String s = newMap.get(key);
|
||||
|
||||
HashMap<Object, Object> addMap = new HashMap<>();
|
||||
addMap.put("name", key);
|
||||
addMap.put("value", s);
|
||||
|
||||
resultList.add(addMap);
|
||||
}
|
||||
|
||||
allDataNum = "" + allNum;
|
||||
} else if ("2".equals(num)) {
|
||||
List<HashMap<Object, Object>> thirdList = transactionDetailService.findBankBillMoneyByTime(map);
|
||||
|
||||
String oldZffs = "";
|
||||
HashMap<String, String> newMap = new HashMap<>();
|
||||
BigDecimal addMoney = new BigDecimal(0);
|
||||
BigDecimal allMoney = new BigDecimal(0);
|
||||
for (int i = 0; i < thirdList.size(); i++) {
|
||||
HashMap<Object, Object> hashMap = thirdList.get(i);
|
||||
String money = StringDUtil.changeNullToEmpty(hashMap.get("MONEY"));
|
||||
String i_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("TRADE_DATE"));
|
||||
String i_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
|
||||
addMoney = addMoney.add(new BigDecimal(money));
|
||||
allMoney = allMoney.add(new BigDecimal(money));
|
||||
|
||||
String s = payMethodMap.get(i_zffs);
|
||||
if (s == null) {
|
||||
s = "其他";
|
||||
}
|
||||
String moneyStr = newMap.get(s);
|
||||
if (moneyStr == null) {
|
||||
newMap.put(s, "0");
|
||||
}
|
||||
moneyStr = newMap.get(s);
|
||||
BigDecimal thisMoney = new BigDecimal(moneyStr).add(new BigDecimal(money));
|
||||
newMap.put(s, thisMoney.toString());
|
||||
}
|
||||
|
||||
for (String key : newMap.keySet()) {
|
||||
String s = newMap.get(key);
|
||||
|
||||
HashMap<Object, Object> addMap = new HashMap<>();
|
||||
addMap.put("name", key);
|
||||
addMap.put("value", s);
|
||||
resultList.add(addMap);
|
||||
}
|
||||
|
||||
allDataNum = allMoney.toString();
|
||||
}
|
||||
|
||||
responseMap.put("resultList", resultList);
|
||||
responseMap.put("allDataNum", allDataNum);
|
||||
//厂商
|
||||
// List<HashMap<Object, Object>> firmlist = hisInterFaceConfigService.findAllconfig();
|
||||
// HashMap<String, String> firmMap = new HashMap<>();
|
||||
// for (HashMap<Object, Object> hashMap : firmlist) {
|
||||
// String id = StringDUtil.changeNullToEmpty(hashMap.get("ID"));
|
||||
// String his_interface_name = StringDUtil.changeNullToEmpty(hashMap.get("HIS_INTERFACE_NAME"));
|
||||
// firmMap.put(id, his_interface_name);
|
||||
// }
|
||||
//
|
||||
// List<HashMap<Object, Object>> firmNumList = hisDetailService.findHisDetailFirmNumByTime(map);
|
||||
// List<HashMap<Object, Object>> firmNumResultList = new ArrayList<>();
|
||||
// for (HashMap<Object, Object> hashMap : firmNumList) {
|
||||
// String his_wsdl_id = StringDUtil.changeNullToEmpty(hashMap.get("HIS_WSDL_ID"));
|
||||
// String firmNum = StringDUtil.changeNullToEmpty(hashMap.get("FIRMNUM"));
|
||||
//
|
||||
// HashMap<Object, Object> newMap = new HashMap<>();
|
||||
// newMap.put("name", firmMap.get(his_wsdl_id));
|
||||
// newMap.put("value", firmNum);
|
||||
// firmNumResultList.add(newMap);
|
||||
// }
|
||||
//
|
||||
// responseMap.put("firmNumResultList", firmNumResultList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询交易趋势失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.service.OperatorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 操作员
|
||||
* @date 2021/9/29 14:51
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/operator")
|
||||
@Api(tags = "操作员相关接口")
|
||||
public class OperatorController {
|
||||
|
||||
@Autowired
|
||||
private OperatorService operatorService;
|
||||
|
||||
@RequestMapping("/toOperator")
|
||||
public String toOperator(ModelMap modelMap) {
|
||||
|
||||
return "operator/operator";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询操作员
|
||||
* @author thuang
|
||||
* @date 2021/9/17 8:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findOperator")
|
||||
@ResponseBody
|
||||
@ApiOperation("查询操作员")
|
||||
public HashMap<Object, Object> findOperator(String likeFiled, String is_active, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("likeFiled", likeFiled);
|
||||
map.put("is_active", is_active);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(operatorService.findAllOperator(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 添加操作员 根据操作员号如果已有 更新,并且设置启用
|
||||
* @author thuang
|
||||
* @date 2021/9/30 10:17
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/addOperator")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "添加操作员 根据操作员号如果已有 更新,并且设置启用")
|
||||
public HashMap<Object, Object> addOperator(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
operatorService.addOperator(map);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "添加操作员失败,原因:" + e.getMessage();
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 修改操作员
|
||||
* @author thuang
|
||||
* @date 2021/9/30 10:44
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/modifyOperator")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "修改操作员")
|
||||
public HashMap<Object, Object> modifyOperator(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
operatorService.modifyOperator(map);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "修改操作员失败,原因:" + e.getMessage();
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除操作员
|
||||
* @author thuang
|
||||
* @date 2021/9/30 10:44
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/deleteOperator")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "删除操作员")
|
||||
public HashMap<Object, Object> deleteOperator(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
operatorService.deleteOperator(map);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "删除操作员失败,原因:" + e.getMessage();
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.BankbillHistoryService;
|
||||
import com.saye.hospitalgd.service.TransactionDetailService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import com.saye.hospitalgd.service.system.ServiceParamsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 支付统计
|
||||
* @date 2021/9/18 16:32
|
||||
*/
|
||||
@Controller
|
||||
@Slf4j
|
||||
@RequestMapping("/paymentStatistics")
|
||||
@Api(tags = "支付统计相关接口")
|
||||
public class PaymentStatisticsController {
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@Autowired
|
||||
private BankbillHistoryService bankbillHistoryService;
|
||||
|
||||
@Autowired
|
||||
private TransactionDetailService transactionDetailService;
|
||||
|
||||
@Autowired
|
||||
private ServiceParamsService serviceParamsService;
|
||||
|
||||
@RequestMapping("/toPaymentStatistics")
|
||||
public String toPaymentStatistics(ModelMap modelMap) {
|
||||
return "paymentStatistics/paymentStatistics";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询支付统计页面数据
|
||||
* @author thuang
|
||||
* @date 2021/10/22 16:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findpaymentStatisticsData")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询支付统计页面数据")
|
||||
public HashMap<Object, Object> findpaymentStatisticsData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
String startTime = StringDUtil.changeNullToEmpty(map.get("startTime"));
|
||||
String endTime = StringDUtil.changeNullToEmpty(map.get("endTime"));
|
||||
|
||||
List<String> betweenDate = DateDUtil.getBetweenDate(startTime, endTime);
|
||||
|
||||
// 查询字典表支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> payMethodMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
String dicname = dicinfo.getDicname();
|
||||
String dicvalue = dicinfo.getDicvalue();
|
||||
|
||||
// 微信支付支付宝支付 其他剩下的全算其他
|
||||
if ("支付宝支付".equals(dicname) || "微信支付".equals(dicname)) {
|
||||
payMethodMap.put(dicvalue, dicname);
|
||||
}
|
||||
}
|
||||
|
||||
// 先组织好map
|
||||
LinkedHashMap<String, LinkedHashMap<String, String>> numMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, LinkedHashMap<String, String>> moneyMap = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, String> addMap = new LinkedHashMap<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd");
|
||||
List<String> betweenDateList = new ArrayList<>();
|
||||
for (String s : betweenDate) {
|
||||
addMap.put(s, "0");
|
||||
|
||||
Date date = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, s);
|
||||
betweenDateList.add(sdf.format(date));
|
||||
}
|
||||
|
||||
numMap.put("支付宝支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
numMap.put("微信支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
numMap.put("其他", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
|
||||
moneyMap.put("支付宝支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
moneyMap.put("微信支付", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
moneyMap.put("其他", new LinkedHashMap<String, String>() {{
|
||||
putAll(addMap);
|
||||
}});
|
||||
|
||||
// 返回格式化后的日期数组
|
||||
responseMap.put("betweenDate", betweenDateList);
|
||||
|
||||
List<HashMap<Object, Object>> thirdNumList = bankbillHistoryService.findBankBillNumByTime(map);
|
||||
|
||||
for (HashMap<Object, Object> hashMap : thirdNumList) {
|
||||
String num1 = StringDUtil.changeNullToEmpty(hashMap.get("NUM"));
|
||||
String c_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("I_JYRQ"));
|
||||
String c_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_FXK"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(c_zffs);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = numMap.get(str_zffs);
|
||||
String countNum = zffsMap.get(c_jyrq);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(num1)).toString();
|
||||
zffsMap.put(c_jyrq, countNum);
|
||||
}
|
||||
|
||||
// 将linkedHashMap转为list<hashMap<>> hashMap 中 name 支付方式,data list集合 内容为计算的数据
|
||||
List<HashMap<String, Object>> resultNumList = new ArrayList<>();
|
||||
for (String key : numMap.keySet()) {
|
||||
LinkedHashMap<String, String> linkedHashMap = numMap.get(key);
|
||||
List<String> newList = new ArrayList<>();
|
||||
for (String key2 : linkedHashMap.keySet()) {
|
||||
String s = linkedHashMap.get(key2);
|
||||
newList.add(s);
|
||||
}
|
||||
HashMap<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("name", key);
|
||||
newMap.put("data", newList);
|
||||
resultNumList.add(newMap);
|
||||
}
|
||||
responseMap.put("resultNumList", resultNumList);
|
||||
|
||||
|
||||
List<HashMap<Object, Object>> thirdMoneyList = bankbillHistoryService.findBankBillMoneyByTime(map);
|
||||
for (HashMap<Object, Object> hashMap : thirdMoneyList) {
|
||||
String money = StringDUtil.changeNullToEmpty(hashMap.get("MONEY"));
|
||||
String c_jyrq = StringDUtil.changeNullToEmpty(hashMap.get("I_JYRQ"));
|
||||
String c_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_FXK"));
|
||||
String str_zffs = "";
|
||||
String s = payMethodMap.get(c_zffs);
|
||||
if (s == null) {
|
||||
str_zffs = "其他";
|
||||
} else {
|
||||
str_zffs = s;
|
||||
}
|
||||
LinkedHashMap<String, String> zffsMap = moneyMap.get(str_zffs);
|
||||
String countNum = zffsMap.get(c_jyrq);
|
||||
countNum = new BigDecimal(countNum).add(new BigDecimal(money)).toString();
|
||||
zffsMap.put(c_jyrq, countNum);
|
||||
}
|
||||
|
||||
// 将linkedHashMap转为list<hashMap<>> hashMap 中 name 支付方式,data list集合 内容为计算的数据
|
||||
List<HashMap<String, Object>> resultMoneyList = new ArrayList<>();
|
||||
for (String key : moneyMap.keySet()) {
|
||||
LinkedHashMap<String, String> linkedHashMap = moneyMap.get(key);
|
||||
List<String> newList = new ArrayList<>();
|
||||
for (String key2 : linkedHashMap.keySet()) {
|
||||
String s = linkedHashMap.get(key2);
|
||||
newList.add(s);
|
||||
}
|
||||
HashMap<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("name", key);
|
||||
newMap.put("data", newList);
|
||||
resultMoneyList.add(newMap);
|
||||
}
|
||||
responseMap.put("resultMoneyList", resultMoneyList);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询统计数据失败,原因:" + e.getMessage();
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 对账汇总统计
|
||||
* @author thuang
|
||||
* @date 2021/12/1 14:53
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/toSummary")
|
||||
@ApiOperation("对账汇总统计")
|
||||
public String toPrint(HttpServletRequest request, ModelMap modelMap) {
|
||||
|
||||
String trade_date = StringDUtil.changeNullToEmpty(request.getParameter("trade_date"));
|
||||
|
||||
|
||||
if ("".equals(trade_date)) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
} else {
|
||||
modelMap.addAttribute("startTime", trade_date);
|
||||
modelMap.addAttribute("endTime", trade_date);
|
||||
modelMap.addAttribute("isClick", "1");
|
||||
}
|
||||
|
||||
List<HashMap<Object, Object>> serviceParams = serviceParamsService.findParamValByParamCode("dzhz_table_name");
|
||||
String dzhz_table_name = StringDUtil.changeNullToEmpty(serviceParams.get(0).get("PARAM_VAL"));
|
||||
modelMap.addAttribute("table_name", dzhz_table_name);
|
||||
|
||||
return "paymentStatistics/summary";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询汇总表数据
|
||||
* @author thuang
|
||||
* @date 2021/12/3 16:29
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findSummaryData")
|
||||
@ResponseBody
|
||||
@ApiOperation("查询汇总表数据")
|
||||
public HashMap<Object, Object> findSummaryData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> resultMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
|
||||
map.put("is_active", "1");
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findHisAndThirdJoinData(map);
|
||||
|
||||
// his需要统计 1扫码支付 2银行卡支付 3掌医支付 4现金支付 5其他
|
||||
// 三方需要统计 1_1微信支付 1_2支付宝支付 云闪付支付 其他支付 2银行卡支付 3掌医支付 4现金支付 5其他
|
||||
|
||||
HashMap<Object, Object> hisMoneyData = new HashMap<>();
|
||||
hisMoneyData.put("1", "0");
|
||||
hisMoneyData.put("2", "0");
|
||||
hisMoneyData.put("3", "0");
|
||||
hisMoneyData.put("4", "0");
|
||||
hisMoneyData.put("5", "0");
|
||||
|
||||
HashMap<Object, Object> thirdMoneyData = new HashMap<>();
|
||||
thirdMoneyData.put("1_1", "0");
|
||||
thirdMoneyData.put("1_2", "0");
|
||||
thirdMoneyData.put("1_3", "0");
|
||||
thirdMoneyData.put("1_4", "0");
|
||||
thirdMoneyData.put("2", "0");
|
||||
thirdMoneyData.put("3", "0");
|
||||
thirdMoneyData.put("4", "0");
|
||||
thirdMoneyData.put("5", "0");
|
||||
|
||||
HashMap<Object, Object> hisNumData = new HashMap<>();
|
||||
hisNumData.put("1", "0");
|
||||
hisNumData.put("2", "0");
|
||||
hisNumData.put("3", "0");
|
||||
hisNumData.put("4", "0");
|
||||
hisNumData.put("5", "0");
|
||||
|
||||
|
||||
HashMap<Object, Object> thirdNumData = new HashMap<>();
|
||||
thirdNumData.put("1_1", "0");
|
||||
thirdNumData.put("1_2", "0");
|
||||
thirdNumData.put("1_3", "0");
|
||||
thirdNumData.put("1_4", "0");
|
||||
thirdNumData.put("2", "0");
|
||||
thirdNumData.put("3", "0");
|
||||
thirdNumData.put("4", "0");
|
||||
thirdNumData.put("5", "0");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
HashMap<Object, Object> hashMap = list.get(i);
|
||||
|
||||
String i_jyje = StringDUtil.changeNullToEmpty(hashMap.get("I_JYJE")).trim();
|
||||
String i_zffs = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD")).trim();
|
||||
|
||||
String amount = StringDUtil.changeNullToEmpty(hashMap.get("AMOUNT")).trim();
|
||||
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE")).trim();
|
||||
|
||||
// 如果银行端金额不为空
|
||||
|
||||
if (StrUtil.isNotBlank(i_jyje)) {
|
||||
log.info("hashMap is :" + hashMap);
|
||||
log.info("aaa is : " + thirdMoneyData.get(i_zffs));
|
||||
BigDecimal money = Convert.toBigDecimal(thirdMoneyData.get(i_zffs));
|
||||
money = money.add(new BigDecimal(i_jyje));
|
||||
thirdMoneyData.put(i_zffs, money.toString());
|
||||
|
||||
int num = Integer.parseInt(StringDUtil.changeNullToEmpty(thirdNumData.get(i_zffs)));
|
||||
num++;
|
||||
thirdNumData.put(i_zffs, num + "");
|
||||
}
|
||||
|
||||
// 如果his端金额不为空
|
||||
|
||||
if (StrUtil.isNotBlank(amount)) {
|
||||
log.info("hashMap is :" + hashMap);
|
||||
BigDecimal money = new BigDecimal(StringDUtil.changeNullToEmpty(hisMoneyData.get(paytype)));
|
||||
money = money.add(new BigDecimal(amount));
|
||||
hisMoneyData.put(paytype, money.toString());
|
||||
|
||||
int num = Integer.parseInt(StringDUtil.changeNullToEmpty(hisNumData.get(paytype)));
|
||||
num++;
|
||||
hisNumData.put(paytype, num + "");
|
||||
}
|
||||
}
|
||||
|
||||
resultMap.put("hisMoneyData", hisMoneyData);
|
||||
resultMap.put("thirdMoneyData", thirdMoneyData);
|
||||
resultMap.put("hisNumData", hisNumData);
|
||||
resultMap.put("thirdNumData", thirdNumData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询对账汇总表信息失败,原因:" + e.getMessage();
|
||||
}
|
||||
resultMap.put("errCode", errCode);
|
||||
resultMap.put("errMsg", errMsg);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.service.BankbillsHistoryService;
|
||||
import com.saye.hospitalgd.service.HisbillsHistoryService;
|
||||
import com.saye.hospitalgd.service.HisbillsOriginalService;
|
||||
import com.saye.hospitalgd.util.CSVUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2022/12/2
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/receiveData")
|
||||
public class ReceiveDataController {
|
||||
|
||||
@Autowired
|
||||
private BankbillsHistoryService bankbillsHistoryService;
|
||||
|
||||
@Autowired
|
||||
private HisbillsHistoryService hisbillsHistoryService;
|
||||
|
||||
@Autowired
|
||||
private HisbillsOriginalService hisbillsOriginalService;
|
||||
|
||||
// @Autowired
|
||||
// private HisInterfaceCountService hisInterfaceCountService;
|
||||
|
||||
@PostMapping("/receiveHisData")
|
||||
@ResponseBody
|
||||
public Map<Object, Object> receiveHisData(@RequestBody HashMap<Object, Object> hisbillsOriginal) {
|
||||
|
||||
log.info("接收到数据:" + hisbillsOriginal);
|
||||
|
||||
Map<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
//保存一份最初的
|
||||
hisbillsOriginalService.saveHisOriginalData(hisbillsOriginal);
|
||||
|
||||
//保存一份历史的
|
||||
hisbillsHistoryService.saveHisHistoryData(hisbillsOriginal);
|
||||
|
||||
log.info("his数据保存完毕");
|
||||
|
||||
|
||||
// //查看数据库今日接口统计是否记录
|
||||
// int i = hisInterfaceCountService.searchToday();
|
||||
// if (i > 0) {
|
||||
// hisInterfaceCountService.updateConut();
|
||||
// } else {
|
||||
// hisInterfaceCountService.insertCount();
|
||||
// }
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
//记录接口调用情况
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("his数据保存失败,原因:" + e.getMessage());
|
||||
responseMap.put("code", 999);
|
||||
responseMap.put("msg", e.getMessage());
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
@PostMapping("/receiveBankData")
|
||||
@ResponseBody
|
||||
public Map<Object, Object> receiveHisData(@RequestBody MultipartFile spareFile) {
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
List<HashMap<Object, Object>> savList = new ArrayList<>();
|
||||
//校验文件名是否正确
|
||||
String fileName = spareFile.getOriginalFilename();
|
||||
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
|
||||
|
||||
String substring = fileName.substring(0, 8);
|
||||
boolean matches = pattern.matcher(substring).matches();
|
||||
log.info("match is :" + matches);
|
||||
if (matches) {
|
||||
log.info("切割出来的字符串是" + substring);
|
||||
String year = substring.substring(0, 4);
|
||||
String month = substring.substring(4, 6);
|
||||
String day = substring.substring(6, 8);
|
||||
String rq = year + "-" + month + "-" + day;
|
||||
log.info("日期是: " + rq);
|
||||
} else {
|
||||
errCode = "999";
|
||||
errMsg = "文件名不合法";
|
||||
}
|
||||
|
||||
|
||||
if (!spareFile.isEmpty()) {
|
||||
|
||||
List<String[]> list = null;
|
||||
try {
|
||||
InputStream inputStream = spareFile.getInputStream();
|
||||
list = CSVUtils.getCsvData(inputStream);
|
||||
} catch (IOException e) {
|
||||
errCode = "999";
|
||||
errMsg = "获取文件失败";
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (list.size() != 0) {
|
||||
|
||||
for (int i = 5; i < list.size() - 2; i++) {
|
||||
String[] s = list.get(i);
|
||||
//遍历去除读取文件时字段前面读取的等号
|
||||
for (int i1 = 0; i1 < s.length; i1++) {
|
||||
if (s[i1].contains("=")) {
|
||||
s[i1] = StringUtils.substringAfter(s[i1], "=");
|
||||
}
|
||||
|
||||
if (s[i1].contains("\"")) {
|
||||
s[i1] = s[i1].replace("\"", "");
|
||||
}
|
||||
}
|
||||
HashMap<Object, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("I_ZDBH", s[1]);
|
||||
resultMap.put("I_DSFZFMC", s[2]);
|
||||
resultMap.put("I_JYLX", s[3]);
|
||||
resultMap.put("I_DSFDDH", s[4]);
|
||||
resultMap.put("I_ZFFS", s[5]);
|
||||
resultMap.put("I_SPMC", s[6]);
|
||||
resultMap.put("I_DDJE", s[7]);
|
||||
resultMap.put("I_JYSJ", s[8]);
|
||||
String[] s1 = s[8].split(" ");
|
||||
resultMap.put("I_JYRQ", s1[0]);
|
||||
resultMap.put("I_HBZL", s[9]);
|
||||
resultMap.put("I_XFJE", s[10]);
|
||||
resultMap.put("I_THJE", s[11]);
|
||||
resultMap.put("I_GHDDH", s[12]);
|
||||
resultMap.put("I_WBDDH", s[13]);
|
||||
resultMap.put("I_XFSXFJE", s[14]);
|
||||
resultMap.put("I_THSXFJE", s[15]);
|
||||
resultMap.put("I_RZJE", s[16]);
|
||||
resultMap.put("I_FKYH", s[18]);
|
||||
resultMap.put("I_YHBS", s[19]);
|
||||
savList.add(resultMap);
|
||||
// log.info("接收到的数据是: " + resultMap);
|
||||
}
|
||||
// int i = bankbillsHistoryService.saveOriginalData(savList);
|
||||
// int o = bankbillsHistoryService.saveHistoryData(savList);
|
||||
} else {
|
||||
errCode = "999";
|
||||
errMsg = "读取失败";
|
||||
}
|
||||
// log.info("接收到数据:" + spareFile.getOriginalFilename());
|
||||
}
|
||||
Map<Object, Object> responseMap = new HashMap<>();
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.excel.ExportXLSX;
|
||||
import com.saye.hospitalgd.commons.excel.HashMapConversionImpl;
|
||||
import com.saye.hospitalgd.commons.excel.IConversionByExport;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.service.BankbillHistoryService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 三方账单明细
|
||||
* @date 2021/9/13 15:52
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/thirdDetail")
|
||||
@Api(tags = "三方账单明细")
|
||||
public class ThirdDetailController {
|
||||
|
||||
@Autowired
|
||||
private BankbillHistoryService bankbillHistoryService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
/**
|
||||
* @description: 到三方对账页面
|
||||
* @author thuang
|
||||
* @date 2021/9/22 14:59
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/toThirdDetail")
|
||||
public String toThirdDetail(ModelMap modelMap) {
|
||||
|
||||
try {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
/*//查询现有支付方式
|
||||
List<HashMap<Object,Object>> list = bankbillHistoryService.findCzffs();
|
||||
modelMap.addAttribute("zffsList",list);*/
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
modelMap.addAttribute("payTypeList", pay_type);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "financialReconciliation/thirdDetail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询三方对账记录
|
||||
* @author thuang
|
||||
* @date 2021/9/17 8:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findThirdDetail")
|
||||
@ResponseBody
|
||||
@ApiOperation("查询三方对账记录")
|
||||
public HashMap<Object, Object> findThirdDetail(String c_zffs, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("c_zffs", c_zffs);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(bankbillHistoryService.findBankbillHistoryList(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @description: 统计第三方数据
|
||||
// * @author thuang
|
||||
// * @date 2021/9/17 8:55
|
||||
// * @version 1.0
|
||||
// */
|
||||
// @RequestMapping("/findThirdDetailCount")
|
||||
// @ResponseBody
|
||||
// public HashMap<Object, Object> findThirdDetailCount(String c_zffs, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
// HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
//
|
||||
// try {
|
||||
// HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
// map.put("c_zffs", c_zffs);
|
||||
// map.put("startTime", startTime);
|
||||
// map.put("endTime", endTime);
|
||||
// map.put("likeFiled", likeFiled);
|
||||
//
|
||||
//
|
||||
// List<HashMap<Object, Object>> bankbillHistoryList = bankbillHistoryService.findBankbillHistoryList(map);
|
||||
//
|
||||
// int thirdNum = 0;
|
||||
// BigDecimal thirdMoney = new BigDecimal(0);
|
||||
//
|
||||
// for (HashMap<Object, Object> hashMap : bankbillHistoryList) {
|
||||
// String i_jyje = StringDUtil.changeNullToEmpty(hashMap.get("I_JYJE"));
|
||||
// if (!StringUtils.isEmpty(i_jyje)) {
|
||||
// thirdMoney = thirdMoney.add(new BigDecimal(i_jyje));
|
||||
// thirdNum++;
|
||||
// }
|
||||
// }
|
||||
// responseMap.put("code", 0);
|
||||
// responseMap.put("msg", "OK");
|
||||
// responseMap.put("thirdNum", thirdNum);
|
||||
// responseMap.put("thirdMoney", thirdMoney);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// String msg = e.getMessage();
|
||||
// responseMap.put("code", 1);
|
||||
// responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return responseMap;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @description: 统计第三方数据
|
||||
* @author thuang
|
||||
* @date 2022/1/7 9:46
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findThirdCountData")
|
||||
@ResponseBody
|
||||
@ApiOperation("统计第三方数据")
|
||||
public HashMap<Object, Object> findThirdCountData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
try {
|
||||
List<HashMap<Object, Object>> thirdDetailCount = bankbillHistoryService.findBankbillCountData(map);
|
||||
|
||||
responseMap.put("money", thirdDetailCount.get(0).get("MONEY"));
|
||||
responseMap.put("num", thirdDetailCount.get(0).get("NUM"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询his记录统计数据,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 导出三方账单明细
|
||||
* @author thuang
|
||||
* @date 2021/10/22 15:38
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/exportThirdDetail")
|
||||
@ResponseBody
|
||||
@ApiOperation("导出三方账单明细")
|
||||
public HashMap<Object, Object> exportThirdDetail(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
List<HashMap<Object, Object>> thirdDetailCount = bankbillHistoryService.findBankbillCountData(map);
|
||||
|
||||
List<HashMap<Object, Object>> list = bankbillHistoryService.findBankbillHistoryList(map);
|
||||
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> peyTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
peyTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String i_fxk = StringDUtil.changeNullToEmpty(hashMap.get("I_FXK"));
|
||||
hashMap.put("I_FXK", peyTypeMap.get(i_fxk));
|
||||
}
|
||||
HashMap<Object, Object> tjMap = new HashMap<>();
|
||||
tjMap.put("I_JZRQ", "合计:");
|
||||
tjMap.put("I_YHLSH", "交易笔数共" + thirdDetailCount.get(0).get("NUM") + "笔,汇总金额" + thirdDetailCount.get(0).get("MONEY") + "元");
|
||||
list.add(tjMap);
|
||||
if (list.size() > 0) {
|
||||
//定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"交易时间", "交易日期", "记账日期", "银行流水号", "商户流水号", "订单号", "订单状态", "付款方账号/客户号", "付款方户名", "订单金额", "交易金额", "手续费", "结算金额", "柜台代码", "发卡行/通道", "支付卡种", "交易类型", "期数", "授权号", "项目号", "基本户", "备注一"};
|
||||
String[] sqlKey = {"I_JYSJ", "I_JYRQ", "I_JZRQ", "I_YHLSH", "I_SHLSH", "I_DDH", "I_DDZT", "I_FKFZH", "I_FKFHM", "I_DDJE", "I_JYJE", "I_SXF", "I_JSJE", "I_GTDM", "I_FXK", "I_ZFKZ", "I_JYLX", "I_QS", "I_SQH", "I_XMH", "I_JBH", "I_BZ"};
|
||||
|
||||
List<Object> rulList = new ArrayList<Object>(list);
|
||||
|
||||
//创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("10000", 3);
|
||||
exportXLS.modifyWidthOfHeader("6000", 4);
|
||||
exportXLS.modifyWidthOfHeader("10000", 5);
|
||||
exportXLS.modifyWidthOfHeader("5000", 6);
|
||||
exportXLS.modifyWidthOfHeader("5000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("5000", 11);
|
||||
exportXLS.modifyWidthOfHeader("5000", 12);
|
||||
exportXLS.modifyWidthOfHeader("5000", 13);
|
||||
exportXLS.modifyWidthOfHeader("5000", 14);
|
||||
exportXLS.modifyWidthOfHeader("10000", 15);
|
||||
exportXLS.modifyWidthOfHeader("6000", 16);
|
||||
exportXLS.modifyWidthOfHeader("5000", 17);
|
||||
exportXLS.modifyWidthOfHeader("5000", 18);
|
||||
exportXLS.modifyWidthOfHeader("5000", 19);
|
||||
exportXLS.modifyWidthOfHeader("5000", 20);
|
||||
exportXLS.modifyWidthOfHeader("5000", 21);
|
||||
|
||||
// 文件名称
|
||||
//产生4位长度的随机码(由字母和数字组成)
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/HisDetail/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "HisDetail/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.excel.ExportXLSX;
|
||||
import com.saye.hospitalgd.commons.excel.HashMapConversionImpl;
|
||||
import com.saye.hospitalgd.commons.excel.IConversionByExport;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.service.OperatorService;
|
||||
import com.saye.hospitalgd.service.TransactionDetailService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 交易明细
|
||||
* @date 2021/9/13 15:52
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/transactionDetail")
|
||||
@Api(tags = "交易明细")
|
||||
public class TransactionDetailController {
|
||||
|
||||
@Autowired
|
||||
private TransactionDetailService transactionDetailService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@Autowired
|
||||
private OperatorService operatorService;
|
||||
|
||||
@RequestMapping("/toTransactionDetail")
|
||||
public String toTransactionDetail(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
modelMap.addAttribute("payTypeList", pay_type);
|
||||
|
||||
//三方支付方式
|
||||
List<Dicinfo> third_pay = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
// System.out.println("!!!!!!!!!"+third_pay);
|
||||
modelMap.addAttribute("thirdPayList", third_pay);
|
||||
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
modelMap.addAttribute("bizTypeList", biz_type);
|
||||
|
||||
//操作员选择
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("is_active", "1");
|
||||
List<HashMap<Object, Object>> allOperator = null;
|
||||
try {
|
||||
allOperator = operatorService.findAllOperator(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
modelMap.addAttribute("operList", allOperator);
|
||||
// System.out.println("_________"+allOperator);
|
||||
|
||||
return "financialReconciliation/transactionDetail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 交易明细
|
||||
* @author thuang
|
||||
* @date 2021/9/28 10:55
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findHisAndThirdJoinData")
|
||||
@ResponseBody
|
||||
@ApiOperation("交易明细")
|
||||
public HashMap<Object, Object> findHisAndThirdJoinData(String BizType, String operCode, String payType, String thirdPay, String startTime, String endTime, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("payType", payType);
|
||||
map.put("BizType", BizType);
|
||||
map.put("thirdPay", thirdPay);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("operCode", operCode);
|
||||
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(transactionDetailService.findHisAndThirdJoinData(map));
|
||||
|
||||
List<HashMap<Object, Object>> list = pageInfo.getList();
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 交易明细统计
|
||||
* @author thuang
|
||||
* @date 2021/10/15 9:52
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/findHisAndThirdJoinCountData")
|
||||
@ResponseBody
|
||||
@ApiOperation("交易明细统计")
|
||||
public HashMap<Object, Object> findHisAndThirdJoinData(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
//查询所有
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findHisAndThirdJoinData(map);
|
||||
|
||||
int thirdNum = 0;
|
||||
int HISNum = 0;
|
||||
BigDecimal thirdMoney = new BigDecimal(0);
|
||||
BigDecimal thirdReceiveMoney = new BigDecimal(0);
|
||||
BigDecimal thirdRefundMoney = new BigDecimal(0);
|
||||
BigDecimal HISMoney = new BigDecimal(0);
|
||||
BigDecimal HISReceiveMoney = new BigDecimal(0);
|
||||
BigDecimal HISRefundMoney = new BigDecimal(0);
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
|
||||
String amount = StringDUtil.changeNullToEmpty(hashMap.get("AMOUNT"));
|
||||
String i_jyje = StringDUtil.changeNullToEmpty(hashMap.get("I_JYJE"));
|
||||
if (!StringUtils.isEmpty(i_jyje)) {
|
||||
thirdMoney = thirdMoney.add(new BigDecimal(i_jyje));
|
||||
|
||||
if (new BigDecimal(i_jyje).compareTo(BigDecimal.ZERO) > 0) {
|
||||
thirdReceiveMoney = thirdReceiveMoney.add(new BigDecimal(i_jyje));
|
||||
} else {
|
||||
thirdRefundMoney = thirdRefundMoney.add(new BigDecimal(i_jyje));
|
||||
}
|
||||
|
||||
thirdNum++;
|
||||
}
|
||||
if (!StringUtils.isEmpty(amount)) {
|
||||
HISMoney = HISMoney.add(new BigDecimal(amount));
|
||||
if (new BigDecimal(amount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
HISReceiveMoney = HISReceiveMoney.add(new BigDecimal(amount));
|
||||
} else {
|
||||
HISRefundMoney = HISRefundMoney.add(new BigDecimal(amount));
|
||||
}
|
||||
HISNum++;
|
||||
}
|
||||
|
||||
}
|
||||
responseMap.put("thirdNum", thirdNum);
|
||||
responseMap.put("thirdMoney", thirdMoney);
|
||||
responseMap.put("thirdReceiveMoney", thirdReceiveMoney);
|
||||
responseMap.put("thirdRefundMoney", thirdRefundMoney);
|
||||
responseMap.put("HISNum", HISNum);
|
||||
responseMap.put("HISMoney", HISMoney);
|
||||
responseMap.put("HISReceiveMoney", HISReceiveMoney);
|
||||
responseMap.put("HISRefundMoney", HISRefundMoney);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "查询交易明细统计失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 导出交易明细
|
||||
* @author thuang
|
||||
* @date 2021/10/22 8:52
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/exportHisAndThirdJoinCount")
|
||||
@ResponseBody
|
||||
@ApiOperation("导出交易明细")
|
||||
public HashMap<Object, Object> exportHisAndThirdJoinCount(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
|
||||
List<HashMap<Object, Object>> list = transactionDetailService.findHisAndThirdJoinData(map);
|
||||
HashMap<Object, Object> hm = new HashMap<>();
|
||||
|
||||
|
||||
int thirdNum = 0;
|
||||
int HISNum = 0;
|
||||
BigDecimal thirdMoney = new BigDecimal(0);
|
||||
BigDecimal thirdReceiveMoney = new BigDecimal(0);
|
||||
BigDecimal thirdRefundMoney = new BigDecimal(0);
|
||||
BigDecimal HISMoney = new BigDecimal(0);
|
||||
BigDecimal HISReceiveMoney = new BigDecimal(0);
|
||||
BigDecimal HISRefundMoney = new BigDecimal(0);
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
|
||||
String amount = StringDUtil.changeNullToEmpty(hashMap.get("AMOUNT"));
|
||||
String i_jyje = StringDUtil.changeNullToEmpty(hashMap.get("I_JYJE"));
|
||||
if (!StringUtils.isEmpty(i_jyje)) {
|
||||
thirdMoney = thirdMoney.add(new BigDecimal(i_jyje));
|
||||
|
||||
if (new BigDecimal(i_jyje).compareTo(BigDecimal.ZERO) > 0) {
|
||||
thirdReceiveMoney = thirdReceiveMoney.add(new BigDecimal(i_jyje));
|
||||
} else {
|
||||
thirdRefundMoney = thirdRefundMoney.add(new BigDecimal(i_jyje));
|
||||
}
|
||||
|
||||
thirdNum++;
|
||||
}
|
||||
if (!StringUtils.isEmpty(amount)) {
|
||||
HISMoney = HISMoney.add(new BigDecimal(amount));
|
||||
if (new BigDecimal(amount).compareTo(BigDecimal.ZERO) > 0) {
|
||||
HISReceiveMoney = HISReceiveMoney.add(new BigDecimal(amount));
|
||||
} else {
|
||||
HISRefundMoney = HISRefundMoney.add(new BigDecimal(amount));
|
||||
}
|
||||
HISNum++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// responseMap.put("thirdNum", thirdNum);
|
||||
// responseMap.put("thirdMoney", thirdMoney);
|
||||
// responseMap.put("thirdReceiveMoney", thirdReceiveMoney);
|
||||
// responseMap.put("thirdRefundMoney", thirdRefundMoney);
|
||||
// responseMap.put("HISNum", HISNum);
|
||||
// responseMap.put("HISMoney", HISMoney);
|
||||
// responseMap.put("HISReceiveMoney", HISReceiveMoney);
|
||||
// responseMap.put("HISRefundMoney", HISRefundMoney);
|
||||
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
HashMap<String, String> peyTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
peyTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
//支付方式
|
||||
List<Dicinfo> third_pay = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> thirdPayMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : third_pay) {
|
||||
thirdPayMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
//业务类型
|
||||
List<Dicinfo> biz_type = dicinfoService.findDicinfoTreeNodeList("BIZ_TYPE");
|
||||
HashMap<String, String> bizTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : biz_type) {
|
||||
bizTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
//操作员选择
|
||||
HashMap<Object, Object> activeMap = new HashMap<>();
|
||||
activeMap.put("is_active", "1");
|
||||
List<HashMap<Object, Object>> allOperator = null;
|
||||
try {
|
||||
allOperator = operatorService.findAllOperator(activeMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE"));
|
||||
hashMap.put("PAYTYPE", peyTypeMap.get(paytype));
|
||||
|
||||
String i_jyqd = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
hashMap.put("I_JYQD", thirdPayMap.get(i_jyqd));
|
||||
|
||||
|
||||
String bizType = StringDUtil.changeNullToEmpty(hashMap.get("BIZTYPE"));
|
||||
hashMap.put("BIZTYPE", bizTypeMap.get(bizType));
|
||||
|
||||
String hisopernum = StringDUtil.changeNullToEmpty(hashMap.get("HISOPERNUM"));
|
||||
HashMap<Object, Object> hisOper = allOperator.stream().filter(h -> h.get("HISOPERCODE").equals(hisopernum)).findAny().orElse(null);
|
||||
if (hisOper != null) {
|
||||
hashMap.put("HISOPERNUM", hisOper.get("USER_NAME"));
|
||||
}
|
||||
|
||||
// String paymethod = StringDUtil.changeNullToEmpty(hashMap.get("PAYMETHOD"));
|
||||
// String paymethodStr="";
|
||||
// if ("1".equals(paymethod)){
|
||||
// paymethodStr="门诊";
|
||||
// }else if ("2".equals(paymethod)){
|
||||
// paymethodStr="住院";
|
||||
// }
|
||||
// hashMap.put("PAYMETHOD",paymethodStr);
|
||||
|
||||
String tradingStatus = StringDUtil.changeNullToEmpty(hashMap.get("H_JYLX"));
|
||||
String tradingStatusStr = "";
|
||||
if ("1".equals(tradingStatus)) {
|
||||
tradingStatusStr = "收款记录";
|
||||
} else if ("2".equals(tradingStatus)) {
|
||||
tradingStatusStr = "退款记录";
|
||||
}
|
||||
hashMap.put("H_JYLX", tradingStatusStr);
|
||||
}
|
||||
|
||||
hm.put("PAYTYPE", "合计结果:");
|
||||
hm.put("TRANID", "第三方交易笔数共" + thirdNum + "笔,收款总计" + thirdReceiveMoney + "元,退款总计" + thirdRefundMoney + "元,汇总金额" + thirdMoney + "元;HIS交易共" + HISNum + "笔,收款总计" + HISReceiveMoney + "元,退款总计" + HISRefundMoney + "元,汇总金额" + HISMoney + "元;");
|
||||
list.add(hm);
|
||||
|
||||
|
||||
if (list.size() > 0) {
|
||||
//定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"业务类型", "交易状态", "支付方式", "HIS订单号", "金额", "交易时间", "操作员号", "患者姓名", "支付方式", "订单号", "金额", "交易时间"};
|
||||
String[] sqlKey = {"BIZTYPE", "H_JYLX", "PAYTYPE", "TRANID", "AMOUNT", "TRADETIME", "HISOPERNUM", "PATIENTNAME", "I_JYQD", "I_DDH", "I_JYJE", "JYSJ"};
|
||||
|
||||
List<Object> rulList = new ArrayList<Object>(list);
|
||||
|
||||
//创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("10000", 3);
|
||||
exportXLS.modifyWidthOfHeader("5000", 4);
|
||||
exportXLS.modifyWidthOfHeader("5000", 5);
|
||||
exportXLS.modifyWidthOfHeader("5000", 6);
|
||||
exportXLS.modifyWidthOfHeader("5000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("10000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("5000", 11);
|
||||
// exportXLS.modifyWidthOfHeader("5000", 11);
|
||||
|
||||
// 文件名称
|
||||
//产生4位长度的随机码(由字母和数字组成)
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/TranscationDetail/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "TranscationDetail/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,522 @@
|
||||
package com.saye.hospitalgd.controller;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.excel.ExportXLSX;
|
||||
import com.saye.hospitalgd.commons.excel.HashMapConversionImpl;
|
||||
import com.saye.hospitalgd.commons.excel.IConversionByExport;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.commons.uuid.UUIDGenerator;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.ReconciliationMethod;
|
||||
import com.saye.hospitalgd.service.BankbillHistoryService;
|
||||
import com.saye.hospitalgd.service.RefundService;
|
||||
import com.saye.hospitalgd.service.TransactionDetailService;
|
||||
import com.saye.hospitalgd.service.UnilateralService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import com.saye.hospitalgd.service.system.ServiceParamsService;
|
||||
import com.saye.hospitalgd.util.IpUtil;
|
||||
import com.saye.hospitalgd.util.RefundUtil;
|
||||
import com.saye.hospitalgd.util.SeriesNumUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 单边账
|
||||
* @date 2021/9/28 11:15
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/unilateral")
|
||||
@Api(tags = "单边账")
|
||||
public class UnilateralController {
|
||||
|
||||
@Autowired
|
||||
private UnilateralService unilateralService;
|
||||
|
||||
@Autowired
|
||||
private TransactionDetailService transactionDetailService;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@Autowired
|
||||
private ServiceParamsService serviceParamsService;
|
||||
|
||||
@Autowired
|
||||
private BankbillHistoryService bankbillHistoryService;
|
||||
|
||||
@Autowired
|
||||
private RefundService refundService;
|
||||
|
||||
@RequestMapping("/toUnilateral")
|
||||
public String toUnilateral(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
modelMap.addAttribute("payTypeList", pay_type);
|
||||
|
||||
//三方支付方式
|
||||
List<Dicinfo> third_pay = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
modelMap.addAttribute("thirdPayList", third_pay);
|
||||
|
||||
|
||||
return "financialReconciliation/unilateral";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 查询单边账记录
|
||||
* @author thuang
|
||||
* @date 2021/9/28 14:14
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findAllUnilateral")
|
||||
@ResponseBody
|
||||
@ApiOperation("查询单边账记录")
|
||||
public HashMap<Object, Object> findAllUnilateral(String payType, String thirdPay, String startTime, String endTime, String err_type, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("payType", payType);
|
||||
map.put("thirdPay", thirdPay);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("err_type", err_type);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(unilateralService.findAllUnilateral(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 导出单边账明细
|
||||
* @author thuang
|
||||
* @date 2021/10/22 8:52
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/exportUnilateral")
|
||||
@ResponseBody
|
||||
@ApiOperation("导出单边账明细")
|
||||
public HashMap<Object, Object> exportUnilateral(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
String dlName = "";
|
||||
String fileName = "";
|
||||
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(map.get("dowloadName"));
|
||||
|
||||
try {
|
||||
|
||||
List<HashMap<Object, Object>> list = unilateralService.findAllUnilateral(map);
|
||||
|
||||
//支付方式
|
||||
List<Dicinfo> pay_type = dicinfoService.findDicinfoTreeNodeList("PAY_TYPE");
|
||||
HashMap<String, String> peyTypeMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : pay_type) {
|
||||
peyTypeMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
//三方支付方式
|
||||
List<Dicinfo> third_pay = dicinfoService.findDicinfoTreeNodeList("THIRD_PAY");
|
||||
HashMap<String, String> thirdPayMap = new HashMap<>();
|
||||
for (Dicinfo dicinfo : third_pay) {
|
||||
thirdPayMap.put(dicinfo.getDicvalue(), dicinfo.getDicname());
|
||||
}
|
||||
|
||||
for (HashMap<Object, Object> hashMap : list) {
|
||||
//处理支付方式
|
||||
String paytype = StringDUtil.changeNullToEmpty(hashMap.get("PAYTYPE"));
|
||||
hashMap.put("PAYTYPE", peyTypeMap.get(paytype));
|
||||
|
||||
String i_jyqd = StringDUtil.changeNullToEmpty(hashMap.get("I_JYQD"));
|
||||
hashMap.put("I_JYQD", thirdPayMap.get(i_jyqd));
|
||||
|
||||
//处理错账类型
|
||||
String err_type = StringDUtil.changeNullToEmpty(hashMap.get("ERR_TYPE"));
|
||||
if ("1".equals(err_type)) {
|
||||
hashMap.put("ERR_TYPE", "HIS单边账");
|
||||
} else if ("2".equals(err_type)) {
|
||||
hashMap.put("ERR_TYPE", "三方单边账");
|
||||
} else if ("3".equals(err_type)) {
|
||||
hashMap.put("ERR_TYPE", "差异账");
|
||||
} else if ("4".equals(err_type)) {
|
||||
hashMap.put("ERR_TYPE", "跨天差异账");
|
||||
}
|
||||
|
||||
String is_manager = StringDUtil.changeNullToEmpty(hashMap.get("IS_MANAGER"));
|
||||
if ("1".equals(is_manager)) {
|
||||
hashMap.put("IS_MANAGER", "已处理");
|
||||
} else {
|
||||
hashMap.put("IS_MANAGER", "未处理");
|
||||
}
|
||||
}
|
||||
|
||||
if (list.size() > 0) {
|
||||
//定义标题头和文件名
|
||||
String[] DISTANCE_HEADERNAME = {"交易日期", "HIS金额", "支付方式", "三方金额", "支付方式", "错账类型", "平台交易号", "银商订单号", "操作员号", "交易时间", "是否已处理", "处理时间"};
|
||||
String[] sqlKey = {"TRADE_DATE", "AMOUNT", "PAYTYPE", "I_JYJE", "I_JYQD", "ERR_TYPE", "TRANID", "I_DDH", "HISOPERNUM", "TRADE_TIME", "IS_MANAGER", "MANAGER_TIME"};
|
||||
|
||||
List<Object> rulList = new ArrayList<Object>(list);
|
||||
|
||||
//创建工作表
|
||||
ExportXLSX exportXLS = new ExportXLSX(DISTANCE_HEADERNAME, sqlKey, ExportXLSX.A3, false);
|
||||
|
||||
exportXLS.setTitleName(dowloadName);
|
||||
|
||||
IConversionByExport conversion = new HashMapConversionImpl();
|
||||
exportXLS.setConversion(conversion);
|
||||
|
||||
exportXLS.setData(rulList);
|
||||
|
||||
exportXLS.modifyWidthOfHeader("5000", 0);
|
||||
exportXLS.modifyWidthOfHeader("5000", 1);
|
||||
exportXLS.modifyWidthOfHeader("5000", 2);
|
||||
exportXLS.modifyWidthOfHeader("5000", 3);
|
||||
exportXLS.modifyWidthOfHeader("5000", 4);
|
||||
exportXLS.modifyWidthOfHeader("5000", 5);
|
||||
exportXLS.modifyWidthOfHeader("10000", 6);
|
||||
exportXLS.modifyWidthOfHeader("10000", 7);
|
||||
exportXLS.modifyWidthOfHeader("5000", 8);
|
||||
exportXLS.modifyWidthOfHeader("5000", 9);
|
||||
exportXLS.modifyWidthOfHeader("5000", 10);
|
||||
exportXLS.modifyWidthOfHeader("5000", 11);
|
||||
|
||||
// 文件名称
|
||||
//产生4位长度的随机码(由字母和数字组成)
|
||||
String randomStr = StringDUtil.generateRandomCodeForLength(4);
|
||||
dlName = DateDUtil.DateToStr(DateDUtil.yyyyMMddHHmmss, new Date()) + randomStr;
|
||||
fileName = dlName + ".xlsx";
|
||||
|
||||
String uploadPath = StatusDefine.filePath + "/Unilateral/";
|
||||
File uploadPathFile = new File(uploadPath);
|
||||
if (!uploadPathFile.exists()) uploadPathFile.mkdirs();
|
||||
|
||||
String savePath = uploadPath + fileName;
|
||||
exportXLS.execGenerateExcel(savePath);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode = "999";
|
||||
errMsg = "未知异常:" + ExceptionDUtil.getDetailExceptionMsg(e);
|
||||
LogUtil.error(this.getClass(), "@@@系统出错!【" + errMsg + "】");
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
responseMap.put("dlName", "Unilateral/" + fileName);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 处理单边账
|
||||
* @author thuang
|
||||
* @date 2021/11/29 15:01
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/managerUnilateral")
|
||||
@ResponseBody
|
||||
@ApiOperation("处理单边账")
|
||||
public HashMap<Object, Object> managerUnilateral(HttpServletRequest request, @RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "处理完成";
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = user.getUserId();
|
||||
String userName = user.getUserName();
|
||||
String trueName = user.getTrueName();
|
||||
String ipAddr = IpUtil.getIpAddr(request);
|
||||
|
||||
|
||||
try {
|
||||
String id = StringDUtil.changeNullToEmpty(map.get("id"));
|
||||
String errType = StringDUtil.changeNullToEmpty(map.get("errType"));
|
||||
String managerType = StringDUtil.changeNullToEmpty(map.get("managerType"));
|
||||
String remark = StringDUtil.changeNullToEmpty(map.get("remark"));
|
||||
String payType = StringDUtil.changeNullToEmpty(map.get("payType"));
|
||||
String c_zffs = StringDUtil.changeNullToEmpty(map.get("c_zffs"));
|
||||
String trade_date = StringDUtil.changeNullToEmpty(map.get("trade_date"));
|
||||
String platformTransId = StringDUtil.changeNullToEmpty(map.get("platformTransId"));
|
||||
String c_ysddh = StringDUtil.changeNullToEmpty(map.get("c_ysddh"));
|
||||
|
||||
//查询系统中设置的现金类型
|
||||
List<HashMap<Object, Object>> serviceParams = serviceParamsService.findParamValByParamCode("cash_code");
|
||||
String cash_code = StringDUtil.changeNullToEmpty(serviceParams.get(0).get("PARAM_VAL"));
|
||||
|
||||
map.put("cash_code", cash_code);
|
||||
//判断 单边账情况和处理情况
|
||||
if ("1".equals(errType)) {
|
||||
//如果是his单边账
|
||||
//判断是否不计统计
|
||||
if ("2".equals(managerType)) {
|
||||
//如果是2 不计统计 处理不计统计
|
||||
map.put("is_active", "0");
|
||||
transactionDetailService.updateJoinSetActiveByHis(map);
|
||||
|
||||
//重新计算对账结果记录表
|
||||
ReconciliationMethod.managerReconciliation(transactionDetailService, new HashMap<Object, Object>() {{
|
||||
put("trade_date", trade_date);
|
||||
}});
|
||||
}
|
||||
} else if ("2".equals(errType)) {
|
||||
//如果是三方单边账
|
||||
//判断是否需要退账
|
||||
if ("1".equals(managerType)) {
|
||||
//原路退回
|
||||
if (cash_code.equals(payType)) {
|
||||
//如果是现金 直接退出
|
||||
throw new RuntimeException("现金帐无法直接退款");
|
||||
}
|
||||
|
||||
//需要先记录退款操作 再调用退款接口 然后更新退款操作状态
|
||||
//支付方式
|
||||
//先在数据中查询这条记录
|
||||
HashMap<Object, Object> searchMap = new HashMap<>();
|
||||
searchMap.put("i_ddh", c_ysddh);
|
||||
List<HashMap<Object, Object>> bankbillHistoryById = bankbillHistoryService.findBankbillHistoryById(searchMap);
|
||||
HashMap<Object, Object> bankbillObj = bankbillHistoryById.get(0);
|
||||
//全部走外联退费,不走九聚退费
|
||||
// String bill_table_name = StringDUtil.changeNullToEmpty(bankbillHistoryById.get(0).get("bill_table_name"));
|
||||
|
||||
//先生成refundRequestId
|
||||
String refundRequestId = "T" + DateDUtil.getCurrentDate(DateDUtil.yyyyMMddHHmmssSSS) + SeriesNumUtil.generateByRandom(3);
|
||||
boolean isOk = true;
|
||||
|
||||
//调用掌医后台接口
|
||||
List<HashMap<Object, Object>> palm_hospitalList = serviceParamsService.findParamValByParamCode("palm_hospital");
|
||||
String palm_hospital = StringDUtil.changeNullToEmpty(palm_hospitalList.get(0).get("PARAM_VAL"));
|
||||
|
||||
// 九聚接口
|
||||
// List<HashMap<Object, Object>> jfjk_wsdlList = serviceParamsService.findParamValByParamCode("jfjk_wsdl");
|
||||
// String jfjk_wsdl = StringDUtil.changeNullToEmpty(jfjk_wsdlList.get(0).get("PARAM_VAL"));
|
||||
|
||||
try {
|
||||
|
||||
//根据excel表名名字选择退款方式
|
||||
// if ("商户对账单".equals(bill_table_name)) {
|
||||
|
||||
HashMap<Object, Object> hashMap = new RefundUtil().refundPalmHospital(bankbillObj, palm_hospital, refundRequestId);
|
||||
String errCode1 = StringDUtil.changeNullToEmpty(hashMap.get("errCode"));
|
||||
//如果处理正常 保存返回信息
|
||||
if ("0".equals(errCode1)) {
|
||||
// hashMap.put("bill_table_name", bill_table_name);
|
||||
hashMap.put("userName", userName);
|
||||
hashMap.put("trueName", trueName);
|
||||
hashMap.put("request_ip", ipAddr);
|
||||
hashMap.put("c_ysddh", c_ysddh);
|
||||
hashMap.put("id", UUIDGenerator.getUUID());
|
||||
|
||||
LogUtil.info(this.getClass(), trueName + "执行退款成功,内容" + hashMap.toString());
|
||||
|
||||
refundService.addRefundInfo(hashMap);
|
||||
} else {
|
||||
//如果不正常 返回错误信息 记录错误信息日志
|
||||
errCode = errCode1;
|
||||
errMsg = StringDUtil.changeNullToEmpty(hashMap.get("errMsg"));
|
||||
|
||||
LogUtil.error(this.getClass(), trueName + "执行退款失败,原因:" + errMsg);
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
//
|
||||
// //调用九聚接口
|
||||
// HashMap<Object, Object> hashMap = new RefundUtil().refundThird(bankbillObj, jfjk_wsdl,refundRequestId);
|
||||
// String errCode1 = StringDUtil.changeNullToEmpty(hashMap.get("errCode"));
|
||||
// //如果处理正常 保存返回信息
|
||||
// if ("0".equals(errCode1)) {
|
||||
// hashMap.put("bill_table_name", bill_table_name);
|
||||
// hashMap.put("userName", userName);
|
||||
// hashMap.put("trueName", trueName);
|
||||
// hashMap.put("request_ip", ipAddr);
|
||||
// hashMap.put("c_ysddh", c_ysddh);
|
||||
// hashMap.put("id", UUIDGenerator.getUUID());
|
||||
//
|
||||
// LogUtil.info(this.getClass(), trueName + "执行退款成功,内容" + hashMap.toString());
|
||||
//
|
||||
// refundService.addRefundInfo(hashMap);
|
||||
// } else {
|
||||
// //如果不正常 返回错误信息 记录错误信息日志
|
||||
// errCode = errCode1;
|
||||
// errMsg = StringDUtil.changeNullToEmpty(hashMap.get("errMsg"));
|
||||
//
|
||||
// LogUtil.error(this.getClass(), trueName + "执行退款失败,原因:" + errMsg);
|
||||
// }
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
//连接直接断了等没有返回的情况
|
||||
isOk = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//使用id查询扣款是否真的成功
|
||||
if (!isOk) {
|
||||
try {
|
||||
//根据excel表名名字选择退款方式
|
||||
// if ("商户对账单".equals(bill_table_name)) {
|
||||
HashMap<Object, Object> hashMap = new RefundUtil().searchRefundPalmHospital(bankbillObj, palm_hospital, refundRequestId);
|
||||
String errCode1 = StringDUtil.changeNullToEmpty(hashMap.get("errCode"));
|
||||
//如果处理正常
|
||||
if ("0".equals(errCode1)) {
|
||||
// 分析其中数据
|
||||
String queryResCode = StringDUtil.changeNullToEmpty(hashMap.get("queryResCode"));
|
||||
|
||||
if ("0".equals(queryResCode)) {
|
||||
//说明之前退款成功 记录数据
|
||||
// hashMap.put("bill_table_name", bill_table_name);
|
||||
hashMap.put("userName", userName);
|
||||
hashMap.put("trueName", trueName);
|
||||
hashMap.put("request_ip", ipAddr);
|
||||
hashMap.put("c_ysddh", c_ysddh);
|
||||
hashMap.put("id", UUIDGenerator.getUUID());
|
||||
|
||||
LogUtil.info(this.getClass(), trueName + "执行退款成功,内容" + hashMap.toString());
|
||||
|
||||
refundService.addRefundInfo(hashMap);
|
||||
|
||||
//重新将errCode改为0
|
||||
errCode = "0";
|
||||
// }
|
||||
// else {
|
||||
// //说明之前退款失败 返回错误信息 不用记录
|
||||
// errCode = queryResCode;
|
||||
// String queryResInfo = StringDUtil.changeNullToEmpty(hashMap.get("queryResInfo"));
|
||||
// errMsg = queryResInfo;
|
||||
//
|
||||
// LogUtil.error(this.getClass(), trueName + "执行退款失败,原因:" + errMsg);
|
||||
// }
|
||||
} else {
|
||||
//查询都失败
|
||||
String errMsg1 = StringDUtil.changeNullToEmpty(hashMap.get("errMsg"));
|
||||
throw new RuntimeException("查询之前退款记录失败,原因:" + errMsg1);
|
||||
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// //调用九聚接口
|
||||
// HashMap<Object, Object> hashMap = new RefundUtil().searchRefundThird(bankbillObj, jfjk_wsdl, refundRequestId);
|
||||
// String errCode1 = StringDUtil.changeNullToEmpty(hashMap.get("errCode"));
|
||||
// //如果处理正常
|
||||
// if ("0".equals(errCode1)) {
|
||||
//
|
||||
// // 分析其中数据
|
||||
// String queryResCode = StringDUtil.changeNullToEmpty(hashMap.get("queryResCode"));
|
||||
// if ("00".equals(queryResCode)) {
|
||||
// hashMap.put("bill_table_name", bill_table_name);
|
||||
// hashMap.put("userName", userName);
|
||||
// hashMap.put("trueName", trueName);
|
||||
// hashMap.put("request_ip", ipAddr);
|
||||
// hashMap.put("c_ysddh", c_ysddh);
|
||||
// hashMap.put("id", UUIDGenerator.getUUID());
|
||||
//
|
||||
// LogUtil.info(this.getClass(), trueName + "执行退款成功,内容" + hashMap.toString());
|
||||
//
|
||||
// refundService.addRefundInfo(hashMap);
|
||||
//
|
||||
// //重新将errCode改为0
|
||||
// errCode = "0";
|
||||
// } else {
|
||||
// //如果不正常 返回错误信息 记录错误信息日志
|
||||
// errCode = queryResCode;
|
||||
// String queryResInfo = StringDUtil.changeNullToEmpty(hashMap.get("queryResInfo"));
|
||||
// errMsg = queryResInfo;
|
||||
// LogUtil.error(this.getClass(), trueName + "执行退款失败,原因:" + errMsg);
|
||||
// }
|
||||
// } else {
|
||||
// //查询都失败
|
||||
// String errMsg1 = StringDUtil.changeNullToEmpty(hashMap.get("errMsg"));
|
||||
// throw new RuntimeException("查询九聚之前退款记录失败,原因:" + errMsg1);
|
||||
// }
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//连查询都错误 或者整个接口都没调通 那就先记录下生成的id以防之后要查
|
||||
HashMap<Object, Object> hashMap = new HashMap<>();
|
||||
// hashMap.put("bill_table_name", bill_table_name);
|
||||
hashMap.put("userName", userName);
|
||||
hashMap.put("trueName", trueName);
|
||||
hashMap.put("request_ip", ipAddr);
|
||||
hashMap.put("c_ysddh", c_ysddh);
|
||||
hashMap.put("id", UUIDGenerator.getUUID());
|
||||
hashMap.put("transactionAmount", "");
|
||||
hashMap.put("refundInvoiceAmount", "查询扣款及扣款信息均失败");
|
||||
hashMap.put("refundRequestId", refundRequestId);
|
||||
hashMap.put("retrievalRefNum", "");
|
||||
refundService.addRefundInfo(hashMap);
|
||||
}
|
||||
}
|
||||
} else if ("2".equals(managerType)) {
|
||||
//不计统计
|
||||
map.put("is_active", "0");
|
||||
transactionDetailService.updateJoinSetActiveByThird(map);
|
||||
|
||||
//重新计算对账结果记录表
|
||||
ReconciliationMethod.managerReconciliation(transactionDetailService, new HashMap<Object, Object>() {{
|
||||
put("trade_date", trade_date);
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
//更新表状态为已处理 ,以及说明。
|
||||
if ("0".equals(errCode)) {
|
||||
map.put("manager_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
|
||||
unilateralService.updateUnilateralManagerStatus(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "处理单边账失败,原因:" + e.getMessage();
|
||||
LogUtil.error(this.getClass(), userName + "[" + trueName + "]处理单边账失败,原因:" + e.getMessage());
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.TranscationsService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/10/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/ActionableTrading")
|
||||
public class ActionableTradingController {
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
@Autowired
|
||||
private TranscationsService transcationsService;
|
||||
|
||||
|
||||
@RequestMapping("/toActionableTrading")
|
||||
public String toActionableTrading(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
//服务渠道
|
||||
List<Dicinfo> serCh = dicinfoService.findDicinfoTreeNodeList("SER_CH");
|
||||
modelMap.addAttribute("serChs", serCh);
|
||||
//支付来源
|
||||
List<Dicinfo> tra_type = dicinfoService.findDicinfoTreeNodeList("TRA_TYPE");
|
||||
modelMap.addAttribute("tra_types", tra_type);
|
||||
//聚合支付标识
|
||||
List<Dicinfo> payLog = dicinfoService.findDicinfoTreeNodeList("PAY_LOG");
|
||||
modelMap.addAttribute("payLogs", payLog);
|
||||
//支付方式
|
||||
List<Dicinfo> paySou = dicinfoService.findDicinfoTreeNodeList("PAY_SOU");
|
||||
modelMap.addAttribute("paySous", paySou);
|
||||
//退款状态
|
||||
List<Dicinfo> reState = dicinfoService.findDicinfoTreeNodeList("RE_STATE");
|
||||
modelMap.addAttribute("reStates", reState);
|
||||
|
||||
|
||||
return "financialReconciliation/ActionableTrading";
|
||||
}
|
||||
|
||||
@RequestMapping("/findActionableTrading")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findActionableTrading(String jyly, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("jyly", jyly);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(transcationsService.findActionableTrading(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
@RequestMapping("/refundTrade")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> refundTrade(@RequestBody HashMap<String, String> jylsh) {
|
||||
|
||||
System.out.println("jylsh is:" + jylsh);
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("jylsh", jylsh.get("jylsh"));
|
||||
List<HashMap<Object, Object>> list = transcationsService.findActionableTrading(map);
|
||||
HashMap<String, String> resultMap = transcationsService.refundTrade(list);
|
||||
if (resultMap.get("errCode").equals("0")) {
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
} else {
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "退款失败:" + resultMap.get("errMsg"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "退款失败:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.service.historyLog.CashDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 现金记录
|
||||
* @date 2021/11/5 13:07
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "")
|
||||
@RequestMapping("/cashLog")
|
||||
public class CashLogController {
|
||||
|
||||
@Autowired
|
||||
private CashDetailService cashDetailService;
|
||||
|
||||
/**
|
||||
* @description: 查询现金记录
|
||||
* @author thuang
|
||||
* @date 2021/11/5 13:10
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/toCashLog")
|
||||
public String toHisBillLog(ModelMap modelMap){
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE,-1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime= DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd,startDate);
|
||||
String endTime= DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime",startTime);
|
||||
modelMap.addAttribute("endTime",endTime);
|
||||
|
||||
return "historyLog/cashLog";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询现金记录
|
||||
* @author thuang
|
||||
* @date 2021/11/5 17:02
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findCashList")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> findCashList(String startTime,String endTime,int page,int limit){
|
||||
HashMap<Object,Object> responseMap=new HashMap<Object,Object>();
|
||||
|
||||
try {
|
||||
HashMap<Object,Object> map=new HashMap<>();
|
||||
map.put("startTime",startTime);
|
||||
map.put("endTime",endTime);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(cashDetailService.findCashDetailPageList(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
String msg=e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:"+msg);
|
||||
}
|
||||
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 上传现金记录
|
||||
* @author thuang
|
||||
* @date 2021/11/5 17:03
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/uploadCash")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> uploadSpecialEvent(@RequestParam("spareFile") MultipartFile file, HttpServletRequest request, HttpServletResponse response)throws Exception{
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
String input_trade_date="";
|
||||
|
||||
//添加人员
|
||||
|
||||
if (!file.isEmpty()) {
|
||||
XSSFWorkbook workbook =null;
|
||||
|
||||
//创建Excel,读取文件内容
|
||||
workbook = new XSSFWorkbook(file.getInputStream());
|
||||
|
||||
//获取第一个工作表
|
||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
||||
//获取sheet中第一行行号
|
||||
int firstRowNum = sheet.getFirstRowNum();
|
||||
//获取sheet中最后一行行号
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
|
||||
try {
|
||||
//时间
|
||||
String create_time = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
|
||||
//循环数据
|
||||
boolean isOK=true;
|
||||
List<HashMap<Object,Object>> addList =new ArrayList<>();
|
||||
for(int i=firstRowNum+2;i<=lastRowNum;i++) {//因为表格中第一行为说明,第二行为列标题
|
||||
XSSFRow row = sheet.getRow(i);
|
||||
|
||||
HashMap<Object,Object> addMap=new HashMap<>();
|
||||
|
||||
//操作员号
|
||||
XSSFCell czyh = row.getCell(0);
|
||||
if (czyh != null) {
|
||||
czyh.setCellType(Cell.CELL_TYPE_STRING);
|
||||
String czyhStr = czyh.getStringCellValue();
|
||||
czyhStr = czyhStr.trim();
|
||||
|
||||
addMap.put("czyh",czyhStr);
|
||||
} else {
|
||||
isOK = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//交易日期
|
||||
XSSFCell trade_date = row.getCell(1);
|
||||
if (trade_date != null) {
|
||||
trade_date.setCellType(Cell.CELL_TYPE_STRING);
|
||||
String trade_dateStr = trade_date.getStringCellValue();
|
||||
trade_dateStr = trade_dateStr.trim();
|
||||
addMap.put("trade_date",trade_dateStr);
|
||||
|
||||
if (i==2){
|
||||
input_trade_date=trade_dateStr;
|
||||
}
|
||||
} else {
|
||||
isOK = false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//交易金额
|
||||
XSSFCell jyje = row.getCell(2);
|
||||
if (jyje != null) {
|
||||
jyje.setCellType(Cell.CELL_TYPE_STRING);
|
||||
String jyjeStr = jyje.getStringCellValue();
|
||||
addMap.put("jyje",jyjeStr);
|
||||
|
||||
}else{
|
||||
isOK = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//添加日期
|
||||
addMap.put("create_time",create_time);
|
||||
|
||||
addList.add(addMap);
|
||||
}
|
||||
|
||||
if(isOK){
|
||||
errCode="999";
|
||||
errMsg="导入失败,请检查数据内容";
|
||||
}else{
|
||||
cashDetailService.insertCash(addList);
|
||||
LogUtil.info(this.getClass(),"导入"+input_trade_date+"金额记录成功");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="导入金额记录失败!原因:"+e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "导入"+input_trade_date+"金额记录失败,原因:"+ ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
} finally {
|
||||
workbook.close();
|
||||
}
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 修改修改现金金额
|
||||
* @author thuang
|
||||
* @date 2021/11/8 9:21
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/editCash")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> editCash(@RequestBody HashMap<Object,Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try{
|
||||
cashDetailService.editCash(map);
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="修改金额记录失败!原因:"+e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "修改金额记录失败,原因:"+ ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除现金金额
|
||||
* @author thuang
|
||||
* @date 2021/11/8 9:22
|
||||
* @version 1.0
|
||||
*/
|
||||
@PostMapping("/deleteCash")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> deleteCash(@RequestBody HashMap<Object,Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try{
|
||||
cashDetailService.deleteCash(map);
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="删除金额记录失败!原因:"+e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "删除金额记录失败,原因:"+ ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.HISGetDataMethodByHY;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.HISGetDataMethodByWN;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.HISGetDataMethodByZL;
|
||||
import com.saye.hospitalgd.service.HisInterFaceConfigService;
|
||||
import com.saye.hospitalgd.service.historyLog.HisBillLogService;
|
||||
import com.saye.hospitalgd.service.system.ServiceParamsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: his对账数据结果查询信息类
|
||||
* @date 2021/8/30 10:54
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/hisBillLog")
|
||||
@Api(tags = "his对账数据结果查询信息类")
|
||||
public class HisBillLogController {
|
||||
|
||||
@Autowired
|
||||
private HisBillLogService hisBillLogService;
|
||||
|
||||
@Autowired
|
||||
private ServiceParamsService serviceParamsService;
|
||||
|
||||
@Autowired
|
||||
private HisInterFaceConfigService hisInterFaceConfigService;
|
||||
|
||||
@RequestMapping("/toHisBillLog")
|
||||
public String toHisBillLog(ModelMap modelMap){
|
||||
|
||||
Calendar calendar=Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE,-1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime= DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd,startDate);
|
||||
String endTime= DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime",startTime);
|
||||
modelMap.addAttribute("endTime",endTime);
|
||||
|
||||
try {
|
||||
//厂商
|
||||
List<HashMap<Object,Object>> firmlist = hisInterFaceConfigService.findAllconfig();
|
||||
HashMap<String,String> firmMap=new HashMap<>();
|
||||
for (HashMap<Object, Object> hashMap : firmlist) {
|
||||
String id = StringDUtil.changeNullToEmpty(hashMap.get("ID"));
|
||||
String his_interface_name = StringDUtil.changeNullToEmpty(hashMap.get("HIS_INTERFACE_NAME"));
|
||||
firmMap.put(id,his_interface_name);
|
||||
}
|
||||
|
||||
modelMap.addAttribute("firmlist",firmlist);
|
||||
}catch (Exception e){
|
||||
System.out.println("返回厂商信息出错,原因"+e.getMessage());
|
||||
}
|
||||
return "historyLog/hisBillLog";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询HIS调用的日志
|
||||
* @author thuang
|
||||
* @date 2021/8/30 14:30
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findHisBillLogPageList")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询HIS调用的日志")
|
||||
public HashMap<Object,Object> findHisBillLogPageList(String business,String status,String startTime,String endTime,int page,int limit) {
|
||||
HashMap<Object,Object> responseMap=new HashMap<Object,Object>();
|
||||
|
||||
try {
|
||||
|
||||
HashMap<Object,Object> map=new HashMap<Object,Object>();
|
||||
map.put("is_ok",status);
|
||||
map.put("startTime",startTime);
|
||||
map.put("endTime",endTime);
|
||||
map.put("his_wsdl_id",business);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(hisBillLogService.findHisBillLogPageList(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg=e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:"+msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: his重新获取数
|
||||
* @author thuang
|
||||
* @date 2021/10/9 15:30
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/restartGetBill")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "his重新获取数")
|
||||
public HashMap<Object,Object> restartGetBill(@RequestBody HashMap<Object,Object> map){
|
||||
HashMap<Object,Object> responseMap=new HashMap<>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try {
|
||||
//交易时间
|
||||
String trade_date = StringDUtil.changeNullToEmpty(map.get("trade_date"));
|
||||
|
||||
//根据交易时间获取交易生成的定时任务
|
||||
HashMap<Object,Object> searchMap=new HashMap<>();
|
||||
searchMap.put("trade_date",trade_date);
|
||||
List<HashMap<Object, Object>> hisBillLogByParam = hisBillLogService.findHisBillLogByParam(searchMap);
|
||||
HashMap<Object, Object> hisBillLog = hisBillLogByParam.get(0);
|
||||
String quartz_id = StringDUtil.changeNullToEmpty(hisBillLog.get("QUARTZ_ID"));
|
||||
String quartz_name = StringDUtil.changeNullToEmpty(hisBillLog.get("QUARTZ_NAME"));
|
||||
|
||||
HashMap<Object, Object> resultMap = null;
|
||||
|
||||
List<HashMap<Object, Object>> serviceParams = serviceParamsService.findParamValByParamCode("his_wsdl_id");
|
||||
String his_wsdl_id = StringDUtil.changeNullToEmpty(serviceParams.get(0).get("PARAM_VAL"));
|
||||
|
||||
if ("1".equals(his_wsdl_id)){
|
||||
resultMap = new HISGetDataMethodByZL().getDate(quartz_id,quartz_name,trade_date,his_wsdl_id);
|
||||
}else if ("2".equals(his_wsdl_id)){
|
||||
resultMap = new HISGetDataMethodByWN().getDate(quartz_id,quartz_name,trade_date,his_wsdl_id);
|
||||
}else if("3".equals(his_wsdl_id)){
|
||||
resultMap = new HISGetDataMethodByHY().getDate(quartz_id,quartz_name,trade_date,his_wsdl_id);
|
||||
}
|
||||
|
||||
errCode=StringDUtil.changeNullToEmpty(resultMap.get("errCode"));
|
||||
errMsg=StringDUtil.changeNullToEmpty(resultMap.get("errMsg"));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
errCode="999";
|
||||
errMsg="重新执行定时任务失败,原因:"+e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode",errCode);
|
||||
responseMap.put("errMsg",errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.scheduler.jobMethod.ReconciliationMethod;
|
||||
import com.saye.hospitalgd.service.historyLog.ReconciliationLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 对账情况信息
|
||||
* @date 2021/8/31 10:17
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/reconciliationLog")
|
||||
@Api(tags = "对账情况信息")
|
||||
public class ReconciliationLogController {
|
||||
|
||||
@Autowired
|
||||
private ReconciliationLogService reconciliationLogService;
|
||||
|
||||
@RequestMapping("/toReconciliationLog")
|
||||
public String toReconciliationLog(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
|
||||
return "historyLog/reconciliationLog";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询对账的日志
|
||||
* @author thuang
|
||||
* @date 2021/8/30 14:30
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findReconciliationLogPageList")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询对账的日志")
|
||||
public HashMap<Object, Object> findReconciliationLogPageList(String status, String startTime, String endTime, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("status", status);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(reconciliationLogService.findReconciliationLogPageList(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 重新开始对账
|
||||
* @author thuang
|
||||
* @date 2021/10/9 15:49
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/restartManager")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "重新开始对账")
|
||||
public HashMap<Object, Object> restartManager(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
//交易时间
|
||||
String trade_date = StringDUtil.changeNullToEmpty(map.get("trade_date"));
|
||||
|
||||
//根据交易时间获取交易生成的定时任务
|
||||
HashMap<Object, Object> searchMap = new HashMap<>();
|
||||
searchMap.put("trade_date", trade_date);
|
||||
List<HashMap<Object, Object>> hisBillLogByParam = reconciliationLogService.findReconciliationLogByParam(searchMap);
|
||||
HashMap<Object, Object> hisBillLog = hisBillLogByParam.get(0);
|
||||
String quartz_id = StringDUtil.changeNullToEmpty(hisBillLog.get("QUARTZ_ID"));
|
||||
String quartz_name = StringDUtil.changeNullToEmpty(hisBillLog.get("QUARTZ_NAME"));
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String trueName = user.getTrueName();
|
||||
|
||||
HashMap<Object, Object> resultMap = new ReconciliationMethod().getDate(quartz_id, quartz_name, trade_date, trueName);
|
||||
errCode = StringDUtil.changeNullToEmpty(resultMap.get("errCode"));
|
||||
errMsg = StringDUtil.changeNullToEmpty(resultMap.get("errMsg"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode = "999";
|
||||
errMsg = "重新执行定时任务失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.RefundOrderService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/10/9
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/refundOrder")
|
||||
public class RefundOrderController {
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
RefundOrderService refundOrderService;
|
||||
|
||||
@RequestMapping("/toRefundOrder")
|
||||
public String toRefundOrder(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
//服务渠道
|
||||
List<Dicinfo> serCh = dicinfoService.findDicinfoTreeNodeList("SER_CH");
|
||||
modelMap.addAttribute("serChs", serCh);
|
||||
//支付来源
|
||||
List<Dicinfo> tra_type = dicinfoService.findDicinfoTreeNodeList("TRA_TYPE");
|
||||
modelMap.addAttribute("tra_types", tra_type);
|
||||
//聚合支付标识
|
||||
List<Dicinfo> payLog = dicinfoService.findDicinfoTreeNodeList("PAY_LOG");
|
||||
modelMap.addAttribute("payLogs", payLog);
|
||||
//支付方式
|
||||
List<Dicinfo> paySou = dicinfoService.findDicinfoTreeNodeList("PAY_SOU");
|
||||
modelMap.addAttribute("paySous", paySou);
|
||||
//退款状态
|
||||
List<Dicinfo> reState = dicinfoService.findDicinfoTreeNodeList("RE_STATE");
|
||||
modelMap.addAttribute("reStates", reState);
|
||||
|
||||
return "financialReconciliation/RefundOrder";
|
||||
}
|
||||
|
||||
@RequestMapping("/findRefundOrder")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findTradeRecords(String jyly, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("jyly", jyly);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(refundOrderService.findRefundOrder(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.scheduler.MySchedulerFactory;
|
||||
import com.saye.hospitalgd.scheduler.job.BankGetData;
|
||||
import com.saye.hospitalgd.service.BankbillGetinfoService;
|
||||
import com.saye.hospitalgd.service.ThirdFtpConfigService;
|
||||
import com.saye.hospitalgd.service.ThirdSftpConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: 三方账单查询信息
|
||||
* @date 2021/8/31 9:04
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/thirdBillLog")
|
||||
@Api(tags = "三方账单查询信息")
|
||||
public class ThirdBillLogController {
|
||||
|
||||
@Autowired
|
||||
private BankbillGetinfoService bankbillGetinfoService;
|
||||
|
||||
@Autowired
|
||||
private MySchedulerFactory mySchedulerFactory;
|
||||
|
||||
@Autowired
|
||||
private ThirdFtpConfigService thirdFtpConfigService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ThirdSftpConfigService thirdSftpConfigService;
|
||||
|
||||
@RequestMapping("/toThirdBillLog")
|
||||
public String toThirdBillLog(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
return "historyLog/thirdBillLog";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询三方调用的日志
|
||||
* @author thuang
|
||||
* @date 2021/8/30 14:30
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findThirdBillLogPageList")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "查询三方调用的日志")
|
||||
public HashMap<Object, Object> findThirdBillLogPageList(String business, String status, String startTime, String endTime, int page, int limit) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("business", business);
|
||||
map.put("is_ok", status);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(bankbillGetinfoService.findBankbillGetinfoList(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 重新执行定时任务
|
||||
* @author thuang
|
||||
* @date 2021/9/13 13:08
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/restartGetBill")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "重新执行定时任务")
|
||||
public HashMap<Object, Object> restartGetBill(@RequestBody HashMap<Object, Object> map) {
|
||||
HashMap<Object, Object> responseMap = new HashMap<>();
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
|
||||
try {
|
||||
//交易时间
|
||||
String trade_date = StringDUtil.changeNullToEmpty(map.get("trade_date"));
|
||||
String bill_table_name = StringDUtil.changeNullToEmpty(map.get("bill_table_name"));
|
||||
|
||||
//根据交易时间获取交易生成的定时任务
|
||||
HashMap<Object, Object> searchMap = new HashMap<>();
|
||||
searchMap.put("trade_date", trade_date);
|
||||
searchMap.put("bill_table_name", bill_table_name);
|
||||
HashMap<Object, Object> bankbillGetinfo = bankbillGetinfoService.findBankbillGetinfoById(searchMap);
|
||||
String quartz_id = StringDUtil.changeNullToEmpty(bankbillGetinfo.get("QUARTZ_ID"));
|
||||
String quartz_name = StringDUtil.changeNullToEmpty(bankbillGetinfo.get("QUARTZ_NAME"));
|
||||
String thirdConfigId = StringDUtil.changeNullToEmpty(bankbillGetinfo.get("THIRDCONFIGID"));
|
||||
|
||||
//查询配置
|
||||
HashMap<Object, Object> searchThirdMap = new HashMap<>();
|
||||
searchThirdMap.put("FUBS", "1");
|
||||
|
||||
List<HashMap<Object, Object>> wlConfigList = thirdSftpConfigService.findWLIF(searchThirdMap);
|
||||
|
||||
//
|
||||
// HashMap<Object, Object> searchConfigMap = new HashMap<>();
|
||||
// searchConfigMap.put("thirdConfigId", thirdConfigId);
|
||||
// List<HashMap<Object, Object>> thirdFtpConfigList = thirdFtpConfigService.findThirdFtpConfigList(searchConfigMap);
|
||||
HashMap<Object, Object> resultMap = BankGetData.oneExecute(quartz_id, quartz_name, trade_date, wlConfigList.get(0));
|
||||
|
||||
errCode = StringDUtil.changeNullToEmpty(resultMap.get("errCode"));
|
||||
errMsg = StringDUtil.changeNullToEmpty(resultMap.get("errMsg"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
errCode = "999";
|
||||
errMsg = "重新执行定时任务失败,原因:" + e.getMessage();
|
||||
}
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.saye.hospitalgd.controller.historyLog;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.service.TranscationsService;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
*
|
||||
* @author: Mr.zs
|
||||
* @date: 2023/10/8
|
||||
* @description:
|
||||
* @modifiedBy:
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/transcationsLog")
|
||||
@Api(tags = "交易记录")
|
||||
public class TranscationsController {
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private TranscationsService transcationsService;
|
||||
|
||||
|
||||
@RequestMapping("/toTranscationLog")
|
||||
public String toTranscationLog(ModelMap modelMap) {
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
Date startDate = calendar.getTime();
|
||||
|
||||
String startTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd, startDate);
|
||||
String endTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
modelMap.addAttribute("startTime", startTime);
|
||||
modelMap.addAttribute("endTime", endTime);
|
||||
|
||||
//服务渠道
|
||||
List<Dicinfo> serCh = dicinfoService.findDicinfoTreeNodeList("SER_CH");
|
||||
modelMap.addAttribute("serChs", serCh);
|
||||
//支付来源
|
||||
List<Dicinfo> tra_type = dicinfoService.findDicinfoTreeNodeList("TRA_TYPE");
|
||||
modelMap.addAttribute("tra_types", tra_type);
|
||||
//聚合支付标识
|
||||
List<Dicinfo> payLog = dicinfoService.findDicinfoTreeNodeList("PAY_LOG");
|
||||
modelMap.addAttribute("payLogs", payLog);
|
||||
//支付方式
|
||||
List<Dicinfo> paySou = dicinfoService.findDicinfoTreeNodeList("PAY_SOU");
|
||||
modelMap.addAttribute("paySous", paySou);
|
||||
//退款状态
|
||||
List<Dicinfo> reState = dicinfoService.findDicinfoTreeNodeList("RE_STATE");
|
||||
modelMap.addAttribute("reStates", reState);
|
||||
|
||||
return "financialReconciliation/Transactions";
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/findTradeRecords")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> findTradeRecords(String jyly, String startTime, String endTime, String likeFiled, int page, int limit) {
|
||||
|
||||
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||
|
||||
try {
|
||||
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||
map.put("jyly", jyly);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
map.put("likeFiled", likeFiled);
|
||||
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> pageInfo = new PageInfo<HashMap<Object, Object>>(transcationsService.findTradeRecords(map));
|
||||
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "OK");
|
||||
responseMap.put("count", pageInfo.getTotal());
|
||||
responseMap.put("data", pageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String msg = e.getMessage();
|
||||
responseMap.put("code", 1);
|
||||
responseMap.put("msg", "查询失败,原因:" + msg);
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
package com.saye.hospitalgd.controller.quartz;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.quartz.impl.JobDetailImpl;
|
||||
import org.quartz.impl.matchers.GroupMatcher;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.page.PageUtil;
|
||||
import com.saye.hospitalgd.commons.page.TemplatePage;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.BaseQuartzConfigEntity;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.scheduler.MySchedulerFactory;
|
||||
import com.saye.hospitalgd.service.quartz.BaseQuartzConfigService;
|
||||
|
||||
/**
|
||||
* @description: 定时任务
|
||||
* @author thuang
|
||||
* @date 2021/10/18 9:46
|
||||
* @version 1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/quartzConfig")
|
||||
public class BaseQuartzConfigController{
|
||||
|
||||
@Autowired
|
||||
private BaseQuartzConfigService baseQuartzConfigService;
|
||||
|
||||
@Autowired
|
||||
private MySchedulerFactory mySchedulerFactory;
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
/**
|
||||
* @description 查询所有的定时任务
|
||||
* @author thuang
|
||||
* @created 2020年1月7日 下午5:10:21
|
||||
* @param configId
|
||||
* @param quartz_name
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/findQuartzConfig")
|
||||
@ResponseBody
|
||||
public TemplatePage findQuartzConfig(String configId,String quartz_name,String quartz_type){
|
||||
PageInfo<BaseQuartzConfigEntity> appsPageInfo=null;
|
||||
try {
|
||||
HashMap<Object, Object> map=new HashMap<Object, Object>();
|
||||
map.put("configId", configId);
|
||||
map.put("quartz_name", quartz_name);
|
||||
map.put("quartz_type", quartz_type);
|
||||
|
||||
appsPageInfo = new PageInfo<BaseQuartzConfigEntity>(baseQuartzConfigService.findAll(map));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return PageUtil.loadJsonPage(appsPageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 修改定时任务设置
|
||||
* @author thuang
|
||||
* @created 2020年1月7日 下午2:10:04
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/changestatus")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> changestatus(@RequestBody Map<Object, Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String status = StringDUtil.changeNullToEmpty(map.get("status"));
|
||||
String configid = StringDUtil.changeNullToEmpty(map.get("quartzId"));
|
||||
if (StringDUtil.isNotBlank(configid) && StringDUtil.isNotBlank(status)) {
|
||||
BaseQuartzConfigEntity quartzConfigEntity = baseQuartzConfigService.get(configid);
|
||||
if ("0".equals(status)) {
|
||||
//修改为0,并且恢复运行
|
||||
quartzConfigEntity.setStatus("1");
|
||||
mySchedulerFactory.resumeJob(configid);
|
||||
}else {
|
||||
//修改为1,并且暂停
|
||||
quartzConfigEntity.setStatus("0");
|
||||
mySchedulerFactory.pauseJob(configid);
|
||||
}
|
||||
baseQuartzConfigService.updateQuartzConfig(quartzConfigEntity);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"修改定时任务:"+configid);
|
||||
}else {
|
||||
errCode="998";
|
||||
errMsg="修改定时任务参数不全";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="修改定时任务失败";
|
||||
LogUtil.error(this.getClass(), "修改定时任务失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 新增定时任务
|
||||
* @author thuang
|
||||
* @created 2020年1月7日 下午2:10:04
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/addNewQuartz")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> addNewQuartz(@RequestBody HashMap<Object, Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try{
|
||||
String time = StringDUtil.changeNullToEmpty(map.get("time"));
|
||||
String dataStr = StringDUtil.changeNullToEmpty(map.get("dataStr"));
|
||||
String remark = StringDUtil.changeNullToEmpty(map.get("remark"));
|
||||
String jobType = StringDUtil.changeNullToEmpty(map.get("jobType"));
|
||||
String quartz_class = StringDUtil.changeNullToEmpty(map.get("quartz_class"));
|
||||
String quartzName = StringDUtil.changeNullToEmpty(map.get("quartzName"));
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = user.getUserId();
|
||||
|
||||
String cronStr = getCron(map);
|
||||
|
||||
//查询任务最大任务id号 生成新的id号
|
||||
List<HashMap<Object, Object>> list =this.baseQuartzConfigService.findMaxId();
|
||||
|
||||
String id="";
|
||||
if(list!=null && list.size()>0){
|
||||
id=""+(Integer.parseInt(StringDUtil.changeNullToEmpty(list.get(0).get("ID")))+1);
|
||||
}else {
|
||||
id="1";
|
||||
}
|
||||
HashMap<Object, Object> addMap=new HashMap<Object, Object>();
|
||||
addMap.put("id", id);
|
||||
addMap.put("quartzName", quartzName);
|
||||
addMap.put("status", "0");
|
||||
addMap.put("quartz_class", quartz_class);
|
||||
addMap.put("remark", remark);
|
||||
addMap.put("createuserid", userId);
|
||||
addMap.put("expression", cronStr);
|
||||
addMap.put("create_time", DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
|
||||
addMap.put("quartz_type", jobType);
|
||||
this.baseQuartzConfigService.addQuartz(addMap);
|
||||
|
||||
mySchedulerFactory.addJob(id,quartzName, null, cronStr, quartz_class);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"新增定时任务:"+id);
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="新增定时任务失败";
|
||||
LogUtil.error(this.getClass(), "新增定时任务失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 删除定时任务
|
||||
* @author thuang
|
||||
* @created 2020年1月7日 下午2:10:04
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/deleteQuartz")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> deleteQuartz(@RequestBody HashMap<Object, Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
try{
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String id = StringDUtil.changeNullToEmpty(map.get("configId"));
|
||||
|
||||
mySchedulerFactory.pauseJob(id);
|
||||
|
||||
this.baseQuartzConfigService.deleteQuartzConfigById(id);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"删除定时任务:"+id);
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="删除定时任务失败";
|
||||
LogUtil.error(this.getClass(), "删除定时任务失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 修改定时任务
|
||||
* @author thuang
|
||||
* @created 2020年1月7日 下午2:10:04
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/modifyQuartz")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> modifyQuartz(@RequestBody HashMap<Object, Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
try{
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
String configId = StringDUtil.changeNullToEmpty(map.get("configId"));
|
||||
String quartzName = StringDUtil.changeNullToEmpty(map.get("quartzName"));
|
||||
String quartzGroup = StringDUtil.changeNullToEmpty(map.get("quartzGroup"));
|
||||
String quartzClass = StringDUtil.changeNullToEmpty(map.get("quartz_class"));
|
||||
String remark = StringDUtil.changeNullToEmpty(map.get("remark"));
|
||||
String quartzType=StringDUtil.changeNullToEmpty(map.get("jobType"));
|
||||
String time=StringDUtil.changeNullToEmpty(map.get("time"));
|
||||
String status=StringDUtil.changeNullToEmpty(map.get("status"));
|
||||
|
||||
if(time==null || "".equals(time)){
|
||||
throw new RuntimeException("time为空");
|
||||
}
|
||||
|
||||
String cronStr = getCron(map);
|
||||
|
||||
HashMap<Object, Object> updateMap=new HashMap<Object, Object>();
|
||||
updateMap.put("configId", configId);
|
||||
updateMap.put("quartzName", quartzName);
|
||||
updateMap.put("quartzGroup", quartzGroup);
|
||||
updateMap.put("quartzClass", quartzClass);
|
||||
updateMap.put("remark", remark);
|
||||
updateMap.put("expression", cronStr);
|
||||
updateMap.put("quartzType", quartzType);
|
||||
this.baseQuartzConfigService.updateQuartzConfigById(updateMap);
|
||||
|
||||
if("0".equals(status)){
|
||||
mySchedulerFactory.pauseJob(configId);
|
||||
Thread.sleep(100);
|
||||
mySchedulerFactory.resumeJob(configId);
|
||||
}
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"修改定时任务:"+configId);
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="修改定时任务失败";
|
||||
LogUtil.error(this.getClass(), "修改定时任务失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取定时任务工厂中所有的任务
|
||||
* @author thuang
|
||||
* @date 2021/9/9 14:28
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/get_all_jobs")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> getAllJobs() {
|
||||
HashMap<Object,Object> responseMap=new HashMap<>();
|
||||
|
||||
|
||||
List<HashMap<Object,Object>> quartzJobsVOList = new ArrayList<>();
|
||||
try {
|
||||
//获取Scheduler
|
||||
Scheduler scheduler = mySchedulerFactory.getScheduler();
|
||||
//再获取Scheduler下的所有group
|
||||
List<String> triggerGroupNames = scheduler.getTriggerGroupNames();
|
||||
for (String groupName : triggerGroupNames) {
|
||||
//组装group的匹配,为了模糊获取所有的triggerKey或者jobKey
|
||||
GroupMatcher groupMatcher = GroupMatcher.groupEquals(groupName);
|
||||
//获取所有的triggerKey
|
||||
Set<TriggerKey> triggerKeySet = scheduler.getTriggerKeys(groupMatcher);
|
||||
for (TriggerKey triggerKey : triggerKeySet) {
|
||||
//通过triggerKey在scheduler中获取trigger对象
|
||||
CronTrigger trigger = (CronTrigger) scheduler.getTrigger(triggerKey);
|
||||
//获取trigger拥有的Job
|
||||
JobKey jobKey = trigger.getJobKey();
|
||||
JobDetailImpl jobDetail = (JobDetailImpl) scheduler.getJobDetail(jobKey);
|
||||
//组装页面需要显示的数据
|
||||
HashMap<Object,Object> map=new HashMap<>();
|
||||
map.put("configId",jobDetail.getName());
|
||||
map.put("groupName",groupName);
|
||||
map.put("cron",trigger.getCronExpression());
|
||||
quartzJobsVOList.add(map);
|
||||
}
|
||||
}
|
||||
responseMap.put("quartzJobsVOList",quartzJobsVOList);
|
||||
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(this.getClass(),"获取定时任务信息出错,原因:"+e.getMessage());
|
||||
}
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
|
||||
//获取cron表达式
|
||||
public String getCron(HashMap<Object, Object> map){
|
||||
|
||||
String dataStr = StringDUtil.changeNullToEmpty(map.get("dataStr"));
|
||||
String time = StringDUtil.changeNullToEmpty(map.get("time"));
|
||||
|
||||
//拼接cron表达式
|
||||
String cronStr= "";
|
||||
|
||||
//拆分时分秒
|
||||
String[] split = dataStr.split(":");
|
||||
|
||||
if(split.length==3){
|
||||
//先秒
|
||||
cronStr=cronStr+split[2]+" ";
|
||||
//分
|
||||
cronStr=cronStr+split[1]+" ";
|
||||
//时
|
||||
cronStr=cronStr+split[0]+" ";
|
||||
}
|
||||
|
||||
//每周
|
||||
if("1".equals(time)){
|
||||
String weekTime = StringDUtil.changeNullToEmpty(map.get("weekTime"));//周几
|
||||
|
||||
cronStr=cronStr+"? * ";
|
||||
|
||||
//国外第一天是礼拜天国内是礼拜一所以转一下
|
||||
if("7".equals(weekTime)){
|
||||
weekTime="1";
|
||||
}else{
|
||||
int week = Integer.parseInt(weekTime);
|
||||
weekTime=""+(week+1);
|
||||
}
|
||||
cronStr=cronStr+weekTime;
|
||||
}
|
||||
|
||||
//每月
|
||||
if("2".equals(time)){
|
||||
String dayOfMonth = StringDUtil.changeNullToEmpty(map.get("dayOfMonth"));
|
||||
cronStr=cronStr+dayOfMonth+" * ?";
|
||||
}
|
||||
|
||||
//每季度
|
||||
if ("3".equals(time)) {
|
||||
String month = StringDUtil.changeNullToEmpty(map.get("month"));//第几个月
|
||||
String dayOfMonth = StringDUtil.changeNullToEmpty(map.get("dayOfMonth"));
|
||||
cronStr=cronStr+dayOfMonth+" "+month+"/3 ?";
|
||||
}
|
||||
|
||||
//每年
|
||||
if ("4".equals(time)) {
|
||||
String month = StringDUtil.changeNullToEmpty(map.get("month"));//那一个月
|
||||
String dayOfMonth = StringDUtil.changeNullToEmpty(map.get("dayOfMonth"));
|
||||
cronStr=cronStr+dayOfMonth+" "+month+" ?";
|
||||
}
|
||||
|
||||
return cronStr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.saye.hospitalgd.commons.JsonResult;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.service.system.DepartService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class DepartController {
|
||||
|
||||
@Autowired
|
||||
private DepartService departService;
|
||||
|
||||
/**
|
||||
* @description 到部门页面
|
||||
* @author thuang
|
||||
* @created 2019年11月13日 下午5:26:53
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toDepartManager")
|
||||
public String toDepartManager(ModelMap modelMap){
|
||||
|
||||
String parentId="10330001";
|
||||
List<HashMap<Object, Object>> resourceInfo = this.departService.findDepartTreeNodeList(parentId);
|
||||
|
||||
modelMap.addAttribute("departInfo", resourceInfo);
|
||||
|
||||
return "system/departManager";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 新增部门
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:42:26
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/addDepart")
|
||||
@ResponseBody
|
||||
public JsonResult addDepart(@RequestBody Map requestMap){
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
map.put("parentId", StringDUtil.changeNullToEmpty(requestMap.get("parentId")));
|
||||
map.put("departName", StringDUtil.changeNullToEmpty(requestMap.get("departName")));
|
||||
map.put("departId", StringDUtil.changeNullToEmpty(requestMap.get("departId")));
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
map.put("modifyUserName", userName);
|
||||
map.put("modifyTrueName", userTrueName);
|
||||
|
||||
String createTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
String createDate = DateDUtil.getCurrentDate();
|
||||
map.put("createTime", createTime);
|
||||
map.put("createDate", createDate);
|
||||
map.put("modifyTime",createTime);
|
||||
int result=0;
|
||||
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
result = departService.addDepart(map);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"新增部门:map:"+map.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "新增部门失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
|
||||
}
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("新增成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("新增失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 部门信息修改
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:45:34
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/modifyDepart")
|
||||
@ResponseBody
|
||||
public JsonResult modifyDepart(@RequestBody Map requestMap){
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
map.put("departId", StringDUtil.changeNullToEmpty(requestMap.get("departId")));
|
||||
map.put("departName", StringDUtil.changeNullToEmpty(requestMap.get("departName")));
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
map.put("modifyUserName", userName);
|
||||
map.put("modifyTrueName", userTrueName);
|
||||
|
||||
String modifyTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
map.put("modifyTime",modifyTime);
|
||||
int result=0;
|
||||
try {
|
||||
result=departService.modifyDepart(map);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"修改部门:map:"+map.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "修改部门失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
|
||||
}
|
||||
JsonResult j=new JsonResult();
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 删除某部门及其下的所有子结点,并更新其父部门的是否叶子结点信息
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:48:04
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/removeDepart")
|
||||
@ResponseBody
|
||||
public JsonResult removeDepart(@RequestBody Map requestMap){
|
||||
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
map.put("departId", StringDUtil.changeNullToEmpty(requestMap.get("departId")));
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
map.put("modifyUserName", userName);
|
||||
map.put("modifyTrueName", userTrueName);
|
||||
|
||||
String modifyTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
map.put("modifyTime",modifyTime);
|
||||
int result=0;
|
||||
try {
|
||||
result=departService.removeDepart(map);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"删除部门:map:"+map.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "删除部门失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
|
||||
}
|
||||
|
||||
JsonResult j=new JsonResult();
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("删除成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("删除失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据上级部门查询部门
|
||||
* @author thuang
|
||||
* @date 2021/7/8 10:10
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findDepartByParentId")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> findDepartByParentId(@RequestBody HashMap<Object,Object> map){
|
||||
HashMap<Object,Object> responseMap=new HashMap<>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try {
|
||||
String parentId=StringDUtil.changeNullToEmpty(map.get("parentId"));
|
||||
List<HashMap<Object, Object>> resourceInfo = this.departService.findDepartTreeNodeList(parentId);
|
||||
|
||||
responseMap.put("resourceInfo",resourceInfo);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
responseMap.put("errCode",errCode);
|
||||
responseMap.put("errMsg",errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.JsonResult;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.page.PageUtil;
|
||||
import com.saye.hospitalgd.commons.page.TemplatePage;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.commons.uuid.UUIDGenerator;
|
||||
import com.saye.hospitalgd.model.Dicinfo;
|
||||
import com.saye.hospitalgd.model.ResourceInfo;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.service.system.DicinfoService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class DicinfoController {
|
||||
|
||||
@Autowired
|
||||
private DicinfoService dicinfoService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 跳转到字典管理页面
|
||||
* @author qfqi
|
||||
* @created 2019年12月23日 下午1:47:21
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toDicinfoManager")
|
||||
public String toDepartManager(ModelMap modelMap){
|
||||
|
||||
String parentCode="0";
|
||||
List<Dicinfo> list= dicinfoService.findDicinfoTreeNodeList(parentCode);
|
||||
ResourceInfo resource = new ResourceInfo();
|
||||
resource.setTitle("字典");
|
||||
resource.setId("0");
|
||||
for (Dicinfo dicinfo : list) {
|
||||
//生成主节点
|
||||
ResourceInfo resourceInfo = new ResourceInfo();
|
||||
resourceInfo.setTitle(dicinfo.getDicname());
|
||||
resourceInfo.setId(dicinfo.getDiccode());
|
||||
resourceInfo.setSysid(dicinfo.getParentCode());
|
||||
resource.getChildren().add(resourceInfo);
|
||||
}
|
||||
String jsonString = JSONObject.toJSONString(resource);
|
||||
modelMap.addAttribute("departInfo", jsonString);
|
||||
return "system/dicinfoManage";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 新增字典
|
||||
* @author qfqi
|
||||
* @created 2019年12月19日 下午5:20:28
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dicinfoManager/addDicinfoManager")
|
||||
@ResponseBody
|
||||
public JsonResult addDicinfoManager(String dicname,String diccode,String dicvalue,String parentCode,String sortNo){
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
JsonResult j=new JsonResult();
|
||||
map.put("dicname", dicname);
|
||||
map.put("dicvalue", dicvalue);
|
||||
map.put("parentCode", parentCode);
|
||||
map.put("sortNo", sortNo);
|
||||
|
||||
|
||||
if(diccode!=null && !"".equals(diccode)){
|
||||
//代表新增的是字典树父级 需要验证字点编码是否重复
|
||||
map.put("diccode", diccode);
|
||||
List<Dicinfo> list= dicinfoService.findDicinfoBydiccode(diccode);
|
||||
if(list.size()>0){
|
||||
//代表在相同的父类下有相同的value值,
|
||||
j.setState(false);
|
||||
j.setMessage("字典编码重复,请重新输入!");
|
||||
return j;
|
||||
}
|
||||
}else{
|
||||
//代表新增的是子类,需要查询该父类下是否存在相同的val值
|
||||
map.put("diccode", UUIDGenerator.getUUID());
|
||||
List<Dicinfo> list= dicinfoService.findDicinfoTreeByCode(map);
|
||||
if(list.size()>0){
|
||||
//代表在相同的父类下有相同的value值,
|
||||
j.setState(false);
|
||||
j.setMessage("字典值重复,请重新输入!");
|
||||
return j;
|
||||
}
|
||||
}
|
||||
int result=0;
|
||||
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
map.put("create_time",DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss));
|
||||
|
||||
result = dicinfoService.addDicinfo(map);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"新增字典:map:"+map.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "新增字典失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("新增成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("新增失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @description 修改字典名称
|
||||
* @author qfqi
|
||||
* @created 2019年12月19日 下午5:50:45
|
||||
* @param requestMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dicinfoManager/updateDicinfoManager")
|
||||
@ResponseBody
|
||||
public JsonResult updateDicinfoManager(String diccode,String dicname,String parentCode,String dicvalue,String sortNo){
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
JsonResult j=new JsonResult();
|
||||
map.put("dicname", dicname);
|
||||
map.put("diccode", diccode);
|
||||
map.put("modifyTime", DateDUtil.getTheCurrentTime());
|
||||
map.put("dicvalue", dicvalue);
|
||||
map.put("parentCode", parentCode);
|
||||
map.put("sortNo", sortNo);
|
||||
|
||||
|
||||
int result=0;
|
||||
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
result = dicinfoService.modifyDicinfo(map);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"修改字典:map:"+map.toString());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "修改字典失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 删除字典
|
||||
* @author qfqi
|
||||
* @created 2019年12月19日 下午5:50:25
|
||||
* @param requestMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dicinfoManager/deleteDicinfoManager")
|
||||
@ResponseBody
|
||||
public JsonResult deleteDicinfoManager(@RequestBody Map requestMap){
|
||||
String diccode= StringDUtil.changeNullToEmpty(requestMap.get("diccode"));
|
||||
int result=0;
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
result = dicinfoService.deleteDicinfo(diccode);
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"删除字典:diccode:"+diccode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "删除字典失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("删除成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("删除失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
//根据父id分页查询字典
|
||||
@RequestMapping("/dicinfoManager/selectDicinfoManager")
|
||||
@ResponseBody
|
||||
public TemplatePage selectDicinfoManager(String parentCode,Integer page,Integer limit){
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<Dicinfo> appsPageInfo = new PageInfo<Dicinfo>(dicinfoService.findDicinfoTreeNodeList(parentCode));
|
||||
return PageUtil.loadJsonPage(appsPageInfo);
|
||||
}
|
||||
|
||||
//根据上级编码查询所有数据
|
||||
@RequestMapping("/dicinfoManager/selectDicinfoListByCode")
|
||||
@ResponseBody
|
||||
public List<HashMap<Object, Object>> selectDicinfoListByCode(String parent_code){
|
||||
|
||||
List<HashMap<Object, Object>> list = this.dicinfoService.selectDicinfoListByCode(parent_code);
|
||||
return list;
|
||||
}
|
||||
|
||||
//根据条件分页查询字典
|
||||
@RequestMapping("/dicinfoManager/selectDicinfoPageListByCondition")
|
||||
@ResponseBody
|
||||
public TemplatePage selectDicinfoPageListByCondition(String parentCode,String dicname,Integer page,Integer limit){
|
||||
|
||||
HashMap<String, String> map = new HashMap<String,String>();
|
||||
map.put("parentCode", parentCode);
|
||||
map.put("dicname", dicname);
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<HashMap<Object, Object>> appsPageInfo = new PageInfo<HashMap<Object, Object>>(dicinfoService.selectDicinfoListByCondition(map));
|
||||
return PageUtil.loadJsonPage(appsPageInfo);
|
||||
}
|
||||
|
||||
//根据条件查询所有字典
|
||||
@RequestMapping("/dicinfoManager/selectDicinfoListByCondition")
|
||||
@ResponseBody
|
||||
public List<HashMap<Object, Object>> selectDicinfoListByCondition(@RequestBody HashMap<String, String> map){
|
||||
|
||||
List<HashMap<Object, Object>> list = this.dicinfoService.selectDicinfoListByCondition(map);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @description 获取最大字典顺序
|
||||
* @author qfqi
|
||||
* @created 2021年1月13日 下午2:56:03
|
||||
* @param requestMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/dicinfoManager/getMaxDicValue")
|
||||
@ResponseBody
|
||||
public JsonResult getMaxDicValue(@RequestBody Map requestMap){
|
||||
String diccode= StringDUtil.changeNullToEmpty(requestMap.get("diccode"));
|
||||
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
HashMap<String, String> map = new HashMap<String,String>();
|
||||
map.put("parentCode", diccode);
|
||||
HashMap<Object, Object> result = dicinfoService.getMaxDicValue(map);
|
||||
j.setState(true);
|
||||
j.setData(result.get("MAXDICVALUE"));
|
||||
j.setMessage("成功!");
|
||||
} catch (Exception e) {
|
||||
j.setState(false);
|
||||
j.setMessage("查询字典最大值失败!");
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "查询字典最大值失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.model.Logger;
|
||||
import com.saye.hospitalgd.service.system.LoggerService;
|
||||
|
||||
@Controller
|
||||
public class LoggerController {
|
||||
|
||||
@Autowired
|
||||
private LoggerService loggerService;
|
||||
|
||||
/**
|
||||
* @description 到日志管理页面
|
||||
* @author thuang
|
||||
* @created 2019年11月13日 下午5:27:29
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toLogger")
|
||||
public String toLogger(ModelMap modelMap){
|
||||
|
||||
return "system/logger";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 查询所有日志数据
|
||||
* @author thuang
|
||||
* @created 2019年11月13日 下午5:41:56
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/findLogger")
|
||||
@ResponseBody
|
||||
public HashMap<String, Object> findLogger(String loggerType,String startTime,String endTime,Integer page,Integer limit ){
|
||||
HashMap<Object, Object> map=new HashMap<Object, Object>();
|
||||
map.put("loggerType", loggerType);
|
||||
map.put("startTime", startTime);
|
||||
map.put("endTime", endTime);
|
||||
|
||||
HashMap<String, Object> responseMap = new HashMap<String,Object>();
|
||||
try {
|
||||
PageHelper.startPage(page, limit);
|
||||
// PageInfo<HashMap<Object, Object>> appsPageInfo = new PageInfo<HashMap<Object,Object>>(loggerService.hospitalgd(map));
|
||||
|
||||
PageInfo<Logger> appsPageInfo = new PageInfo<Logger>(loggerService.findLogger(map));
|
||||
|
||||
responseMap.put("code", 0);
|
||||
responseMap.put("msg", "");
|
||||
responseMap.put("count", appsPageInfo.getTotal());
|
||||
responseMap.put("data", appsPageInfo.getList());
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "查询所有日志数据失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
|
||||
}
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,306 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.ResourceInfo;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.service.UnilateralService;
|
||||
import com.saye.hospitalgd.service.system.MenuService;
|
||||
import com.saye.hospitalgd.service.system.ServiceParamsService;
|
||||
import com.saye.hospitalgd.service.system.UsersService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authc.ExcessiveAttemptsException;
|
||||
import org.apache.shiro.authc.ExpiredCredentialsException;
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
@Autowired
|
||||
private ServiceParamsService serviceParamsService;
|
||||
|
||||
|
||||
/**
|
||||
* @description 去登录页面
|
||||
* @author dqzhang
|
||||
* @created 2019年11月13日 下午4:22:48
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toLogin")
|
||||
public String toLogin(ModelMap map) {
|
||||
|
||||
List<HashMap<Object, Object>> list = serviceParamsService.findParamValByParamCode("prj_name");
|
||||
map.addAttribute("prj_name",list.get(0).get("PARAM_VAL"));
|
||||
return "login";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 登录
|
||||
* @author dqzhang
|
||||
* @created 2019年11月13日 下午5:03:11
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/login")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> signin(@RequestBody Map map) {
|
||||
|
||||
String key = StringDUtil.removeSpaces(map.get("key"));
|
||||
String username = StringDUtil.removeSpaces(map.get("username"));
|
||||
String password = StringDUtil.removeSpaces(map.get("password"));
|
||||
String vercode = StringDUtil.removeSpaces(map.get("vercode"));
|
||||
String initVector = StringDUtil.removeSpaces(map.get("initVector"));
|
||||
|
||||
String errCode = "0";
|
||||
String errMsg = "";
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
|
||||
try {
|
||||
String code = (String) subject.getSession().getAttribute("verify_code");
|
||||
if(!code.equalsIgnoreCase(vercode)) {
|
||||
errCode = "CodeError";
|
||||
errMsg = "验证码不正确!";
|
||||
}
|
||||
if("0".equals(errCode)) {
|
||||
UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password);
|
||||
subject.login(usernamePasswordToken);
|
||||
LogUtil.info(getClass(), "用户:"+username+"登录系统");
|
||||
}
|
||||
} catch (ExcessiveAttemptsException e) {
|
||||
errCode = "ExcessiveAttempts";
|
||||
errMsg = "账户已锁定,请稍后再试!";
|
||||
LogUtil.error(this.getClass(), "登录失败,原因:"+errMsg);
|
||||
} catch (ExpiredCredentialsException e) {
|
||||
errCode = "ExpiredCredentials";
|
||||
errMsg = "账号已过期!";
|
||||
LogUtil.error(this.getClass(), "登录失败,原因:"+errMsg);
|
||||
} catch (AuthenticationException e) {
|
||||
errCode = "Authentication";
|
||||
errMsg = "账号或密码错误!";
|
||||
LogUtil.error(this.getClass(), "登录失败,原因:"+errMsg);
|
||||
} catch (Exception e) {
|
||||
errCode = e.getLocalizedMessage();
|
||||
errMsg = "未知异常!";
|
||||
LogUtil.error(this.getClass(), "登录失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
HashMap<Object,Object> resultMap = new HashMap<Object,Object>();
|
||||
resultMap.put("errCode", errCode);
|
||||
resultMap.put("errMsg", errMsg);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 首页
|
||||
* @author dqzhang
|
||||
* @created 2019年11月13日 下午5:10:21
|
||||
* @param modelMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index")
|
||||
public String index(ModelMap modelMap) {
|
||||
|
||||
HashMap<Object,Object> map = new HashMap<Object,Object>();
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
Users user = (Users) subject.getPrincipal();
|
||||
String user_id = user.getUserId();
|
||||
map.put("user_id", user_id);
|
||||
ResourceInfo resourceInfo=null;
|
||||
modelMap.addAttribute("expired",false);
|
||||
try {
|
||||
//上次密码修改时间
|
||||
String modifyTime = user.getModifyTime();
|
||||
String modifyDate = modifyTime.substring(0, 10);
|
||||
String today = DateDUtil.getCurrentDate("yyyy-MM-dd");
|
||||
long differDay = DateDUtil.getDaysOfTowDiffDate(modifyDate, today);
|
||||
if(differDay>90) { //密码90天过期
|
||||
modelMap.addAttribute("expired",true);
|
||||
}
|
||||
resourceInfo = this.menuService.getMenuByRole(map);
|
||||
String userTrueName = user.getTrueName();
|
||||
String userName = user.getUserName();
|
||||
modelMap.addAttribute("userTrueName",userTrueName);
|
||||
modelMap.addAttribute("userName",userName);
|
||||
modelMap.addAttribute("userId",user_id);
|
||||
|
||||
List<HashMap<Object, Object>> list = serviceParamsService.findParamValByParamCode("prj_name");
|
||||
modelMap.addAttribute("prj_name",list.get(0).get("PARAM_VAL"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "跳转首页失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
modelMap.addAttribute("resourceInfo", resourceInfo.getChildren());
|
||||
|
||||
|
||||
return "index";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 查询菜单
|
||||
* @author thuang
|
||||
* @created 2019年11月6日 下午3:55:20
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/menu")
|
||||
@ResponseBody
|
||||
public ResourceInfo findMenu(){
|
||||
HashMap<Object,Object> map = new HashMap<Object,Object>();
|
||||
map.put("user_id", "admin");
|
||||
map.put("firstNode", "0");
|
||||
ResourceInfo resourceInfo=null;
|
||||
try {
|
||||
resourceInfo = this.menuService.getMenuByRole(map);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "查询菜单失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
return resourceInfo;
|
||||
}
|
||||
|
||||
@RequestMapping("/logout")
|
||||
public void logout(HttpServletResponse response) throws IOException {
|
||||
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
if(subject.isAuthenticated()) {
|
||||
subject.logout();
|
||||
}
|
||||
response.sendRedirect("/toLogin");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取验证码
|
||||
* @author dqzhang
|
||||
* @created 2019年11月27日 下午3:15:32
|
||||
* @param reuqest
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/getCode")
|
||||
public void verify(HttpServletRequest reuqest,HttpServletResponse response) throws Exception {
|
||||
|
||||
String name = reuqest.getParameter("name");
|
||||
|
||||
response.setContentType("image/jpeg");
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0L);
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
Session session = subject.getSession();
|
||||
|
||||
try {
|
||||
int width = 73;
|
||||
int height = 27;
|
||||
BufferedImage image = new BufferedImage(width, height, 1);
|
||||
|
||||
Graphics g = image.getGraphics();
|
||||
|
||||
Random random = new Random();
|
||||
|
||||
g.setColor(getRandColor(200, 250));
|
||||
g.fillRect(0, 0, width, height);
|
||||
|
||||
g.setFont(new Font("Times New Roman", 0, 24));
|
||||
|
||||
g.setColor(getRandColor(160, 200));
|
||||
for (int i = 0; i < 155; i++) {
|
||||
int x = random.nextInt(width);
|
||||
int y = random.nextInt(height);
|
||||
int xl = random.nextInt(12);
|
||||
int yl = random.nextInt(12);
|
||||
g.drawLine(x, y, x + xl, y + yl);
|
||||
}
|
||||
|
||||
String sRand = "";
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String rand = randomInt(1).toUpperCase();
|
||||
sRand = sRand + rand;
|
||||
|
||||
g.setColor(new Color(20 + random.nextInt(110), 20 + random
|
||||
.nextInt(110), 20 + random.nextInt(110)));
|
||||
g.drawString(rand, 13 * i + 6, 24);
|
||||
}
|
||||
if (StringDUtil.changeNullToEmpty(name).equals(""))
|
||||
session.setAttribute("verify_code", sRand);
|
||||
else {
|
||||
session.setAttribute(name, sRand);
|
||||
}
|
||||
|
||||
g.dispose();
|
||||
ServletOutputStream responseOutputStream = response.getOutputStream();
|
||||
|
||||
ImageIO.write(image, "JPEG", responseOutputStream);
|
||||
|
||||
responseOutputStream.flush();
|
||||
responseOutputStream.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Color getRandColor(int fc, int bc) {
|
||||
Random random = new Random();
|
||||
if (fc > 255)
|
||||
fc = 255;
|
||||
if (bc > 255)
|
||||
bc = 255;
|
||||
int r = fc + random.nextInt(bc - fc);
|
||||
int g = fc + random.nextInt(bc - fc);
|
||||
int b = fc + random.nextInt(bc - fc);
|
||||
return new Color(r, g, b);
|
||||
}
|
||||
|
||||
public static final String randomInt(int length) {
|
||||
if (length < 1) {
|
||||
return null;
|
||||
}
|
||||
Random randGen = new Random();
|
||||
// char[] numbersAndLetters = "0123456789abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||
char[] numbersAndLetters = "0123456789".toCharArray();
|
||||
char[] randBuffer = new char[length];
|
||||
for (int i = 0; i < randBuffer.length; i++) {
|
||||
// randBuffer[i] = numbersAndLetters[randGen.nextInt(36)];
|
||||
randBuffer[i] = numbersAndLetters[randGen.nextInt(10)];
|
||||
}
|
||||
return new String(randBuffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/toNoAuthority")
|
||||
public String toNoAuthority(ModelMap modelMap) {
|
||||
|
||||
return "/noAuthority";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.JsonResult;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.model.MenuRole;
|
||||
import com.saye.hospitalgd.model.ResourceInfo;
|
||||
import com.saye.hospitalgd.model.Role;
|
||||
import com.saye.hospitalgd.model.Users;
|
||||
import com.saye.hospitalgd.service.system.DepartService;
|
||||
import com.saye.hospitalgd.service.system.MenuService;
|
||||
import com.saye.hospitalgd.service.system.RoleService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class RoleController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private DepartService departService;
|
||||
/**
|
||||
* @description 到角色管理页面
|
||||
* @author thuang
|
||||
* @created 2019年11月11日 上午10:50:40
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toRoleManager")
|
||||
public String toRoleManager(ModelMap modelMap){
|
||||
|
||||
HashMap<Object,Object> responseMap = new HashMap<Object,Object>();
|
||||
responseMap.put("firstNode", "0");
|
||||
ResourceInfo resourceInfo=null;
|
||||
try {
|
||||
resourceInfo = this.menuService.getMenuByRole(responseMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
modelMap.addAttribute("resourceInfo", resourceInfo);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("parent_id","10330701");
|
||||
List<HashMap<Object, Object>> departList = this.departService.findDepartByParentId(map);
|
||||
for (HashMap<Object, Object> departMap : departList) {
|
||||
departMap.put("id",departMap.get("DEPART_ID"));
|
||||
departMap.put("title",departMap.get("DEPART_NAME"));
|
||||
}
|
||||
modelMap.put("departList",departList);
|
||||
return "system/roleManager";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 查询列表
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:07:41
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/searchRole")
|
||||
@ResponseBody
|
||||
public HashMap<String, Object> searchRole(String roleName,String date,Integer page, Integer limit){
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
map.put("roleName", roleName);
|
||||
map.put("date", date);
|
||||
PageHelper.startPage(page, limit);
|
||||
PageInfo<Role> appsPageInfo = new PageInfo<Role>(roleService.searchRole(map));
|
||||
HashMap<String, Object> map1 = new HashMap<String,Object>();
|
||||
map1.put("code", 0);
|
||||
map1.put("msg", "你好");
|
||||
map1.put("count", appsPageInfo.getTotal());
|
||||
map1.put("data", appsPageInfo.getList());
|
||||
|
||||
return map1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 添加角色
|
||||
* @author thuang
|
||||
* @created 2019年11月11日 下午3:58:24
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertRoles")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> insertRoles(String roleName,String menuId){
|
||||
|
||||
HashMap<String, String> map=new HashMap<String, String>();
|
||||
HashMap<Object, Object> response=new HashMap<Object, Object>();
|
||||
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
map.put("roleName",roleName);
|
||||
map.put("menuId",menuId);
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
map.put("userName", userName);
|
||||
map.put("userTrueName", userTrueName);
|
||||
|
||||
//新增角色
|
||||
try {
|
||||
String status = roleService.addRole(map);
|
||||
LogUtil.info(this.getClass(),"用户"+ user.getTrueName()+"添加角色:map:"+map.toString());
|
||||
if ("true".equals(status)) {
|
||||
|
||||
}else {
|
||||
errCode="998";
|
||||
errMsg=status;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errCode="999";
|
||||
errMsg=e.getMessage();
|
||||
LogUtil.error(this.getClass(), "新增角色失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
response.put("errCode", errCode);
|
||||
response.put("errMsg", errMsg);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 删除用户角色
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:07:54
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/deleteRole")
|
||||
@ResponseBody
|
||||
public JsonResult deleteRole(String roleId){
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
int result=roleService.deleteRole(roleId);
|
||||
LogUtil.info(this.getClass(),"用户"+ user.getTrueName()+"删除角色:roleId:"+roleId);
|
||||
JsonResult j=new JsonResult();
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("删除成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("删除失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据角色id获取角色权限菜单id
|
||||
* @author thuang
|
||||
* @created 2019年11月12日 上午9:51:08
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getSelectMenuId")
|
||||
@ResponseBody
|
||||
public List<String> getSelectMenuId(String roleId){
|
||||
|
||||
HashMap<Object, Object> map=new HashMap<Object, Object>();
|
||||
map.put("roleId",roleId);
|
||||
List<MenuRole> menuIdByRoleId = menuService.getMenuIdByRoleId(map);
|
||||
|
||||
List<String> menuIdList=new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < menuIdByRoleId.size(); i++) {
|
||||
MenuRole menuRole = menuIdByRoleId.get(i);
|
||||
menuIdList.add(menuRole.getMenuId());
|
||||
}
|
||||
|
||||
return menuIdList;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 修改用户角色权限信息
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:08:05
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/modifyRoleResource")
|
||||
@ResponseBody
|
||||
public JsonResult modifyRoleResource(String roleId,String roleName,String menuId,String departId,String pointDelete) {
|
||||
|
||||
HashMap<String,String> map=new HashMap<String,String>();
|
||||
map.put("roleName", roleName);
|
||||
map.put("roleId", roleId);
|
||||
map.put("menuId", menuId);
|
||||
map.put("departId", departId);
|
||||
map.put("pointDelete", pointDelete);
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
int result=roleService.modifyRoleResource(map);
|
||||
LogUtil.info(this.getClass(),"用户"+ user.getTrueName()+"修改用户角色权限信息:map:"+map.toString());
|
||||
JsonResult j=new JsonResult();
|
||||
if(result>0){
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,714 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.saye.hospitalgd.commons.JsonResult;
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.commons.log.ExceptionDUtil;
|
||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import com.saye.hospitalgd.model.*;
|
||||
import com.saye.hospitalgd.service.system.DepartService;
|
||||
import com.saye.hospitalgd.service.system.RoleService;
|
||||
import com.saye.hospitalgd.service.system.UsersService;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.crypto.hash.Md5Hash;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Controller
|
||||
public class UsersController {
|
||||
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private DepartService departService;
|
||||
|
||||
|
||||
/**
|
||||
* @description 到用户管理页面
|
||||
* @author thuang
|
||||
* @created 2019年11月15日 上午10:12:12
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/toUserManager")
|
||||
public String toUserManager(ModelMap modelMap){
|
||||
|
||||
//查询所有部门
|
||||
String parentId="10330001";
|
||||
List<HashMap<Object, Object>> resourceInfo = this.departService.findDepartTreeNodeList(parentId);
|
||||
modelMap.addAttribute("departInfo", resourceInfo);
|
||||
|
||||
//查询所有角色
|
||||
List<Role> roleList = this.roleService.findRoleList();
|
||||
modelMap.addAttribute("roleList",roleList);
|
||||
|
||||
|
||||
//查询所有一级地市
|
||||
List<HashMap<Object, Object>> departList = departService.findDepartByParentId(new HashMap<String,Object>(){{put("parent_id","10330701");}});
|
||||
modelMap.addAttribute("departList",departList);
|
||||
return "system/userManager";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description user表分页查询
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:06:12
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/selectUser")
|
||||
@ResponseBody
|
||||
public HashMap<String, Object> searchUsers(String departId,String trueName,String isactive,String roleId,String dtRoleId,Integer page, Integer limit) {
|
||||
HashMap<Object,Object> map=new HashMap<Object,Object>();
|
||||
HashMap<String, Object> resultMap = new HashMap<String,Object>();
|
||||
try{
|
||||
|
||||
String[] departIds=null;
|
||||
if (departId !=null && !"".equals(departId)) {
|
||||
departIds = departId.split(",");
|
||||
}
|
||||
|
||||
map.put("departId", departIds);
|
||||
map.put("trueName", trueName);
|
||||
map.put("isactive", isactive);
|
||||
map.put("roleId", roleId);
|
||||
map.put("dtRoleId", dtRoleId);
|
||||
PageHelper.startPage(page, limit);
|
||||
|
||||
PageInfo<Users> appsPageInfo = new PageInfo<Users>(usersService.searchUsers(map));
|
||||
|
||||
resultMap.put("code", 0);
|
||||
resultMap.put("msg", "OK");
|
||||
resultMap.put("count", appsPageInfo.getTotal());
|
||||
resultMap.put("data", appsPageInfo.getList());
|
||||
}catch (Exception e){
|
||||
resultMap.put("code", 999);
|
||||
resultMap.put("msg", e.getMessage());
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 新增用户
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:05:10
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/insertUsers")
|
||||
@ResponseBody
|
||||
public JsonResult insertUsers(@RequestBody HashMap<Object, Object> requestMap){
|
||||
|
||||
int i;
|
||||
JsonResult j=new JsonResult();
|
||||
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
|
||||
requestMap.put("userName", userName);
|
||||
requestMap.put("userTrueName", userTrueName);
|
||||
|
||||
i = usersService.insertUser(requestMap);
|
||||
if(i>0){
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"新增用户的方法:requestMap:"+requestMap.toString());
|
||||
j.setState(true);
|
||||
j.setMessage("新增成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("新增失败!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setState(false);
|
||||
j.setMessage(e.getMessage());
|
||||
LogUtil.error(this.getClass(), "新增用户失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 修改用户
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:04:28
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/modifyUsers")
|
||||
@ResponseBody
|
||||
public JsonResult modifyUsers(@RequestBody HashMap<Object, Object> requestMap){
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
|
||||
requestMap.put("userName", userName);
|
||||
requestMap.put("userTrueName", userTrueName);
|
||||
String createTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
String createDate = DateDUtil.getCurrentDate();
|
||||
/*requestMap.put("modifyTime", createTime);
|
||||
requestMap.put("createTime", createTime);*/
|
||||
requestMap.put("createDate", createDate);
|
||||
int result=usersService.modifyUsers(requestMap);
|
||||
|
||||
if(result>0){
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"修改用户的方法:requestMap:"+requestMap.toString());
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setState(false);
|
||||
j.setMessage(e.getMessage());
|
||||
LogUtil.error(this.getClass(), "修改用户失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 密码重置
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:06:37
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/reSetPassword")
|
||||
@ResponseBody
|
||||
public JsonResult reSetPassword(@RequestBody HashMap<Object, Object> requestMap){
|
||||
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
|
||||
requestMap.put("modifyUserName", userName);
|
||||
requestMap.put("modifyTrueName", userTrueName);
|
||||
String createTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
String createDate = DateDUtil.getCurrentDate();
|
||||
requestMap.put("createTime", createTime);
|
||||
requestMap.put("createDate", createDate);
|
||||
//产生6位长度的随机密码(由字母和数字组成)
|
||||
String password = StringDUtil.generateRandomCodeForLength(6);
|
||||
String addPasswordMd5 = new Md5Hash(password,"hospitalgd",2).toString();
|
||||
requestMap.put("password", addPasswordMd5);
|
||||
|
||||
int result=usersService.reSetPassword(requestMap);
|
||||
|
||||
if(result>0){
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"重置用户的密码方法:requestMap:"+requestMap.toString());
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
j.setData(password);
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setState(false);
|
||||
j.setMessage(e.getMessage());
|
||||
LogUtil.error(this.getClass(), "密码重置失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @description 启用/禁用
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:06:54
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/unableUser")
|
||||
@ResponseBody
|
||||
public JsonResult unableUser(@RequestBody HashMap<Object, Object> requestMap){
|
||||
JsonResult j=new JsonResult();
|
||||
try{
|
||||
Users user = (Users) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
String userName = user.getUserName();
|
||||
String userTrueName = user.getTrueName();
|
||||
|
||||
requestMap.put("modifyUserName", userName);
|
||||
requestMap.put("modifyTrueName", userTrueName);
|
||||
String createTime = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
String createDate = DateDUtil.getCurrentDate();
|
||||
requestMap.put("createTime", createTime);
|
||||
requestMap.put("createDate", createDate);
|
||||
|
||||
int result=usersService.unableUser(requestMap);
|
||||
|
||||
if(result>0){
|
||||
LogUtil.debug(this.getClass(),"用户"+ user.getTrueName()+"启用禁用用户的方法:requestMap:"+requestMap.toString());
|
||||
j.setState(true);
|
||||
j.setMessage("修改成功!");
|
||||
}else{
|
||||
j.setState(false);
|
||||
j.setMessage("修改失败!");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setState(false);
|
||||
j.setMessage(e.getMessage());
|
||||
LogUtil.error(this.getClass(), "禁用启用失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 查询角色
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:07:09
|
||||
* @return
|
||||
*/
|
||||
// @RequestMapping("/findRoleList")
|
||||
// @ResponseBody
|
||||
// public JsonResult findRoleList(){
|
||||
// List<Role> list =roleService.findRoleList();
|
||||
// JsonResult j=new JsonResult();
|
||||
// j.setState(true);
|
||||
// j.setMessage("查询成功");
|
||||
// j.setData(list);
|
||||
// return j;
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
* @description 新增用户名验证
|
||||
* @author qfqi
|
||||
* @created 2019年11月5日 下午3:07:22
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/searchByName")
|
||||
@ResponseBody
|
||||
public JsonResult searchByName(String userName){
|
||||
List<Users> list=usersService.searchByName(userName);
|
||||
JsonResult j=new JsonResult();
|
||||
j.setState(true);
|
||||
j.setMessage("查询成功");
|
||||
j.setData(list);
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 修改密码
|
||||
* @author thuang
|
||||
* @created 2019年11月27日 下午6:13:05
|
||||
* @param requestMap
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/modifyPassword")
|
||||
@ResponseBody
|
||||
public JsonResult modifyPassword(@RequestBody HashMap<Object, Object> requestMap){
|
||||
|
||||
String password = StringDUtil.changeNullToEmpty(requestMap.get("password"));
|
||||
String key = StringDUtil.removeSpaces(requestMap.get("key"));
|
||||
String initVector = StringDUtil.removeSpaces(requestMap.get("initVector"));
|
||||
JsonResult j=new JsonResult();
|
||||
try {
|
||||
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
Users user = (Users) subject.getPrincipal();
|
||||
String username = user.getUserName();
|
||||
String passwordMd5 = new Md5Hash(password,"hospitalgd",2).toString();
|
||||
String addPasswordMd5 = new Md5Hash(password,"hospitalgd",2).toString();
|
||||
|
||||
String modifyTime = DateDUtil.getTheCurrentTime();
|
||||
this.usersService.modifyPassword(username,passwordMd5,modifyTime);
|
||||
|
||||
user.setModifyTime(modifyTime);
|
||||
j.setState(true);
|
||||
j.setMessage("更改密码成功");
|
||||
LogUtil.debug(this.getClass(),"用户修改用户的密码方法:requestMap:"+requestMap.toString());
|
||||
} catch (Exception e) {
|
||||
j.setState(false);
|
||||
j.setMessage("更改密码失败");
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "修改密码失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 导入人员信息
|
||||
* @author thuang
|
||||
* @date 2021/5/19 9:57
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/uploadUsers")
|
||||
@ResponseBody
|
||||
public HashMap<Object, Object> uploadUsers(@RequestParam("spareFile") MultipartFile file, HttpServletRequest request, HttpServletResponse response)throws Exception{
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
if (!file.isEmpty()) {
|
||||
XSSFWorkbook workbook =null;
|
||||
|
||||
//创建Excel,读取文件内容
|
||||
workbook = new XSSFWorkbook(file.getInputStream());
|
||||
|
||||
//获取第一个工作表
|
||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
||||
//获取sheet中第一行行号
|
||||
int firstRowNum = sheet.getFirstRowNum();
|
||||
//获取sheet中最后一行行号
|
||||
int lastRowNum = sheet.getLastRowNum();
|
||||
|
||||
try {
|
||||
//查询部门
|
||||
List<HashMap<Object,Object>> departs = departService.selectAllDeparts();
|
||||
HashMap<String,HashMap<Object,Object>> departTreeMap=new HashMap<>();
|
||||
HashMap<String,List<HashMap<Object,Object>>> parentIdMap=new HashMap<>();
|
||||
HashMap<String,HashMap<Object,Object>> departIdMap=new HashMap<>();
|
||||
//处理部门组织方便查询
|
||||
for (int i=0;i<departs.size();i++){
|
||||
HashMap<Object, Object> map = departs.get(i);
|
||||
String depart_id = StringDUtil.changeNullToEmpty(map.get("DEPART_ID"));
|
||||
String depart_name = StringDUtil.changeNullToEmpty(map.get("DEPART_NAME"));
|
||||
String parent_id = StringDUtil.changeNullToEmpty(map.get("PARENT_ID"));
|
||||
String parent_name = StringDUtil.changeNullToEmpty(map.get("PARENT_NAME"));
|
||||
|
||||
//如果上级名称为空说明没有上级部门,就是第一级 当然也有错误数据的情况,不过要出问题要满足名称相同,且上级都为空
|
||||
departIdMap.put(depart_id,map);
|
||||
if ("".equals(parent_name)){
|
||||
departTreeMap.put(depart_id,map);
|
||||
continue;
|
||||
}
|
||||
|
||||
List<HashMap<Object, Object>> pidList = parentIdMap.get(parent_id);
|
||||
if (pidList == null){
|
||||
pidList=new ArrayList<>();
|
||||
parentIdMap.put(parent_id,pidList);
|
||||
}
|
||||
pidList.add(map);
|
||||
}
|
||||
for (String key : parentIdMap.keySet()){
|
||||
List<HashMap<Object, Object>> list = parentIdMap.get(key);
|
||||
HashMap<Object, Object> map = departIdMap.get(key);
|
||||
|
||||
map.put("childen",list);
|
||||
}
|
||||
|
||||
//时间
|
||||
String create_time = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd_HH_mm_ss);
|
||||
String create_date = DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd);
|
||||
|
||||
//添加人员
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
Users user = (Users) subject.getPrincipal();
|
||||
String modify_user_name = user.getUserName();
|
||||
String modify_true_name = user.getTrueName();
|
||||
|
||||
//循环插入数据
|
||||
int errNum=0;
|
||||
List<String> errNumList=new ArrayList<String>();
|
||||
List<HashMap<Object,Object>> addList=new ArrayList<>();
|
||||
for(int i=firstRowNum+2;i<=lastRowNum;i++){//因为表格中第一行为标题,第二行为列标题
|
||||
XSSFRow row = sheet.getRow(i);
|
||||
HashMap<Object, Object> addMap=new HashMap<Object, Object>();
|
||||
//用户id
|
||||
XSSFCell user_id = row.getCell(0);
|
||||
if(user_id==null){
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}else {
|
||||
user_id.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("user_id",user_id.getStringCellValue());
|
||||
addMap.put("user_name",user_id.getStringCellValue());
|
||||
}
|
||||
|
||||
//姓名
|
||||
XSSFCell true_name = row.getCell(1);
|
||||
if(true_name==null){
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}else {
|
||||
true_name.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("true_name",true_name.getStringCellValue());
|
||||
}
|
||||
|
||||
//性别
|
||||
XSSFCell sex = row.getCell(2);
|
||||
if(sex==null){
|
||||
addMap.put("sex","");
|
||||
}else {
|
||||
sex.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("sex",sex.getStringCellValue());
|
||||
}
|
||||
|
||||
//公司
|
||||
String companyId="";
|
||||
XSSFCell company = row.getCell(3);
|
||||
if(company==null){
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}else {
|
||||
company.setCellType(Cell.CELL_TYPE_STRING);
|
||||
String companyStr = company.getStringCellValue();
|
||||
|
||||
//第一层是最上一级
|
||||
boolean isHas=false;
|
||||
for(String key:departTreeMap.keySet()){
|
||||
HashMap<Object, Object> hashMap = departTreeMap.get(key);
|
||||
List<HashMap<Object,Object>> departList = (List<HashMap<Object,Object>>)hashMap.get("childen");
|
||||
//要循环的级别
|
||||
for (int j=0;j<departList.size();j++){
|
||||
HashMap<Object, Object> departObj = departList.get(j);
|
||||
String depart_id = StringDUtil.changeNullToEmpty(departObj.get("DEPART_ID"));
|
||||
String depart_name = StringDUtil.changeNullToEmpty(departObj.get("DEPART_NAME"));
|
||||
if(companyStr.equals(depart_name)){
|
||||
addMap.put("company",depart_id);
|
||||
companyId=depart_id;
|
||||
isHas=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//判断对错 错的错误记录加1
|
||||
if (!isHas){
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//部门
|
||||
XSSFCell depart = row.getCell(4);
|
||||
if(depart==null){
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}else {
|
||||
depart.setCellType(Cell.CELL_TYPE_STRING);
|
||||
String departStr = depart.getStringCellValue();
|
||||
|
||||
//从部门树中找到部门
|
||||
HashMap<Object, Object> hashMap = departIdMap.get(companyId);
|
||||
List<HashMap<Object,Object>> departList = (List<HashMap<Object,Object>>)hashMap.get("childen");
|
||||
List<String> data=new ArrayList<>();
|
||||
getDepartIdByMapTree(data,departStr,departList);
|
||||
|
||||
if (data.size()>0){
|
||||
addMap.put("depart_id",data.get(0));
|
||||
}else{
|
||||
errNum++;
|
||||
errNumList.add(""+(i+1));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//岗位
|
||||
XSSFCell post = row.getCell(5);
|
||||
if(post==null){
|
||||
addMap.put("post","");
|
||||
}else {
|
||||
post.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("post",post.getStringCellValue());
|
||||
}
|
||||
|
||||
//政治面貌
|
||||
XSSFCell policital_status = row.getCell(6);
|
||||
if(policital_status==null){
|
||||
addMap.put("policital_status","");
|
||||
}else {
|
||||
policital_status.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("policital_status",policital_status.getStringCellValue());
|
||||
}
|
||||
|
||||
//专业技术资格
|
||||
XSSFCell positional_titles = row.getCell(7);
|
||||
if(positional_titles==null){
|
||||
addMap.put("positional_titles","");
|
||||
}else {
|
||||
positional_titles.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("positional_titles",positional_titles.getStringCellValue());
|
||||
}
|
||||
|
||||
//学历
|
||||
XSSFCell education = row.getCell(8);
|
||||
if(education==null){
|
||||
addMap.put("education","");
|
||||
}else {
|
||||
education.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("education",education.getStringCellValue());
|
||||
}
|
||||
|
||||
//职业技能名称
|
||||
XSSFCell vocational_name = row.getCell(9);
|
||||
if(vocational_name==null){
|
||||
addMap.put("vocational_name","");
|
||||
}else {
|
||||
vocational_name.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("vocational_name",vocational_name.getStringCellValue());
|
||||
}
|
||||
|
||||
//职业技术等级级别
|
||||
XSSFCell level = row.getCell(10);
|
||||
if(level==null){
|
||||
addMap.put("level","");
|
||||
}else {
|
||||
level.setCellType(Cell.CELL_TYPE_STRING);
|
||||
addMap.put("level",level.getStringCellValue());
|
||||
}
|
||||
|
||||
|
||||
//把固定的参数添加到map 默认密码先设置123
|
||||
addMap.put("password",new Md5Hash("123","hospitalgd",2).toString());
|
||||
addMap.put("isactive", "1");
|
||||
addMap.put("modify_user_name", modify_user_name);
|
||||
addMap.put("modify_true_name", modify_true_name);
|
||||
addMap.put("create_time", create_time);
|
||||
addMap.put("create_date", create_date);
|
||||
|
||||
addList.add(addMap);
|
||||
}
|
||||
|
||||
if(errNum>0){
|
||||
errCode="999";
|
||||
errMsg="导入失败,有"+errNum+"行导入错误";
|
||||
responseMap.put("errNumList", errNumList);
|
||||
}else{
|
||||
try {
|
||||
usersService.insertExcelUsers(addList);//往数据库插入数据
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(this.getClass(), "上传人员列表失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errCode="999";
|
||||
errMsg="上传备件列表失败!"+e.getMessage();
|
||||
e.printStackTrace();
|
||||
LogUtil.error(this.getClass(), "上传人员列表失败,原因:"+ExceptionDUtil.getDetailExceptionMsg(e));
|
||||
} finally {
|
||||
workbook.close();
|
||||
}
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据部门id查询相关人员
|
||||
* @author thuang
|
||||
* @date 2021/8/3 10:15
|
||||
* @version 1.0
|
||||
*/
|
||||
@RequestMapping("/findUserByDepartId")
|
||||
@ResponseBody
|
||||
public HashMap<Object,Object> findUserByDepartId(@RequestBody HashMap<Object,Object> map){
|
||||
HashMap<Object, Object> responseMap=new HashMap<Object, Object>();
|
||||
String errCode="0";
|
||||
String errMsg="";
|
||||
|
||||
try {
|
||||
String departIds = StringDUtil.changeNullToEmpty(map.get("departIds"));
|
||||
|
||||
//如果是空的就直接返回个空集合 不查询
|
||||
if ("".equals(departIds)){
|
||||
responseMap.put("userList",new ArrayList<>());
|
||||
}else {
|
||||
String[] split = departIds.split(",");
|
||||
|
||||
List<String> idList=new ArrayList<>();
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
idList.add(split[i]);
|
||||
}
|
||||
|
||||
List<HashMap<Object, Object>> userByDepartIds = usersService.findUserByDepartIds(idList);
|
||||
|
||||
//循环数据生成所要格式 list 中 {name,value}
|
||||
List<HashMap<Object, Object>> userList =new ArrayList<>();
|
||||
for (int i = 0; i < userByDepartIds.size(); i++) {
|
||||
HashMap<Object, Object> hashMap = userByDepartIds.get(i);
|
||||
HashMap<Object, Object> selectObj=new HashMap<>();
|
||||
|
||||
selectObj.put("name",hashMap.get("TRUE_NAME"));
|
||||
selectObj.put("value",hashMap.get("USER_ID"));
|
||||
userList.add(selectObj);
|
||||
}
|
||||
responseMap.put("userList",userList);
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
errCode="999";
|
||||
errMsg="查询部门相关人员失败,原因:"+e.getMessage();
|
||||
}
|
||||
|
||||
responseMap.put("errCode", errCode);
|
||||
responseMap.put("errMsg", errMsg);
|
||||
|
||||
return responseMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 从上面生成的部门Map中根据部门名称获取部门id
|
||||
* @author thuang
|
||||
* @date 2021/7/14 13:45
|
||||
* @version 1.0
|
||||
* @param data
|
||||
*/
|
||||
public void getDepartIdByMapTree(List<String> data, String departStr, List<HashMap<Object, Object>> departList){
|
||||
|
||||
for (int i=0;i<departList.size();i++){
|
||||
HashMap<Object, Object> departObj = departList.get(i);
|
||||
|
||||
String depart_id = StringDUtil.changeNullToEmpty(departObj.get("DEPART_ID"));
|
||||
String depart_name = StringDUtil.changeNullToEmpty(departObj.get("DEPART_NAME"));
|
||||
List<HashMap<Object,Object>> departChildenList = (List<HashMap<Object,Object>>)departObj.get("childen");
|
||||
|
||||
if(departStr.equals(depart_name)){
|
||||
data.add(depart_id);
|
||||
return;
|
||||
}
|
||||
if(departChildenList!=null && departChildenList.size()>0){
|
||||
getDepartIdByMapTree(data,departStr,departChildenList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.saye.hospitalgd.controller.system;
|
||||
|
||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||
import com.saye.hospitalgd.model.StatusDefine;
|
||||
import com.saye.hospitalgd.commons.string.StringDUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
/**
|
||||
* @author thuang
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2021/5/24 13:56
|
||||
*/
|
||||
@Controller
|
||||
public class downloadController {
|
||||
|
||||
@RequestMapping("/download")
|
||||
public void downloadFile(HttpServletRequest request, HttpServletResponse response) throws Exception{
|
||||
|
||||
try {
|
||||
String fileName = StringDUtil.changeNullToEmpty(request.getParameter("fileName"));
|
||||
String dowloadName = StringDUtil.changeNullToEmpty(request.getParameter("dowloadName"));
|
||||
//过滤相对路径../
|
||||
int lastIndex = fileName.lastIndexOf(".");
|
||||
//fileName = fileName.substring(0, lastIndex).replaceAll(".", "")+fileName.substring(lastIndex);
|
||||
String savePath = StatusDefine.filePath + fileName ;
|
||||
File file = new File(savePath);
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
response.setContentType("application/force-download");
|
||||
response.addHeader("Content-disposition", "attachment;fileName=" + URLEncoder.encode(dowloadName+ DateDUtil.getCurrentDate(DateDUtil.yyyy_MM_dd)+".xlsx", "UTF-8"));
|
||||
OutputStream os = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len = 0;
|
||||
while((len = fis.read(buf)) != -1) {
|
||||
os.write(buf, 0, len);
|
||||
}
|
||||
fis.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user